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[10]; /* 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];
970 pincap = snd_hda_query_pin_caps(codec, nid);
971 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
972 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
973 present = snd_hda_codec_read(codec, nid, 0,
974 AC_VERB_GET_PIN_SENSE, 0);
975 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
976 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
977 nid = spec->autocfg.speaker_pins[i];
980 snd_hda_codec_write(codec, nid, 0,
981 AC_VERB_SET_PIN_WIDGET_CONTROL,
982 spec->jack_present ? 0 : PIN_OUT);
986 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
989 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
992 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
993 for (i = 0; i < nums; i++)
999 static void alc_mic_automute(struct hda_codec *codec)
1001 struct alc_spec *spec = codec->spec;
1002 struct alc_mic_route *dead, *alive;
1003 unsigned int present, type;
1006 if (!spec->auto_mic)
1008 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1010 if (snd_BUG_ON(!spec->adc_nids))
1013 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1015 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1016 AC_VERB_GET_PIN_SENSE, 0);
1017 present &= AC_PINSENSE_PRESENCE;
1019 alive = &spec->ext_mic;
1020 dead = &spec->int_mic;
1022 alive = &spec->int_mic;
1023 dead = &spec->ext_mic;
1026 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1027 if (type == AC_WID_AUD_MIX) {
1028 /* Matrix-mixer style (e.g. ALC882) */
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1032 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1034 HDA_AMP_MUTE, HDA_AMP_MUTE);
1036 /* MUX style (e.g. ALC880) */
1037 snd_hda_codec_write_cache(codec, cap_nid, 0,
1038 AC_VERB_SET_CONNECT_SEL,
1042 /* FIXME: analog mixer */
1045 /* unsolicited event for HP jack sensing */
1046 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1048 if (codec->vendor_id == 0x10ec0880)
1053 case ALC880_HP_EVENT:
1054 alc_automute_pin(codec);
1056 case ALC880_MIC_EVENT:
1057 alc_mic_automute(codec);
1062 static void alc_inithook(struct hda_codec *codec)
1064 alc_automute_pin(codec);
1065 alc_mic_automute(codec);
1068 /* additional initialization for ALC888 variants */
1069 static void alc888_coef_init(struct hda_codec *codec)
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1074 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 if ((tmp & 0xf0) == 0x20)
1078 snd_hda_codec_read(codec, 0x20, 0,
1079 AC_VERB_SET_PROC_COEF, 0x830);
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x3030);
1086 static void alc889_coef_init(struct hda_codec *codec)
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1091 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1092 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1096 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1101 case ALC_INIT_GPIO1:
1102 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1104 case ALC_INIT_GPIO2:
1105 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1107 case ALC_INIT_GPIO3:
1108 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1110 case ALC_INIT_DEFAULT:
1111 switch (codec->vendor_id) {
1113 snd_hda_codec_write(codec, 0x0f, 0,
1114 AC_VERB_SET_EAPD_BTLENABLE, 2);
1115 snd_hda_codec_write(codec, 0x10, 0,
1116 AC_VERB_SET_EAPD_BTLENABLE, 2);
1128 snd_hda_codec_write(codec, 0x14, 0,
1129 AC_VERB_SET_EAPD_BTLENABLE, 2);
1130 snd_hda_codec_write(codec, 0x15, 0,
1131 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 switch (codec->vendor_id) {
1136 snd_hda_codec_write(codec, 0x1a, 0,
1137 AC_VERB_SET_COEF_INDEX, 7);
1138 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1139 AC_VERB_GET_PROC_COEF, 0);
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 snd_hda_codec_write(codec, 0x1a, 0,
1143 AC_VERB_SET_PROC_COEF,
1153 alc889_coef_init(codec);
1156 alc888_coef_init(codec);
1160 snd_hda_codec_write(codec, 0x20, 0,
1161 AC_VERB_SET_COEF_INDEX, 7);
1162 tmp = snd_hda_codec_read(codec, 0x20, 0,
1163 AC_VERB_GET_PROC_COEF, 0);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 snd_hda_codec_write(codec, 0x20, 0,
1167 AC_VERB_SET_PROC_COEF,
1175 static void alc_init_auto_hp(struct hda_codec *codec)
1177 struct alc_spec *spec = codec->spec;
1179 if (!spec->autocfg.hp_pins[0])
1182 if (!spec->autocfg.speaker_pins[0]) {
1183 if (spec->autocfg.line_out_pins[0] &&
1184 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1185 spec->autocfg.speaker_pins[0] =
1186 spec->autocfg.line_out_pins[0];
1191 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1192 spec->autocfg.hp_pins[0]);
1193 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1194 AC_VERB_SET_UNSOLICITED_ENABLE,
1195 AC_USRSP_EN | ALC880_HP_EVENT);
1196 spec->unsol_event = alc_sku_unsol_event;
1199 static void alc_init_auto_mic(struct hda_codec *codec)
1201 struct alc_spec *spec = codec->spec;
1202 struct auto_pin_cfg *cfg = &spec->autocfg;
1203 hda_nid_t fixed, ext;
1206 /* there must be only two mic inputs exclusively */
1207 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1208 if (cfg->input_pins[i])
1212 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1213 hda_nid_t nid = cfg->input_pins[i];
1214 unsigned int defcfg;
1217 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1218 switch (get_defcfg_connect(defcfg)) {
1219 case AC_JACK_PORT_FIXED:
1221 return; /* already occupied */
1224 case AC_JACK_PORT_COMPLEX:
1226 return; /* already occupied */
1230 return; /* invalid entry */
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1237 spec->ext_mic.pin = ext;
1238 spec->int_mic.pin = fixed;
1239 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1240 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1242 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1243 AC_VERB_SET_UNSOLICITED_ENABLE,
1244 AC_USRSP_EN | ALC880_MIC_EVENT);
1245 spec->unsol_event = alc_sku_unsol_event;
1248 /* check subsystem ID and set up device-specific initialization;
1249 * return 1 if initialized, 0 if invalid SSID
1251 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1252 * 31 ~ 16 : Manufacture ID
1254 * 7 ~ 0 : Assembly ID
1255 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1257 static int alc_subsystem_id(struct hda_codec *codec,
1258 hda_nid_t porta, hda_nid_t porte,
1261 unsigned int ass, tmp, i;
1263 struct alc_spec *spec = codec->spec;
1265 ass = codec->subsystem_id & 0xffff;
1266 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1269 /* invalid SSID, check the special NID pin defcfg instead */
1271 * 31~30 : port connectivity
1274 * 19~16 : Check sum (15:1)
1279 if (codec->vendor_id == 0x10ec0260)
1281 ass = snd_hda_codec_get_pincfg(codec, nid);
1282 snd_printd("realtek: No valid SSID, "
1283 "checking pincfg 0x%08x for NID 0x%x\n",
1285 if (!(ass & 1) && !(ass & 0x100000))
1287 if ((ass >> 30) != 1) /* no physical connection */
1292 for (i = 1; i < 16; i++) {
1296 if (((ass >> 16) & 0xf) != tmp)
1299 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1300 ass & 0xffff, codec->vendor_id);
1304 * 2 : 0 --> Desktop, 1 --> Laptop
1305 * 3~5 : External Amplifier control
1308 tmp = (ass & 0x38) >> 3; /* external Amp control */
1311 spec->init_amp = ALC_INIT_GPIO1;
1314 spec->init_amp = ALC_INIT_GPIO2;
1317 spec->init_amp = ALC_INIT_GPIO3;
1320 spec->init_amp = ALC_INIT_DEFAULT;
1324 /* is laptop or Desktop and enable the function "Mute internal speaker
1325 * when the external headphone out jack is plugged"
1327 if (!(ass & 0x8000))
1330 * 10~8 : Jack location
1331 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1333 * 15 : 1 --> enable the function "Mute internal speaker
1334 * when the external headphone out jack is plugged"
1336 if (!spec->autocfg.hp_pins[0]) {
1338 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1347 for (i = 0; i < spec->autocfg.line_outs; i++)
1348 if (spec->autocfg.line_out_pins[i] == nid)
1350 spec->autocfg.hp_pins[0] = nid;
1353 alc_init_auto_hp(codec);
1354 alc_init_auto_mic(codec);
1358 static void alc_ssid_check(struct hda_codec *codec,
1359 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1361 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1362 struct alc_spec *spec = codec->spec;
1363 snd_printd("realtek: "
1364 "Enable default setup for auto mode as fallback\n");
1365 spec->init_amp = ALC_INIT_DEFAULT;
1366 alc_init_auto_hp(codec);
1367 alc_init_auto_mic(codec);
1372 * Fix-up pin default configurations and add default verbs
1381 const struct alc_pincfg *pins;
1382 const struct hda_verb *verbs;
1385 static void alc_pick_fixup(struct hda_codec *codec,
1386 const struct snd_pci_quirk *quirk,
1387 const struct alc_fixup *fix)
1389 const struct alc_pincfg *cfg;
1391 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1395 fix += quirk->value;
1398 for (; cfg->nid; cfg++)
1399 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1402 add_verb(codec->spec, fix->verbs);
1412 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1413 /* Mic-in jack as mic in */
1414 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1415 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1416 /* Line-in jack as Line in */
1417 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1418 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1419 /* Line-Out as Front */
1420 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1427 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1428 /* Mic-in jack as mic in */
1429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1431 /* Line-in jack as Surround */
1432 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1433 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1434 /* Line-Out as Front */
1435 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1442 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1443 /* Mic-in jack as CLFE */
1444 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1445 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1446 /* Line-in jack as Surround */
1447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1449 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1450 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1457 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1458 /* Mic-in jack as CLFE */
1459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1461 /* Line-in jack as Surround */
1462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1464 /* Line-Out as Side */
1465 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1469 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1470 { 2, alc888_4ST_ch2_intel_init },
1471 { 4, alc888_4ST_ch4_intel_init },
1472 { 6, alc888_4ST_ch6_intel_init },
1473 { 8, alc888_4ST_ch8_intel_init },
1477 * ALC888 Fujitsu Siemens Amillo xa3530
1480 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1481 /* Front Mic: set to PIN_IN (empty by default) */
1482 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1483 /* Connect Internal HP to Front */
1484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1486 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1487 /* Connect Bass HP to Front */
1488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1489 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1490 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1491 /* Connect Line-Out side jack (SPDIF) to Side */
1492 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1495 /* Connect Mic jack to CLFE */
1496 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1499 /* Connect Line-in jack to Surround */
1500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1503 /* Connect HP out jack to Front */
1504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1507 /* Enable unsolicited event for HP jack and Line-out jack */
1508 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1509 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1513 static void alc_automute_amp(struct hda_codec *codec)
1515 struct alc_spec *spec = codec->spec;
1516 unsigned int val, mute, pincap;
1520 spec->jack_present = 0;
1521 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1522 nid = spec->autocfg.hp_pins[i];
1525 pincap = snd_hda_query_pin_caps(codec, nid);
1526 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1527 snd_hda_codec_read(codec, nid, 0,
1528 AC_VERB_SET_PIN_SENSE, 0);
1529 val = snd_hda_codec_read(codec, nid, 0,
1530 AC_VERB_GET_PIN_SENSE, 0);
1531 if (val & AC_PINSENSE_PRESENCE) {
1532 spec->jack_present = 1;
1537 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1538 /* Toggle internal speakers muting */
1539 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1540 nid = spec->autocfg.speaker_pins[i];
1543 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1544 HDA_AMP_MUTE, mute);
1548 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1551 if (codec->vendor_id == 0x10ec0880)
1555 if (res == ALC880_HP_EVENT)
1556 alc_automute_amp(codec);
1559 static void alc889_automute_setup(struct hda_codec *codec)
1561 struct alc_spec *spec = codec->spec;
1563 spec->autocfg.hp_pins[0] = 0x15;
1564 spec->autocfg.speaker_pins[0] = 0x14;
1565 spec->autocfg.speaker_pins[1] = 0x16;
1566 spec->autocfg.speaker_pins[2] = 0x17;
1567 spec->autocfg.speaker_pins[3] = 0x19;
1568 spec->autocfg.speaker_pins[4] = 0x1a;
1571 static void alc889_intel_init_hook(struct hda_codec *codec)
1573 alc889_coef_init(codec);
1574 alc_automute_amp(codec);
1577 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1579 struct alc_spec *spec = codec->spec;
1581 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1582 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1583 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1584 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1588 * ALC888 Acer Aspire 4930G model
1591 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1592 /* Front Mic: set to PIN_IN (empty by default) */
1593 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1594 /* Unselect Front Mic by default in input mixer 3 */
1595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1596 /* Enable unsolicited event for HP jack */
1597 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1598 /* Connect Internal HP to front */
1599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1601 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1602 /* Connect HP out to front */
1603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1610 * ALC888 Acer Aspire 6530G model
1613 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1614 /* Bias voltage on for external mic port */
1615 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1616 /* Front Mic: set to PIN_IN (empty by default) */
1617 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1618 /* Unselect Front Mic by default in input mixer 3 */
1619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1620 /* Enable unsolicited event for HP jack */
1621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1622 /* Enable speaker output */
1623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1624 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1625 /* Enable headphone output */
1626 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1628 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1633 * ALC889 Acer Aspire 8930G model
1636 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1637 /* Front Mic: set to PIN_IN (empty by default) */
1638 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1639 /* Unselect Front Mic by default in input mixer 3 */
1640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1641 /* Enable unsolicited event for HP jack */
1642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1643 /* Connect Internal Front to Front */
1644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1647 /* Connect Internal Rear to Rear */
1648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1650 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1651 /* Connect Internal CLFE to CLFE */
1652 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1653 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1654 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1655 /* Connect HP out to Front */
1656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1658 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1659 /* Enable all DACs */
1660 /* DAC DISABLE/MUTE 1? */
1661 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1662 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1663 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1664 /* DAC DISABLE/MUTE 2? */
1665 /* some bit here disables the other DACs. Init=0x4900 */
1666 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1667 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668 /* Enable amplifiers */
1669 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1670 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1672 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1673 * which makes the stereo useless. However, either the mic or the ALC889
1674 * makes the signal become a difference/sum signal instead of standard
1675 * stereo, which is annoying. So instead we flip this bit which makes the
1676 * codec replicate the sum signal to both channels, turning it into a
1679 /* DMIC_CONTROL? Init value = 0x0001 */
1680 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1681 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1685 static struct hda_input_mux alc888_2_capture_sources[2] = {
1686 /* Front mic only available on one ADC */
1693 { "Front Mic", 0xb },
1706 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1707 /* Interal mic only available on one ADC */
1714 { "Input Mix", 0xa },
1724 { "Input Mix", 0xa },
1729 static struct hda_input_mux alc889_capture_sources[3] = {
1730 /* Digital mic only available on first "ADC" */
1737 { "Front Mic", 0xb },
1738 { "Input Mix", 0xa },
1747 { "Input Mix", 0xa },
1756 { "Input Mix", 0xa },
1761 static struct snd_kcontrol_new alc888_base_mixer[] = {
1762 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1763 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1764 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1768 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1770 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1783 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1785 struct alc_spec *spec = codec->spec;
1787 spec->autocfg.hp_pins[0] = 0x15;
1788 spec->autocfg.speaker_pins[0] = 0x14;
1791 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1793 struct alc_spec *spec = codec->spec;
1795 spec->autocfg.hp_pins[0] = 0x15;
1796 spec->autocfg.speaker_pins[0] = 0x14;
1797 spec->autocfg.speaker_pins[1] = 0x16;
1798 spec->autocfg.speaker_pins[2] = 0x17;
1801 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1803 struct alc_spec *spec = codec->spec;
1805 spec->autocfg.hp_pins[0] = 0x15;
1806 spec->autocfg.speaker_pins[0] = 0x14;
1807 spec->autocfg.speaker_pins[1] = 0x16;
1808 spec->autocfg.speaker_pins[2] = 0x1b;
1812 * ALC880 3-stack model
1814 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1815 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1816 * F-Mic = 0x1b, HP = 0x19
1819 static hda_nid_t alc880_dac_nids[4] = {
1820 /* front, rear, clfe, rear_surr */
1821 0x02, 0x05, 0x04, 0x03
1824 static hda_nid_t alc880_adc_nids[3] = {
1829 /* The datasheet says the node 0x07 is connected from inputs,
1830 * but it shows zero connection in the real implementation on some devices.
1831 * Note: this is a 915GAV bug, fixed on 915GLV
1833 static hda_nid_t alc880_adc_nids_alt[2] = {
1838 #define ALC880_DIGOUT_NID 0x06
1839 #define ALC880_DIGIN_NID 0x0a
1841 static struct hda_input_mux alc880_capture_source = {
1845 { "Front Mic", 0x3 },
1851 /* channel source setting (2/6 channel selection for 3-stack) */
1853 static struct hda_verb alc880_threestack_ch2_init[] = {
1854 /* set line-in to input, mute it */
1855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1857 /* set mic-in to input vref 80%, mute it */
1858 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1864 static struct hda_verb alc880_threestack_ch6_init[] = {
1865 /* set line-in to output, unmute it */
1866 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1867 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1868 /* set mic-in to output, unmute it */
1869 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1870 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1874 static struct hda_channel_mode alc880_threestack_modes[2] = {
1875 { 2, alc880_threestack_ch2_init },
1876 { 6, alc880_threestack_ch6_init },
1879 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1880 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1881 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1882 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1883 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1884 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1885 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1886 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1887 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1896 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1899 .name = "Channel Mode",
1900 .info = alc_ch_mode_info,
1901 .get = alc_ch_mode_get,
1902 .put = alc_ch_mode_put,
1907 /* capture mixer elements */
1908 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1909 struct snd_ctl_elem_info *uinfo)
1911 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1912 struct alc_spec *spec = codec->spec;
1915 mutex_lock(&codec->control_mutex);
1916 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1918 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1919 mutex_unlock(&codec->control_mutex);
1923 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1924 unsigned int size, unsigned int __user *tlv)
1926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1927 struct alc_spec *spec = codec->spec;
1930 mutex_lock(&codec->control_mutex);
1931 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1933 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1934 mutex_unlock(&codec->control_mutex);
1938 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1939 struct snd_ctl_elem_value *ucontrol);
1941 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1942 struct snd_ctl_elem_value *ucontrol,
1945 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1946 struct alc_spec *spec = codec->spec;
1947 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1950 mutex_lock(&codec->control_mutex);
1951 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1953 err = func(kcontrol, ucontrol);
1954 mutex_unlock(&codec->control_mutex);
1958 static int alc_cap_vol_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_volume_get);
1965 static int alc_cap_vol_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_volume_put);
1972 /* capture mixer elements */
1973 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1975 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol)
1978 return alc_cap_getput_caller(kcontrol, ucontrol,
1979 snd_hda_mixer_amp_switch_get);
1982 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1983 struct snd_ctl_elem_value *ucontrol)
1985 return alc_cap_getput_caller(kcontrol, ucontrol,
1986 snd_hda_mixer_amp_switch_put);
1989 #define _DEFINE_CAPMIX(num) \
1991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1992 .name = "Capture Switch", \
1993 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1995 .info = alc_cap_sw_info, \
1996 .get = alc_cap_sw_get, \
1997 .put = alc_cap_sw_put, \
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2001 .name = "Capture Volume", \
2002 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2003 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2004 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2006 .info = alc_cap_vol_info, \
2007 .get = alc_cap_vol_get, \
2008 .put = alc_cap_vol_put, \
2009 .tlv = { .c = alc_cap_vol_tlv }, \
2012 #define _DEFINE_CAPSRC(num) \
2014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2015 /* .name = "Capture Source", */ \
2016 .name = "Input Source", \
2018 .info = alc_mux_enum_info, \
2019 .get = alc_mux_enum_get, \
2020 .put = alc_mux_enum_put, \
2023 #define DEFINE_CAPMIX(num) \
2024 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2025 _DEFINE_CAPMIX(num), \
2026 _DEFINE_CAPSRC(num), \
2030 #define DEFINE_CAPMIX_NOSRC(num) \
2031 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2032 _DEFINE_CAPMIX(num), \
2036 /* up to three ADCs */
2040 DEFINE_CAPMIX_NOSRC(1);
2041 DEFINE_CAPMIX_NOSRC(2);
2042 DEFINE_CAPMIX_NOSRC(3);
2045 * ALC880 5-stack model
2047 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2049 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2050 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2053 /* additional mixers to alc880_three_stack_mixer */
2054 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2055 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2056 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2060 /* channel source setting (6/8 channel selection for 5-stack) */
2062 static struct hda_verb alc880_fivestack_ch6_init[] = {
2063 /* set line-in to input, mute it */
2064 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2065 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2070 static struct hda_verb alc880_fivestack_ch8_init[] = {
2071 /* set line-in to output, unmute it */
2072 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2073 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2077 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2078 { 6, alc880_fivestack_ch6_init },
2079 { 8, alc880_fivestack_ch8_init },
2084 * ALC880 6-stack model
2086 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2087 * Side = 0x05 (0x0f)
2088 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2089 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2092 static hda_nid_t alc880_6st_dac_nids[4] = {
2093 /* front, rear, clfe, rear_surr */
2094 0x02, 0x03, 0x04, 0x05
2097 static struct hda_input_mux alc880_6stack_capture_source = {
2101 { "Front Mic", 0x1 },
2107 /* fixed 8-channels */
2108 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2112 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2116 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2117 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2118 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2119 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2133 .name = "Channel Mode",
2134 .info = alc_ch_mode_info,
2135 .get = alc_ch_mode_get,
2136 .put = alc_ch_mode_put,
2145 * W810 has rear IO for:
2148 * Center/LFE (DAC 04)
2151 * The system also has a pair of internal speakers, and a headphone jack.
2152 * These are both connected to Line2 on the codec, hence to DAC 02.
2154 * There is a variable resistor to control the speaker or headphone
2155 * volume. This is a hardware-only device without a software API.
2157 * Plugging headphones in will disable the internal speakers. This is
2158 * implemented in hardware, not via the driver using jack sense. In
2159 * a similar fashion, plugging into the rear socket marked "front" will
2160 * disable both the speakers and headphones.
2162 * For input, there's a microphone jack, and an "audio in" jack.
2163 * These may not do anything useful with this driver yet, because I
2164 * haven't setup any initialization verbs for these yet...
2167 static hda_nid_t alc880_w810_dac_nids[3] = {
2168 /* front, rear/surround, clfe */
2172 /* fixed 6 channels */
2173 static struct hda_channel_mode alc880_w810_modes[1] = {
2177 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2178 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2181 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2182 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2183 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2184 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2185 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2186 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2195 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2196 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2200 static hda_nid_t alc880_z71v_dac_nids[1] = {
2203 #define ALC880_Z71V_HP_DAC 0x03
2205 /* fixed 2 channels */
2206 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2210 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2216 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2224 * ALC880 F1734 model
2226 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2227 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2230 static hda_nid_t alc880_f1734_dac_nids[1] = {
2233 #define ALC880_F1734_HP_DAC 0x02
2235 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2236 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2237 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2247 static struct hda_input_mux alc880_f1734_capture_source = {
2259 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2260 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2261 * Mic = 0x18, Line = 0x1a
2264 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2265 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2267 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2270 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2273 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2274 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2275 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2284 .name = "Channel Mode",
2285 .info = alc_ch_mode_info,
2286 .get = alc_ch_mode_get,
2287 .put = alc_ch_mode_put,
2293 * ALC880 ASUS W1V model
2295 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2296 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2297 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2300 /* additional mixers to alc880_asus_mixer */
2301 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2302 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2303 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2308 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2322 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2323 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2324 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2326 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2328 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2329 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2330 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2332 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2336 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2338 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2340 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2341 .name = "Channel Mode",
2342 .info = alc_ch_mode_info,
2343 .get = alc_ch_mode_get,
2344 .put = alc_ch_mode_put,
2349 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2357 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2359 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2363 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2364 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2365 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2367 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2374 * virtual master controls
2378 * slave controls for virtual master
2380 static const char *alc_slave_vols[] = {
2381 "Front Playback Volume",
2382 "Surround Playback Volume",
2383 "Center Playback Volume",
2384 "LFE Playback Volume",
2385 "Side Playback Volume",
2386 "Headphone Playback Volume",
2387 "Speaker Playback Volume",
2388 "Mono Playback Volume",
2389 "Line-Out Playback Volume",
2390 "PCM Playback Volume",
2394 static const char *alc_slave_sws[] = {
2395 "Front Playback Switch",
2396 "Surround Playback Switch",
2397 "Center Playback Switch",
2398 "LFE Playback Switch",
2399 "Side Playback Switch",
2400 "Headphone Playback Switch",
2401 "Speaker Playback Switch",
2402 "Mono Playback Switch",
2403 "IEC958 Playback Switch",
2408 * build control elements
2411 static void alc_free_kctls(struct hda_codec *codec);
2413 /* additional beep mixers; the actual parameters are overwritten at build */
2414 static struct snd_kcontrol_new alc_beep_mixer[] = {
2415 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2416 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2420 static int alc_build_controls(struct hda_codec *codec)
2422 struct alc_spec *spec = codec->spec;
2426 for (i = 0; i < spec->num_mixers; i++) {
2427 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2431 if (spec->cap_mixer) {
2432 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2436 if (spec->multiout.dig_out_nid) {
2437 err = snd_hda_create_spdif_out_ctls(codec,
2438 spec->multiout.dig_out_nid);
2441 if (!spec->no_analog) {
2442 err = snd_hda_create_spdif_share_sw(codec,
2446 spec->multiout.share_spdif = 1;
2449 if (spec->dig_in_nid) {
2450 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2455 /* create beep controls if needed */
2456 if (spec->beep_amp) {
2457 struct snd_kcontrol_new *knew;
2458 for (knew = alc_beep_mixer; knew->name; knew++) {
2459 struct snd_kcontrol *kctl;
2460 kctl = snd_ctl_new1(knew, codec);
2463 kctl->private_value = spec->beep_amp;
2464 err = snd_hda_ctl_add(codec, kctl);
2470 /* if we have no master control, let's create it */
2471 if (!spec->no_analog &&
2472 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2473 unsigned int vmaster_tlv[4];
2474 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2475 HDA_OUTPUT, vmaster_tlv);
2476 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2477 vmaster_tlv, alc_slave_vols);
2481 if (!spec->no_analog &&
2482 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2483 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2484 NULL, alc_slave_sws);
2489 alc_free_kctls(codec); /* no longer needed */
2495 * initialize the codec volumes, etc
2499 * generic initialization of ADC, input mixers and output mixers
2501 static struct hda_verb alc880_volume_init_verbs[] = {
2503 * Unmute ADC0-2 and set the default input to mic-in
2505 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2507 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2509 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2512 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2514 * Note: PASD motherboards uses the Line In 2 as the input for front
2517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2527 * Set up output mixers (0x0c - 0x0f)
2529 /* set vol=0 to output mixers */
2530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2533 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2534 /* set up input amps for analog loopback */
2535 /* Amp Indices: DAC = 0, mixer = 1 */
2536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2542 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2543 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2549 * 3-stack pin configuration:
2550 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2552 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2554 * preset connection lists of input pins
2555 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2557 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2558 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2559 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2562 * Set pin mode and muting
2564 /* set front pin widgets 0x14 for output */
2565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2566 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2567 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2570 /* Mic2 (as headphone out) for HP output */
2571 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2572 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 /* Line In pin widget for input */
2574 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2575 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2576 /* Line2 (as front mic) pin widget for input and vref at 80% */
2577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2579 /* CD pin widget for input */
2580 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2586 * 5-stack pin configuration:
2587 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2588 * line-in/side = 0x1a, f-mic = 0x1b
2590 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2592 * preset connection lists of input pins
2593 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2595 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2596 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2599 * Set pin mode and muting
2601 /* set pin widgets 0x14-0x17 for output */
2602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2604 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2605 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2606 /* unmute pins for output (no gain on this amp) */
2607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2609 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2610 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2612 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2614 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2615 /* Mic2 (as headphone out) for HP output */
2616 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2617 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2618 /* Line In pin widget for input */
2619 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2620 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2621 /* Line2 (as front mic) pin widget for input and vref at 80% */
2622 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2623 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2624 /* CD pin widget for input */
2625 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2631 * W810 pin configuration:
2632 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2634 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2635 /* hphone/speaker input selector: front DAC */
2636 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2639 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2642 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2643 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2645 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2646 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2652 * Z71V pin configuration:
2653 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2655 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2661 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2662 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2663 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2664 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2670 * 6-stack pin configuration:
2671 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2672 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2674 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2675 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2681 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2683 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2688 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2692 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2693 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2694 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2700 * Uniwill pin configuration:
2701 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2704 static struct hda_verb alc880_uniwill_init_verbs[] = {
2705 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2711 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2712 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2713 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2714 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2718 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2719 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2720 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2723 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2724 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2725 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2729 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2730 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2732 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2733 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2740 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2742 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2743 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2758 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2759 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2760 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2761 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2762 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2765 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2766 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2771 static struct hda_verb alc880_beep_init_verbs[] = {
2772 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2776 /* auto-toggle front mic */
2777 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2779 unsigned int present;
2782 present = snd_hda_codec_read(codec, 0x18, 0,
2783 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2784 bits = present ? HDA_AMP_MUTE : 0;
2785 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2788 static void alc880_uniwill_setup(struct hda_codec *codec)
2790 struct alc_spec *spec = codec->spec;
2792 spec->autocfg.hp_pins[0] = 0x14;
2793 spec->autocfg.speaker_pins[0] = 0x15;
2794 spec->autocfg.speaker_pins[0] = 0x16;
2797 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2799 alc_automute_amp(codec);
2800 alc880_uniwill_mic_automute(codec);
2803 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2806 /* Looks like the unsol event is incompatible with the standard
2807 * definition. 4bit tag is placed at 28 bit!
2809 switch (res >> 28) {
2810 case ALC880_MIC_EVENT:
2811 alc880_uniwill_mic_automute(codec);
2814 alc_automute_amp_unsol_event(codec, res);
2819 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2821 struct alc_spec *spec = codec->spec;
2823 spec->autocfg.hp_pins[0] = 0x14;
2824 spec->autocfg.speaker_pins[0] = 0x15;
2827 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2829 unsigned int present;
2831 present = snd_hda_codec_read(codec, 0x21, 0,
2832 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2833 present &= HDA_AMP_VOLMASK;
2834 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2835 HDA_AMP_VOLMASK, present);
2836 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2837 HDA_AMP_VOLMASK, present);
2840 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2843 /* Looks like the unsol event is incompatible with the standard
2844 * definition. 4bit tag is placed at 28 bit!
2846 if ((res >> 28) == ALC880_DCVOL_EVENT)
2847 alc880_uniwill_p53_dcvol_automute(codec);
2849 alc_automute_amp_unsol_event(codec, res);
2853 * F1734 pin configuration:
2854 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2856 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2857 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2858 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2859 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2860 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2861 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2863 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2864 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2865 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2868 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2870 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2871 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2872 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2875 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2878 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2879 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2885 * ASUS pin configuration:
2886 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2888 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2889 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2890 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2891 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2892 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2896 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2897 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2898 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2900 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2906 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2907 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2908 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2909 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2910 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2916 /* Enable GPIO mask and set output */
2917 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2918 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2919 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2921 /* Clevo m520g init */
2922 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2923 /* headphone output */
2924 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2927 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2933 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 /* Mic1 (rear panel) */
2935 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2936 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 /* Mic2 (front panel) */
2938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2943 /* change to EAPD mode */
2944 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2945 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2950 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2951 /* change to EAPD mode */
2952 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2953 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2955 /* Headphone output */
2956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2958 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2961 /* Line In pin widget for input */
2962 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2963 /* CD pin widget for input */
2964 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2965 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2966 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2968 /* change to EAPD mode */
2969 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2970 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2976 * LG m1 express dual
2979 * Rear Line-In/Out (blue): 0x14
2980 * Build-in Mic-In: 0x15
2982 * HP-Out (green): 0x1b
2983 * Mic-In/Out (red): 0x19
2987 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2988 static hda_nid_t alc880_lg_dac_nids[3] = {
2992 /* seems analog CD is not working */
2993 static struct hda_input_mux alc880_lg_capture_source = {
2998 { "Internal Mic", 0x6 },
3002 /* 2,4,6 channel modes */
3003 static struct hda_verb alc880_lg_ch2_init[] = {
3004 /* set line-in and mic-in to input */
3005 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3006 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3010 static struct hda_verb alc880_lg_ch4_init[] = {
3011 /* set line-in to out and mic-in to input */
3012 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3013 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3017 static struct hda_verb alc880_lg_ch6_init[] = {
3018 /* set line-in and mic-in to output */
3019 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3020 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3024 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3025 { 2, alc880_lg_ch2_init },
3026 { 4, alc880_lg_ch4_init },
3027 { 6, alc880_lg_ch6_init },
3030 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3031 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3032 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3033 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3034 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3035 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3036 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3037 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3038 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3043 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3044 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3047 .name = "Channel Mode",
3048 .info = alc_ch_mode_info,
3049 .get = alc_ch_mode_get,
3050 .put = alc_ch_mode_put,
3055 static struct hda_verb alc880_lg_init_verbs[] = {
3056 /* set capture source to mic-in */
3057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3060 /* mute all amp mixer inputs */
3061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3064 /* line-in to input */
3065 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3071 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3073 /* mic-in to input */
3074 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3075 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3078 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3086 /* toggle speaker-output according to the hp-jack state */
3087 static void alc880_lg_setup(struct hda_codec *codec)
3089 struct alc_spec *spec = codec->spec;
3091 spec->autocfg.hp_pins[0] = 0x1b;
3092 spec->autocfg.speaker_pins[0] = 0x17;
3101 * Built-in Mic-In: 0x19
3107 static struct hda_input_mux alc880_lg_lw_capture_source = {
3111 { "Internal Mic", 0x1 },
3116 #define alc880_lg_lw_modes alc880_threestack_modes
3118 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3120 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3122 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3125 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3126 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3131 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3132 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3135 .name = "Channel Mode",
3136 .info = alc_ch_mode_info,
3137 .get = alc_ch_mode_get,
3138 .put = alc_ch_mode_put,
3143 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3144 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3145 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3146 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3148 /* set capture source to mic-in */
3149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3150 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3151 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3159 /* mic-in to input */
3160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3161 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3164 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3166 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3170 /* toggle speaker-output according to the hp-jack state */
3171 static void alc880_lg_lw_setup(struct hda_codec *codec)
3173 struct alc_spec *spec = codec->spec;
3175 spec->autocfg.hp_pins[0] = 0x1b;
3176 spec->autocfg.speaker_pins[0] = 0x14;
3179 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3180 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3181 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3184 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3185 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3189 static struct hda_input_mux alc880_medion_rim_capture_source = {
3193 { "Internal Mic", 0x1 },
3197 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3198 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3204 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3206 /* Mic2 (as headphone out) for HP output */
3207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3209 /* Internal Speaker */
3210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3211 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3213 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3214 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3216 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3220 /* toggle speaker-output according to the hp-jack state */
3221 static void alc880_medion_rim_automute(struct hda_codec *codec)
3223 struct alc_spec *spec = codec->spec;
3224 alc_automute_amp(codec);
3226 if (spec->jack_present)
3227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3229 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3232 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3235 /* Looks like the unsol event is incompatible with the standard
3236 * definition. 4bit tag is placed at 28 bit!
3238 if ((res >> 28) == ALC880_HP_EVENT)
3239 alc880_medion_rim_automute(codec);
3242 static void alc880_medion_rim_setup(struct hda_codec *codec)
3244 struct alc_spec *spec = codec->spec;
3246 spec->autocfg.hp_pins[0] = 0x14;
3247 spec->autocfg.speaker_pins[0] = 0x1b;
3250 #ifdef CONFIG_SND_HDA_POWER_SAVE
3251 static struct hda_amp_list alc880_loopbacks[] = {
3252 { 0x0b, HDA_INPUT, 0 },
3253 { 0x0b, HDA_INPUT, 1 },
3254 { 0x0b, HDA_INPUT, 2 },
3255 { 0x0b, HDA_INPUT, 3 },
3256 { 0x0b, HDA_INPUT, 4 },
3260 static struct hda_amp_list alc880_lg_loopbacks[] = {
3261 { 0x0b, HDA_INPUT, 1 },
3262 { 0x0b, HDA_INPUT, 6 },
3263 { 0x0b, HDA_INPUT, 7 },
3272 static int alc_init(struct hda_codec *codec)
3274 struct alc_spec *spec = codec->spec;
3278 alc_auto_init_amp(codec, spec->init_amp);
3280 for (i = 0; i < spec->num_init_verbs; i++)
3281 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3283 if (spec->init_hook)
3284 spec->init_hook(codec);
3289 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3291 struct alc_spec *spec = codec->spec;
3293 if (spec->unsol_event)
3294 spec->unsol_event(codec, res);
3297 #ifdef CONFIG_SND_HDA_POWER_SAVE
3298 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3300 struct alc_spec *spec = codec->spec;
3301 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3306 * Analog playback callbacks
3308 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3309 struct hda_codec *codec,
3310 struct snd_pcm_substream *substream)
3312 struct alc_spec *spec = codec->spec;
3313 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3317 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3318 struct hda_codec *codec,
3319 unsigned int stream_tag,
3320 unsigned int format,
3321 struct snd_pcm_substream *substream)
3323 struct alc_spec *spec = codec->spec;
3324 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3325 stream_tag, format, substream);
3328 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3329 struct hda_codec *codec,
3330 struct snd_pcm_substream *substream)
3332 struct alc_spec *spec = codec->spec;
3333 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3339 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3340 struct hda_codec *codec,
3341 struct snd_pcm_substream *substream)
3343 struct alc_spec *spec = codec->spec;
3344 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3347 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 unsigned int stream_tag,
3350 unsigned int format,
3351 struct snd_pcm_substream *substream)
3353 struct alc_spec *spec = codec->spec;
3354 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3355 stream_tag, format, substream);
3358 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3359 struct hda_codec *codec,
3360 struct snd_pcm_substream *substream)
3362 struct alc_spec *spec = codec->spec;
3363 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3366 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3367 struct hda_codec *codec,
3368 struct snd_pcm_substream *substream)
3370 struct alc_spec *spec = codec->spec;
3371 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3377 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3378 struct hda_codec *codec,
3379 unsigned int stream_tag,
3380 unsigned int format,
3381 struct snd_pcm_substream *substream)
3383 struct alc_spec *spec = codec->spec;
3385 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3386 stream_tag, 0, format);
3390 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3391 struct hda_codec *codec,
3392 struct snd_pcm_substream *substream)
3394 struct alc_spec *spec = codec->spec;
3396 snd_hda_codec_cleanup_stream(codec,
3397 spec->adc_nids[substream->number + 1]);
3404 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3408 /* NID is set in alc_build_pcms */
3410 .open = alc880_playback_pcm_open,
3411 .prepare = alc880_playback_pcm_prepare,
3412 .cleanup = alc880_playback_pcm_cleanup
3416 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3420 /* NID is set in alc_build_pcms */
3423 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3427 /* NID is set in alc_build_pcms */
3430 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3431 .substreams = 2, /* can be overridden */
3434 /* NID is set in alc_build_pcms */
3436 .prepare = alc880_alt_capture_pcm_prepare,
3437 .cleanup = alc880_alt_capture_pcm_cleanup
3441 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3445 /* NID is set in alc_build_pcms */
3447 .open = alc880_dig_playback_pcm_open,
3448 .close = alc880_dig_playback_pcm_close,
3449 .prepare = alc880_dig_playback_pcm_prepare,
3450 .cleanup = alc880_dig_playback_pcm_cleanup
3454 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3458 /* NID is set in alc_build_pcms */
3461 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3462 static struct hda_pcm_stream alc_pcm_null_stream = {
3468 static int alc_build_pcms(struct hda_codec *codec)
3470 struct alc_spec *spec = codec->spec;
3471 struct hda_pcm *info = spec->pcm_rec;
3474 codec->num_pcms = 1;
3475 codec->pcm_info = info;
3477 if (spec->no_analog)
3480 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3481 "%s Analog", codec->chip_name);
3482 info->name = spec->stream_name_analog;
3484 if (spec->stream_analog_playback) {
3485 if (snd_BUG_ON(!spec->multiout.dac_nids))
3487 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3488 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3490 if (spec->stream_analog_capture) {
3491 if (snd_BUG_ON(!spec->adc_nids))
3493 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3494 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3497 if (spec->channel_mode) {
3498 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3499 for (i = 0; i < spec->num_channel_mode; i++) {
3500 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3501 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3507 /* SPDIF for stream index #1 */
3508 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3509 snprintf(spec->stream_name_digital,
3510 sizeof(spec->stream_name_digital),
3511 "%s Digital", codec->chip_name);
3512 codec->num_pcms = 2;
3513 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3514 info = spec->pcm_rec + 1;
3515 info->name = spec->stream_name_digital;
3516 if (spec->dig_out_type)
3517 info->pcm_type = spec->dig_out_type;
3519 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3520 if (spec->multiout.dig_out_nid &&
3521 spec->stream_digital_playback) {
3522 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3523 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3525 if (spec->dig_in_nid &&
3526 spec->stream_digital_capture) {
3527 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3528 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3530 /* FIXME: do we need this for all Realtek codec models? */
3531 codec->spdif_status_reset = 1;
3534 if (spec->no_analog)
3537 /* If the use of more than one ADC is requested for the current
3538 * model, configure a second analog capture-only PCM.
3540 /* Additional Analaog capture for index #2 */
3541 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3542 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3543 codec->num_pcms = 3;
3544 info = spec->pcm_rec + 2;
3545 info->name = spec->stream_name_analog;
3546 if (spec->alt_dac_nid) {
3547 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3548 *spec->stream_analog_alt_playback;
3549 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3552 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3553 alc_pcm_null_stream;
3554 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3556 if (spec->num_adc_nids > 1) {
3557 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3558 *spec->stream_analog_alt_capture;
3559 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3561 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3562 spec->num_adc_nids - 1;
3564 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3565 alc_pcm_null_stream;
3566 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3573 static void alc_free_kctls(struct hda_codec *codec)
3575 struct alc_spec *spec = codec->spec;
3577 if (spec->kctls.list) {
3578 struct snd_kcontrol_new *kctl = spec->kctls.list;
3580 for (i = 0; i < spec->kctls.used; i++)
3581 kfree(kctl[i].name);
3583 snd_array_free(&spec->kctls);
3586 static void alc_free(struct hda_codec *codec)
3588 struct alc_spec *spec = codec->spec;
3593 alc_free_kctls(codec);
3595 snd_hda_detach_beep_device(codec);
3598 #ifdef SND_HDA_NEEDS_RESUME
3599 static int alc_resume(struct hda_codec *codec)
3601 codec->patch_ops.init(codec);
3602 snd_hda_codec_resume_amp(codec);
3603 snd_hda_codec_resume_cache(codec);
3610 static struct hda_codec_ops alc_patch_ops = {
3611 .build_controls = alc_build_controls,
3612 .build_pcms = alc_build_pcms,
3615 .unsol_event = alc_unsol_event,
3616 #ifdef SND_HDA_NEEDS_RESUME
3617 .resume = alc_resume,
3619 #ifdef CONFIG_SND_HDA_POWER_SAVE
3620 .check_power_status = alc_check_power_status,
3626 * Test configuration for debugging
3628 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3631 #ifdef CONFIG_SND_DEBUG
3632 static hda_nid_t alc880_test_dac_nids[4] = {
3633 0x02, 0x03, 0x04, 0x05
3636 static struct hda_input_mux alc880_test_capture_source = {
3645 { "Surround", 0x6 },
3649 static struct hda_channel_mode alc880_test_modes[4] = {
3656 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3657 struct snd_ctl_elem_info *uinfo)
3659 static char *texts[] = {
3660 "N/A", "Line Out", "HP Out",
3661 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3663 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3665 uinfo->value.enumerated.items = 8;
3666 if (uinfo->value.enumerated.item >= 8)
3667 uinfo->value.enumerated.item = 7;
3668 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3672 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3673 struct snd_ctl_elem_value *ucontrol)
3675 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3676 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3677 unsigned int pin_ctl, item = 0;
3679 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3680 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3681 if (pin_ctl & AC_PINCTL_OUT_EN) {
3682 if (pin_ctl & AC_PINCTL_HP_EN)
3686 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3687 switch (pin_ctl & AC_PINCTL_VREFEN) {
3688 case AC_PINCTL_VREF_HIZ: item = 3; break;
3689 case AC_PINCTL_VREF_50: item = 4; break;
3690 case AC_PINCTL_VREF_GRD: item = 5; break;
3691 case AC_PINCTL_VREF_80: item = 6; break;
3692 case AC_PINCTL_VREF_100: item = 7; break;
3695 ucontrol->value.enumerated.item[0] = item;
3699 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3700 struct snd_ctl_elem_value *ucontrol)
3702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3703 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3704 static unsigned int ctls[] = {
3705 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3706 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3707 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3708 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3709 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3710 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3712 unsigned int old_ctl, new_ctl;
3714 old_ctl = snd_hda_codec_read(codec, nid, 0,
3715 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3716 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3717 if (old_ctl != new_ctl) {
3719 snd_hda_codec_write_cache(codec, nid, 0,
3720 AC_VERB_SET_PIN_WIDGET_CONTROL,
3722 val = ucontrol->value.enumerated.item[0] >= 3 ?
3724 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3731 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3732 struct snd_ctl_elem_info *uinfo)
3734 static char *texts[] = {
3735 "Front", "Surround", "CLFE", "Side"
3737 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3739 uinfo->value.enumerated.items = 4;
3740 if (uinfo->value.enumerated.item >= 4)
3741 uinfo->value.enumerated.item = 3;
3742 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3746 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3747 struct snd_ctl_elem_value *ucontrol)
3749 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3750 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3753 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3754 ucontrol->value.enumerated.item[0] = sel & 3;
3758 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3759 struct snd_ctl_elem_value *ucontrol)
3761 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3762 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3765 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3766 if (ucontrol->value.enumerated.item[0] != sel) {
3767 sel = ucontrol->value.enumerated.item[0] & 3;
3768 snd_hda_codec_write_cache(codec, nid, 0,
3769 AC_VERB_SET_CONNECT_SEL, sel);
3775 #define PIN_CTL_TEST(xname,nid) { \
3776 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3778 .info = alc_test_pin_ctl_info, \
3779 .get = alc_test_pin_ctl_get, \
3780 .put = alc_test_pin_ctl_put, \
3781 .private_value = nid \
3784 #define PIN_SRC_TEST(xname,nid) { \
3785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3787 .info = alc_test_pin_src_info, \
3788 .get = alc_test_pin_src_get, \
3789 .put = alc_test_pin_src_put, \
3790 .private_value = nid \
3793 static struct snd_kcontrol_new alc880_test_mixer[] = {
3794 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3795 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3796 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3797 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3798 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3799 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3800 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3801 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3802 PIN_CTL_TEST("Front Pin Mode", 0x14),
3803 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3804 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3805 PIN_CTL_TEST("Side Pin Mode", 0x17),
3806 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3807 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3808 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3809 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3810 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3811 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3812 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3813 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3814 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3815 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3816 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3817 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3818 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3819 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3820 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3821 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3822 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3823 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3826 .name = "Channel Mode",
3827 .info = alc_ch_mode_info,
3828 .get = alc_ch_mode_get,
3829 .put = alc_ch_mode_put,
3834 static struct hda_verb alc880_test_init_verbs[] = {
3835 /* Unmute inputs of 0x0c - 0x0f */
3836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3844 /* Vol output for 0x0c-0x0f */
3845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3849 /* Set output pins 0x14-0x17 */
3850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3852 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3853 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3854 /* Unmute output pins 0x14-0x17 */
3855 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3858 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3859 /* Set input pins 0x18-0x1c */
3860 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3862 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3863 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3864 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3865 /* Mute input pins 0x18-0x1b */
3866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3869 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3872 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3873 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3874 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3875 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3876 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3877 /* Analog input/passthru */
3878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3890 static const char *alc880_models[ALC880_MODEL_LAST] = {
3891 [ALC880_3ST] = "3stack",
3892 [ALC880_TCL_S700] = "tcl",
3893 [ALC880_3ST_DIG] = "3stack-digout",
3894 [ALC880_CLEVO] = "clevo",
3895 [ALC880_5ST] = "5stack",
3896 [ALC880_5ST_DIG] = "5stack-digout",
3897 [ALC880_W810] = "w810",
3898 [ALC880_Z71V] = "z71v",
3899 [ALC880_6ST] = "6stack",
3900 [ALC880_6ST_DIG] = "6stack-digout",
3901 [ALC880_ASUS] = "asus",
3902 [ALC880_ASUS_W1V] = "asus-w1v",
3903 [ALC880_ASUS_DIG] = "asus-dig",
3904 [ALC880_ASUS_DIG2] = "asus-dig2",
3905 [ALC880_UNIWILL_DIG] = "uniwill",
3906 [ALC880_UNIWILL_P53] = "uniwill-p53",
3907 [ALC880_FUJITSU] = "fujitsu",
3908 [ALC880_F1734] = "F1734",
3910 [ALC880_LG_LW] = "lg-lw",
3911 [ALC880_MEDION_RIM] = "medion",
3912 #ifdef CONFIG_SND_DEBUG
3913 [ALC880_TEST] = "test",
3915 [ALC880_AUTO] = "auto",
3918 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3919 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3920 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3921 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3922 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3923 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3924 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3925 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3926 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3927 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3928 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3929 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3930 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3931 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3932 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3933 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3934 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3935 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3936 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3937 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3938 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3939 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3940 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3941 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3942 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3943 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3944 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3945 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3946 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3947 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3948 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3949 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3950 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3951 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3952 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3953 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3954 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3955 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3956 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3957 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3958 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3959 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3960 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3961 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3962 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3963 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3964 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3965 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3967 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3968 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3969 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3970 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3971 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3972 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3973 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3974 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3975 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3976 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3977 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3978 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3979 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3980 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3981 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3982 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3983 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3984 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3988 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3989 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3990 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3995 * ALC880 codec presets
3997 static struct alc_config_preset alc880_presets[] = {
3999 .mixers = { alc880_three_stack_mixer },
4000 .init_verbs = { alc880_volume_init_verbs,
4001 alc880_pin_3stack_init_verbs },
4002 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4003 .dac_nids = alc880_dac_nids,
4004 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4005 .channel_mode = alc880_threestack_modes,
4007 .input_mux = &alc880_capture_source,
4009 [ALC880_3ST_DIG] = {
4010 .mixers = { alc880_three_stack_mixer },
4011 .init_verbs = { alc880_volume_init_verbs,
4012 alc880_pin_3stack_init_verbs },
4013 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4014 .dac_nids = alc880_dac_nids,
4015 .dig_out_nid = ALC880_DIGOUT_NID,
4016 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4017 .channel_mode = alc880_threestack_modes,
4019 .input_mux = &alc880_capture_source,
4021 [ALC880_TCL_S700] = {
4022 .mixers = { alc880_tcl_s700_mixer },
4023 .init_verbs = { alc880_volume_init_verbs,
4024 alc880_pin_tcl_S700_init_verbs,
4025 alc880_gpio2_init_verbs },
4026 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4027 .dac_nids = alc880_dac_nids,
4028 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4029 .num_adc_nids = 1, /* single ADC */
4031 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4032 .channel_mode = alc880_2_jack_modes,
4033 .input_mux = &alc880_capture_source,
4036 .mixers = { alc880_three_stack_mixer,
4037 alc880_five_stack_mixer},
4038 .init_verbs = { alc880_volume_init_verbs,
4039 alc880_pin_5stack_init_verbs },
4040 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4041 .dac_nids = alc880_dac_nids,
4042 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4043 .channel_mode = alc880_fivestack_modes,
4044 .input_mux = &alc880_capture_source,
4046 [ALC880_5ST_DIG] = {
4047 .mixers = { alc880_three_stack_mixer,
4048 alc880_five_stack_mixer },
4049 .init_verbs = { alc880_volume_init_verbs,
4050 alc880_pin_5stack_init_verbs },
4051 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4052 .dac_nids = alc880_dac_nids,
4053 .dig_out_nid = ALC880_DIGOUT_NID,
4054 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4055 .channel_mode = alc880_fivestack_modes,
4056 .input_mux = &alc880_capture_source,
4059 .mixers = { alc880_six_stack_mixer },
4060 .init_verbs = { alc880_volume_init_verbs,
4061 alc880_pin_6stack_init_verbs },
4062 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4063 .dac_nids = alc880_6st_dac_nids,
4064 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4065 .channel_mode = alc880_sixstack_modes,
4066 .input_mux = &alc880_6stack_capture_source,
4068 [ALC880_6ST_DIG] = {
4069 .mixers = { alc880_six_stack_mixer },
4070 .init_verbs = { alc880_volume_init_verbs,
4071 alc880_pin_6stack_init_verbs },
4072 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4073 .dac_nids = alc880_6st_dac_nids,
4074 .dig_out_nid = ALC880_DIGOUT_NID,
4075 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4076 .channel_mode = alc880_sixstack_modes,
4077 .input_mux = &alc880_6stack_capture_source,
4080 .mixers = { alc880_w810_base_mixer },
4081 .init_verbs = { alc880_volume_init_verbs,
4082 alc880_pin_w810_init_verbs,
4083 alc880_gpio2_init_verbs },
4084 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4085 .dac_nids = alc880_w810_dac_nids,
4086 .dig_out_nid = ALC880_DIGOUT_NID,
4087 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4088 .channel_mode = alc880_w810_modes,
4089 .input_mux = &alc880_capture_source,
4092 .mixers = { alc880_z71v_mixer },
4093 .init_verbs = { alc880_volume_init_verbs,
4094 alc880_pin_z71v_init_verbs },
4095 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4096 .dac_nids = alc880_z71v_dac_nids,
4097 .dig_out_nid = ALC880_DIGOUT_NID,
4099 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4100 .channel_mode = alc880_2_jack_modes,
4101 .input_mux = &alc880_capture_source,
4104 .mixers = { alc880_f1734_mixer },
4105 .init_verbs = { alc880_volume_init_verbs,
4106 alc880_pin_f1734_init_verbs },
4107 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4108 .dac_nids = alc880_f1734_dac_nids,
4110 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4111 .channel_mode = alc880_2_jack_modes,
4112 .input_mux = &alc880_f1734_capture_source,
4113 .unsol_event = alc880_uniwill_p53_unsol_event,
4114 .setup = alc880_uniwill_p53_setup,
4115 .init_hook = alc_automute_amp,
4118 .mixers = { alc880_asus_mixer },
4119 .init_verbs = { alc880_volume_init_verbs,
4120 alc880_pin_asus_init_verbs,
4121 alc880_gpio1_init_verbs },
4122 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4123 .dac_nids = alc880_asus_dac_nids,
4124 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4125 .channel_mode = alc880_asus_modes,
4127 .input_mux = &alc880_capture_source,
4129 [ALC880_ASUS_DIG] = {
4130 .mixers = { alc880_asus_mixer },
4131 .init_verbs = { alc880_volume_init_verbs,
4132 alc880_pin_asus_init_verbs,
4133 alc880_gpio1_init_verbs },
4134 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4135 .dac_nids = alc880_asus_dac_nids,
4136 .dig_out_nid = ALC880_DIGOUT_NID,
4137 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4138 .channel_mode = alc880_asus_modes,
4140 .input_mux = &alc880_capture_source,
4142 [ALC880_ASUS_DIG2] = {
4143 .mixers = { alc880_asus_mixer },
4144 .init_verbs = { alc880_volume_init_verbs,
4145 alc880_pin_asus_init_verbs,
4146 alc880_gpio2_init_verbs }, /* use GPIO2 */
4147 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4148 .dac_nids = alc880_asus_dac_nids,
4149 .dig_out_nid = ALC880_DIGOUT_NID,
4150 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4151 .channel_mode = alc880_asus_modes,
4153 .input_mux = &alc880_capture_source,
4155 [ALC880_ASUS_W1V] = {
4156 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4157 .init_verbs = { alc880_volume_init_verbs,
4158 alc880_pin_asus_init_verbs,
4159 alc880_gpio1_init_verbs },
4160 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4161 .dac_nids = alc880_asus_dac_nids,
4162 .dig_out_nid = ALC880_DIGOUT_NID,
4163 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4164 .channel_mode = alc880_asus_modes,
4166 .input_mux = &alc880_capture_source,
4168 [ALC880_UNIWILL_DIG] = {
4169 .mixers = { alc880_asus_mixer },
4170 .init_verbs = { alc880_volume_init_verbs,
4171 alc880_pin_asus_init_verbs },
4172 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4173 .dac_nids = alc880_asus_dac_nids,
4174 .dig_out_nid = ALC880_DIGOUT_NID,
4175 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4176 .channel_mode = alc880_asus_modes,
4178 .input_mux = &alc880_capture_source,
4180 [ALC880_UNIWILL] = {
4181 .mixers = { alc880_uniwill_mixer },
4182 .init_verbs = { alc880_volume_init_verbs,
4183 alc880_uniwill_init_verbs },
4184 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4185 .dac_nids = alc880_asus_dac_nids,
4186 .dig_out_nid = ALC880_DIGOUT_NID,
4187 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4188 .channel_mode = alc880_threestack_modes,
4190 .input_mux = &alc880_capture_source,
4191 .unsol_event = alc880_uniwill_unsol_event,
4192 .setup = alc880_uniwill_setup,
4193 .init_hook = alc880_uniwill_init_hook,
4195 [ALC880_UNIWILL_P53] = {
4196 .mixers = { alc880_uniwill_p53_mixer },
4197 .init_verbs = { alc880_volume_init_verbs,
4198 alc880_uniwill_p53_init_verbs },
4199 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4200 .dac_nids = alc880_asus_dac_nids,
4201 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4202 .channel_mode = alc880_threestack_modes,
4203 .input_mux = &alc880_capture_source,
4204 .unsol_event = alc880_uniwill_p53_unsol_event,
4205 .setup = alc880_uniwill_p53_setup,
4206 .init_hook = alc_automute_amp,
4208 [ALC880_FUJITSU] = {
4209 .mixers = { alc880_fujitsu_mixer },
4210 .init_verbs = { alc880_volume_init_verbs,
4211 alc880_uniwill_p53_init_verbs,
4212 alc880_beep_init_verbs },
4213 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4214 .dac_nids = alc880_dac_nids,
4215 .dig_out_nid = ALC880_DIGOUT_NID,
4216 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4217 .channel_mode = alc880_2_jack_modes,
4218 .input_mux = &alc880_capture_source,
4219 .unsol_event = alc880_uniwill_p53_unsol_event,
4220 .setup = alc880_uniwill_p53_setup,
4221 .init_hook = alc_automute_amp,
4224 .mixers = { alc880_three_stack_mixer },
4225 .init_verbs = { alc880_volume_init_verbs,
4226 alc880_pin_clevo_init_verbs },
4227 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4228 .dac_nids = alc880_dac_nids,
4230 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4231 .channel_mode = alc880_threestack_modes,
4233 .input_mux = &alc880_capture_source,
4236 .mixers = { alc880_lg_mixer },
4237 .init_verbs = { alc880_volume_init_verbs,
4238 alc880_lg_init_verbs },
4239 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4240 .dac_nids = alc880_lg_dac_nids,
4241 .dig_out_nid = ALC880_DIGOUT_NID,
4242 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4243 .channel_mode = alc880_lg_ch_modes,
4245 .input_mux = &alc880_lg_capture_source,
4246 .unsol_event = alc_automute_amp_unsol_event,
4247 .setup = alc880_lg_setup,
4248 .init_hook = alc_automute_amp,
4249 #ifdef CONFIG_SND_HDA_POWER_SAVE
4250 .loopbacks = alc880_lg_loopbacks,
4254 .mixers = { alc880_lg_lw_mixer },
4255 .init_verbs = { alc880_volume_init_verbs,
4256 alc880_lg_lw_init_verbs },
4257 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4258 .dac_nids = alc880_dac_nids,
4259 .dig_out_nid = ALC880_DIGOUT_NID,
4260 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4261 .channel_mode = alc880_lg_lw_modes,
4262 .input_mux = &alc880_lg_lw_capture_source,
4263 .unsol_event = alc_automute_amp_unsol_event,
4264 .setup = alc880_lg_lw_setup,
4265 .init_hook = alc_automute_amp,
4267 [ALC880_MEDION_RIM] = {
4268 .mixers = { alc880_medion_rim_mixer },
4269 .init_verbs = { alc880_volume_init_verbs,
4270 alc880_medion_rim_init_verbs,
4271 alc_gpio2_init_verbs },
4272 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4273 .dac_nids = alc880_dac_nids,
4274 .dig_out_nid = ALC880_DIGOUT_NID,
4275 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4276 .channel_mode = alc880_2_jack_modes,
4277 .input_mux = &alc880_medion_rim_capture_source,
4278 .unsol_event = alc880_medion_rim_unsol_event,
4279 .setup = alc880_medion_rim_setup,
4280 .init_hook = alc880_medion_rim_automute,
4282 #ifdef CONFIG_SND_DEBUG
4284 .mixers = { alc880_test_mixer },
4285 .init_verbs = { alc880_test_init_verbs },
4286 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4287 .dac_nids = alc880_test_dac_nids,
4288 .dig_out_nid = ALC880_DIGOUT_NID,
4289 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4290 .channel_mode = alc880_test_modes,
4291 .input_mux = &alc880_test_capture_source,
4297 * Automatic parse of I/O pins from the BIOS configuration
4302 ALC_CTL_WIDGET_MUTE,
4305 static struct snd_kcontrol_new alc880_control_templates[] = {
4306 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4307 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4308 HDA_BIND_MUTE(NULL, 0, 0, 0),
4311 /* add dynamic controls */
4312 static int add_control(struct alc_spec *spec, int type, const char *name,
4315 struct snd_kcontrol_new *knew;
4317 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4318 knew = snd_array_new(&spec->kctls);
4321 *knew = alc880_control_templates[type];
4322 knew->name = kstrdup(name, GFP_KERNEL);
4325 knew->private_value = val;
4329 static int add_control_with_pfx(struct alc_spec *spec, int type,
4330 const char *pfx, const char *dir,
4331 const char *sfx, unsigned long val)
4334 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4335 return add_control(spec, type, name, val);
4338 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4339 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4340 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4341 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4343 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4344 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4345 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4346 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4347 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4348 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4349 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4350 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4351 #define ALC880_PIN_CD_NID 0x1c
4353 /* fill in the dac_nids table from the parsed pin configuration */
4354 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4355 const struct auto_pin_cfg *cfg)
4361 memset(assigned, 0, sizeof(assigned));
4362 spec->multiout.dac_nids = spec->private_dac_nids;
4364 /* check the pins hardwired to audio widget */
4365 for (i = 0; i < cfg->line_outs; i++) {
4366 nid = cfg->line_out_pins[i];
4367 if (alc880_is_fixed_pin(nid)) {
4368 int idx = alc880_fixed_pin_idx(nid);
4369 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4373 /* left pins can be connect to any audio widget */
4374 for (i = 0; i < cfg->line_outs; i++) {
4375 nid = cfg->line_out_pins[i];
4376 if (alc880_is_fixed_pin(nid))
4378 /* search for an empty channel */
4379 for (j = 0; j < cfg->line_outs; j++) {
4381 spec->multiout.dac_nids[i] =
4382 alc880_idx_to_dac(j);
4388 spec->multiout.num_dacs = cfg->line_outs;
4392 /* add playback controls from the parsed DAC table */
4393 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4394 const struct auto_pin_cfg *cfg)
4396 static const char *chname[4] = {
4397 "Front", "Surround", NULL /*CLFE*/, "Side"
4402 for (i = 0; i < cfg->line_outs; i++) {
4403 if (!spec->multiout.dac_nids[i])
4405 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4408 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4410 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4414 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4416 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4420 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4422 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4426 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4428 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4434 if (cfg->line_outs == 1 &&
4435 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4439 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4440 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4444 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4445 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4454 /* add playback controls for speaker and HP outputs */
4455 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4464 if (alc880_is_fixed_pin(pin)) {
4465 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4466 /* specify the DAC as the extra output */
4467 if (!spec->multiout.hp_nid)
4468 spec->multiout.hp_nid = nid;
4470 spec->multiout.extra_out_nid[0] = nid;
4471 /* control HP volume/switch on the output mixer amp */
4472 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4473 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4474 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4477 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4478 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4481 } else if (alc880_is_multi_pin(pin)) {
4482 /* set manual connection */
4483 /* we have only a switch on HP-out PIN */
4484 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4485 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4492 /* create input playback/capture controls for the given pin */
4493 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4494 const char *ctlname,
4495 int idx, hda_nid_t mix_nid)
4499 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4500 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4503 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4504 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4510 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4512 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4513 return (pincap & AC_PINCAP_IN) != 0;
4516 /* create playback/capture controls for input pins */
4517 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4518 const struct auto_pin_cfg *cfg,
4520 hda_nid_t cap1, hda_nid_t cap2)
4522 struct alc_spec *spec = codec->spec;
4523 struct hda_input_mux *imux = &spec->private_imux[0];
4526 for (i = 0; i < AUTO_PIN_LAST; i++) {
4529 pin = cfg->input_pins[i];
4530 if (!alc_is_input_pin(codec, pin))
4534 idx = get_connection_index(codec, mixer, pin);
4536 err = new_analog_input(spec, pin,
4537 auto_pin_cfg_labels[i],
4546 idx = get_connection_index(codec, cap1, pin);
4547 if (idx < 0 && cap2)
4548 idx = get_connection_index(codec, cap2, pin);
4550 imux->items[imux->num_items].label =
4551 auto_pin_cfg_labels[i];
4552 imux->items[imux->num_items].index = idx;
4559 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4560 const struct auto_pin_cfg *cfg)
4562 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4565 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4566 unsigned int pin_type)
4568 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4571 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4575 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4576 hda_nid_t nid, int pin_type,
4579 alc_set_pin_output(codec, nid, pin_type);
4580 /* need the manual connection? */
4581 if (alc880_is_multi_pin(nid)) {
4582 struct alc_spec *spec = codec->spec;
4583 int idx = alc880_multi_pin_idx(nid);
4584 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4585 AC_VERB_SET_CONNECT_SEL,
4586 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4590 static int get_pin_type(int line_out_type)
4592 if (line_out_type == AUTO_PIN_HP_OUT)
4598 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4600 struct alc_spec *spec = codec->spec;
4603 for (i = 0; i < spec->autocfg.line_outs; i++) {
4604 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4605 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4606 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4610 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4612 struct alc_spec *spec = codec->spec;
4615 pin = spec->autocfg.speaker_pins[0];
4616 if (pin) /* connect to front */
4617 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4618 pin = spec->autocfg.hp_pins[0];
4619 if (pin) /* connect to front */
4620 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4623 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4625 struct alc_spec *spec = codec->spec;
4628 for (i = 0; i < AUTO_PIN_LAST; i++) {
4629 hda_nid_t nid = spec->autocfg.input_pins[i];
4630 if (alc_is_input_pin(codec, nid)) {
4631 alc_set_input_pin(codec, nid, i);
4632 if (nid != ALC880_PIN_CD_NID &&
4633 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4634 snd_hda_codec_write(codec, nid, 0,
4635 AC_VERB_SET_AMP_GAIN_MUTE,
4641 /* parse the BIOS configuration and set up the alc_spec */
4642 /* return 1 if successful, 0 if the proper config is not found,
4643 * or a negative error code
4645 static int alc880_parse_auto_config(struct hda_codec *codec)
4647 struct alc_spec *spec = codec->spec;
4649 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4651 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4655 if (!spec->autocfg.line_outs)
4656 return 0; /* can't find valid BIOS pin config */
4658 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4661 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4664 err = alc880_auto_create_extra_out(spec,
4665 spec->autocfg.speaker_pins[0],
4669 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4673 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4677 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4679 /* check multiple SPDIF-out (for recent codecs) */
4680 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4682 err = snd_hda_get_connections(codec,
4683 spec->autocfg.dig_out_pins[i],
4688 spec->multiout.dig_out_nid = dig_nid;
4690 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4691 spec->slave_dig_outs[i - 1] = dig_nid;
4692 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4696 if (spec->autocfg.dig_in_pin)
4697 spec->dig_in_nid = ALC880_DIGIN_NID;
4699 if (spec->kctls.list)
4700 add_mixer(spec, spec->kctls.list);
4702 add_verb(spec, alc880_volume_init_verbs);
4704 spec->num_mux_defs = 1;
4705 spec->input_mux = &spec->private_imux[0];
4707 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4712 /* additional initialization for auto-configuration model */
4713 static void alc880_auto_init(struct hda_codec *codec)
4715 struct alc_spec *spec = codec->spec;
4716 alc880_auto_init_multi_out(codec);
4717 alc880_auto_init_extra_out(codec);
4718 alc880_auto_init_analog_input(codec);
4719 if (spec->unsol_event)
4720 alc_inithook(codec);
4723 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4724 * one of two digital mic pins, e.g. on ALC272
4726 static void fixup_automic_adc(struct hda_codec *codec)
4728 struct alc_spec *spec = codec->spec;
4731 for (i = 0; i < spec->num_adc_nids; i++) {
4732 hda_nid_t cap = spec->capsrc_nids ?
4733 spec->capsrc_nids[i] : spec->adc_nids[i];
4736 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4739 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4742 spec->int_mic.mux_idx = iidx;
4743 spec->ext_mic.mux_idx = eidx;
4744 if (spec->capsrc_nids)
4745 spec->capsrc_nids += i;
4746 spec->adc_nids += i;
4747 spec->num_adc_nids = 1;
4750 snd_printd(KERN_INFO "hda_codec: %s: "
4751 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4752 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4753 spec->auto_mic = 0; /* disable auto-mic to be sure */
4756 static void set_capture_mixer(struct hda_codec *codec)
4758 struct alc_spec *spec = codec->spec;
4759 static struct snd_kcontrol_new *caps[2][3] = {
4760 { alc_capture_mixer_nosrc1,
4761 alc_capture_mixer_nosrc2,
4762 alc_capture_mixer_nosrc3 },
4763 { alc_capture_mixer1,
4765 alc_capture_mixer3 },
4767 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4769 if (spec->auto_mic) {
4771 fixup_automic_adc(codec);
4772 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4776 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4780 #define set_beep_amp(spec, nid, idx, dir) \
4781 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4784 * OK, here we have finally the patch for ALC880
4787 static int patch_alc880(struct hda_codec *codec)
4789 struct alc_spec *spec;
4793 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4799 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4802 if (board_config < 0) {
4803 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4805 board_config = ALC880_AUTO;
4808 if (board_config == ALC880_AUTO) {
4809 /* automatic parse from the BIOS config */
4810 err = alc880_parse_auto_config(codec);
4816 "hda_codec: Cannot set up configuration "
4817 "from BIOS. Using 3-stack mode...\n");
4818 board_config = ALC880_3ST;
4822 err = snd_hda_attach_beep_device(codec, 0x1);
4828 if (board_config != ALC880_AUTO)
4829 setup_preset(codec, &alc880_presets[board_config]);
4831 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4832 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4833 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4835 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4836 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4838 if (!spec->adc_nids && spec->input_mux) {
4839 /* check whether NID 0x07 is valid */
4840 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4842 wcap = get_wcaps_type(wcap);
4843 if (wcap != AC_WID_AUD_IN) {
4844 spec->adc_nids = alc880_adc_nids_alt;
4845 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4847 spec->adc_nids = alc880_adc_nids;
4848 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4851 set_capture_mixer(codec);
4852 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4854 spec->vmaster_nid = 0x0c;
4856 codec->patch_ops = alc_patch_ops;
4857 if (board_config == ALC880_AUTO)
4858 spec->init_hook = alc880_auto_init;
4859 #ifdef CONFIG_SND_HDA_POWER_SAVE
4860 if (!spec->loopback.amplist)
4861 spec->loopback.amplist = alc880_loopbacks;
4863 codec->proc_widget_hook = print_realtek_coef;
4873 static hda_nid_t alc260_dac_nids[1] = {
4878 static hda_nid_t alc260_adc_nids[1] = {
4883 static hda_nid_t alc260_adc_nids_alt[1] = {
4888 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4889 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4891 static hda_nid_t alc260_dual_adc_nids[2] = {
4896 #define ALC260_DIGOUT_NID 0x03
4897 #define ALC260_DIGIN_NID 0x06
4899 static struct hda_input_mux alc260_capture_source = {
4903 { "Front Mic", 0x1 },
4909 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4910 * headphone jack and the internal CD lines since these are the only pins at
4911 * which audio can appear. For flexibility, also allow the option of
4912 * recording the mixer output on the second ADC (ADC0 doesn't have a
4913 * connection to the mixer output).
4915 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4919 { "Mic/Line", 0x0 },
4921 { "Headphone", 0x2 },
4927 { "Mic/Line", 0x0 },
4929 { "Headphone", 0x2 },
4936 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4937 * the Fujitsu S702x, but jacks are marked differently.
4939 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4946 { "Headphone", 0x5 },
4955 { "Headphone", 0x6 },
4961 /* Maxdata Favorit 100XS */
4962 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4966 { "Line/Mic", 0x0 },
4973 { "Line/Mic", 0x0 },
4981 * This is just place-holder, so there's something for alc_build_pcms to look
4982 * at when it calculates the maximum number of channels. ALC260 has no mixer
4983 * element which allows changing the channel mode, so the verb list is
4986 static struct hda_channel_mode alc260_modes[1] = {
4991 /* Mixer combinations
4993 * basic: base_output + input + pc_beep + capture
4994 * HP: base_output + input + capture_alt
4995 * HP_3013: hp_3013 + input + capture
4996 * fujitsu: fujitsu + capture
4997 * acer: acer + capture
5000 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5001 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5002 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5004 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5005 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5006 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5010 static struct snd_kcontrol_new alc260_input_mixer[] = {
5011 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5012 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5013 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5014 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5016 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5022 /* update HP, line and mono out pins according to the master switch */
5023 static void alc260_hp_master_update(struct hda_codec *codec,
5024 hda_nid_t hp, hda_nid_t line,
5027 struct alc_spec *spec = codec->spec;
5028 unsigned int val = spec->master_sw ? PIN_HP : 0;
5029 /* change HP and line-out pins */
5030 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5032 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5034 /* mono (speaker) depending on the HP jack sense */
5035 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5036 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5040 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5041 struct snd_ctl_elem_value *ucontrol)
5043 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5044 struct alc_spec *spec = codec->spec;
5045 *ucontrol->value.integer.value = spec->master_sw;
5049 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5050 struct snd_ctl_elem_value *ucontrol)
5052 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5053 struct alc_spec *spec = codec->spec;
5054 int val = !!*ucontrol->value.integer.value;
5055 hda_nid_t hp, line, mono;
5057 if (val == spec->master_sw)
5059 spec->master_sw = val;
5060 hp = (kcontrol->private_value >> 16) & 0xff;
5061 line = (kcontrol->private_value >> 8) & 0xff;
5062 mono = kcontrol->private_value & 0xff;
5063 alc260_hp_master_update(codec, hp, line, mono);
5067 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5069 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5070 .name = "Master Playback Switch",
5071 .info = snd_ctl_boolean_mono_info,
5072 .get = alc260_hp_master_sw_get,
5073 .put = alc260_hp_master_sw_put,
5074 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5076 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5077 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5079 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5080 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5082 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5086 static struct hda_verb alc260_hp_unsol_verbs[] = {
5087 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5091 static void alc260_hp_automute(struct hda_codec *codec)
5093 struct alc_spec *spec = codec->spec;
5094 unsigned int present;
5096 present = snd_hda_codec_read(codec, 0x10, 0,
5097 AC_VERB_GET_PIN_SENSE, 0);
5098 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5099 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5102 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5104 if ((res >> 26) == ALC880_HP_EVENT)
5105 alc260_hp_automute(codec);
5108 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5111 .name = "Master Playback Switch",
5112 .info = snd_ctl_boolean_mono_info,
5113 .get = alc260_hp_master_sw_get,
5114 .put = alc260_hp_master_sw_put,
5115 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5117 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5118 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5119 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5120 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5123 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5124 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5128 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5129 .ops = &snd_hda_bind_vol,
5131 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5132 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5133 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5138 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5139 .ops = &snd_hda_bind_sw,
5141 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5142 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5147 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5148 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5149 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5150 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5155 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5160 static void alc260_hp_3013_automute(struct hda_codec *codec)
5162 struct alc_spec *spec = codec->spec;
5163 unsigned int present;
5165 present = snd_hda_codec_read(codec, 0x15, 0,
5166 AC_VERB_GET_PIN_SENSE, 0);
5167 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5168 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5171 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5174 if ((res >> 26) == ALC880_HP_EVENT)
5175 alc260_hp_3013_automute(codec);
5178 static void alc260_hp_3012_automute(struct hda_codec *codec)
5180 unsigned int present, bits;
5182 present = snd_hda_codec_read(codec, 0x10, 0,
5183 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5185 bits = present ? 0 : PIN_OUT;
5186 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5188 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5190 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5194 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5197 if ((res >> 26) == ALC880_HP_EVENT)
5198 alc260_hp_3012_automute(codec);
5201 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5202 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5204 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5205 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5206 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5207 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5208 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5209 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5210 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5211 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5212 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5213 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5214 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5218 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5219 * versions of the ALC260 don't act on requests to enable mic bias from NID
5220 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5221 * datasheet doesn't mention this restriction. At this stage it's not clear
5222 * whether this behaviour is intentional or is a hardware bug in chip
5223 * revisions available in early 2006. Therefore for now allow the
5224 * "Headphone Jack Mode" control to span all choices, but if it turns out
5225 * that the lack of mic bias for this NID is intentional we could change the
5226 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5228 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5229 * don't appear to make the mic bias available from the "line" jack, even
5230 * though the NID used for this jack (0x14) can supply it. The theory is
5231 * that perhaps Acer have included blocking capacitors between the ALC260
5232 * and the output jack. If this turns out to be the case for all such
5233 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5234 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5236 * The C20x Tablet series have a mono internal speaker which is controlled
5237 * via the chip's Mono sum widget and pin complex, so include the necessary
5238 * controls for such models. On models without a "mono speaker" the control
5239 * won't do anything.
5241 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5242 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5243 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5244 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5245 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5247 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5249 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5250 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5252 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5253 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5254 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5255 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5256 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5260 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5262 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5263 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5264 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5265 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5266 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5267 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5268 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5272 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5273 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5275 static struct snd_kcontrol_new alc260_will_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("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5282 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5283 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5284 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5285 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5289 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5290 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5292 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5293 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5294 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5296 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5297 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5298 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5299 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5300 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5301 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5302 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5307 * initialization verbs
5309 static struct hda_verb alc260_init_verbs[] = {
5310 /* Line In pin widget for input */
5311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5312 /* CD pin widget for input */
5313 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5314 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5315 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5316 /* Mic2 (front panel) pin widget for input and vref at 80% */
5317 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5318 /* LINE-2 is used for line-out in rear */
5319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5320 /* select line-out */
5321 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5323 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5325 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5327 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5328 /* mute capture amp left and right */
5329 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5330 /* set connection select to line in (default select for this ADC) */
5331 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5332 /* mute capture amp left and right */
5333 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5334 /* set connection select to line in (default select for this ADC) */
5335 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5336 /* set vol=0 Line-Out mixer amp left and right */
5337 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5338 /* unmute pin widget amp left and right (no gain on this amp) */
5339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5340 /* set vol=0 HP mixer amp left and right */
5341 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5342 /* unmute pin widget amp left and right (no gain on this amp) */
5343 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5344 /* set vol=0 Mono mixer amp left and right */
5345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5346 /* unmute pin widget amp left and right (no gain on this amp) */
5347 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5348 /* unmute LINE-2 out pin */
5349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5353 /* mute analog inputs */
5354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5359 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5360 /* mute Front out path */
5361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5362 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5363 /* mute Headphone out path */
5364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5365 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5366 /* mute Mono out path */
5367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5368 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5372 #if 0 /* should be identical with alc260_init_verbs? */
5373 static struct hda_verb alc260_hp_init_verbs[] = {
5374 /* Headphone and output */
5375 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5377 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5378 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5379 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5380 /* Mic2 (front panel) pin widget for input and vref at 80% */
5381 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5382 /* Line In pin widget for input */
5383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5384 /* Line-2 pin widget for output */
5385 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5386 /* CD pin widget for input */
5387 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5388 /* unmute amp left and right */
5389 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5390 /* set connection select to line in (default select for this ADC) */
5391 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5392 /* unmute Line-Out mixer amp left and right (volume = 0) */
5393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5394 /* mute pin widget amp left and right (no gain on this amp) */
5395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5396 /* unmute HP mixer amp left and right (volume = 0) */
5397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5398 /* mute pin widget amp left and right (no gain on this amp) */
5399 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5400 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5403 /* mute analog inputs */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5409 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5410 /* Unmute Front out path */
5411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5412 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5413 /* Unmute Headphone out path */
5414 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5415 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5416 /* Unmute Mono out path */
5417 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5418 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5423 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5424 /* Line out and output */
5425 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5427 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5428 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5429 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5430 /* Mic2 (front panel) pin widget for input and vref at 80% */
5431 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5432 /* Line In pin widget for input */
5433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5434 /* Headphone pin widget for output */
5435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5436 /* CD pin widget for input */
5437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5438 /* unmute amp left and right */
5439 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5440 /* set connection select to line in (default select for this ADC) */
5441 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5442 /* unmute Line-Out mixer amp left and right (volume = 0) */
5443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5444 /* mute pin widget amp left and right (no gain on this amp) */
5445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5446 /* unmute HP mixer amp left and right (volume = 0) */
5447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5448 /* mute pin widget amp left and right (no gain on this amp) */
5449 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5450 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5453 /* mute analog inputs */
5454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5459 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5460 /* Unmute Front out path */
5461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5463 /* Unmute Headphone out path */
5464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5466 /* Unmute Mono out path */
5467 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5472 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5473 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5474 * audio = 0x16, internal speaker = 0x10.
5476 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5477 /* Disable all GPIOs */
5478 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5479 /* Internal speaker is connected to headphone pin */
5480 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5481 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5483 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5485 /* Ensure all other unused pins are disabled and muted. */
5486 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5487 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5488 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5489 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5490 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5491 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 /* Disable digital (SPDIF) pins */
5496 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5497 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5499 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5500 * when acting as an output.
5502 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5504 /* Start with output sum widgets muted and their output gains at min */
5505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5515 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5516 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5517 /* Unmute Line1 pin widget output buffer since it starts as an output.
5518 * If the pin mode is changed by the user the pin mode control will
5519 * take care of enabling the pin's input/output buffers as needed.
5520 * Therefore there's no need to enable the input buffer at this
5523 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5524 /* Unmute input buffer of pin widget used for Line-in (no equiv
5527 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5529 /* Mute capture amp left and right */
5530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5531 /* Set ADC connection select to match default mixer setting - line
5534 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5536 /* Do the same for the second ADC: mute capture input amp and
5537 * set ADC connection to line in (on mic1 pin)
5539 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5540 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5542 /* Mute all inputs to mixer widget (even unconnected ones) */
5543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5555 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5556 * similar laptops (adapted from Fujitsu init verbs).
5558 static struct hda_verb alc260_acer_init_verbs[] = {
5559 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5560 * the headphone jack. Turn this on and rely on the standard mute
5561 * methods whenever the user wants to turn these outputs off.
5563 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5564 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5565 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5566 /* Internal speaker/Headphone jack is connected to Line-out pin */
5567 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5568 /* Internal microphone/Mic jack is connected to Mic1 pin */
5569 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5570 /* Line In jack is connected to Line1 pin */
5571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5572 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5573 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5574 /* Ensure all other unused pins are disabled and muted. */
5575 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5576 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5578 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5580 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 /* Disable digital (SPDIF) pins */
5582 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5583 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5585 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5586 * bus when acting as outputs.
5588 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5589 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5591 /* Start with output sum widgets muted and their output gains at min */
5592 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5598 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5602 /* Unmute Line-out pin widget amp left and right
5603 * (no equiv mixer ctrl)
5605 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5606 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5607 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5608 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5609 * inputs. If the pin mode is changed by the user the pin mode control
5610 * will take care of enabling the pin's input/output buffers as needed.
5611 * Therefore there's no need to enable the input buffer at this
5614 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 /* Mute capture amp left and right */
5618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5619 /* Set ADC connection select to match default mixer setting - mic
5622 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5624 /* Do similar with the second ADC: mute capture input amp and
5625 * set ADC connection to mic to match ALSA's default state.
5627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5628 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* Mute all inputs to mixer widget (even unconnected ones) */
5631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5643 /* Initialisation sequence for Maxdata Favorit 100XS
5644 * (adapted from Acer init verbs).
5646 static struct hda_verb alc260_favorit100_init_verbs[] = {
5647 /* GPIO 0 enables the output jack.
5648 * Turn this on and rely on the standard mute
5649 * methods whenever the user wants to turn these outputs off.
5651 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5652 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5653 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5654 /* Line/Mic input jack is connected to Mic1 pin */
5655 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5656 /* Ensure all other unused pins are disabled and muted. */
5657 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5658 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5660 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5661 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5662 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 /* Disable digital (SPDIF) pins */
5668 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5669 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5671 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5672 * bus when acting as outputs.
5674 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5675 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5677 /* Start with output sum widgets muted and their output gains at min */
5678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5684 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5688 /* Unmute Line-out pin widget amp left and right
5689 * (no equiv mixer ctrl)
5691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5692 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5693 * inputs. If the pin mode is changed by the user the pin mode control
5694 * will take care of enabling the pin's input/output buffers as needed.
5695 * Therefore there's no need to enable the input buffer at this
5698 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5700 /* Mute capture amp left and right */
5701 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 /* Set ADC connection select to match default mixer setting - mic
5705 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5707 /* Do similar with the second ADC: mute capture input amp and
5708 * set ADC connection to mic to match ALSA's default state.
5710 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5713 /* Mute all inputs to mixer widget (even unconnected ones) */
5714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5726 static struct hda_verb alc260_will_verbs[] = {
5727 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5728 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5729 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5730 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5731 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5732 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5736 static struct hda_verb alc260_replacer_672v_verbs[] = {
5737 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5738 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5739 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5741 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5742 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5743 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5745 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5749 /* toggle speaker-output according to the hp-jack state */
5750 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5752 unsigned int present;
5754 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5755 present = snd_hda_codec_read(codec, 0x0f, 0,
5756 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5758 snd_hda_codec_write_cache(codec, 0x01, 0,
5759 AC_VERB_SET_GPIO_DATA, 1);
5760 snd_hda_codec_write_cache(codec, 0x0f, 0,
5761 AC_VERB_SET_PIN_WIDGET_CONTROL,
5764 snd_hda_codec_write_cache(codec, 0x01, 0,
5765 AC_VERB_SET_GPIO_DATA, 0);
5766 snd_hda_codec_write_cache(codec, 0x0f, 0,
5767 AC_VERB_SET_PIN_WIDGET_CONTROL,
5772 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5775 if ((res >> 26) == ALC880_HP_EVENT)
5776 alc260_replacer_672v_automute(codec);
5779 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5780 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5781 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5782 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5783 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5784 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5787 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5788 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5789 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5793 /* Test configuration for debugging, modelled after the ALC880 test
5796 #ifdef CONFIG_SND_DEBUG
5797 static hda_nid_t alc260_test_dac_nids[1] = {
5800 static hda_nid_t alc260_test_adc_nids[2] = {
5803 /* For testing the ALC260, each input MUX needs its own definition since
5804 * the signal assignments are different. This assumes that the first ADC
5807 static struct hda_input_mux alc260_test_capture_sources[2] = {
5811 { "MIC1 pin", 0x0 },
5812 { "MIC2 pin", 0x1 },
5813 { "LINE1 pin", 0x2 },
5814 { "LINE2 pin", 0x3 },
5816 { "LINE-OUT pin", 0x5 },
5817 { "HP-OUT pin", 0x6 },
5823 { "MIC1 pin", 0x0 },
5824 { "MIC2 pin", 0x1 },
5825 { "LINE1 pin", 0x2 },
5826 { "LINE2 pin", 0x3 },
5829 { "LINE-OUT pin", 0x6 },
5830 { "HP-OUT pin", 0x7 },
5834 static struct snd_kcontrol_new alc260_test_mixer[] = {
5835 /* Output driver widgets */
5836 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5837 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5838 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5839 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5840 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5843 /* Modes for retasking pin widgets
5844 * Note: the ALC260 doesn't seem to act on requests to enable mic
5845 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5846 * mention this restriction. At this stage it's not clear whether
5847 * this behaviour is intentional or is a hardware bug in chip
5848 * revisions available at least up until early 2006. Therefore for
5849 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5850 * choices, but if it turns out that the lack of mic bias for these
5851 * NIDs is intentional we could change their modes from
5852 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5854 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5855 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5856 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5857 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5859 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5861 /* Loopback mixer controls */
5862 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5863 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5864 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5865 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5866 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5867 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5868 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5869 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5870 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5871 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5872 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5873 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5874 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5875 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5877 /* Controls for GPIO pins, assuming they are configured as outputs */
5878 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5879 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5880 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5881 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5883 /* Switches to allow the digital IO pins to be enabled. The datasheet
5884 * is ambigious as to which NID is which; testing on laptops which
5885 * make this output available should provide clarification.
5887 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5888 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5890 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5891 * this output to turn on an external amplifier.
5893 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5894 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5898 static struct hda_verb alc260_test_init_verbs[] = {
5899 /* Enable all GPIOs as outputs with an initial value of 0 */
5900 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5901 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5902 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5904 /* Enable retasking pins as output, initially without power amp */
5905 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5906 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5912 /* Disable digital (SPDIF) pins initially, but users can enable
5913 * them via a mixer switch. In the case of SPDIF-out, this initverb
5914 * payload also sets the generation to 0, output to be in "consumer"
5915 * PCM format, copyright asserted, no pre-emphasis and no validity
5918 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5919 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5921 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5922 * OUT1 sum bus when acting as an output.
5924 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5925 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5926 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5927 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5929 /* Start with output sum widgets muted and their output gains at min */
5930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5933 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5936 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5938 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5940 /* Unmute retasking pin widget output buffers since the default
5941 * state appears to be output. As the pin mode is changed by the
5942 * user the pin mode control will take care of enabling the pin's
5943 * input/output buffers as needed.
5945 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5946 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 /* Also unmute the mono-out pin widget */
5952 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5954 /* Mute capture amp left and right */
5955 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5956 /* Set ADC connection select to match default mixer setting (mic1
5959 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5961 /* Do the same for the second ADC: mute capture input amp and
5962 * set ADC connection to mic1 pin
5964 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5965 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5967 /* Mute all inputs to mixer widget (even unconnected ones) */
5968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5981 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5982 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5984 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5985 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5988 * for BIOS auto-configuration
5991 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5992 const char *pfx, int *vol_bits)
5995 unsigned long vol_val, sw_val;
5998 if (nid >= 0x0f && nid < 0x11) {
5999 nid_vol = nid - 0x7;
6000 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6001 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6002 } else if (nid == 0x11) {
6003 nid_vol = nid - 0x7;
6004 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6005 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6006 } else if (nid >= 0x12 && nid <= 0x15) {
6008 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6009 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6013 if (!(*vol_bits & (1 << nid_vol))) {
6014 /* first control for the volume widget */
6015 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6018 *vol_bits |= (1 << nid_vol);
6020 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6026 /* add playback controls from the parsed DAC table */
6027 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6028 const struct auto_pin_cfg *cfg)
6034 spec->multiout.num_dacs = 1;
6035 spec->multiout.dac_nids = spec->private_dac_nids;
6036 spec->multiout.dac_nids[0] = 0x02;
6038 nid = cfg->line_out_pins[0];
6041 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6043 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6047 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6052 nid = cfg->speaker_pins[0];
6054 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6059 nid = cfg->hp_pins[0];
6061 err = alc260_add_playback_controls(spec, nid, "Headphone",
6069 /* create playback/capture controls for input pins */
6070 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6071 const struct auto_pin_cfg *cfg)
6073 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6076 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6077 hda_nid_t nid, int pin_type,
6080 alc_set_pin_output(codec, nid, pin_type);
6081 /* need the manual connection? */
6083 int idx = nid - 0x12;
6084 snd_hda_codec_write(codec, idx + 0x0b, 0,
6085 AC_VERB_SET_CONNECT_SEL, sel_idx);
6089 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6091 struct alc_spec *spec = codec->spec;
6094 nid = spec->autocfg.line_out_pins[0];
6096 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6097 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6100 nid = spec->autocfg.speaker_pins[0];
6102 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6104 nid = spec->autocfg.hp_pins[0];
6106 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6109 #define ALC260_PIN_CD_NID 0x16
6110 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6112 struct alc_spec *spec = codec->spec;
6115 for (i = 0; i < AUTO_PIN_LAST; i++) {
6116 hda_nid_t nid = spec->autocfg.input_pins[i];
6118 alc_set_input_pin(codec, nid, i);
6119 if (nid != ALC260_PIN_CD_NID &&
6120 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6121 snd_hda_codec_write(codec, nid, 0,
6122 AC_VERB_SET_AMP_GAIN_MUTE,
6129 * generic initialization of ADC, input mixers and output mixers
6131 static struct hda_verb alc260_volume_init_verbs[] = {
6133 * Unmute ADC0-1 and set the default input to mic-in
6135 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6136 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6137 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6138 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6140 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6142 * Note: PASD motherboards uses the Line In 2 as the input for
6143 * front panel mic (mic 2)
6145 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6146 /* mute analog inputs */
6147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6151 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6154 * Set up output mixers (0x08 - 0x0a)
6156 /* set vol=0 to output mixers */
6157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6159 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6160 /* set up input amps for analog loopback */
6161 /* Amp Indices: DAC = 0, mixer = 1 */
6162 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6165 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6166 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6167 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6172 static int alc260_parse_auto_config(struct hda_codec *codec)
6174 struct alc_spec *spec = codec->spec;
6176 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6178 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6182 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6185 if (!spec->kctls.list)
6186 return 0; /* can't find valid BIOS pin config */
6187 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6191 spec->multiout.max_channels = 2;
6193 if (spec->autocfg.dig_outs)
6194 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6195 if (spec->kctls.list)
6196 add_mixer(spec, spec->kctls.list);
6198 add_verb(spec, alc260_volume_init_verbs);
6200 spec->num_mux_defs = 1;
6201 spec->input_mux = &spec->private_imux[0];
6203 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6208 /* additional initialization for auto-configuration model */
6209 static void alc260_auto_init(struct hda_codec *codec)
6211 struct alc_spec *spec = codec->spec;
6212 alc260_auto_init_multi_out(codec);
6213 alc260_auto_init_analog_input(codec);
6214 if (spec->unsol_event)
6215 alc_inithook(codec);
6218 #ifdef CONFIG_SND_HDA_POWER_SAVE
6219 static struct hda_amp_list alc260_loopbacks[] = {
6220 { 0x07, HDA_INPUT, 0 },
6221 { 0x07, HDA_INPUT, 1 },
6222 { 0x07, HDA_INPUT, 2 },
6223 { 0x07, HDA_INPUT, 3 },
6224 { 0x07, HDA_INPUT, 4 },
6230 * ALC260 configurations
6232 static const char *alc260_models[ALC260_MODEL_LAST] = {
6233 [ALC260_BASIC] = "basic",
6235 [ALC260_HP_3013] = "hp-3013",
6236 [ALC260_HP_DC7600] = "hp-dc7600",
6237 [ALC260_FUJITSU_S702X] = "fujitsu",
6238 [ALC260_ACER] = "acer",
6239 [ALC260_WILL] = "will",
6240 [ALC260_REPLACER_672V] = "replacer",
6241 [ALC260_FAVORIT100] = "favorit100",
6242 #ifdef CONFIG_SND_DEBUG
6243 [ALC260_TEST] = "test",
6245 [ALC260_AUTO] = "auto",
6248 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6249 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6250 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6251 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6252 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6253 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6254 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6255 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6256 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6257 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6258 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6259 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6260 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6261 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6262 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6263 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6264 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6265 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6266 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6267 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6271 static struct alc_config_preset alc260_presets[] = {
6273 .mixers = { alc260_base_output_mixer,
6274 alc260_input_mixer },
6275 .init_verbs = { alc260_init_verbs },
6276 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6277 .dac_nids = alc260_dac_nids,
6278 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6279 .adc_nids = alc260_adc_nids,
6280 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6281 .channel_mode = alc260_modes,
6282 .input_mux = &alc260_capture_source,
6285 .mixers = { alc260_hp_output_mixer,
6286 alc260_input_mixer },
6287 .init_verbs = { alc260_init_verbs,
6288 alc260_hp_unsol_verbs },
6289 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6290 .dac_nids = alc260_dac_nids,
6291 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6292 .adc_nids = alc260_adc_nids_alt,
6293 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6294 .channel_mode = alc260_modes,
6295 .input_mux = &alc260_capture_source,
6296 .unsol_event = alc260_hp_unsol_event,
6297 .init_hook = alc260_hp_automute,
6299 [ALC260_HP_DC7600] = {
6300 .mixers = { alc260_hp_dc7600_mixer,
6301 alc260_input_mixer },
6302 .init_verbs = { alc260_init_verbs,
6303 alc260_hp_dc7600_verbs },
6304 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6305 .dac_nids = alc260_dac_nids,
6306 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6307 .adc_nids = alc260_adc_nids_alt,
6308 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6309 .channel_mode = alc260_modes,
6310 .input_mux = &alc260_capture_source,
6311 .unsol_event = alc260_hp_3012_unsol_event,
6312 .init_hook = alc260_hp_3012_automute,
6314 [ALC260_HP_3013] = {
6315 .mixers = { alc260_hp_3013_mixer,
6316 alc260_input_mixer },
6317 .init_verbs = { alc260_hp_3013_init_verbs,
6318 alc260_hp_3013_unsol_verbs },
6319 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6320 .dac_nids = alc260_dac_nids,
6321 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6322 .adc_nids = alc260_adc_nids_alt,
6323 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6324 .channel_mode = alc260_modes,
6325 .input_mux = &alc260_capture_source,
6326 .unsol_event = alc260_hp_3013_unsol_event,
6327 .init_hook = alc260_hp_3013_automute,
6329 [ALC260_FUJITSU_S702X] = {
6330 .mixers = { alc260_fujitsu_mixer },
6331 .init_verbs = { alc260_fujitsu_init_verbs },
6332 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6333 .dac_nids = alc260_dac_nids,
6334 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6335 .adc_nids = alc260_dual_adc_nids,
6336 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6337 .channel_mode = alc260_modes,
6338 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6339 .input_mux = alc260_fujitsu_capture_sources,
6342 .mixers = { alc260_acer_mixer },
6343 .init_verbs = { alc260_acer_init_verbs },
6344 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6345 .dac_nids = alc260_dac_nids,
6346 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6347 .adc_nids = alc260_dual_adc_nids,
6348 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6349 .channel_mode = alc260_modes,
6350 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6351 .input_mux = alc260_acer_capture_sources,
6353 [ALC260_FAVORIT100] = {
6354 .mixers = { alc260_favorit100_mixer },
6355 .init_verbs = { alc260_favorit100_init_verbs },
6356 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6357 .dac_nids = alc260_dac_nids,
6358 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6359 .adc_nids = alc260_dual_adc_nids,
6360 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6361 .channel_mode = alc260_modes,
6362 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6363 .input_mux = alc260_favorit100_capture_sources,
6366 .mixers = { alc260_will_mixer },
6367 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6368 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6369 .dac_nids = alc260_dac_nids,
6370 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6371 .adc_nids = alc260_adc_nids,
6372 .dig_out_nid = ALC260_DIGOUT_NID,
6373 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6374 .channel_mode = alc260_modes,
6375 .input_mux = &alc260_capture_source,
6377 [ALC260_REPLACER_672V] = {
6378 .mixers = { alc260_replacer_672v_mixer },
6379 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6380 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6381 .dac_nids = alc260_dac_nids,
6382 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6383 .adc_nids = alc260_adc_nids,
6384 .dig_out_nid = ALC260_DIGOUT_NID,
6385 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6386 .channel_mode = alc260_modes,
6387 .input_mux = &alc260_capture_source,
6388 .unsol_event = alc260_replacer_672v_unsol_event,
6389 .init_hook = alc260_replacer_672v_automute,
6391 #ifdef CONFIG_SND_DEBUG
6393 .mixers = { alc260_test_mixer },
6394 .init_verbs = { alc260_test_init_verbs },
6395 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6396 .dac_nids = alc260_test_dac_nids,
6397 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6398 .adc_nids = alc260_test_adc_nids,
6399 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6400 .channel_mode = alc260_modes,
6401 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6402 .input_mux = alc260_test_capture_sources,
6407 static int patch_alc260(struct hda_codec *codec)
6409 struct alc_spec *spec;
6410 int err, board_config;
6412 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6418 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6421 if (board_config < 0) {
6422 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6424 board_config = ALC260_AUTO;
6427 if (board_config == ALC260_AUTO) {
6428 /* automatic parse from the BIOS config */
6429 err = alc260_parse_auto_config(codec);
6435 "hda_codec: Cannot set up configuration "
6436 "from BIOS. Using base mode...\n");
6437 board_config = ALC260_BASIC;
6441 err = snd_hda_attach_beep_device(codec, 0x1);
6447 if (board_config != ALC260_AUTO)
6448 setup_preset(codec, &alc260_presets[board_config]);
6450 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6451 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6453 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6454 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6456 if (!spec->adc_nids && spec->input_mux) {
6457 /* check whether NID 0x04 is valid */
6458 unsigned int wcap = get_wcaps(codec, 0x04);
6459 wcap = get_wcaps_type(wcap);
6461 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6462 spec->adc_nids = alc260_adc_nids_alt;
6463 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6465 spec->adc_nids = alc260_adc_nids;
6466 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6469 set_capture_mixer(codec);
6470 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6472 spec->vmaster_nid = 0x08;
6474 codec->patch_ops = alc_patch_ops;
6475 if (board_config == ALC260_AUTO)
6476 spec->init_hook = alc260_auto_init;
6477 #ifdef CONFIG_SND_HDA_POWER_SAVE
6478 if (!spec->loopback.amplist)
6479 spec->loopback.amplist = alc260_loopbacks;
6481 codec->proc_widget_hook = print_realtek_coef;
6488 * ALC882/883/885/888/889 support
6490 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6491 * configuration. Each pin widget can choose any input DACs and a mixer.
6492 * Each ADC is connected from a mixer of all inputs. This makes possible
6493 * 6-channel independent captures.
6495 * In addition, an independent DAC for the multi-playback (not used in this
6498 #define ALC882_DIGOUT_NID 0x06
6499 #define ALC882_DIGIN_NID 0x0a
6500 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6501 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6502 #define ALC1200_DIGOUT_NID 0x10
6505 static struct hda_channel_mode alc882_ch_modes[1] = {
6510 static hda_nid_t alc882_dac_nids[4] = {
6511 /* front, rear, clfe, rear_surr */
6512 0x02, 0x03, 0x04, 0x05
6514 #define alc883_dac_nids alc882_dac_nids
6517 #define alc882_adc_nids alc880_adc_nids
6518 #define alc882_adc_nids_alt alc880_adc_nids_alt
6519 #define alc883_adc_nids alc882_adc_nids_alt
6520 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6521 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6522 #define alc889_adc_nids alc880_adc_nids
6524 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6525 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6526 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6527 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6528 #define alc889_capsrc_nids alc882_capsrc_nids
6531 /* FIXME: should be a matrix-type input source selection */
6533 static struct hda_input_mux alc882_capture_source = {
6537 { "Front Mic", 0x1 },
6543 #define alc883_capture_source alc882_capture_source
6545 static struct hda_input_mux alc889_capture_source = {
6548 { "Front Mic", 0x0 },
6554 static struct hda_input_mux mb5_capture_source = {
6563 static struct hda_input_mux alc883_3stack_6ch_intel = {
6567 { "Front Mic", 0x0 },
6573 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6581 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6591 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6599 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6603 { "Front Mic", 0x1 },
6608 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6616 static struct hda_input_mux alc889A_mb31_capture_source = {
6620 /* Front Mic (0x01) unused */
6622 /* Line 2 (0x03) unused */
6623 /* CD (0x04) unsused? */
6630 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6637 static struct hda_verb alc882_3ST_ch2_init[] = {
6638 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6639 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6640 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6641 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6648 static struct hda_verb alc882_3ST_ch4_init[] = {
6649 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6650 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6651 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6652 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6653 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6660 static struct hda_verb alc882_3ST_ch6_init[] = {
6661 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6662 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6663 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6664 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6666 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6670 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6671 { 2, alc882_3ST_ch2_init },
6672 { 4, alc882_3ST_ch4_init },
6673 { 6, alc882_3ST_ch6_init },
6676 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6681 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6682 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6683 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6684 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6685 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6686 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6693 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6694 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6695 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6696 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6697 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6698 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6699 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6706 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6707 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6708 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6709 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6710 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6711 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6712 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6713 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6717 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6718 { 2, alc883_3ST_ch2_clevo_init },
6719 { 4, alc883_3ST_ch4_clevo_init },
6720 { 6, alc883_3ST_ch6_clevo_init },
6727 static struct hda_verb alc882_sixstack_ch6_init[] = {
6728 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6729 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6730 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6731 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 static struct hda_verb alc882_sixstack_ch8_init[] = {
6739 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6746 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6747 { 6, alc882_sixstack_ch6_init },
6748 { 8, alc882_sixstack_ch8_init },
6752 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6758 static struct hda_verb alc885_mbp_ch2_init[] = {
6759 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6760 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6761 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6768 static struct hda_verb alc885_mbp_ch4_init[] = {
6769 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6770 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6771 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6772 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6773 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6777 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6778 { 2, alc885_mbp_ch2_init },
6779 { 4, alc885_mbp_ch4_init },
6784 * Speakers/Woofer/HP = Front
6787 static struct hda_verb alc885_mb5_ch2_init[] = {
6788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6795 * Speakers/HP = Front
6799 static struct hda_verb alc885_mb5_ch6_init[] = {
6800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6806 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6807 { 2, alc885_mb5_ch2_init },
6808 { 6, alc885_mb5_ch6_init },
6815 static struct hda_verb alc883_4ST_ch2_init[] = {
6816 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6817 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6818 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6819 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6820 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6821 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6828 static struct hda_verb alc883_4ST_ch4_init[] = {
6829 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6830 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6831 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6832 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6833 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6835 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6842 static struct hda_verb alc883_4ST_ch6_init[] = {
6843 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6844 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6845 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6846 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6847 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6848 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6849 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6850 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6857 static struct hda_verb alc883_4ST_ch8_init[] = {
6858 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6859 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6860 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6861 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6862 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6863 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6864 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6865 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6866 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6870 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6871 { 2, alc883_4ST_ch2_init },
6872 { 4, alc883_4ST_ch4_init },
6873 { 6, alc883_4ST_ch6_init },
6874 { 8, alc883_4ST_ch8_init },
6881 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6882 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6883 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6884 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6885 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6892 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6893 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6894 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6895 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6896 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6897 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6904 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6905 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6906 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6907 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6908 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6909 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6910 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6914 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6915 { 2, alc883_3ST_ch2_intel_init },
6916 { 4, alc883_3ST_ch4_intel_init },
6917 { 6, alc883_3ST_ch6_intel_init },
6923 static struct hda_verb alc889_ch2_intel_init[] = {
6924 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6925 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6926 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6927 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6928 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6929 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6936 static struct hda_verb alc889_ch6_intel_init[] = {
6937 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6938 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6939 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6940 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6941 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6942 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6949 static struct hda_verb alc889_ch8_intel_init[] = {
6950 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6951 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6952 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6953 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6954 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6955 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6960 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6961 { 2, alc889_ch2_intel_init },
6962 { 6, alc889_ch6_intel_init },
6963 { 8, alc889_ch8_intel_init },
6969 static struct hda_verb alc883_sixstack_ch6_init[] = {
6970 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6971 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6972 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6973 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6980 static struct hda_verb alc883_sixstack_ch8_init[] = {
6981 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6982 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6989 { 6, alc883_sixstack_ch6_init },
6990 { 8, alc883_sixstack_ch8_init },
6994 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6995 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6997 static struct snd_kcontrol_new alc882_base_mixer[] = {
6998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6999 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7001 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7002 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7003 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7004 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7005 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7006 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7007 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7009 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7010 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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, 0x0, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7022 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7023 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7024 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7026 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7029 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7031 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7032 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7037 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7039 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7040 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7041 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7042 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7043 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7044 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7045 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7047 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7049 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7051 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7055 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7056 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7057 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7068 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7072 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7073 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7079 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7080 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7081 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7085 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7086 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7088 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7092 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7098 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7105 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7106 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7107 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7119 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7122 .name = "Channel Mode",
7123 .info = alc_ch_mode_info,
7124 .get = alc_ch_mode_get,
7125 .put = alc_ch_mode_put,
7130 static struct hda_verb alc882_base_init_verbs[] = {
7131 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7132 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7137 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7141 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7142 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7148 /* mute analog input loopbacks */
7149 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7155 /* Front Pin: output 0 (0x0c) */
7156 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7158 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7159 /* Rear Pin: output 1 (0x0d) */
7160 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7163 /* CLFE Pin: output 2 (0x0e) */
7164 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7165 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7166 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7167 /* Side Pin: output 3 (0x0f) */
7168 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7169 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7170 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7171 /* Mic (rear) pin: input vref at 80% */
7172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7174 /* Front Mic pin: input vref at 80% */
7175 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7176 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7177 /* Line In pin: input */
7178 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7179 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7180 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7182 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7183 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7184 /* CD pin widget for input */
7185 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7187 /* FIXME: use matrix-type input source selection */
7188 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7199 /* ADC2: mute amp left and right */
7200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7202 /* ADC3: mute amp left and right */
7203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7204 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7209 static struct hda_verb alc882_adc1_init_verbs[] = {
7210 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7211 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7215 /* ADC1: mute amp left and right */
7216 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7217 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7221 static struct hda_verb alc882_eapd_verbs[] = {
7222 /* change to EAPD mode */
7223 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7224 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7228 static struct hda_verb alc889_eapd_verbs[] = {
7229 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7230 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7234 static struct hda_verb alc_hp15_unsol_verbs[] = {
7235 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7236 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7240 static struct hda_verb alc885_init_verbs[] = {
7241 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7248 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7250 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7251 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7256 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7258 /* mute analog input loopbacks */
7259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7263 /* Front HP Pin: output 0 (0x0c) */
7264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7267 /* Front Pin: output 0 (0x0c) */
7268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7270 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7271 /* Rear Pin: output 1 (0x0d) */
7272 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7273 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7274 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7275 /* CLFE Pin: output 2 (0x0e) */
7276 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7277 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7278 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7279 /* Side Pin: output 3 (0x0f) */
7280 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7281 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7282 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7283 /* Mic (rear) pin: input vref at 80% */
7284 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7285 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7286 /* Front Mic pin: input vref at 80% */
7287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7288 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7289 /* Line In pin: input */
7290 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7291 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7293 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7295 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7296 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7306 /* ADC2: mute amp left and right */
7307 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7308 /* ADC3: mute amp left and right */
7309 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7314 static struct hda_verb alc885_init_input_verbs[] = {
7315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7322 /* Unmute Selector 24h and set the default input to front mic */
7323 static struct hda_verb alc889_init_input_verbs[] = {
7324 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7330 #define alc883_init_verbs alc882_base_init_verbs
7333 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7334 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7335 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7339 /* FIXME: this looks suspicious...
7340 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7341 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7346 static struct hda_verb alc882_macpro_init_verbs[] = {
7347 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7351 /* Front Pin: output 0 (0x0c) */
7352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7355 /* Front Mic pin: input vref at 80% */
7356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7358 /* Speaker: output */
7359 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7361 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7362 /* Headphone output (output 0 - 0x0c) */
7363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7365 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7367 /* FIXME: use matrix-type input source selection */
7368 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7369 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7384 /* ADC1: mute amp left and right */
7385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7386 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7387 /* ADC2: mute amp left and right */
7388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7389 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7390 /* ADC3: mute amp left and right */
7391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7392 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7398 static struct hda_verb alc885_mb5_init_verbs[] = {
7400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7401 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7405 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7408 /* Surround mixer */
7409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7419 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7420 /* Front Pin (0x0c) */
7421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7423 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7424 /* LFE Pin (0x0e) */
7425 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7426 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7427 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7429 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7430 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7431 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7432 /* Front Mic pin: input vref at 80% */
7433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7441 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7446 /* Macbook Pro rev3 */
7447 static struct hda_verb alc885_mbp3_init_verbs[] = {
7448 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7453 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7454 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7460 /* Front Pin: output 0 (0x0c) */
7461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7462 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7463 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7464 /* HP Pin: output 0 (0x0e) */
7465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7468 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7469 /* Mic (rear) pin: input vref at 80% */
7470 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7472 /* Front Mic pin: input vref at 80% */
7473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7474 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7475 /* Line In pin: use output 1 when in LineOut mode */
7476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7478 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7480 /* FIXME: use matrix-type input source selection */
7481 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7482 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7497 /* ADC1: mute amp left and right */
7498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7499 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7500 /* ADC2: mute amp left and right */
7501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7502 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7503 /* ADC3: mute amp left and right */
7504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7505 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7510 /* iMac 24 mixer. */
7511 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7512 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7513 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7517 /* iMac 24 init verbs. */
7518 static struct hda_verb alc885_imac24_init_verbs[] = {
7519 /* Internal speakers: output 0 (0x0c) */
7520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7522 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7523 /* Internal speakers: output 0 (0x0c) */
7524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7526 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7527 /* Headphone: output 0 (0x0c) */
7528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7529 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7530 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7531 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7532 /* Front Mic: input vref at 80% */
7533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7534 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7538 /* Toggle speaker-output according to the hp-jack state */
7539 static void alc885_imac24_setup(struct hda_codec *codec)
7541 struct alc_spec *spec = codec->spec;
7543 spec->autocfg.hp_pins[0] = 0x14;
7544 spec->autocfg.speaker_pins[0] = 0x18;
7545 spec->autocfg.speaker_pins[1] = 0x1a;
7548 static void alc885_mbp3_setup(struct hda_codec *codec)
7550 struct alc_spec *spec = codec->spec;
7552 spec->autocfg.hp_pins[0] = 0x15;
7553 spec->autocfg.speaker_pins[0] = 0x14;
7557 static struct hda_verb alc882_targa_verbs[] = {
7558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7564 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7565 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7566 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7568 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7572 /* toggle speaker-output according to the hp-jack state */
7573 static void alc882_targa_automute(struct hda_codec *codec)
7575 struct alc_spec *spec = codec->spec;
7576 alc_automute_amp(codec);
7577 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7578 spec->jack_present ? 1 : 3);
7581 static void alc882_targa_setup(struct hda_codec *codec)
7583 struct alc_spec *spec = codec->spec;
7585 spec->autocfg.hp_pins[0] = 0x14;
7586 spec->autocfg.speaker_pins[0] = 0x1b;
7589 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7591 if ((res >> 26) == ALC880_HP_EVENT)
7592 alc882_targa_automute(codec);
7595 static struct hda_verb alc882_asus_a7j_verbs[] = {
7596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7601 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7605 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7607 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7608 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7609 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7613 static struct hda_verb alc882_asus_a7m_verbs[] = {
7614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7617 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7619 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7621 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7622 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7623 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7625 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7626 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7627 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7631 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7633 unsigned int gpiostate, gpiomask, gpiodir;
7635 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7636 AC_VERB_GET_GPIO_DATA, 0);
7639 gpiostate |= (1 << pin);
7641 gpiostate &= ~(1 << pin);
7643 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7644 AC_VERB_GET_GPIO_MASK, 0);
7645 gpiomask |= (1 << pin);
7647 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7648 AC_VERB_GET_GPIO_DIRECTION, 0);
7649 gpiodir |= (1 << pin);
7652 snd_hda_codec_write(codec, codec->afg, 0,
7653 AC_VERB_SET_GPIO_MASK, gpiomask);
7654 snd_hda_codec_write(codec, codec->afg, 0,
7655 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7659 snd_hda_codec_write(codec, codec->afg, 0,
7660 AC_VERB_SET_GPIO_DATA, gpiostate);
7663 /* set up GPIO at initialization */
7664 static void alc885_macpro_init_hook(struct hda_codec *codec)
7666 alc882_gpio_mute(codec, 0, 0);
7667 alc882_gpio_mute(codec, 1, 0);
7670 /* set up GPIO and update auto-muting at initialization */
7671 static void alc885_imac24_init_hook(struct hda_codec *codec)
7673 alc885_macpro_init_hook(codec);
7674 alc_automute_amp(codec);
7678 * generic initialization of ADC, input mixers and output mixers
7680 static struct hda_verb alc883_auto_init_verbs[] = {
7682 * Unmute ADC0-2 and set the default input to mic-in
7684 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7686 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7687 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7689 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7691 * Note: PASD motherboards uses the Line In 2 as the input for
7692 * front panel mic (mic 2)
7694 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7702 * Set up output mixers (0x0c - 0x0f)
7704 /* set vol=0 to output mixers */
7705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7706 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7708 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7709 /* set up input amps for analog loopback */
7710 /* Amp Indices: DAC = 0, mixer = 1 */
7711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7719 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7720 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7722 /* FIXME: use matrix-type input source selection */
7723 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7726 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7727 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7728 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7738 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7739 static struct hda_verb alc889A_mb31_ch2_init[] = {
7740 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7741 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7743 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7747 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7748 static struct hda_verb alc889A_mb31_ch4_init[] = {
7749 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7750 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7756 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7757 static struct hda_verb alc889A_mb31_ch5_init[] = {
7758 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7760 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7765 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7766 static struct hda_verb alc889A_mb31_ch6_init[] = {
7767 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7769 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7770 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7774 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7775 { 2, alc889A_mb31_ch2_init },
7776 { 4, alc889A_mb31_ch4_init },
7777 { 5, alc889A_mb31_ch5_init },
7778 { 6, alc889A_mb31_ch6_init },
7781 static struct hda_verb alc883_medion_eapd_verbs[] = {
7782 /* eanable EAPD on medion laptop */
7783 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7784 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7788 #define alc883_base_mixer alc882_base_mixer
7790 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7791 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7792 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7793 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7794 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7795 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7796 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7798 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7802 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7803 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7807 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7808 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7809 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7811 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7817 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7821 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7822 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7823 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7824 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7825 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, 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("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7831 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7835 static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7839 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7840 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7841 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7842 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7848 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7852 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7854 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7857 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7858 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7859 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7860 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7865 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7871 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7875 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7877 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7878 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7879 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7880 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7887 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7888 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7889 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7893 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7899 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7903 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7906 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7908 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7909 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7910 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7911 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7912 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7913 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7919 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7923 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7924 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7925 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7926 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7927 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7928 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7929 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7930 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7931 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7942 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7946 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7947 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7948 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7950 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7951 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7953 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7954 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7955 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7956 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7960 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7967 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7968 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7969 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7975 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7977 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7979 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7983 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
7984 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7985 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7988 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7992 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7996 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8004 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8006 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8012 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8013 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8017 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8020 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8026 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8030 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8031 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8032 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8034 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8035 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8038 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8042 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8045 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8049 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8050 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8057 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8058 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8059 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8061 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8062 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8063 0x0d, 1, 0x0, HDA_OUTPUT),
8064 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8066 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8068 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8072 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8075 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8078 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8082 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8085 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8087 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8088 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8090 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8091 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8093 /* Output switches */
8094 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8095 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8096 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8104 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8108 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8118 static struct hda_bind_ctls alc883_bind_cap_vol = {
8119 .ops = &snd_hda_bind_vol,
8121 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8122 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8127 static struct hda_bind_ctls alc883_bind_cap_switch = {
8128 .ops = &snd_hda_bind_sw,
8130 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8131 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8136 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8148 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8149 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8150 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8153 /* .name = "Capture Source", */
8154 .name = "Input Source",
8156 .info = alc_mux_enum_info,
8157 .get = alc_mux_enum_get,
8158 .put = alc_mux_enum_put,
8163 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8166 .name = "Channel Mode",
8167 .info = alc_ch_mode_info,
8168 .get = alc_ch_mode_get,
8169 .put = alc_ch_mode_put,
8174 /* toggle speaker-output according to the hp-jack state */
8175 static void alc883_mitac_setup(struct hda_codec *codec)
8177 struct alc_spec *spec = codec->spec;
8179 spec->autocfg.hp_pins[0] = 0x15;
8180 spec->autocfg.speaker_pins[0] = 0x14;
8181 spec->autocfg.speaker_pins[1] = 0x17;
8184 /* auto-toggle front mic */
8186 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8188 unsigned int present;
8191 present = snd_hda_codec_read(codec, 0x18, 0,
8192 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8193 bits = present ? HDA_AMP_MUTE : 0;
8194 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8198 static struct hda_verb alc883_mitac_verbs[] = {
8200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8203 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8204 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8206 /* enable unsolicited event */
8207 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8208 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8213 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8218 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8220 /* enable unsolicited event */
8222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8223 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8229 static struct hda_verb alc883_clevo_m720_verbs[] = {
8231 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8234 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8237 /* enable unsolicited event */
8238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8239 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8244 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8246 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8249 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8252 /* enable unsolicited event */
8253 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8258 static struct hda_verb alc883_targa_verbs[] = {
8259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8265 /* Connect Line-Out side jack (SPDIF) to Side */
8266 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8267 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8268 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8269 /* Connect Mic jack to CLFE */
8270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8272 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8273 /* Connect Line-in jack to Surround */
8274 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8275 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8276 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8277 /* Connect HP out jack to Front */
8278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8280 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8282 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8287 static struct hda_verb alc883_lenovo_101e_verbs[] = {
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_lenovo_nb0763_verbs[] = {
8295 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8297 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8302 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8305 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8306 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8307 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8311 static struct hda_verb alc883_haier_w66_verbs[] = {
8312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8315 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8317 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8319 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8320 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8324 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8330 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8331 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8332 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8336 static struct hda_verb alc888_6st_dell_verbs[] = {
8337 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8341 static struct hda_verb alc883_vaiott_verbs[] = {
8343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8346 /* enable unsolicited event */
8347 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8352 static void alc888_3st_hp_setup(struct hda_codec *codec)
8354 struct alc_spec *spec = codec->spec;
8356 spec->autocfg.hp_pins[0] = 0x1b;
8357 spec->autocfg.speaker_pins[0] = 0x14;
8358 spec->autocfg.speaker_pins[1] = 0x16;
8359 spec->autocfg.speaker_pins[2] = 0x18;
8362 static struct hda_verb alc888_3st_hp_verbs[] = {
8363 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8364 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8365 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8366 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8373 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8374 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8375 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8376 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8377 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8384 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8385 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8386 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8387 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8388 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8389 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8396 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8397 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8398 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8399 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8400 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8401 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8402 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8406 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8407 { 2, alc888_3st_hp_2ch_init },
8408 { 4, alc888_3st_hp_4ch_init },
8409 { 6, alc888_3st_hp_6ch_init },
8412 /* toggle front-jack and RCA according to the hp-jack state */
8413 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8415 unsigned int present;
8417 present = snd_hda_codec_read(codec, 0x1b, 0,
8418 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8419 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8420 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8421 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8422 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8425 /* toggle RCA according to the front-jack state */
8426 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8428 unsigned int present;
8430 present = snd_hda_codec_read(codec, 0x14, 0,
8431 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8432 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8433 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8436 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8439 if ((res >> 26) == ALC880_HP_EVENT)
8440 alc888_lenovo_ms7195_front_automute(codec);
8441 if ((res >> 26) == ALC880_FRONT_EVENT)
8442 alc888_lenovo_ms7195_rca_automute(codec);
8445 static struct hda_verb alc883_medion_md2_verbs[] = {
8446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8451 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8455 /* toggle speaker-output according to the hp-jack state */
8456 static void alc883_medion_md2_setup(struct hda_codec *codec)
8458 struct alc_spec *spec = codec->spec;
8460 spec->autocfg.hp_pins[0] = 0x14;
8461 spec->autocfg.speaker_pins[0] = 0x15;
8464 /* toggle speaker-output according to the hp-jack state */
8465 #define alc883_targa_init_hook alc882_targa_init_hook
8466 #define alc883_targa_unsol_event alc882_targa_unsol_event
8468 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8470 unsigned int present;
8472 present = snd_hda_codec_read(codec, 0x18, 0,
8473 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8474 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8475 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8478 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8480 struct alc_spec *spec = codec->spec;
8482 spec->autocfg.hp_pins[0] = 0x15;
8483 spec->autocfg.speaker_pins[0] = 0x14;
8486 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8488 alc_automute_amp(codec);
8489 alc883_clevo_m720_mic_automute(codec);
8492 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8495 switch (res >> 26) {
8496 case ALC880_MIC_EVENT:
8497 alc883_clevo_m720_mic_automute(codec);
8500 alc_automute_amp_unsol_event(codec, res);
8505 /* toggle speaker-output according to the hp-jack state */
8506 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8508 struct alc_spec *spec = codec->spec;
8510 spec->autocfg.hp_pins[0] = 0x14;
8511 spec->autocfg.speaker_pins[0] = 0x15;
8514 static void alc883_haier_w66_setup(struct hda_codec *codec)
8516 struct alc_spec *spec = codec->spec;
8518 spec->autocfg.hp_pins[0] = 0x1b;
8519 spec->autocfg.speaker_pins[0] = 0x14;
8522 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8524 unsigned int present;
8527 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8528 & AC_PINSENSE_PRESENCE;
8529 bits = present ? HDA_AMP_MUTE : 0;
8530 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8531 HDA_AMP_MUTE, bits);
8534 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8536 unsigned int present;
8539 present = snd_hda_codec_read(codec, 0x1b, 0,
8540 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8541 bits = present ? HDA_AMP_MUTE : 0;
8542 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8543 HDA_AMP_MUTE, bits);
8544 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8545 HDA_AMP_MUTE, bits);
8548 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8551 if ((res >> 26) == ALC880_HP_EVENT)
8552 alc883_lenovo_101e_all_automute(codec);
8553 if ((res >> 26) == ALC880_FRONT_EVENT)
8554 alc883_lenovo_101e_ispeaker_automute(codec);
8557 /* toggle speaker-output according to the hp-jack state */
8558 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8560 struct alc_spec *spec = codec->spec;
8562 spec->autocfg.hp_pins[0] = 0x14;
8563 spec->autocfg.speaker_pins[0] = 0x15;
8564 spec->autocfg.speaker_pins[1] = 0x16;
8567 static struct hda_verb alc883_acer_eapd_verbs[] = {
8568 /* HP Pin: output 0 (0x0c) */
8569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8571 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8572 /* Front Pin: output 0 (0x0c) */
8573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8574 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8575 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8576 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8577 /* eanable EAPD on medion laptop */
8578 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8579 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8580 /* enable unsolicited event */
8581 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8585 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8587 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8588 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8592 static void alc888_6st_dell_setup(struct hda_codec *codec)
8594 struct alc_spec *spec = codec->spec;
8596 spec->autocfg.hp_pins[0] = 0x1b;
8597 spec->autocfg.speaker_pins[0] = 0x14;
8598 spec->autocfg.speaker_pins[1] = 0x15;
8599 spec->autocfg.speaker_pins[2] = 0x16;
8600 spec->autocfg.speaker_pins[3] = 0x17;
8603 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8605 struct alc_spec *spec = codec->spec;
8607 spec->autocfg.hp_pins[0] = 0x1b;
8608 spec->autocfg.speaker_pins[0] = 0x14;
8609 spec->autocfg.speaker_pins[1] = 0x15;
8610 spec->autocfg.speaker_pins[2] = 0x16;
8611 spec->autocfg.speaker_pins[3] = 0x17;
8612 spec->autocfg.speaker_pins[4] = 0x1a;
8615 static void alc883_vaiott_setup(struct hda_codec *codec)
8617 struct alc_spec *spec = codec->spec;
8619 spec->autocfg.hp_pins[0] = 0x15;
8620 spec->autocfg.speaker_pins[0] = 0x14;
8621 spec->autocfg.speaker_pins[1] = 0x17;
8624 static struct hda_verb alc888_asus_m90v_verbs[] = {
8625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8626 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8627 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8628 /* enable unsolicited event */
8629 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8630 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8634 static void alc883_mode2_setup(struct hda_codec *codec)
8636 struct alc_spec *spec = codec->spec;
8638 spec->autocfg.hp_pins[0] = 0x1b;
8639 spec->autocfg.speaker_pins[0] = 0x14;
8640 spec->autocfg.speaker_pins[1] = 0x15;
8641 spec->autocfg.speaker_pins[2] = 0x16;
8642 spec->ext_mic.pin = 0x18;
8643 spec->int_mic.pin = 0x19;
8644 spec->ext_mic.mux_idx = 0;
8645 spec->int_mic.mux_idx = 1;
8649 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8655 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8656 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8657 /* enable unsolicited event */
8658 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8662 static void alc883_eee1601_inithook(struct hda_codec *codec)
8664 struct alc_spec *spec = codec->spec;
8666 spec->autocfg.hp_pins[0] = 0x14;
8667 spec->autocfg.speaker_pins[0] = 0x1b;
8668 alc_automute_pin(codec);
8671 static struct hda_verb alc889A_mb31_verbs[] = {
8672 /* Init rear pin (used as headphone output) */
8673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8674 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8675 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8676 /* Init line pin (used as output in 4ch and 6ch mode) */
8677 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8678 /* Init line 2 pin (used as headphone out by default) */
8679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8680 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8684 /* Mute speakers according to the headphone jack state */
8685 static void alc889A_mb31_automute(struct hda_codec *codec)
8687 unsigned int present;
8689 /* Mute only in 2ch or 4ch mode */
8690 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8692 present = snd_hda_codec_read(codec, 0x15, 0,
8693 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8696 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8697 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8701 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8703 if ((res >> 26) == ALC880_HP_EVENT)
8704 alc889A_mb31_automute(codec);
8708 #ifdef CONFIG_SND_HDA_POWER_SAVE
8709 #define alc882_loopbacks alc880_loopbacks
8712 /* pcm configuration: identical with ALC880 */
8713 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8714 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8715 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8716 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8718 static hda_nid_t alc883_slave_dig_outs[] = {
8719 ALC1200_DIGOUT_NID, 0,
8722 static hda_nid_t alc1200_slave_dig_outs[] = {
8723 ALC883_DIGOUT_NID, 0,
8727 * configuration and preset
8729 static const char *alc882_models[ALC882_MODEL_LAST] = {
8730 [ALC882_3ST_DIG] = "3stack-dig",
8731 [ALC882_6ST_DIG] = "6stack-dig",
8732 [ALC882_ARIMA] = "arima",
8733 [ALC882_W2JC] = "w2jc",
8734 [ALC882_TARGA] = "targa",
8735 [ALC882_ASUS_A7J] = "asus-a7j",
8736 [ALC882_ASUS_A7M] = "asus-a7m",
8737 [ALC885_MACPRO] = "macpro",
8738 [ALC885_MB5] = "mb5",
8739 [ALC885_MBP3] = "mbp3",
8740 [ALC885_IMAC24] = "imac24",
8741 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8742 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8743 [ALC883_3ST_6ch] = "3stack-6ch",
8744 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8745 [ALC883_TARGA_DIG] = "targa-dig",
8746 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8747 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8748 [ALC883_ACER] = "acer",
8749 [ALC883_ACER_ASPIRE] = "acer-aspire",
8750 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8751 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8752 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8753 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8754 [ALC883_MEDION] = "medion",
8755 [ALC883_MEDION_MD2] = "medion-md2",
8756 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8757 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8758 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8759 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8760 [ALC888_LENOVO_SKY] = "lenovo-sky",
8761 [ALC883_HAIER_W66] = "haier-w66",
8762 [ALC888_3ST_HP] = "3stack-hp",
8763 [ALC888_6ST_DELL] = "6stack-dell",
8764 [ALC883_MITAC] = "mitac",
8765 [ALC883_CLEVO_M540R] = "clevo-m540r",
8766 [ALC883_CLEVO_M720] = "clevo-m720",
8767 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8768 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8769 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8770 [ALC889A_INTEL] = "intel-alc889a",
8771 [ALC889_INTEL] = "intel-x58",
8772 [ALC1200_ASUS_P5Q] = "asus-p5q",
8773 [ALC889A_MB31] = "mb31",
8774 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8775 [ALC882_AUTO] = "auto",
8778 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8779 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8781 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8782 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8783 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8784 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8785 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8786 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8787 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8788 ALC888_ACER_ASPIRE_4930G),
8789 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8790 ALC888_ACER_ASPIRE_4930G),
8791 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8792 ALC888_ACER_ASPIRE_8930G),
8793 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8794 ALC888_ACER_ASPIRE_8930G),
8795 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8796 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8797 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8798 ALC888_ACER_ASPIRE_6530G),
8799 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8800 ALC888_ACER_ASPIRE_6530G),
8801 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8802 ALC888_ACER_ASPIRE_7730G),
8803 /* default Acer -- disabled as it causes more problems.
8804 * model=auto should work fine now
8806 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8808 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8810 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8811 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8812 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8813 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8814 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8815 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8817 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8818 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8819 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8820 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8821 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8822 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8823 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8824 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8825 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8826 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8827 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8829 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8830 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8831 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8832 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8833 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8834 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8835 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8836 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8837 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8839 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8840 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8841 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8842 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8843 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8844 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8845 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8846 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8847 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8848 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8849 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8850 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8851 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8852 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8853 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8854 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8855 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8856 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8857 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8858 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8859 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8860 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8861 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8862 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8863 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8864 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8865 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8866 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8867 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8869 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8870 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8871 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8872 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8873 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8874 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8875 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8876 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8877 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8878 ALC883_FUJITSU_PI2515),
8879 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8880 ALC888_FUJITSU_XA3530),
8881 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8882 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8883 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8884 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8885 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8886 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8887 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8888 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8889 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8891 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8892 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8893 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8894 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8895 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8896 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8897 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8902 /* codec SSID table for Intel Mac */
8903 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8904 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8905 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8906 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8907 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8908 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8909 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8910 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8911 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8912 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8913 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8914 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8915 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8916 * no perfect solution yet
8918 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8922 static struct alc_config_preset alc882_presets[] = {
8923 [ALC882_3ST_DIG] = {
8924 .mixers = { alc882_base_mixer },
8925 .init_verbs = { alc882_base_init_verbs,
8926 alc882_adc1_init_verbs },
8927 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8928 .dac_nids = alc882_dac_nids,
8929 .dig_out_nid = ALC882_DIGOUT_NID,
8930 .dig_in_nid = ALC882_DIGIN_NID,
8931 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8932 .channel_mode = alc882_ch_modes,
8934 .input_mux = &alc882_capture_source,
8936 [ALC882_6ST_DIG] = {
8937 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8938 .init_verbs = { alc882_base_init_verbs,
8939 alc882_adc1_init_verbs },
8940 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8941 .dac_nids = alc882_dac_nids,
8942 .dig_out_nid = ALC882_DIGOUT_NID,
8943 .dig_in_nid = ALC882_DIGIN_NID,
8944 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8945 .channel_mode = alc882_sixstack_modes,
8946 .input_mux = &alc882_capture_source,
8949 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8950 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8951 alc882_eapd_verbs },
8952 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8953 .dac_nids = alc882_dac_nids,
8954 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8955 .channel_mode = alc882_sixstack_modes,
8956 .input_mux = &alc882_capture_source,
8959 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8960 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8961 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8962 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8963 .dac_nids = alc882_dac_nids,
8964 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8965 .channel_mode = alc880_threestack_modes,
8967 .input_mux = &alc882_capture_source,
8968 .dig_out_nid = ALC882_DIGOUT_NID,
8971 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8972 .init_verbs = { alc885_mbp3_init_verbs,
8973 alc880_gpio1_init_verbs },
8975 .dac_nids = alc882_dac_nids,
8977 .channel_mode = alc885_mbp_4ch_modes,
8978 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
8979 .input_mux = &alc882_capture_source,
8980 .dig_out_nid = ALC882_DIGOUT_NID,
8981 .dig_in_nid = ALC882_DIGIN_NID,
8982 .unsol_event = alc_automute_amp_unsol_event,
8983 .setup = alc885_mbp3_setup,
8984 .init_hook = alc_automute_amp,
8987 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8988 .init_verbs = { alc885_mb5_init_verbs,
8989 alc880_gpio1_init_verbs },
8990 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8991 .dac_nids = alc882_dac_nids,
8992 .channel_mode = alc885_mb5_6ch_modes,
8993 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8994 .input_mux = &mb5_capture_source,
8995 .dig_out_nid = ALC882_DIGOUT_NID,
8996 .dig_in_nid = ALC882_DIGIN_NID,
8999 .mixers = { alc882_macpro_mixer },
9000 .init_verbs = { alc882_macpro_init_verbs },
9001 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9002 .dac_nids = alc882_dac_nids,
9003 .dig_out_nid = ALC882_DIGOUT_NID,
9004 .dig_in_nid = ALC882_DIGIN_NID,
9005 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9006 .channel_mode = alc882_ch_modes,
9007 .input_mux = &alc882_capture_source,
9008 .init_hook = alc885_macpro_init_hook,
9011 .mixers = { alc885_imac24_mixer },
9012 .init_verbs = { alc885_imac24_init_verbs },
9013 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9014 .dac_nids = alc882_dac_nids,
9015 .dig_out_nid = ALC882_DIGOUT_NID,
9016 .dig_in_nid = ALC882_DIGIN_NID,
9017 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9018 .channel_mode = alc882_ch_modes,
9019 .input_mux = &alc882_capture_source,
9020 .unsol_event = alc_automute_amp_unsol_event,
9021 .setup = alc885_imac24_setup,
9022 .init_hook = alc885_imac24_init_hook,
9025 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9026 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9027 alc880_gpio3_init_verbs, alc882_targa_verbs},
9028 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9029 .dac_nids = alc882_dac_nids,
9030 .dig_out_nid = ALC882_DIGOUT_NID,
9031 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9032 .adc_nids = alc882_adc_nids,
9033 .capsrc_nids = alc882_capsrc_nids,
9034 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9035 .channel_mode = alc882_3ST_6ch_modes,
9037 .input_mux = &alc882_capture_source,
9038 .unsol_event = alc882_targa_unsol_event,
9039 .setup = alc882_targa_setup,
9040 .init_hook = alc882_targa_automute,
9042 [ALC882_ASUS_A7J] = {
9043 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9044 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9045 alc882_asus_a7j_verbs},
9046 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9047 .dac_nids = alc882_dac_nids,
9048 .dig_out_nid = ALC882_DIGOUT_NID,
9049 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9050 .adc_nids = alc882_adc_nids,
9051 .capsrc_nids = alc882_capsrc_nids,
9052 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9053 .channel_mode = alc882_3ST_6ch_modes,
9055 .input_mux = &alc882_capture_source,
9057 [ALC882_ASUS_A7M] = {
9058 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9059 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9060 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9061 alc882_asus_a7m_verbs },
9062 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9063 .dac_nids = alc882_dac_nids,
9064 .dig_out_nid = ALC882_DIGOUT_NID,
9065 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9066 .channel_mode = alc880_threestack_modes,
9068 .input_mux = &alc882_capture_source,
9070 [ALC883_3ST_2ch_DIG] = {
9071 .mixers = { alc883_3ST_2ch_mixer },
9072 .init_verbs = { alc883_init_verbs },
9073 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9074 .dac_nids = alc883_dac_nids,
9075 .dig_out_nid = ALC883_DIGOUT_NID,
9076 .dig_in_nid = ALC883_DIGIN_NID,
9077 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9078 .channel_mode = alc883_3ST_2ch_modes,
9079 .input_mux = &alc883_capture_source,
9081 [ALC883_3ST_6ch_DIG] = {
9082 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9083 .init_verbs = { alc883_init_verbs },
9084 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9085 .dac_nids = alc883_dac_nids,
9086 .dig_out_nid = ALC883_DIGOUT_NID,
9087 .dig_in_nid = ALC883_DIGIN_NID,
9088 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9089 .channel_mode = alc883_3ST_6ch_modes,
9091 .input_mux = &alc883_capture_source,
9093 [ALC883_3ST_6ch] = {
9094 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9095 .init_verbs = { alc883_init_verbs },
9096 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9097 .dac_nids = alc883_dac_nids,
9098 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9099 .channel_mode = alc883_3ST_6ch_modes,
9101 .input_mux = &alc883_capture_source,
9103 [ALC883_3ST_6ch_INTEL] = {
9104 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9105 .init_verbs = { alc883_init_verbs },
9106 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9107 .dac_nids = alc883_dac_nids,
9108 .dig_out_nid = ALC883_DIGOUT_NID,
9109 .dig_in_nid = ALC883_DIGIN_NID,
9110 .slave_dig_outs = alc883_slave_dig_outs,
9111 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9112 .channel_mode = alc883_3ST_6ch_intel_modes,
9114 .input_mux = &alc883_3stack_6ch_intel,
9117 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9118 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9119 alc_hp15_unsol_verbs },
9120 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9121 .dac_nids = alc883_dac_nids,
9122 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9123 .adc_nids = alc889_adc_nids,
9124 .dig_out_nid = ALC883_DIGOUT_NID,
9125 .dig_in_nid = ALC883_DIGIN_NID,
9126 .slave_dig_outs = alc883_slave_dig_outs,
9127 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9128 .channel_mode = alc889_8ch_intel_modes,
9129 .capsrc_nids = alc889_capsrc_nids,
9130 .input_mux = &alc889_capture_source,
9131 .setup = alc889_automute_setup,
9132 .init_hook = alc_automute_amp,
9133 .unsol_event = alc_automute_amp_unsol_event,
9137 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9138 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9139 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9140 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9141 .dac_nids = alc883_dac_nids,
9142 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9143 .adc_nids = alc889_adc_nids,
9144 .dig_out_nid = ALC883_DIGOUT_NID,
9145 .dig_in_nid = ALC883_DIGIN_NID,
9146 .slave_dig_outs = alc883_slave_dig_outs,
9147 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9148 .channel_mode = alc889_8ch_intel_modes,
9149 .capsrc_nids = alc889_capsrc_nids,
9150 .input_mux = &alc889_capture_source,
9151 .setup = alc889_automute_setup,
9152 .init_hook = alc889_intel_init_hook,
9153 .unsol_event = alc_automute_amp_unsol_event,
9156 [ALC883_6ST_DIG] = {
9157 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9158 .init_verbs = { alc883_init_verbs },
9159 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9160 .dac_nids = alc883_dac_nids,
9161 .dig_out_nid = ALC883_DIGOUT_NID,
9162 .dig_in_nid = ALC883_DIGIN_NID,
9163 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9164 .channel_mode = alc883_sixstack_modes,
9165 .input_mux = &alc883_capture_source,
9167 [ALC883_TARGA_DIG] = {
9168 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9169 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9170 alc883_targa_verbs},
9171 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9172 .dac_nids = alc883_dac_nids,
9173 .dig_out_nid = ALC883_DIGOUT_NID,
9174 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9175 .channel_mode = alc883_3ST_6ch_modes,
9177 .input_mux = &alc883_capture_source,
9178 .unsol_event = alc883_targa_unsol_event,
9179 .setup = alc882_targa_setup,
9180 .init_hook = alc882_targa_automute,
9182 [ALC883_TARGA_2ch_DIG] = {
9183 .mixers = { alc883_targa_2ch_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 .adc_nids = alc883_adc_nids_alt,
9189 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9190 .dig_out_nid = ALC883_DIGOUT_NID,
9191 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9192 .channel_mode = alc883_3ST_2ch_modes,
9193 .input_mux = &alc883_capture_source,
9194 .unsol_event = alc883_targa_unsol_event,
9195 .setup = alc882_targa_setup,
9196 .init_hook = alc882_targa_automute,
9198 [ALC883_TARGA_8ch_DIG] = {
9199 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9200 alc883_chmode_mixer },
9201 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9202 alc883_targa_verbs },
9203 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9204 .dac_nids = alc883_dac_nids,
9205 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9206 .adc_nids = alc883_adc_nids_rev,
9207 .capsrc_nids = alc883_capsrc_nids_rev,
9208 .dig_out_nid = ALC883_DIGOUT_NID,
9209 .dig_in_nid = ALC883_DIGIN_NID,
9210 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9211 .channel_mode = alc883_4ST_8ch_modes,
9213 .input_mux = &alc883_capture_source,
9214 .unsol_event = alc883_targa_unsol_event,
9215 .setup = alc882_targa_setup,
9216 .init_hook = alc882_targa_automute,
9219 .mixers = { alc883_base_mixer },
9220 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9221 * and the headphone jack. Turn this on and rely on the
9222 * standard mute methods whenever the user wants to turn
9223 * these outputs off.
9225 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9226 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9227 .dac_nids = alc883_dac_nids,
9228 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9229 .channel_mode = alc883_3ST_2ch_modes,
9230 .input_mux = &alc883_capture_source,
9232 [ALC883_ACER_ASPIRE] = {
9233 .mixers = { alc883_acer_aspire_mixer },
9234 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9235 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9236 .dac_nids = alc883_dac_nids,
9237 .dig_out_nid = ALC883_DIGOUT_NID,
9238 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9239 .channel_mode = alc883_3ST_2ch_modes,
9240 .input_mux = &alc883_capture_source,
9241 .unsol_event = alc_automute_amp_unsol_event,
9242 .setup = alc883_acer_aspire_setup,
9243 .init_hook = alc_automute_amp,
9245 [ALC888_ACER_ASPIRE_4930G] = {
9246 .mixers = { alc888_base_mixer,
9247 alc883_chmode_mixer },
9248 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9249 alc888_acer_aspire_4930g_verbs },
9250 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9251 .dac_nids = alc883_dac_nids,
9252 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9253 .adc_nids = alc883_adc_nids_rev,
9254 .capsrc_nids = alc883_capsrc_nids_rev,
9255 .dig_out_nid = ALC883_DIGOUT_NID,
9256 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9257 .channel_mode = alc883_3ST_6ch_modes,
9260 ARRAY_SIZE(alc888_2_capture_sources),
9261 .input_mux = alc888_2_capture_sources,
9262 .unsol_event = alc_automute_amp_unsol_event,
9263 .setup = alc888_acer_aspire_4930g_setup,
9264 .init_hook = alc_automute_amp,
9266 [ALC888_ACER_ASPIRE_6530G] = {
9267 .mixers = { alc888_acer_aspire_6530_mixer },
9268 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9269 alc888_acer_aspire_6530g_verbs },
9270 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9271 .dac_nids = alc883_dac_nids,
9272 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9273 .adc_nids = alc883_adc_nids_rev,
9274 .capsrc_nids = alc883_capsrc_nids_rev,
9275 .dig_out_nid = ALC883_DIGOUT_NID,
9276 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9277 .channel_mode = alc883_3ST_2ch_modes,
9279 ARRAY_SIZE(alc888_2_capture_sources),
9280 .input_mux = alc888_acer_aspire_6530_sources,
9281 .unsol_event = alc_automute_amp_unsol_event,
9282 .setup = alc888_acer_aspire_6530g_setup,
9283 .init_hook = alc_automute_amp,
9285 [ALC888_ACER_ASPIRE_8930G] = {
9286 .mixers = { alc888_base_mixer,
9287 alc883_chmode_mixer },
9288 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9289 alc889_acer_aspire_8930g_verbs },
9290 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9291 .dac_nids = alc883_dac_nids,
9292 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9293 .adc_nids = alc889_adc_nids,
9294 .capsrc_nids = alc889_capsrc_nids,
9295 .dig_out_nid = ALC883_DIGOUT_NID,
9296 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9297 .channel_mode = alc883_3ST_6ch_modes,
9299 .const_channel_count = 6,
9301 ARRAY_SIZE(alc889_capture_sources),
9302 .input_mux = alc889_capture_sources,
9303 .unsol_event = alc_automute_amp_unsol_event,
9304 .setup = alc889_acer_aspire_8930g_setup,
9305 .init_hook = alc_automute_amp,
9307 [ALC888_ACER_ASPIRE_7730G] = {
9308 .mixers = { alc883_3ST_6ch_mixer,
9309 alc883_chmode_mixer },
9310 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9311 alc888_acer_aspire_7730G_verbs },
9312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9313 .dac_nids = alc883_dac_nids,
9314 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9315 .adc_nids = alc883_adc_nids_rev,
9316 .capsrc_nids = alc883_capsrc_nids_rev,
9317 .dig_out_nid = ALC883_DIGOUT_NID,
9318 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9319 .channel_mode = alc883_3ST_6ch_modes,
9321 .const_channel_count = 6,
9322 .input_mux = &alc883_capture_source,
9323 .unsol_event = alc_automute_amp_unsol_event,
9324 .setup = alc888_acer_aspire_6530g_setup,
9325 .init_hook = alc_automute_amp,
9328 .mixers = { alc883_fivestack_mixer,
9329 alc883_chmode_mixer },
9330 .init_verbs = { alc883_init_verbs,
9331 alc883_medion_eapd_verbs },
9332 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9333 .dac_nids = alc883_dac_nids,
9334 .adc_nids = alc883_adc_nids_alt,
9335 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9336 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9337 .channel_mode = alc883_sixstack_modes,
9338 .input_mux = &alc883_capture_source,
9340 [ALC883_MEDION_MD2] = {
9341 .mixers = { alc883_medion_md2_mixer},
9342 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9343 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9344 .dac_nids = alc883_dac_nids,
9345 .dig_out_nid = ALC883_DIGOUT_NID,
9346 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9347 .channel_mode = alc883_3ST_2ch_modes,
9348 .input_mux = &alc883_capture_source,
9349 .unsol_event = alc_automute_amp_unsol_event,
9350 .setup = alc883_medion_md2_setup,
9351 .init_hook = alc_automute_amp,
9353 [ALC883_LAPTOP_EAPD] = {
9354 .mixers = { alc883_base_mixer },
9355 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9356 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9357 .dac_nids = alc883_dac_nids,
9358 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9359 .channel_mode = alc883_3ST_2ch_modes,
9360 .input_mux = &alc883_capture_source,
9362 [ALC883_CLEVO_M540R] = {
9363 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9364 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9365 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9366 .dac_nids = alc883_dac_nids,
9367 .dig_out_nid = ALC883_DIGOUT_NID,
9368 .dig_in_nid = ALC883_DIGIN_NID,
9369 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9370 .channel_mode = alc883_3ST_6ch_clevo_modes,
9372 .input_mux = &alc883_capture_source,
9373 /* This machine has the hardware HP auto-muting, thus
9374 * we need no software mute via unsol event
9377 [ALC883_CLEVO_M720] = {
9378 .mixers = { alc883_clevo_m720_mixer },
9379 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9380 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9381 .dac_nids = alc883_dac_nids,
9382 .dig_out_nid = ALC883_DIGOUT_NID,
9383 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9384 .channel_mode = alc883_3ST_2ch_modes,
9385 .input_mux = &alc883_capture_source,
9386 .unsol_event = alc883_clevo_m720_unsol_event,
9387 .setup = alc883_clevo_m720_setup,
9388 .init_hook = alc883_clevo_m720_init_hook,
9390 [ALC883_LENOVO_101E_2ch] = {
9391 .mixers = { alc883_lenovo_101e_2ch_mixer},
9392 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .adc_nids = alc883_adc_nids_alt,
9396 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9398 .channel_mode = alc883_3ST_2ch_modes,
9399 .input_mux = &alc883_lenovo_101e_capture_source,
9400 .unsol_event = alc883_lenovo_101e_unsol_event,
9401 .init_hook = alc883_lenovo_101e_all_automute,
9403 [ALC883_LENOVO_NB0763] = {
9404 .mixers = { alc883_lenovo_nb0763_mixer },
9405 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9407 .dac_nids = alc883_dac_nids,
9408 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9409 .channel_mode = alc883_3ST_2ch_modes,
9411 .input_mux = &alc883_lenovo_nb0763_capture_source,
9412 .unsol_event = alc_automute_amp_unsol_event,
9413 .setup = alc883_medion_md2_setup,
9414 .init_hook = alc_automute_amp,
9416 [ALC888_LENOVO_MS7195_DIG] = {
9417 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9418 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9419 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9420 .dac_nids = alc883_dac_nids,
9421 .dig_out_nid = ALC883_DIGOUT_NID,
9422 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9423 .channel_mode = alc883_3ST_6ch_modes,
9425 .input_mux = &alc883_capture_source,
9426 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9427 .init_hook = alc888_lenovo_ms7195_front_automute,
9429 [ALC883_HAIER_W66] = {
9430 .mixers = { alc883_targa_2ch_mixer},
9431 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9432 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9433 .dac_nids = alc883_dac_nids,
9434 .dig_out_nid = ALC883_DIGOUT_NID,
9435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9436 .channel_mode = alc883_3ST_2ch_modes,
9437 .input_mux = &alc883_capture_source,
9438 .unsol_event = alc_automute_amp_unsol_event,
9439 .setup = alc883_haier_w66_setup,
9440 .init_hook = alc_automute_amp,
9443 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9444 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9446 .dac_nids = alc883_dac_nids,
9447 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9448 .channel_mode = alc888_3st_hp_modes,
9450 .input_mux = &alc883_capture_source,
9451 .unsol_event = alc_automute_amp_unsol_event,
9452 .setup = alc888_3st_hp_setup,
9453 .init_hook = alc_automute_amp,
9455 [ALC888_6ST_DELL] = {
9456 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9457 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9459 .dac_nids = alc883_dac_nids,
9460 .dig_out_nid = ALC883_DIGOUT_NID,
9461 .dig_in_nid = ALC883_DIGIN_NID,
9462 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9463 .channel_mode = alc883_sixstack_modes,
9464 .input_mux = &alc883_capture_source,
9465 .unsol_event = alc_automute_amp_unsol_event,
9466 .setup = alc888_6st_dell_setup,
9467 .init_hook = alc_automute_amp,
9470 .mixers = { alc883_mitac_mixer },
9471 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9473 .dac_nids = alc883_dac_nids,
9474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9475 .channel_mode = alc883_3ST_2ch_modes,
9476 .input_mux = &alc883_capture_source,
9477 .unsol_event = alc_automute_amp_unsol_event,
9478 .setup = alc883_mitac_setup,
9479 .init_hook = alc_automute_amp,
9481 [ALC883_FUJITSU_PI2515] = {
9482 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9483 .init_verbs = { alc883_init_verbs,
9484 alc883_2ch_fujitsu_pi2515_verbs},
9485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9486 .dac_nids = alc883_dac_nids,
9487 .dig_out_nid = ALC883_DIGOUT_NID,
9488 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9489 .channel_mode = alc883_3ST_2ch_modes,
9490 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9491 .unsol_event = alc_automute_amp_unsol_event,
9492 .setup = alc883_2ch_fujitsu_pi2515_setup,
9493 .init_hook = alc_automute_amp,
9495 [ALC888_FUJITSU_XA3530] = {
9496 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9497 .init_verbs = { alc883_init_verbs,
9498 alc888_fujitsu_xa3530_verbs },
9499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9500 .dac_nids = alc883_dac_nids,
9501 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9502 .adc_nids = alc883_adc_nids_rev,
9503 .capsrc_nids = alc883_capsrc_nids_rev,
9504 .dig_out_nid = ALC883_DIGOUT_NID,
9505 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9506 .channel_mode = alc888_4ST_8ch_intel_modes,
9508 ARRAY_SIZE(alc888_2_capture_sources),
9509 .input_mux = alc888_2_capture_sources,
9510 .unsol_event = alc_automute_amp_unsol_event,
9511 .setup = alc888_fujitsu_xa3530_setup,
9512 .init_hook = alc_automute_amp,
9514 [ALC888_LENOVO_SKY] = {
9515 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9516 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9517 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9518 .dac_nids = alc883_dac_nids,
9519 .dig_out_nid = ALC883_DIGOUT_NID,
9520 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9521 .channel_mode = alc883_sixstack_modes,
9523 .input_mux = &alc883_lenovo_sky_capture_source,
9524 .unsol_event = alc_automute_amp_unsol_event,
9525 .setup = alc888_lenovo_sky_setup,
9526 .init_hook = alc_automute_amp,
9528 [ALC888_ASUS_M90V] = {
9529 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9530 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9531 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9532 .dac_nids = alc883_dac_nids,
9533 .dig_out_nid = ALC883_DIGOUT_NID,
9534 .dig_in_nid = ALC883_DIGIN_NID,
9535 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9536 .channel_mode = alc883_3ST_6ch_modes,
9538 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9539 .unsol_event = alc_sku_unsol_event,
9540 .setup = alc883_mode2_setup,
9541 .init_hook = alc_inithook,
9543 [ALC888_ASUS_EEE1601] = {
9544 .mixers = { alc883_asus_eee1601_mixer },
9545 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9546 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9548 .dac_nids = alc883_dac_nids,
9549 .dig_out_nid = ALC883_DIGOUT_NID,
9550 .dig_in_nid = ALC883_DIGIN_NID,
9551 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9552 .channel_mode = alc883_3ST_2ch_modes,
9554 .input_mux = &alc883_asus_eee1601_capture_source,
9555 .unsol_event = alc_sku_unsol_event,
9556 .init_hook = alc883_eee1601_inithook,
9558 [ALC1200_ASUS_P5Q] = {
9559 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9560 .init_verbs = { alc883_init_verbs },
9561 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9562 .dac_nids = alc883_dac_nids,
9563 .dig_out_nid = ALC1200_DIGOUT_NID,
9564 .dig_in_nid = ALC883_DIGIN_NID,
9565 .slave_dig_outs = alc1200_slave_dig_outs,
9566 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9567 .channel_mode = alc883_sixstack_modes,
9568 .input_mux = &alc883_capture_source,
9571 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9572 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9573 alc880_gpio1_init_verbs },
9574 .adc_nids = alc883_adc_nids,
9575 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9576 .dac_nids = alc883_dac_nids,
9577 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9578 .channel_mode = alc889A_mb31_6ch_modes,
9579 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9580 .input_mux = &alc889A_mb31_capture_source,
9581 .dig_out_nid = ALC883_DIGOUT_NID,
9582 .unsol_event = alc889A_mb31_unsol_event,
9583 .init_hook = alc889A_mb31_automute,
9585 [ALC883_SONY_VAIO_TT] = {
9586 .mixers = { alc883_vaiott_mixer },
9587 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9588 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9589 .dac_nids = alc883_dac_nids,
9590 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9591 .channel_mode = alc883_3ST_2ch_modes,
9592 .input_mux = &alc883_capture_source,
9593 .unsol_event = alc_automute_amp_unsol_event,
9594 .setup = alc883_vaiott_setup,
9595 .init_hook = alc_automute_amp,
9604 PINFIX_ABIT_AW9D_MAX
9607 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9608 { 0x15, 0x01080104 }, /* side */
9609 { 0x16, 0x01011012 }, /* rear */
9610 { 0x17, 0x01016011 }, /* clfe */
9614 static const struct alc_fixup alc882_fixups[] = {
9615 [PINFIX_ABIT_AW9D_MAX] = {
9616 .pins = alc882_abit_aw9d_pinfix
9620 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9621 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9626 * BIOS auto configuration
9628 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9629 const struct auto_pin_cfg *cfg)
9631 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9634 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9635 hda_nid_t nid, int pin_type,
9639 struct alc_spec *spec = codec->spec;
9642 alc_set_pin_output(codec, nid, pin_type);
9643 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9646 idx = spec->multiout.dac_nids[dac_idx] - 2;
9647 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9651 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9653 struct alc_spec *spec = codec->spec;
9656 for (i = 0; i <= HDA_SIDE; i++) {
9657 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9658 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9660 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9665 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9667 struct alc_spec *spec = codec->spec;
9670 pin = spec->autocfg.hp_pins[0];
9671 if (pin) /* connect to front */
9673 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9674 pin = spec->autocfg.speaker_pins[0];
9676 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9679 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9681 struct alc_spec *spec = codec->spec;
9684 for (i = 0; i < AUTO_PIN_LAST; i++) {
9685 hda_nid_t nid = spec->autocfg.input_pins[i];
9688 alc_set_input_pin(codec, nid, i);
9689 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9690 snd_hda_codec_write(codec, nid, 0,
9691 AC_VERB_SET_AMP_GAIN_MUTE,
9696 static void alc882_auto_init_input_src(struct hda_codec *codec)
9698 struct alc_spec *spec = codec->spec;
9701 for (c = 0; c < spec->num_adc_nids; c++) {
9702 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9703 hda_nid_t nid = spec->capsrc_nids[c];
9704 unsigned int mux_idx;
9705 const struct hda_input_mux *imux;
9706 int conns, mute, idx, item;
9708 conns = snd_hda_get_connections(codec, nid, conn_list,
9709 ARRAY_SIZE(conn_list));
9712 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9713 imux = &spec->input_mux[mux_idx];
9714 for (idx = 0; idx < conns; idx++) {
9715 /* if the current connection is the selected one,
9716 * unmute it as default - otherwise mute it
9718 mute = AMP_IN_MUTE(idx);
9719 for (item = 0; item < imux->num_items; item++) {
9720 if (imux->items[item].index == idx) {
9721 if (spec->cur_mux[c] == item)
9722 mute = AMP_IN_UNMUTE(idx);
9726 /* check if we have a selector or mixer
9727 * we could check for the widget type instead, but
9728 * just check for Amp-In presence (in case of mixer
9729 * without amp-in there is something wrong, this
9730 * function shouldn't be used or capsrc nid is wrong)
9732 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9733 snd_hda_codec_write(codec, nid, 0,
9734 AC_VERB_SET_AMP_GAIN_MUTE,
9736 else if (mute != AMP_IN_MUTE(idx))
9737 snd_hda_codec_write(codec, nid, 0,
9738 AC_VERB_SET_CONNECT_SEL,
9744 /* add mic boosts if needed */
9745 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9747 struct alc_spec *spec = codec->spec;
9751 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9752 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9753 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9755 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9759 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9760 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9761 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9763 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9770 /* almost identical with ALC880 parser... */
9771 static int alc882_parse_auto_config(struct hda_codec *codec)
9773 struct alc_spec *spec = codec->spec;
9774 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9777 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9781 if (!spec->autocfg.line_outs)
9782 return 0; /* can't find valid BIOS pin config */
9784 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9787 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9790 err = alc880_auto_create_extra_out(spec,
9791 spec->autocfg.speaker_pins[0],
9795 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9799 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9803 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9805 /* check multiple SPDIF-out (for recent codecs) */
9806 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9808 err = snd_hda_get_connections(codec,
9809 spec->autocfg.dig_out_pins[i],
9814 spec->multiout.dig_out_nid = dig_nid;
9816 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9817 spec->slave_dig_outs[i - 1] = dig_nid;
9818 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
9822 if (spec->autocfg.dig_in_pin)
9823 spec->dig_in_nid = ALC880_DIGIN_NID;
9825 if (spec->kctls.list)
9826 add_mixer(spec, spec->kctls.list);
9828 add_verb(spec, alc883_auto_init_verbs);
9829 /* if ADC 0x07 is available, initialize it, too */
9830 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9831 add_verb(spec, alc882_adc1_init_verbs);
9833 spec->num_mux_defs = 1;
9834 spec->input_mux = &spec->private_imux[0];
9836 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9838 err = alc_auto_add_mic_boost(codec);
9842 return 1; /* config found */
9845 /* additional initialization for auto-configuration model */
9846 static void alc882_auto_init(struct hda_codec *codec)
9848 struct alc_spec *spec = codec->spec;
9849 alc882_auto_init_multi_out(codec);
9850 alc882_auto_init_hp_out(codec);
9851 alc882_auto_init_analog_input(codec);
9852 alc882_auto_init_input_src(codec);
9853 if (spec->unsol_event)
9854 alc_inithook(codec);
9857 static int patch_alc882(struct hda_codec *codec)
9859 struct alc_spec *spec;
9860 int err, board_config;
9862 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9868 switch (codec->vendor_id) {
9873 /* ALC883 and variants */
9874 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9878 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9882 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9883 board_config = snd_hda_check_board_codec_sid_config(codec,
9884 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9886 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9887 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9889 board_config = ALC882_AUTO;
9892 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9894 if (board_config == ALC882_AUTO) {
9895 /* automatic parse from the BIOS config */
9896 err = alc882_parse_auto_config(codec);
9902 "hda_codec: Cannot set up configuration "
9903 "from BIOS. Using base mode...\n");
9904 board_config = ALC882_3ST_DIG;
9908 err = snd_hda_attach_beep_device(codec, 0x1);
9914 if (board_config != ALC882_AUTO)
9915 setup_preset(codec, &alc882_presets[board_config]);
9917 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9918 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9919 /* FIXME: setup DAC5 */
9920 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9921 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9923 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9924 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9926 if (codec->vendor_id == 0x10ec0888)
9927 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9929 if (!spec->adc_nids && spec->input_mux) {
9931 spec->num_adc_nids = 0;
9932 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9934 hda_nid_t nid = alc882_adc_nids[i];
9935 unsigned int wcap = get_wcaps(codec, nid);
9937 wcap = get_wcaps_type(wcap);
9938 if (wcap != AC_WID_AUD_IN)
9940 spec->private_adc_nids[spec->num_adc_nids] = nid;
9941 err = snd_hda_get_connections(codec, nid, &cap, 1);
9944 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9945 spec->num_adc_nids++;
9947 spec->adc_nids = spec->private_adc_nids;
9948 spec->capsrc_nids = spec->private_capsrc_nids;
9951 set_capture_mixer(codec);
9952 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9954 spec->vmaster_nid = 0x0c;
9956 codec->patch_ops = alc_patch_ops;
9957 if (board_config == ALC882_AUTO)
9958 spec->init_hook = alc882_auto_init;
9959 #ifdef CONFIG_SND_HDA_POWER_SAVE
9960 if (!spec->loopback.amplist)
9961 spec->loopback.amplist = alc882_loopbacks;
9963 codec->proc_widget_hook = print_realtek_coef;
9973 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9974 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9976 #define alc262_dac_nids alc260_dac_nids
9977 #define alc262_adc_nids alc882_adc_nids
9978 #define alc262_adc_nids_alt alc882_adc_nids_alt
9979 #define alc262_capsrc_nids alc882_capsrc_nids
9980 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9982 #define alc262_modes alc260_modes
9983 #define alc262_capture_source alc882_capture_source
9985 static hda_nid_t alc262_dmic_adc_nids[1] = {
9990 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9992 static struct snd_kcontrol_new alc262_base_mixer[] = {
9993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9994 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10003 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10004 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10005 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10007 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10008 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10012 /* update HP, line and mono-out pins according to the master switch */
10013 static void alc262_hp_master_update(struct hda_codec *codec)
10015 struct alc_spec *spec = codec->spec;
10016 int val = spec->master_sw;
10018 /* HP & line-out */
10019 snd_hda_codec_write_cache(codec, 0x1b, 0,
10020 AC_VERB_SET_PIN_WIDGET_CONTROL,
10022 snd_hda_codec_write_cache(codec, 0x15, 0,
10023 AC_VERB_SET_PIN_WIDGET_CONTROL,
10025 /* mono (speaker) depending on the HP jack sense */
10026 val = val && !spec->jack_present;
10027 snd_hda_codec_write_cache(codec, 0x16, 0,
10028 AC_VERB_SET_PIN_WIDGET_CONTROL,
10029 val ? PIN_OUT : 0);
10032 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10034 struct alc_spec *spec = codec->spec;
10035 unsigned int presence;
10036 presence = snd_hda_codec_read(codec, 0x1b, 0,
10037 AC_VERB_GET_PIN_SENSE, 0);
10038 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10039 alc262_hp_master_update(codec);
10042 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10044 if ((res >> 26) != ALC880_HP_EVENT)
10046 alc262_hp_bpc_automute(codec);
10049 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10051 struct alc_spec *spec = codec->spec;
10052 unsigned int presence;
10053 presence = snd_hda_codec_read(codec, 0x15, 0,
10054 AC_VERB_GET_PIN_SENSE, 0);
10055 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10056 alc262_hp_master_update(codec);
10059 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10062 if ((res >> 26) != ALC880_HP_EVENT)
10064 alc262_hp_wildwest_automute(codec);
10067 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10069 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10070 struct snd_ctl_elem_value *ucontrol)
10072 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10073 struct alc_spec *spec = codec->spec;
10074 int val = !!*ucontrol->value.integer.value;
10076 if (val == spec->master_sw)
10078 spec->master_sw = val;
10079 alc262_hp_master_update(codec);
10083 #define ALC262_HP_MASTER_SWITCH \
10085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10086 .name = "Master Playback Switch", \
10087 .info = snd_ctl_boolean_mono_info, \
10088 .get = alc262_hp_master_sw_get, \
10089 .put = alc262_hp_master_sw_put, \
10092 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10093 ALC262_HP_MASTER_SWITCH,
10094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10095 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10097 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10099 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10106 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10111 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10112 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10116 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10117 ALC262_HP_MASTER_SWITCH,
10118 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10119 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10120 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10122 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10124 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10126 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10127 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10136 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10137 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10138 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10139 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10143 /* mute/unmute internal speaker according to the hp jack and mute state */
10144 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10146 struct alc_spec *spec = codec->spec;
10148 spec->autocfg.hp_pins[0] = 0x15;
10149 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10152 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10153 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10154 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10163 static struct hda_verb alc262_hp_t5735_verbs[] = {
10164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10171 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10181 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10182 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10187 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10195 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10202 /* bind hp and internal speaker mute (with plug check) as master switch */
10203 static void alc262_hippo_master_update(struct hda_codec *codec)
10205 struct alc_spec *spec = codec->spec;
10206 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10207 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10208 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10212 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10213 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10214 HDA_AMP_MUTE, mute);
10215 /* mute internal speaker per jack sense */
10216 if (spec->jack_present)
10217 mute = HDA_AMP_MUTE;
10219 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10220 HDA_AMP_MUTE, mute);
10221 if (speaker_nid && speaker_nid != line_nid)
10222 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10223 HDA_AMP_MUTE, mute);
10226 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10228 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10229 struct snd_ctl_elem_value *ucontrol)
10231 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10232 struct alc_spec *spec = codec->spec;
10233 int val = !!*ucontrol->value.integer.value;
10235 if (val == spec->master_sw)
10237 spec->master_sw = val;
10238 alc262_hippo_master_update(codec);
10242 #define ALC262_HIPPO_MASTER_SWITCH \
10244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10245 .name = "Master Playback Switch", \
10246 .info = snd_ctl_boolean_mono_info, \
10247 .get = alc262_hippo_master_sw_get, \
10248 .put = alc262_hippo_master_sw_put, \
10251 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10252 ALC262_HIPPO_MASTER_SWITCH,
10253 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10254 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10255 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10260 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10261 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10262 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10263 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10264 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10268 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10269 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10270 ALC262_HIPPO_MASTER_SWITCH,
10271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10273 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10274 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10277 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10278 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10279 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10280 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10284 /* mute/unmute internal speaker according to the hp jack and mute state */
10285 static void alc262_hippo_automute(struct hda_codec *codec)
10287 struct alc_spec *spec = codec->spec;
10288 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10289 unsigned int present;
10291 /* need to execute and sync at first */
10292 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10293 present = snd_hda_codec_read(codec, hp_nid, 0,
10294 AC_VERB_GET_PIN_SENSE, 0);
10295 spec->jack_present = (present & 0x80000000) != 0;
10296 alc262_hippo_master_update(codec);
10299 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10301 if ((res >> 26) != ALC880_HP_EVENT)
10303 alc262_hippo_automute(codec);
10306 static void alc262_hippo_setup(struct hda_codec *codec)
10308 struct alc_spec *spec = codec->spec;
10310 spec->autocfg.hp_pins[0] = 0x15;
10311 spec->autocfg.speaker_pins[0] = 0x14;
10314 static void alc262_hippo1_setup(struct hda_codec *codec)
10316 struct alc_spec *spec = codec->spec;
10318 spec->autocfg.hp_pins[0] = 0x1b;
10319 spec->autocfg.speaker_pins[0] = 0x14;
10323 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10324 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10325 ALC262_HIPPO_MASTER_SWITCH,
10326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10328 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10329 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10333 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10334 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10335 ALC262_HIPPO_MASTER_SWITCH,
10336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10338 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10339 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10340 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10344 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10345 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10346 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10347 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10348 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10356 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10360 static struct hda_verb alc262_tyan_verbs[] = {
10361 /* Headphone automute */
10362 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10363 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10364 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10366 /* P11 AUX_IN, white 4-pin connector */
10367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10368 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10369 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10370 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10375 /* unsolicited event for HP jack sensing */
10376 static void alc262_tyan_setup(struct hda_codec *codec)
10378 struct alc_spec *spec = codec->spec;
10380 spec->autocfg.hp_pins[0] = 0x1b;
10381 spec->autocfg.speaker_pins[0] = 0x15;
10385 #define alc262_capture_mixer alc882_capture_mixer
10386 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10389 * generic initialization of ADC, input mixers and output mixers
10391 static struct hda_verb alc262_init_verbs[] = {
10393 * Unmute ADC0-2 and set the default input to mic-in
10395 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10396 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10397 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10399 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10402 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10404 * Note: PASD motherboards uses the Line In 2 as the input for
10405 * front panel mic (mic 2)
10407 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10408 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10409 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10410 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10411 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10415 * Set up output mixers (0x0c - 0x0e)
10417 /* set vol=0 to output mixers */
10418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10421 /* set up input amps for analog loopback */
10422 /* Amp Indices: DAC = 0, mixer = 1 */
10423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10425 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10427 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10430 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10432 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10433 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10435 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10439 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10443 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10446 /* FIXME: use matrix-type input source selection */
10447 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10448 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10467 static struct hda_verb alc262_eapd_verbs[] = {
10468 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10469 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10473 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10475 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10476 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10478 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10483 static struct hda_verb alc262_sony_unsol_verbs[] = {
10484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10486 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10493 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10494 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10495 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10502 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10503 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10507 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10509 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10514 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10516 struct alc_spec *spec = codec->spec;
10518 spec->autocfg.hp_pins[0] = 0x15;
10519 spec->autocfg.speaker_pins[0] = 0x14;
10520 spec->ext_mic.pin = 0x18;
10521 spec->ext_mic.mux_idx = 0;
10522 spec->int_mic.pin = 0x12;
10523 spec->int_mic.mux_idx = 9;
10524 spec->auto_mic = 1;
10530 * 0x16 = internal speaker
10531 * 0x18 = external mic
10534 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10535 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10536 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10540 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10547 static struct hda_verb alc262_nec_verbs[] = {
10548 /* Unmute Speaker */
10549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10552 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10555 /* External mic to headphone */
10556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10557 /* External mic to speaker */
10558 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10564 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10565 * 0x1b = port replicator headphone out
10568 #define ALC_HP_EVENT 0x37
10570 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10571 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10573 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10578 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10579 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10580 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10584 static struct hda_input_mux alc262_fujitsu_capture_source = {
10588 { "Int Mic", 0x1 },
10593 static struct hda_input_mux alc262_HP_capture_source = {
10597 { "Front Mic", 0x1 },
10604 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10608 { "Front Mic", 0x2 },
10614 /* mute/unmute internal speaker according to the hp jacks and mute state */
10615 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10617 struct alc_spec *spec = codec->spec;
10620 if (force || !spec->sense_updated) {
10621 unsigned int present;
10622 /* need to execute and sync at first */
10623 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10624 /* check laptop HP jack */
10625 present = snd_hda_codec_read(codec, 0x14, 0,
10626 AC_VERB_GET_PIN_SENSE, 0);
10627 /* need to execute and sync at first */
10628 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10629 /* check docking HP jack */
10630 present |= snd_hda_codec_read(codec, 0x1b, 0,
10631 AC_VERB_GET_PIN_SENSE, 0);
10632 if (present & AC_PINSENSE_PRESENCE)
10633 spec->jack_present = 1;
10635 spec->jack_present = 0;
10636 spec->sense_updated = 1;
10638 /* unmute internal speaker only if both HPs are unplugged and
10639 * master switch is on
10641 if (spec->jack_present)
10642 mute = HDA_AMP_MUTE;
10644 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10645 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10646 HDA_AMP_MUTE, mute);
10649 /* unsolicited event for HP jack sensing */
10650 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10653 if ((res >> 26) != ALC_HP_EVENT)
10655 alc262_fujitsu_automute(codec, 1);
10658 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10660 alc262_fujitsu_automute(codec, 1);
10663 /* bind volumes of both NID 0x0c and 0x0d */
10664 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10665 .ops = &snd_hda_bind_vol,
10667 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10668 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10673 /* mute/unmute internal speaker according to the hp jack and mute state */
10674 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10676 struct alc_spec *spec = codec->spec;
10679 if (force || !spec->sense_updated) {
10680 unsigned int present_int_hp;
10681 /* need to execute and sync at first */
10682 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10683 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10684 AC_VERB_GET_PIN_SENSE, 0);
10685 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10686 spec->sense_updated = 1;
10688 if (spec->jack_present) {
10689 /* mute internal speaker */
10690 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10691 HDA_AMP_MUTE, HDA_AMP_MUTE);
10692 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10693 HDA_AMP_MUTE, HDA_AMP_MUTE);
10695 /* unmute internal speaker if necessary */
10696 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10697 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10698 HDA_AMP_MUTE, mute);
10699 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10700 HDA_AMP_MUTE, mute);
10704 /* unsolicited event for HP jack sensing */
10705 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10708 if ((res >> 26) != ALC_HP_EVENT)
10710 alc262_lenovo_3000_automute(codec, 1);
10713 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10714 int dir, int idx, long *valp)
10718 for (i = 0; i < 2; i++, valp++)
10719 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10721 *valp ? 0 : HDA_AMP_MUTE);
10725 /* bind hp and internal speaker mute (with plug check) */
10726 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10727 struct snd_ctl_elem_value *ucontrol)
10729 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10730 long *valp = ucontrol->value.integer.value;
10733 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10734 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10736 alc262_fujitsu_automute(codec, 0);
10740 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10741 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10744 .name = "Master Playback Switch",
10745 .info = snd_hda_mixer_amp_switch_info,
10746 .get = snd_hda_mixer_amp_switch_get,
10747 .put = alc262_fujitsu_master_sw_put,
10748 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10750 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10751 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10752 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10755 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10756 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10757 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10761 /* bind hp and internal speaker mute (with plug check) */
10762 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10763 struct snd_ctl_elem_value *ucontrol)
10765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10766 long *valp = ucontrol->value.integer.value;
10769 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10771 alc262_lenovo_3000_automute(codec, 0);
10775 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10776 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10778 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10779 .name = "Master Playback Switch",
10780 .info = snd_hda_mixer_amp_switch_info,
10781 .get = snd_hda_mixer_amp_switch_get,
10782 .put = alc262_lenovo_3000_master_sw_put,
10783 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10785 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10786 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10787 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10790 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10791 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10792 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10796 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10797 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10798 ALC262_HIPPO_MASTER_SWITCH,
10799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10802 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10803 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10804 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10808 /* additional init verbs for Benq laptops */
10809 static struct hda_verb alc262_EAPD_verbs[] = {
10810 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10811 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10815 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10816 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10817 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10819 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10820 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10824 /* Samsung Q1 Ultra Vista model setup */
10825 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10826 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10827 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10828 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10829 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10830 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10831 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10835 static struct hda_verb alc262_ultra_verbs[] = {
10837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10844 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10847 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10849 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10850 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10852 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10854 /* ADC, choose mic */
10855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10868 /* mute/unmute internal speaker according to the hp jack and mute state */
10869 static void alc262_ultra_automute(struct hda_codec *codec)
10871 struct alc_spec *spec = codec->spec;
10875 /* auto-mute only when HP is used as HP */
10876 if (!spec->cur_mux[0]) {
10877 unsigned int present;
10878 /* need to execute and sync at first */
10879 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10880 present = snd_hda_codec_read(codec, 0x15, 0,
10881 AC_VERB_GET_PIN_SENSE, 0);
10882 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10883 if (spec->jack_present)
10884 mute = HDA_AMP_MUTE;
10886 /* mute/unmute internal speaker */
10887 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10888 HDA_AMP_MUTE, mute);
10889 /* mute/unmute HP */
10890 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10891 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10894 /* unsolicited event for HP jack sensing */
10895 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10898 if ((res >> 26) != ALC880_HP_EVENT)
10900 alc262_ultra_automute(codec);
10903 static struct hda_input_mux alc262_ultra_capture_source = {
10907 { "Headphone", 0x7 },
10911 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10912 struct snd_ctl_elem_value *ucontrol)
10914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10915 struct alc_spec *spec = codec->spec;
10918 ret = alc_mux_enum_put(kcontrol, ucontrol);
10921 /* reprogram the HP pin as mic or HP according to the input source */
10922 snd_hda_codec_write_cache(codec, 0x15, 0,
10923 AC_VERB_SET_PIN_WIDGET_CONTROL,
10924 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10925 alc262_ultra_automute(codec); /* mute/unmute HP */
10929 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10930 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10931 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10934 .name = "Capture Source",
10935 .info = alc_mux_enum_info,
10936 .get = alc_mux_enum_get,
10937 .put = alc262_ultra_mux_enum_put,
10942 /* We use two mixers depending on the output pin; 0x16 is a mono output
10943 * and thus it's bound with a different mixer.
10944 * This function returns which mixer amp should be used.
10946 static int alc262_check_volbit(hda_nid_t nid)
10950 else if (nid == 0x16)
10956 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
10957 const char *pfx, int *vbits)
10962 vbit = alc262_check_volbit(nid);
10965 if (*vbits & vbit) /* a volume control for this mixer already there */
10969 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
10971 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
10972 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
10975 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
10983 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
10985 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
10986 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
10989 /* add playback controls from the parsed DAC table */
10990 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10991 const struct auto_pin_cfg *cfg)
10997 spec->multiout.num_dacs = 1; /* only use one dac */
10998 spec->multiout.dac_nids = spec->private_dac_nids;
10999 spec->multiout.dac_nids[0] = 2;
11001 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11003 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11007 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11010 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11013 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11017 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11018 alc262_check_volbit(cfg->speaker_pins[0]) |
11019 alc262_check_volbit(cfg->hp_pins[0]);
11020 if (vbits == 1 || vbits == 2)
11021 pfx = "Master"; /* only one mixer is used */
11022 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11027 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11030 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11034 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11041 #define alc262_auto_create_input_ctls \
11042 alc880_auto_create_input_ctls
11045 * generic initialization of ADC, input mixers and output mixers
11047 static struct hda_verb alc262_volume_init_verbs[] = {
11049 * Unmute ADC0-2 and set the default input to mic-in
11051 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11053 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11055 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11056 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11058 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11060 * Note: PASD motherboards uses the Line In 2 as the input for
11061 * front panel mic (mic 2)
11063 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11071 * Set up output mixers (0x0c - 0x0f)
11073 /* set vol=0 to output mixers */
11074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11075 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11078 /* set up input amps for analog loopback */
11079 /* Amp Indices: DAC = 0, mixer = 1 */
11080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11082 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11083 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11084 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11087 /* FIXME: use matrix-type input source selection */
11088 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11089 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11108 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11110 * Unmute ADC0-2 and set the default input to mic-in
11112 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11114 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11116 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11119 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11121 * Note: PASD motherboards uses the Line In 2 as the input for
11122 * front panel mic (mic 2)
11124 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11134 * Set up output mixers (0x0c - 0x0e)
11136 /* set vol=0 to output mixers */
11137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11141 /* set up input amps for analog loopback */
11142 /* Amp Indices: DAC = 0, mixer = 1 */
11143 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11147 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11152 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11154 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11157 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11161 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11164 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11166 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11167 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11169 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11170 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11171 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11174 /* FIXME: use matrix-type input source selection */
11175 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11176 /* Input mixer1: only unmute Mic */
11177 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11178 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11207 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11212 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11214 * Unmute ADC0-2 and set the default input to mic-in
11216 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11217 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11218 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11219 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11220 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11221 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11223 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11225 * Note: PASD motherboards uses the Line In 2 as the input for front
11226 * panel mic (mic 2)
11228 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11238 * Set up output mixers (0x0c - 0x0e)
11240 /* set vol=0 to output mixers */
11241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11245 /* set up input amps for analog loopback */
11246 /* Amp Indices: DAC = 0, mixer = 1 */
11247 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11249 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11251 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11257 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11258 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11260 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11261 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11266 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11267 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11269 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11271 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11272 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11273 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11274 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11276 /* FIXME: use matrix-type input source selection */
11277 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11278 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11284 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11287 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11292 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11300 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11308 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11310 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11311 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11312 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11315 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11317 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11320 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11326 #ifdef CONFIG_SND_HDA_POWER_SAVE
11327 #define alc262_loopbacks alc880_loopbacks
11330 /* pcm configuration: identical with ALC880 */
11331 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11332 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11333 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11334 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11337 * BIOS auto configuration
11339 static int alc262_parse_auto_config(struct hda_codec *codec)
11341 struct alc_spec *spec = codec->spec;
11343 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11345 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11349 if (!spec->autocfg.line_outs) {
11350 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11351 spec->multiout.max_channels = 2;
11352 spec->no_analog = 1;
11355 return 0; /* can't find valid BIOS pin config */
11357 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11360 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11364 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11367 if (spec->autocfg.dig_outs) {
11368 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11369 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11371 if (spec->autocfg.dig_in_pin)
11372 spec->dig_in_nid = ALC262_DIGIN_NID;
11374 if (spec->kctls.list)
11375 add_mixer(spec, spec->kctls.list);
11377 add_verb(spec, alc262_volume_init_verbs);
11378 spec->num_mux_defs = 1;
11379 spec->input_mux = &spec->private_imux[0];
11381 err = alc_auto_add_mic_boost(codec);
11385 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11390 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11391 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11392 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11393 #define alc262_auto_init_input_src alc882_auto_init_input_src
11396 /* init callback for auto-configuration model -- overriding the default init */
11397 static void alc262_auto_init(struct hda_codec *codec)
11399 struct alc_spec *spec = codec->spec;
11400 alc262_auto_init_multi_out(codec);
11401 alc262_auto_init_hp_out(codec);
11402 alc262_auto_init_analog_input(codec);
11403 alc262_auto_init_input_src(codec);
11404 if (spec->unsol_event)
11405 alc_inithook(codec);
11409 * configuration and preset
11411 static const char *alc262_models[ALC262_MODEL_LAST] = {
11412 [ALC262_BASIC] = "basic",
11413 [ALC262_HIPPO] = "hippo",
11414 [ALC262_HIPPO_1] = "hippo_1",
11415 [ALC262_FUJITSU] = "fujitsu",
11416 [ALC262_HP_BPC] = "hp-bpc",
11417 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11418 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11419 [ALC262_HP_RP5700] = "hp-rp5700",
11420 [ALC262_BENQ_ED8] = "benq",
11421 [ALC262_BENQ_T31] = "benq-t31",
11422 [ALC262_SONY_ASSAMD] = "sony-assamd",
11423 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11424 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11425 [ALC262_ULTRA] = "ultra",
11426 [ALC262_LENOVO_3000] = "lenovo-3000",
11427 [ALC262_NEC] = "nec",
11428 [ALC262_TYAN] = "tyan",
11429 [ALC262_AUTO] = "auto",
11432 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11433 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11434 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11435 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11437 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11439 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11441 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11442 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11443 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11444 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11445 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11446 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11447 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11448 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11449 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11450 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11451 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11452 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11453 ALC262_HP_TC_T5735),
11454 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11455 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11456 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11457 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11458 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11459 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11460 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11461 ALC262_SONY_ASSAMD),
11462 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11463 ALC262_TOSHIBA_RX1),
11464 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11465 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11466 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11467 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11468 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11470 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11471 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11472 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11473 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11474 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11478 static struct alc_config_preset alc262_presets[] = {
11480 .mixers = { alc262_base_mixer },
11481 .init_verbs = { alc262_init_verbs },
11482 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11483 .dac_nids = alc262_dac_nids,
11485 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11486 .channel_mode = alc262_modes,
11487 .input_mux = &alc262_capture_source,
11490 .mixers = { alc262_hippo_mixer },
11491 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11492 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11493 .dac_nids = alc262_dac_nids,
11495 .dig_out_nid = ALC262_DIGOUT_NID,
11496 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11497 .channel_mode = alc262_modes,
11498 .input_mux = &alc262_capture_source,
11499 .unsol_event = alc262_hippo_unsol_event,
11500 .setup = alc262_hippo_setup,
11501 .init_hook = alc262_hippo_automute,
11503 [ALC262_HIPPO_1] = {
11504 .mixers = { alc262_hippo1_mixer },
11505 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11506 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11507 .dac_nids = alc262_dac_nids,
11509 .dig_out_nid = ALC262_DIGOUT_NID,
11510 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11511 .channel_mode = alc262_modes,
11512 .input_mux = &alc262_capture_source,
11513 .unsol_event = alc262_hippo_unsol_event,
11514 .setup = alc262_hippo1_setup,
11515 .init_hook = alc262_hippo_automute,
11517 [ALC262_FUJITSU] = {
11518 .mixers = { alc262_fujitsu_mixer },
11519 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11520 alc262_fujitsu_unsol_verbs },
11521 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11522 .dac_nids = alc262_dac_nids,
11524 .dig_out_nid = ALC262_DIGOUT_NID,
11525 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11526 .channel_mode = alc262_modes,
11527 .input_mux = &alc262_fujitsu_capture_source,
11528 .unsol_event = alc262_fujitsu_unsol_event,
11529 .init_hook = alc262_fujitsu_init_hook,
11531 [ALC262_HP_BPC] = {
11532 .mixers = { alc262_HP_BPC_mixer },
11533 .init_verbs = { alc262_HP_BPC_init_verbs },
11534 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11535 .dac_nids = alc262_dac_nids,
11537 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11538 .channel_mode = alc262_modes,
11539 .input_mux = &alc262_HP_capture_source,
11540 .unsol_event = alc262_hp_bpc_unsol_event,
11541 .init_hook = alc262_hp_bpc_automute,
11543 [ALC262_HP_BPC_D7000_WF] = {
11544 .mixers = { alc262_HP_BPC_WildWest_mixer },
11545 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11546 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11547 .dac_nids = alc262_dac_nids,
11549 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11550 .channel_mode = alc262_modes,
11551 .input_mux = &alc262_HP_D7000_capture_source,
11552 .unsol_event = alc262_hp_wildwest_unsol_event,
11553 .init_hook = alc262_hp_wildwest_automute,
11555 [ALC262_HP_BPC_D7000_WL] = {
11556 .mixers = { alc262_HP_BPC_WildWest_mixer,
11557 alc262_HP_BPC_WildWest_option_mixer },
11558 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11559 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11560 .dac_nids = alc262_dac_nids,
11562 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11563 .channel_mode = alc262_modes,
11564 .input_mux = &alc262_HP_D7000_capture_source,
11565 .unsol_event = alc262_hp_wildwest_unsol_event,
11566 .init_hook = alc262_hp_wildwest_automute,
11568 [ALC262_HP_TC_T5735] = {
11569 .mixers = { alc262_hp_t5735_mixer },
11570 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11571 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11572 .dac_nids = alc262_dac_nids,
11574 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11575 .channel_mode = alc262_modes,
11576 .input_mux = &alc262_capture_source,
11577 .unsol_event = alc_automute_amp_unsol_event,
11578 .setup = alc262_hp_t5735_setup,
11579 .init_hook = alc_automute_amp,
11581 [ALC262_HP_RP5700] = {
11582 .mixers = { alc262_hp_rp5700_mixer },
11583 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11584 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11585 .dac_nids = alc262_dac_nids,
11586 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11587 .channel_mode = alc262_modes,
11588 .input_mux = &alc262_hp_rp5700_capture_source,
11590 [ALC262_BENQ_ED8] = {
11591 .mixers = { alc262_base_mixer },
11592 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11593 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11594 .dac_nids = alc262_dac_nids,
11596 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11597 .channel_mode = alc262_modes,
11598 .input_mux = &alc262_capture_source,
11600 [ALC262_SONY_ASSAMD] = {
11601 .mixers = { alc262_sony_mixer },
11602 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11603 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11604 .dac_nids = alc262_dac_nids,
11606 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11607 .channel_mode = alc262_modes,
11608 .input_mux = &alc262_capture_source,
11609 .unsol_event = alc262_hippo_unsol_event,
11610 .setup = alc262_hippo_setup,
11611 .init_hook = alc262_hippo_automute,
11613 [ALC262_BENQ_T31] = {
11614 .mixers = { alc262_benq_t31_mixer },
11615 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11616 alc_hp15_unsol_verbs },
11617 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11618 .dac_nids = alc262_dac_nids,
11620 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11621 .channel_mode = alc262_modes,
11622 .input_mux = &alc262_capture_source,
11623 .unsol_event = alc262_hippo_unsol_event,
11624 .setup = alc262_hippo_setup,
11625 .init_hook = alc262_hippo_automute,
11628 .mixers = { alc262_ultra_mixer },
11629 .cap_mixer = alc262_ultra_capture_mixer,
11630 .init_verbs = { alc262_ultra_verbs },
11631 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11632 .dac_nids = alc262_dac_nids,
11633 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11634 .channel_mode = alc262_modes,
11635 .input_mux = &alc262_ultra_capture_source,
11636 .adc_nids = alc262_adc_nids, /* ADC0 */
11637 .capsrc_nids = alc262_capsrc_nids,
11638 .num_adc_nids = 1, /* single ADC */
11639 .unsol_event = alc262_ultra_unsol_event,
11640 .init_hook = alc262_ultra_automute,
11642 [ALC262_LENOVO_3000] = {
11643 .mixers = { alc262_lenovo_3000_mixer },
11644 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11645 alc262_lenovo_3000_unsol_verbs },
11646 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11647 .dac_nids = alc262_dac_nids,
11649 .dig_out_nid = ALC262_DIGOUT_NID,
11650 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11651 .channel_mode = alc262_modes,
11652 .input_mux = &alc262_fujitsu_capture_source,
11653 .unsol_event = alc262_lenovo_3000_unsol_event,
11656 .mixers = { alc262_nec_mixer },
11657 .init_verbs = { alc262_nec_verbs },
11658 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11659 .dac_nids = alc262_dac_nids,
11661 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11662 .channel_mode = alc262_modes,
11663 .input_mux = &alc262_capture_source,
11665 [ALC262_TOSHIBA_S06] = {
11666 .mixers = { alc262_toshiba_s06_mixer },
11667 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11668 alc262_eapd_verbs },
11669 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11670 .capsrc_nids = alc262_dmic_capsrc_nids,
11671 .dac_nids = alc262_dac_nids,
11672 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11673 .num_adc_nids = 1, /* single ADC */
11674 .dig_out_nid = ALC262_DIGOUT_NID,
11675 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11676 .channel_mode = alc262_modes,
11677 .unsol_event = alc_sku_unsol_event,
11678 .setup = alc262_toshiba_s06_setup,
11679 .init_hook = alc_inithook,
11681 [ALC262_TOSHIBA_RX1] = {
11682 .mixers = { alc262_toshiba_rx1_mixer },
11683 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11685 .dac_nids = alc262_dac_nids,
11687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11688 .channel_mode = alc262_modes,
11689 .input_mux = &alc262_capture_source,
11690 .unsol_event = alc262_hippo_unsol_event,
11691 .setup = alc262_hippo_setup,
11692 .init_hook = alc262_hippo_automute,
11695 .mixers = { alc262_tyan_mixer },
11696 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11697 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11698 .dac_nids = alc262_dac_nids,
11700 .dig_out_nid = ALC262_DIGOUT_NID,
11701 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11702 .channel_mode = alc262_modes,
11703 .input_mux = &alc262_capture_source,
11704 .unsol_event = alc_automute_amp_unsol_event,
11705 .setup = alc262_tyan_setup,
11706 .init_hook = alc_automute_amp,
11710 static int patch_alc262(struct hda_codec *codec)
11712 struct alc_spec *spec;
11716 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11720 codec->spec = spec;
11722 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11727 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11728 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11729 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11730 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11734 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11736 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11740 if (board_config < 0) {
11741 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11743 board_config = ALC262_AUTO;
11746 if (board_config == ALC262_AUTO) {
11747 /* automatic parse from the BIOS config */
11748 err = alc262_parse_auto_config(codec);
11754 "hda_codec: Cannot set up configuration "
11755 "from BIOS. Using base mode...\n");
11756 board_config = ALC262_BASIC;
11760 if (!spec->no_analog) {
11761 err = snd_hda_attach_beep_device(codec, 0x1);
11768 if (board_config != ALC262_AUTO)
11769 setup_preset(codec, &alc262_presets[board_config]);
11771 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11772 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11774 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11775 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11777 if (!spec->adc_nids && spec->input_mux) {
11779 /* check whether the digital-mic has to be supported */
11780 for (i = 0; i < spec->input_mux->num_items; i++) {
11781 if (spec->input_mux->items[i].index >= 9)
11784 if (i < spec->input_mux->num_items) {
11785 /* use only ADC0 */
11786 spec->adc_nids = alc262_dmic_adc_nids;
11787 spec->num_adc_nids = 1;
11788 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11790 /* all analog inputs */
11791 /* check whether NID 0x07 is valid */
11792 unsigned int wcap = get_wcaps(codec, 0x07);
11795 wcap = get_wcaps_type(wcap);
11796 if (wcap != AC_WID_AUD_IN) {
11797 spec->adc_nids = alc262_adc_nids_alt;
11798 spec->num_adc_nids =
11799 ARRAY_SIZE(alc262_adc_nids_alt);
11800 spec->capsrc_nids = alc262_capsrc_nids_alt;
11802 spec->adc_nids = alc262_adc_nids;
11803 spec->num_adc_nids =
11804 ARRAY_SIZE(alc262_adc_nids);
11805 spec->capsrc_nids = alc262_capsrc_nids;
11809 if (!spec->cap_mixer && !spec->no_analog)
11810 set_capture_mixer(codec);
11811 if (!spec->no_analog)
11812 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11814 spec->vmaster_nid = 0x0c;
11816 codec->patch_ops = alc_patch_ops;
11817 if (board_config == ALC262_AUTO)
11818 spec->init_hook = alc262_auto_init;
11819 #ifdef CONFIG_SND_HDA_POWER_SAVE
11820 if (!spec->loopback.amplist)
11821 spec->loopback.amplist = alc262_loopbacks;
11823 codec->proc_widget_hook = print_realtek_coef;
11829 * ALC268 channel source setting (2 channel)
11831 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11832 #define alc268_modes alc260_modes
11834 static hda_nid_t alc268_dac_nids[2] = {
11839 static hda_nid_t alc268_adc_nids[2] = {
11844 static hda_nid_t alc268_adc_nids_alt[1] = {
11849 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11851 static struct snd_kcontrol_new alc268_base_mixer[] = {
11852 /* output mixer control */
11853 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11854 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11857 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11858 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11863 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11864 /* output mixer control */
11865 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11866 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11867 ALC262_HIPPO_MASTER_SWITCH,
11868 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11869 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11870 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11874 /* bind Beep switches of both NID 0x0f and 0x10 */
11875 static struct hda_bind_ctls alc268_bind_beep_sw = {
11876 .ops = &snd_hda_bind_sw,
11878 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11879 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11884 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11885 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11886 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11890 static struct hda_verb alc268_eapd_verbs[] = {
11891 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11892 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11896 /* Toshiba specific */
11897 static struct hda_verb alc268_toshiba_verbs[] = {
11898 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11902 /* Acer specific */
11903 /* bind volumes of both NID 0x02 and 0x03 */
11904 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11905 .ops = &snd_hda_bind_vol,
11907 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11908 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11913 /* mute/unmute internal speaker according to the hp jack and mute state */
11914 static void alc268_acer_automute(struct hda_codec *codec, int force)
11916 struct alc_spec *spec = codec->spec;
11919 if (force || !spec->sense_updated) {
11920 unsigned int present;
11921 present = snd_hda_codec_read(codec, 0x14, 0,
11922 AC_VERB_GET_PIN_SENSE, 0);
11923 spec->jack_present = (present & 0x80000000) != 0;
11924 spec->sense_updated = 1;
11926 if (spec->jack_present)
11927 mute = HDA_AMP_MUTE; /* mute internal speaker */
11928 else /* unmute internal speaker if necessary */
11929 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11930 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11931 HDA_AMP_MUTE, mute);
11935 /* bind hp and internal speaker mute (with plug check) */
11936 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11937 struct snd_ctl_elem_value *ucontrol)
11939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11940 long *valp = ucontrol->value.integer.value;
11943 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11945 alc268_acer_automute(codec, 0);
11949 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11950 /* output mixer control */
11951 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11954 .name = "Master Playback Switch",
11955 .info = snd_hda_mixer_amp_switch_info,
11956 .get = snd_hda_mixer_amp_switch_get,
11957 .put = alc268_acer_master_sw_put,
11958 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11960 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11964 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11965 /* output mixer control */
11966 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11968 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11969 .name = "Master Playback Switch",
11970 .info = snd_hda_mixer_amp_switch_info,
11971 .get = snd_hda_mixer_amp_switch_get,
11972 .put = alc268_acer_master_sw_put,
11973 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11975 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11976 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11977 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11981 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11982 /* output mixer control */
11983 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11986 .name = "Master Playback Switch",
11987 .info = snd_hda_mixer_amp_switch_info,
11988 .get = snd_hda_mixer_amp_switch_get,
11989 .put = alc268_acer_master_sw_put,
11990 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11992 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11993 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11997 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11998 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12001 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12002 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12007 static struct hda_verb alc268_acer_verbs[] = {
12008 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12009 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12014 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12018 /* unsolicited event for HP jack sensing */
12019 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12020 #define alc268_toshiba_setup alc262_hippo_setup
12021 #define alc268_toshiba_automute alc262_hippo_automute
12023 static void alc268_acer_unsol_event(struct hda_codec *codec,
12026 if ((res >> 26) != ALC880_HP_EVENT)
12028 alc268_acer_automute(codec, 1);
12031 static void alc268_acer_init_hook(struct hda_codec *codec)
12033 alc268_acer_automute(codec, 1);
12036 /* toggle speaker-output according to the hp-jack state */
12037 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12039 unsigned int present;
12040 unsigned char bits;
12042 present = snd_hda_codec_read(codec, 0x15, 0,
12043 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12044 bits = present ? AMP_IN_MUTE(0) : 0;
12045 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12046 AMP_IN_MUTE(0), bits);
12047 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12048 AMP_IN_MUTE(0), bits);
12051 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12054 switch (res >> 26) {
12055 case ALC880_HP_EVENT:
12056 alc268_aspire_one_speaker_automute(codec);
12058 case ALC880_MIC_EVENT:
12059 alc_mic_automute(codec);
12064 static void alc268_acer_lc_setup(struct hda_codec *codec)
12066 struct alc_spec *spec = codec->spec;
12067 spec->ext_mic.pin = 0x18;
12068 spec->ext_mic.mux_idx = 0;
12069 spec->int_mic.pin = 0x12;
12070 spec->int_mic.mux_idx = 6;
12071 spec->auto_mic = 1;
12074 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12076 alc268_aspire_one_speaker_automute(codec);
12077 alc_mic_automute(codec);
12080 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12081 /* output mixer control */
12082 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12083 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12084 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12087 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12091 static struct hda_verb alc268_dell_verbs[] = {
12092 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12093 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12099 /* mute/unmute internal speaker according to the hp jack and mute state */
12100 static void alc268_dell_setup(struct hda_codec *codec)
12102 struct alc_spec *spec = codec->spec;
12104 spec->autocfg.hp_pins[0] = 0x15;
12105 spec->autocfg.speaker_pins[0] = 0x14;
12106 spec->ext_mic.pin = 0x18;
12107 spec->ext_mic.mux_idx = 0;
12108 spec->int_mic.pin = 0x19;
12109 spec->int_mic.mux_idx = 1;
12110 spec->auto_mic = 1;
12113 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12114 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12115 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12118 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12119 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12120 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12121 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12125 static struct hda_verb alc267_quanta_il1_verbs[] = {
12126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12127 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12131 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12133 struct alc_spec *spec = codec->spec;
12134 spec->autocfg.hp_pins[0] = 0x15;
12135 spec->autocfg.speaker_pins[0] = 0x14;
12136 spec->ext_mic.pin = 0x18;
12137 spec->ext_mic.mux_idx = 0;
12138 spec->int_mic.pin = 0x19;
12139 spec->int_mic.mux_idx = 1;
12140 spec->auto_mic = 1;
12144 * generic initialization of ADC, input mixers and output mixers
12146 static struct hda_verb alc268_base_init_verbs[] = {
12147 /* Unmute DAC0-1 and set vol = 0 */
12148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12149 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12152 * Set up output mixers (0x0c - 0x0e)
12154 /* set vol=0 to output mixers */
12155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12156 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12158 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12159 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12168 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12172 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12176 /* set PCBEEP vol = 0, mute connections */
12177 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12178 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12179 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12181 /* Unmute Selector 23h,24h and set the default input to mic-in */
12183 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12185 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12192 * generic initialization of ADC, input mixers and output mixers
12194 static struct hda_verb alc268_volume_init_verbs[] = {
12195 /* set output DAC */
12196 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12197 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12200 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12201 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12202 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12203 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12206 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12207 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12209 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12212 /* set PCBEEP vol = 0, mute connections */
12213 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12215 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12220 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12221 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12222 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12226 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12227 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12228 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12233 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12234 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12235 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12236 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12237 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12242 static struct hda_input_mux alc268_capture_source = {
12246 { "Front Mic", 0x1 },
12252 static struct hda_input_mux alc268_acer_capture_source = {
12256 { "Internal Mic", 0x1 },
12261 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12265 { "Internal Mic", 0x6 },
12270 #ifdef CONFIG_SND_DEBUG
12271 static struct snd_kcontrol_new alc268_test_mixer[] = {
12272 /* Volume widgets */
12273 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12274 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12275 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12276 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12277 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12278 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12279 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12280 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12281 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12282 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12283 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12284 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12285 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12286 /* The below appears problematic on some hardwares */
12287 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12288 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12289 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12290 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12291 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12293 /* Modes for retasking pin widgets */
12294 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12295 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12296 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12297 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12299 /* Controls for GPIO pins, assuming they are configured as outputs */
12300 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12301 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12302 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12303 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12305 /* Switches to allow the digital SPDIF output pin to be enabled.
12306 * The ALC268 does not have an SPDIF input.
12308 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12310 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12311 * this output to turn on an external amplifier.
12313 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12314 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12320 /* create input playback/capture controls for the given pin */
12321 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12322 const char *ctlname, int idx)
12338 if (spec->multiout.dac_nids[0] != dac &&
12339 spec->multiout.dac_nids[1] != dac) {
12340 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12341 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12345 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12349 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12350 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12352 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12353 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12359 /* add playback controls from the parsed DAC table */
12360 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12361 const struct auto_pin_cfg *cfg)
12366 spec->multiout.dac_nids = spec->private_dac_nids;
12368 nid = cfg->line_out_pins[0];
12371 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12375 err = alc268_new_analog_output(spec, nid, name, 0);
12380 nid = cfg->speaker_pins[0];
12382 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12383 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12387 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12391 nid = cfg->hp_pins[0];
12393 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12398 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12400 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12401 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12408 /* create playback/capture controls for input pins */
12409 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12410 const struct auto_pin_cfg *cfg)
12412 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12415 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12416 hda_nid_t nid, int pin_type)
12420 alc_set_pin_output(codec, nid, pin_type);
12421 if (nid == 0x14 || nid == 0x16)
12425 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12428 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12430 struct alc_spec *spec = codec->spec;
12431 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12433 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12434 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12438 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12440 struct alc_spec *spec = codec->spec;
12443 pin = spec->autocfg.hp_pins[0];
12445 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12446 pin = spec->autocfg.speaker_pins[0];
12448 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12451 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12453 struct alc_spec *spec = codec->spec;
12454 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12455 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12456 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12457 unsigned int dac_vol1, dac_vol2;
12459 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12460 snd_hda_codec_write(codec, speaker_nid, 0,
12461 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12462 /* mute mixer inputs from 0x1d */
12463 snd_hda_codec_write(codec, 0x0f, 0,
12464 AC_VERB_SET_AMP_GAIN_MUTE,
12466 snd_hda_codec_write(codec, 0x10, 0,
12467 AC_VERB_SET_AMP_GAIN_MUTE,
12470 /* unmute mixer inputs from 0x1d */
12471 snd_hda_codec_write(codec, 0x0f, 0,
12472 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12473 snd_hda_codec_write(codec, 0x10, 0,
12474 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12477 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12478 if (line_nid == 0x14)
12479 dac_vol2 = AMP_OUT_ZERO;
12480 else if (line_nid == 0x15)
12481 dac_vol1 = AMP_OUT_ZERO;
12482 if (hp_nid == 0x14)
12483 dac_vol2 = AMP_OUT_ZERO;
12484 else if (hp_nid == 0x15)
12485 dac_vol1 = AMP_OUT_ZERO;
12486 if (line_nid != 0x16 || hp_nid != 0x16 ||
12487 spec->autocfg.line_out_pins[1] != 0x16 ||
12488 spec->autocfg.line_out_pins[2] != 0x16)
12489 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12491 snd_hda_codec_write(codec, 0x02, 0,
12492 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12493 snd_hda_codec_write(codec, 0x03, 0,
12494 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12497 /* pcm configuration: identical with ALC880 */
12498 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12499 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12500 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12501 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12504 * BIOS auto configuration
12506 static int alc268_parse_auto_config(struct hda_codec *codec)
12508 struct alc_spec *spec = codec->spec;
12510 static hda_nid_t alc268_ignore[] = { 0 };
12512 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12516 if (!spec->autocfg.line_outs) {
12517 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12518 spec->multiout.max_channels = 2;
12519 spec->no_analog = 1;
12522 return 0; /* can't find valid BIOS pin config */
12524 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12527 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12531 spec->multiout.max_channels = 2;
12534 /* digital only support output */
12535 if (spec->autocfg.dig_outs) {
12536 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12537 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12539 if (spec->kctls.list)
12540 add_mixer(spec, spec->kctls.list);
12542 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12543 add_mixer(spec, alc268_beep_mixer);
12545 add_verb(spec, alc268_volume_init_verbs);
12546 spec->num_mux_defs = 2;
12547 spec->input_mux = &spec->private_imux[0];
12549 err = alc_auto_add_mic_boost(codec);
12553 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12558 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12560 /* init callback for auto-configuration model -- overriding the default init */
12561 static void alc268_auto_init(struct hda_codec *codec)
12563 struct alc_spec *spec = codec->spec;
12564 alc268_auto_init_multi_out(codec);
12565 alc268_auto_init_hp_out(codec);
12566 alc268_auto_init_mono_speaker_out(codec);
12567 alc268_auto_init_analog_input(codec);
12568 if (spec->unsol_event)
12569 alc_inithook(codec);
12573 * configuration and preset
12575 static const char *alc268_models[ALC268_MODEL_LAST] = {
12576 [ALC267_QUANTA_IL1] = "quanta-il1",
12577 [ALC268_3ST] = "3stack",
12578 [ALC268_TOSHIBA] = "toshiba",
12579 [ALC268_ACER] = "acer",
12580 [ALC268_ACER_DMIC] = "acer-dmic",
12581 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12582 [ALC268_DELL] = "dell",
12583 [ALC268_ZEPTO] = "zepto",
12584 #ifdef CONFIG_SND_DEBUG
12585 [ALC268_TEST] = "test",
12587 [ALC268_AUTO] = "auto",
12590 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12591 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12592 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12593 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12594 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12595 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12596 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12597 ALC268_ACER_ASPIRE_ONE),
12598 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12599 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12600 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12601 /* almost compatible with toshiba but with optional digital outs;
12602 * auto-probing seems working fine
12604 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12606 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12607 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12608 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12609 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12610 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12611 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12615 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12616 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12617 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12618 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12619 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12624 static struct alc_config_preset alc268_presets[] = {
12625 [ALC267_QUANTA_IL1] = {
12626 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12627 alc268_capture_nosrc_mixer },
12628 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12629 alc267_quanta_il1_verbs },
12630 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12631 .dac_nids = alc268_dac_nids,
12632 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12633 .adc_nids = alc268_adc_nids_alt,
12635 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12636 .channel_mode = alc268_modes,
12637 .unsol_event = alc_sku_unsol_event,
12638 .setup = alc267_quanta_il1_setup,
12639 .init_hook = alc_inithook,
12642 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12643 alc268_beep_mixer },
12644 .init_verbs = { alc268_base_init_verbs },
12645 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12646 .dac_nids = alc268_dac_nids,
12647 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12648 .adc_nids = alc268_adc_nids_alt,
12649 .capsrc_nids = alc268_capsrc_nids,
12651 .dig_out_nid = ALC268_DIGOUT_NID,
12652 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12653 .channel_mode = alc268_modes,
12654 .input_mux = &alc268_capture_source,
12656 [ALC268_TOSHIBA] = {
12657 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12658 alc268_beep_mixer },
12659 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12660 alc268_toshiba_verbs },
12661 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12662 .dac_nids = alc268_dac_nids,
12663 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12664 .adc_nids = alc268_adc_nids_alt,
12665 .capsrc_nids = alc268_capsrc_nids,
12667 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12668 .channel_mode = alc268_modes,
12669 .input_mux = &alc268_capture_source,
12670 .unsol_event = alc268_toshiba_unsol_event,
12671 .setup = alc268_toshiba_setup,
12672 .init_hook = alc268_toshiba_automute,
12675 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12676 alc268_beep_mixer },
12677 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12678 alc268_acer_verbs },
12679 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12680 .dac_nids = alc268_dac_nids,
12681 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12682 .adc_nids = alc268_adc_nids_alt,
12683 .capsrc_nids = alc268_capsrc_nids,
12685 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12686 .channel_mode = alc268_modes,
12687 .input_mux = &alc268_acer_capture_source,
12688 .unsol_event = alc268_acer_unsol_event,
12689 .init_hook = alc268_acer_init_hook,
12691 [ALC268_ACER_DMIC] = {
12692 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12693 alc268_beep_mixer },
12694 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12695 alc268_acer_verbs },
12696 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12697 .dac_nids = alc268_dac_nids,
12698 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12699 .adc_nids = alc268_adc_nids_alt,
12700 .capsrc_nids = alc268_capsrc_nids,
12702 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12703 .channel_mode = alc268_modes,
12704 .input_mux = &alc268_acer_dmic_capture_source,
12705 .unsol_event = alc268_acer_unsol_event,
12706 .init_hook = alc268_acer_init_hook,
12708 [ALC268_ACER_ASPIRE_ONE] = {
12709 .mixers = { alc268_acer_aspire_one_mixer,
12711 alc268_capture_nosrc_mixer },
12712 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12713 alc268_acer_aspire_one_verbs },
12714 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12715 .dac_nids = alc268_dac_nids,
12716 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12717 .adc_nids = alc268_adc_nids_alt,
12718 .capsrc_nids = alc268_capsrc_nids,
12720 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12721 .channel_mode = alc268_modes,
12722 .unsol_event = alc268_acer_lc_unsol_event,
12723 .setup = alc268_acer_lc_setup,
12724 .init_hook = alc268_acer_lc_init_hook,
12727 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12728 alc268_capture_nosrc_mixer },
12729 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12730 alc268_dell_verbs },
12731 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12732 .dac_nids = alc268_dac_nids,
12733 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12734 .adc_nids = alc268_adc_nids_alt,
12735 .capsrc_nids = alc268_capsrc_nids,
12737 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12738 .channel_mode = alc268_modes,
12739 .unsol_event = alc_sku_unsol_event,
12740 .setup = alc268_dell_setup,
12741 .init_hook = alc_inithook,
12744 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12745 alc268_beep_mixer },
12746 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12747 alc268_toshiba_verbs },
12748 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12749 .dac_nids = alc268_dac_nids,
12750 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12751 .adc_nids = alc268_adc_nids_alt,
12752 .capsrc_nids = alc268_capsrc_nids,
12754 .dig_out_nid = ALC268_DIGOUT_NID,
12755 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12756 .channel_mode = alc268_modes,
12757 .input_mux = &alc268_capture_source,
12758 .setup = alc268_toshiba_setup,
12759 .init_hook = alc268_toshiba_automute,
12761 #ifdef CONFIG_SND_DEBUG
12763 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12764 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12765 alc268_volume_init_verbs },
12766 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12767 .dac_nids = alc268_dac_nids,
12768 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12769 .adc_nids = alc268_adc_nids_alt,
12770 .capsrc_nids = alc268_capsrc_nids,
12772 .dig_out_nid = ALC268_DIGOUT_NID,
12773 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12774 .channel_mode = alc268_modes,
12775 .input_mux = &alc268_capture_source,
12780 static int patch_alc268(struct hda_codec *codec)
12782 struct alc_spec *spec;
12784 int i, has_beep, err;
12786 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12790 codec->spec = spec;
12792 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12796 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12797 board_config = snd_hda_check_board_codec_sid_config(codec,
12798 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12800 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12801 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12803 board_config = ALC268_AUTO;
12806 if (board_config == ALC268_AUTO) {
12807 /* automatic parse from the BIOS config */
12808 err = alc268_parse_auto_config(codec);
12814 "hda_codec: Cannot set up configuration "
12815 "from BIOS. Using base mode...\n");
12816 board_config = ALC268_3ST;
12820 if (board_config != ALC268_AUTO)
12821 setup_preset(codec, &alc268_presets[board_config]);
12823 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12824 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12825 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12827 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12830 for (i = 0; i < spec->num_mixers; i++) {
12831 if (spec->mixers[i] == alc268_beep_mixer) {
12838 err = snd_hda_attach_beep_device(codec, 0x1);
12843 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12844 /* override the amp caps for beep generator */
12845 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12846 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12847 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12848 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12849 (0 << AC_AMPCAP_MUTE_SHIFT));
12852 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12853 /* check whether NID 0x07 is valid */
12854 unsigned int wcap = get_wcaps(codec, 0x07);
12857 spec->capsrc_nids = alc268_capsrc_nids;
12859 wcap = get_wcaps_type(wcap);
12860 if (spec->auto_mic ||
12861 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12862 spec->adc_nids = alc268_adc_nids_alt;
12863 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12864 if (spec->auto_mic)
12865 fixup_automic_adc(codec);
12866 if (spec->auto_mic || spec->input_mux->num_items == 1)
12867 add_mixer(spec, alc268_capture_nosrc_mixer);
12869 add_mixer(spec, alc268_capture_alt_mixer);
12871 spec->adc_nids = alc268_adc_nids;
12872 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12873 add_mixer(spec, alc268_capture_mixer);
12875 /* set default input source */
12876 for (i = 0; i < spec->num_adc_nids; i++)
12877 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12878 0, AC_VERB_SET_CONNECT_SEL,
12879 i < spec->num_mux_defs ?
12880 spec->input_mux[i].items[0].index :
12881 spec->input_mux->items[0].index);
12884 spec->vmaster_nid = 0x02;
12886 codec->patch_ops = alc_patch_ops;
12887 if (board_config == ALC268_AUTO)
12888 spec->init_hook = alc268_auto_init;
12890 codec->proc_widget_hook = print_realtek_coef;
12896 * ALC269 channel source setting (2 channel)
12898 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12900 #define alc269_dac_nids alc260_dac_nids
12902 static hda_nid_t alc269_adc_nids[1] = {
12907 static hda_nid_t alc269_capsrc_nids[1] = {
12911 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12915 #define alc269_modes alc260_modes
12916 #define alc269_capture_source alc880_lg_lw_capture_source
12918 static struct snd_kcontrol_new alc269_base_mixer[] = {
12919 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12920 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12922 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12927 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12928 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12930 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12934 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12935 /* output mixer control */
12936 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12939 .name = "Master Playback Switch",
12940 .info = snd_hda_mixer_amp_switch_info,
12941 .get = snd_hda_mixer_amp_switch_get,
12942 .put = alc268_acer_master_sw_put,
12943 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12948 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12949 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12950 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12954 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12955 /* output mixer control */
12956 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12958 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12959 .name = "Master Playback Switch",
12960 .info = snd_hda_mixer_amp_switch_info,
12961 .get = snd_hda_mixer_amp_switch_get,
12962 .put = alc268_acer_master_sw_put,
12963 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12965 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12966 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12968 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12969 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12970 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12971 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12972 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12973 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12977 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12978 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12979 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12985 /* capture mixer elements */
12986 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12987 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12988 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12994 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12996 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12997 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12998 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13001 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13002 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13006 static struct hda_verb alc269_lifebook_verbs[] = {
13007 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13008 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13009 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13011 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13014 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13016 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13020 /* toggle speaker-output according to the hp-jack state */
13021 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13023 unsigned int present;
13024 unsigned char bits;
13026 present = snd_hda_codec_read(codec, 0x15, 0,
13027 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13028 bits = present ? AMP_IN_MUTE(0) : 0;
13029 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13030 AMP_IN_MUTE(0), bits);
13031 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13032 AMP_IN_MUTE(0), bits);
13034 snd_hda_codec_write(codec, 0x20, 0,
13035 AC_VERB_SET_COEF_INDEX, 0x0c);
13036 snd_hda_codec_write(codec, 0x20, 0,
13037 AC_VERB_SET_PROC_COEF, 0x680);
13039 snd_hda_codec_write(codec, 0x20, 0,
13040 AC_VERB_SET_COEF_INDEX, 0x0c);
13041 snd_hda_codec_write(codec, 0x20, 0,
13042 AC_VERB_SET_PROC_COEF, 0x480);
13045 /* toggle speaker-output according to the hp-jacks state */
13046 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13048 unsigned int present;
13049 unsigned char bits;
13051 /* Check laptop headphone socket */
13052 present = snd_hda_codec_read(codec, 0x15, 0,
13053 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13055 /* Check port replicator headphone socket */
13056 present |= snd_hda_codec_read(codec, 0x1a, 0,
13057 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13059 bits = present ? AMP_IN_MUTE(0) : 0;
13060 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13061 AMP_IN_MUTE(0), bits);
13062 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13063 AMP_IN_MUTE(0), bits);
13065 snd_hda_codec_write(codec, 0x20, 0,
13066 AC_VERB_SET_COEF_INDEX, 0x0c);
13067 snd_hda_codec_write(codec, 0x20, 0,
13068 AC_VERB_SET_PROC_COEF, 0x680);
13070 snd_hda_codec_write(codec, 0x20, 0,
13071 AC_VERB_SET_COEF_INDEX, 0x0c);
13072 snd_hda_codec_write(codec, 0x20, 0,
13073 AC_VERB_SET_PROC_COEF, 0x480);
13076 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13078 unsigned int present_laptop;
13079 unsigned int present_dock;
13081 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13082 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13084 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13085 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13087 /* Laptop mic port overrides dock mic port, design decision */
13089 snd_hda_codec_write(codec, 0x23, 0,
13090 AC_VERB_SET_CONNECT_SEL, 0x3);
13091 if (present_laptop)
13092 snd_hda_codec_write(codec, 0x23, 0,
13093 AC_VERB_SET_CONNECT_SEL, 0x0);
13094 if (!present_dock && !present_laptop)
13095 snd_hda_codec_write(codec, 0x23, 0,
13096 AC_VERB_SET_CONNECT_SEL, 0x1);
13099 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13102 switch (res >> 26) {
13103 case ALC880_HP_EVENT:
13104 alc269_quanta_fl1_speaker_automute(codec);
13106 case ALC880_MIC_EVENT:
13107 alc_mic_automute(codec);
13112 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13115 if ((res >> 26) == ALC880_HP_EVENT)
13116 alc269_lifebook_speaker_automute(codec);
13117 if ((res >> 26) == ALC880_MIC_EVENT)
13118 alc269_lifebook_mic_autoswitch(codec);
13121 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13123 struct alc_spec *spec = codec->spec;
13124 spec->ext_mic.pin = 0x18;
13125 spec->ext_mic.mux_idx = 0;
13126 spec->int_mic.pin = 0x19;
13127 spec->int_mic.mux_idx = 1;
13128 spec->auto_mic = 1;
13131 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13133 alc269_quanta_fl1_speaker_automute(codec);
13134 alc_mic_automute(codec);
13137 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13139 alc269_lifebook_speaker_automute(codec);
13140 alc269_lifebook_mic_autoswitch(codec);
13143 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13144 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13145 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13146 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13147 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13148 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13149 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13150 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13154 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13155 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13156 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13157 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13159 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13160 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13164 /* toggle speaker-output according to the hp-jack state */
13165 static void alc269_speaker_automute(struct hda_codec *codec)
13167 unsigned int present;
13168 unsigned char bits;
13170 present = snd_hda_codec_read(codec, 0x15, 0,
13171 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13172 bits = present ? AMP_IN_MUTE(0) : 0;
13173 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13174 AMP_IN_MUTE(0), bits);
13175 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13176 AMP_IN_MUTE(0), bits);
13179 /* unsolicited event for HP jack sensing */
13180 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13183 switch (res >> 26) {
13184 case ALC880_HP_EVENT:
13185 alc269_speaker_automute(codec);
13187 case ALC880_MIC_EVENT:
13188 alc_mic_automute(codec);
13193 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13195 struct alc_spec *spec = codec->spec;
13196 spec->ext_mic.pin = 0x18;
13197 spec->ext_mic.mux_idx = 0;
13198 spec->int_mic.pin = 0x12;
13199 spec->int_mic.mux_idx = 5;
13200 spec->auto_mic = 1;
13203 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13205 struct alc_spec *spec = codec->spec;
13206 spec->ext_mic.pin = 0x18;
13207 spec->ext_mic.mux_idx = 0;
13208 spec->int_mic.pin = 0x19;
13209 spec->int_mic.mux_idx = 1;
13210 spec->auto_mic = 1;
13213 static void alc269_eeepc_inithook(struct hda_codec *codec)
13215 alc269_speaker_automute(codec);
13216 alc_mic_automute(codec);
13220 * generic initialization of ADC, input mixers and output mixers
13222 static struct hda_verb alc269_init_verbs[] = {
13224 * Unmute ADC0 and set the default input to mic-in
13226 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13228 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13229 * analog-loopback mixer widget
13230 * Note: PASD motherboards uses the Line In 2 as the input for
13231 * front panel mic (mic 2)
13233 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13241 * Set up output mixers (0x0c - 0x0e)
13243 /* set vol=0 to output mixers */
13244 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13245 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13247 /* set up input amps for analog loopback */
13248 /* Amp Indices: DAC = 0, mixer = 1 */
13249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13258 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13259 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13260 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13261 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13264 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13266 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13267 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13270 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13272 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13273 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13275 /* FIXME: use matrix-type input source selection */
13276 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13277 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13284 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13285 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13289 #define alc269_auto_create_multi_out_ctls \
13290 alc268_auto_create_multi_out_ctls
13291 #define alc269_auto_create_input_ctls \
13292 alc268_auto_create_input_ctls
13294 #ifdef CONFIG_SND_HDA_POWER_SAVE
13295 #define alc269_loopbacks alc880_loopbacks
13298 /* pcm configuration: identical with ALC880 */
13299 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13300 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13301 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13302 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13304 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13308 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13309 /* NID is set in alc_build_pcms */
13311 .open = alc880_playback_pcm_open,
13312 .prepare = alc880_playback_pcm_prepare,
13313 .cleanup = alc880_playback_pcm_cleanup
13317 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13321 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13322 /* NID is set in alc_build_pcms */
13326 * BIOS auto configuration
13328 static int alc269_parse_auto_config(struct hda_codec *codec)
13330 struct alc_spec *spec = codec->spec;
13332 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13334 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13339 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13342 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13346 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13348 if (spec->autocfg.dig_outs)
13349 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13351 if (spec->kctls.list)
13352 add_mixer(spec, spec->kctls.list);
13354 add_verb(spec, alc269_init_verbs);
13355 spec->num_mux_defs = 1;
13356 spec->input_mux = &spec->private_imux[0];
13357 /* set default input source */
13358 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13359 0, AC_VERB_SET_CONNECT_SEL,
13360 spec->input_mux->items[0].index);
13362 err = alc_auto_add_mic_boost(codec);
13366 if (!spec->cap_mixer && !spec->no_analog)
13367 set_capture_mixer(codec);
13369 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13374 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13375 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13376 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13379 /* init callback for auto-configuration model -- overriding the default init */
13380 static void alc269_auto_init(struct hda_codec *codec)
13382 struct alc_spec *spec = codec->spec;
13383 alc269_auto_init_multi_out(codec);
13384 alc269_auto_init_hp_out(codec);
13385 alc269_auto_init_analog_input(codec);
13386 if (spec->unsol_event)
13387 alc_inithook(codec);
13391 * configuration and preset
13393 static const char *alc269_models[ALC269_MODEL_LAST] = {
13394 [ALC269_BASIC] = "basic",
13395 [ALC269_QUANTA_FL1] = "quanta",
13396 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13397 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13398 [ALC269_FUJITSU] = "fujitsu",
13399 [ALC269_LIFEBOOK] = "lifebook",
13400 [ALC269_AUTO] = "auto",
13403 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13404 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13405 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13406 ALC269_ASUS_EEEPC_P703),
13407 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13408 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13409 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13410 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13411 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13412 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13413 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13414 ALC269_ASUS_EEEPC_P901),
13415 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13416 ALC269_ASUS_EEEPC_P901),
13417 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13418 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13419 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13423 static struct alc_config_preset alc269_presets[] = {
13425 .mixers = { alc269_base_mixer },
13426 .init_verbs = { alc269_init_verbs },
13427 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13428 .dac_nids = alc269_dac_nids,
13430 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13431 .channel_mode = alc269_modes,
13432 .input_mux = &alc269_capture_source,
13434 [ALC269_QUANTA_FL1] = {
13435 .mixers = { alc269_quanta_fl1_mixer },
13436 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13437 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13438 .dac_nids = alc269_dac_nids,
13440 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13441 .channel_mode = alc269_modes,
13442 .input_mux = &alc269_capture_source,
13443 .unsol_event = alc269_quanta_fl1_unsol_event,
13444 .setup = alc269_quanta_fl1_setup,
13445 .init_hook = alc269_quanta_fl1_init_hook,
13447 [ALC269_ASUS_EEEPC_P703] = {
13448 .mixers = { alc269_eeepc_mixer },
13449 .cap_mixer = alc269_epc_capture_mixer,
13450 .init_verbs = { alc269_init_verbs,
13451 alc269_eeepc_amic_init_verbs },
13452 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13453 .dac_nids = alc269_dac_nids,
13455 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13456 .channel_mode = alc269_modes,
13457 .unsol_event = alc269_eeepc_unsol_event,
13458 .setup = alc269_eeepc_amic_setup,
13459 .init_hook = alc269_eeepc_inithook,
13461 [ALC269_ASUS_EEEPC_P901] = {
13462 .mixers = { alc269_eeepc_mixer },
13463 .cap_mixer = alc269_epc_capture_mixer,
13464 .init_verbs = { alc269_init_verbs,
13465 alc269_eeepc_dmic_init_verbs },
13466 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13467 .dac_nids = alc269_dac_nids,
13469 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13470 .channel_mode = alc269_modes,
13471 .unsol_event = alc269_eeepc_unsol_event,
13472 .setup = alc269_eeepc_dmic_setup,
13473 .init_hook = alc269_eeepc_inithook,
13475 [ALC269_FUJITSU] = {
13476 .mixers = { alc269_fujitsu_mixer },
13477 .cap_mixer = alc269_epc_capture_mixer,
13478 .init_verbs = { alc269_init_verbs,
13479 alc269_eeepc_dmic_init_verbs },
13480 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13481 .dac_nids = alc269_dac_nids,
13483 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13484 .channel_mode = alc269_modes,
13485 .unsol_event = alc269_eeepc_unsol_event,
13486 .setup = alc269_eeepc_dmic_setup,
13487 .init_hook = alc269_eeepc_inithook,
13489 [ALC269_LIFEBOOK] = {
13490 .mixers = { alc269_lifebook_mixer },
13491 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13492 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13493 .dac_nids = alc269_dac_nids,
13495 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13496 .channel_mode = alc269_modes,
13497 .input_mux = &alc269_capture_source,
13498 .unsol_event = alc269_lifebook_unsol_event,
13499 .init_hook = alc269_lifebook_init_hook,
13503 static int patch_alc269(struct hda_codec *codec)
13505 struct alc_spec *spec;
13509 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13513 codec->spec = spec;
13515 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13517 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13521 if (board_config < 0) {
13522 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13524 board_config = ALC269_AUTO;
13527 if (board_config == ALC269_AUTO) {
13528 /* automatic parse from the BIOS config */
13529 err = alc269_parse_auto_config(codec);
13535 "hda_codec: Cannot set up configuration "
13536 "from BIOS. Using base mode...\n");
13537 board_config = ALC269_BASIC;
13541 err = snd_hda_attach_beep_device(codec, 0x1);
13547 if (board_config != ALC269_AUTO)
13548 setup_preset(codec, &alc269_presets[board_config]);
13550 if (codec->subsystem_id == 0x17aa3bf8) {
13551 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13552 * fix the sample rate of analog I/O to 44.1kHz
13554 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13555 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13557 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13558 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13560 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13561 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13563 spec->adc_nids = alc269_adc_nids;
13564 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13565 spec->capsrc_nids = alc269_capsrc_nids;
13566 if (!spec->cap_mixer)
13567 set_capture_mixer(codec);
13568 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13570 spec->vmaster_nid = 0x02;
13572 codec->patch_ops = alc_patch_ops;
13573 if (board_config == ALC269_AUTO)
13574 spec->init_hook = alc269_auto_init;
13575 #ifdef CONFIG_SND_HDA_POWER_SAVE
13576 if (!spec->loopback.amplist)
13577 spec->loopback.amplist = alc269_loopbacks;
13579 codec->proc_widget_hook = print_realtek_coef;
13585 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13589 * set the path ways for 2 channel output
13590 * need to set the codec line out and mic 1 pin widgets to inputs
13592 static struct hda_verb alc861_threestack_ch2_init[] = {
13593 /* set pin widget 1Ah (line in) for input */
13594 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13595 /* set pin widget 18h (mic1/2) for input, for mic also enable
13598 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13603 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13609 * need to set the codec line out and mic 1 pin widgets to outputs
13611 static struct hda_verb alc861_threestack_ch6_init[] = {
13612 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13613 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13614 /* set pin widget 18h (mic1) for output (CLFE)*/
13615 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13617 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13618 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13620 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13622 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13623 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13628 static struct hda_channel_mode alc861_threestack_modes[2] = {
13629 { 2, alc861_threestack_ch2_init },
13630 { 6, alc861_threestack_ch6_init },
13632 /* Set mic1 as input and unmute the mixer */
13633 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13634 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13635 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13638 /* Set mic1 as output and mute mixer */
13639 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13640 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13641 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13645 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13646 { 2, alc861_uniwill_m31_ch2_init },
13647 { 4, alc861_uniwill_m31_ch4_init },
13650 /* Set mic1 and line-in as input and unmute the mixer */
13651 static struct hda_verb alc861_asus_ch2_init[] = {
13652 /* set pin widget 1Ah (line in) for input */
13653 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13654 /* set pin widget 18h (mic1/2) for input, for mic also enable
13657 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13659 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13661 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13662 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13666 /* Set mic1 nad line-in as output and mute mixer */
13667 static struct hda_verb alc861_asus_ch6_init[] = {
13668 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13669 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13670 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13671 /* set pin widget 18h (mic1) for output (CLFE)*/
13672 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13673 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13674 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13675 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13677 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13679 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13680 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13685 static struct hda_channel_mode alc861_asus_modes[2] = {
13686 { 2, alc861_asus_ch2_init },
13687 { 6, alc861_asus_ch6_init },
13692 static struct snd_kcontrol_new alc861_base_mixer[] = {
13693 /* output mixer control */
13694 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13695 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13696 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13700 /*Input mixer control */
13701 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13702 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13703 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13704 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13705 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13706 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13708 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13715 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13716 /* output mixer control */
13717 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13718 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13719 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13720 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13721 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13723 /* Input mixer control */
13724 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13725 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13726 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13727 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13728 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13729 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13731 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13732 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13733 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13737 .name = "Channel Mode",
13738 .info = alc_ch_mode_info,
13739 .get = alc_ch_mode_get,
13740 .put = alc_ch_mode_put,
13741 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13746 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13747 /* output mixer control */
13748 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13749 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13750 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13755 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13756 /* output mixer control */
13757 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13758 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13759 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13760 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13761 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13763 /* Input mixer control */
13764 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13765 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13766 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13767 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13768 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13769 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13771 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13772 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13773 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13776 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13777 .name = "Channel Mode",
13778 .info = alc_ch_mode_info,
13779 .get = alc_ch_mode_get,
13780 .put = alc_ch_mode_put,
13781 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13786 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13787 /* output mixer control */
13788 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13789 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13790 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13791 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13792 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13794 /* Input mixer control */
13795 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13796 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13797 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13798 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13799 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13800 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13802 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13803 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13808 .name = "Channel Mode",
13809 .info = alc_ch_mode_info,
13810 .get = alc_ch_mode_get,
13811 .put = alc_ch_mode_put,
13812 .private_value = ARRAY_SIZE(alc861_asus_modes),
13817 /* additional mixer */
13818 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13819 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13820 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13825 * generic initialization of ADC, input mixers and output mixers
13827 static struct hda_verb alc861_base_init_verbs[] = {
13829 * Unmute ADC0 and set the default input to mic-in
13831 /* port-A for surround (rear panel) */
13832 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13833 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13834 /* port-B for mic-in (rear panel) with vref */
13835 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13836 /* port-C for line-in (rear panel) */
13837 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13838 /* port-D for Front */
13839 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13840 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13841 /* port-E for HP out (front panel) */
13842 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13843 /* route front PCM to HP */
13844 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13845 /* port-F for mic-in (front panel) with vref */
13846 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13847 /* port-G for CLFE (rear panel) */
13848 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13849 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13850 /* port-H for side (rear panel) */
13851 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13852 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13854 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13855 /* route front mic to ADC1*/
13856 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13859 /* Unmute DAC0~3 & spdif out*/
13860 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13861 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13862 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13863 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13866 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13867 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13868 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13869 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13870 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13872 /* Unmute Stereo Mixer 15 */
13873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13878 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13880 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13881 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 /* hp used DAC 3 (Front) */
13887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13893 static struct hda_verb alc861_threestack_init_verbs[] = {
13895 * Unmute ADC0 and set the default input to mic-in
13897 /* port-A for surround (rear panel) */
13898 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13899 /* port-B for mic-in (rear panel) with vref */
13900 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13901 /* port-C for line-in (rear panel) */
13902 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13903 /* port-D for Front */
13904 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13905 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13906 /* port-E for HP out (front panel) */
13907 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13908 /* route front PCM to HP */
13909 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13910 /* port-F for mic-in (front panel) with vref */
13911 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13912 /* port-G for CLFE (rear panel) */
13913 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13914 /* port-H for side (rear panel) */
13915 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13917 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13918 /* route front mic to ADC1*/
13919 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13920 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13921 /* Unmute DAC0~3 & spdif out*/
13922 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13923 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13924 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13925 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13929 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13930 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13931 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13932 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13934 /* Unmute Stereo Mixer 15 */
13935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 /* hp used DAC 3 (Front) */
13949 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13954 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13956 * Unmute ADC0 and set the default input to mic-in
13958 /* port-A for surround (rear panel) */
13959 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13960 /* port-B for mic-in (rear panel) with vref */
13961 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13962 /* port-C for line-in (rear panel) */
13963 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13964 /* port-D for Front */
13965 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13966 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13967 /* port-E for HP out (front panel) */
13968 /* this has to be set to VREF80 */
13969 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13970 /* route front PCM to HP */
13971 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13972 /* port-F for mic-in (front panel) with vref */
13973 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13974 /* port-G for CLFE (rear panel) */
13975 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13976 /* port-H for side (rear panel) */
13977 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13979 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13980 /* route front mic to ADC1*/
13981 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13983 /* Unmute DAC0~3 & spdif out*/
13984 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13985 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13986 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13987 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13990 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13991 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13993 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13994 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13996 /* Unmute Stereo Mixer 15 */
13997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14002 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14004 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14005 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14010 /* hp used DAC 3 (Front) */
14011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14016 static struct hda_verb alc861_asus_init_verbs[] = {
14018 * Unmute ADC0 and set the default input to mic-in
14020 /* port-A for surround (rear panel)
14021 * according to codec#0 this is the HP jack
14023 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14024 /* route front PCM to HP */
14025 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14026 /* port-B for mic-in (rear panel) with vref */
14027 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14028 /* port-C for line-in (rear panel) */
14029 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14030 /* port-D for Front */
14031 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14032 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14033 /* port-E for HP out (front panel) */
14034 /* this has to be set to VREF80 */
14035 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14036 /* route front PCM to HP */
14037 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14038 /* port-F for mic-in (front panel) with vref */
14039 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14040 /* port-G for CLFE (rear panel) */
14041 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14042 /* port-H for side (rear panel) */
14043 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14045 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14046 /* route front mic to ADC1*/
14047 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14049 /* Unmute DAC0~3 & spdif out*/
14050 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14052 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14055 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14056 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14057 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14058 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14059 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14061 /* Unmute Stereo Mixer 15 */
14062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14068 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14069 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14070 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14071 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14072 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14075 /* hp used DAC 3 (Front) */
14076 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14077 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14081 /* additional init verbs for ASUS laptops */
14082 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14083 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14084 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14089 * generic initialization of ADC, input mixers and output mixers
14091 static struct hda_verb alc861_auto_init_verbs[] = {
14093 * Unmute ADC0 and set the default input to mic-in
14095 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14098 /* Unmute DAC0~3 & spdif out*/
14099 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14100 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14102 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14105 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14106 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14107 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14108 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14111 /* Unmute Stereo Mixer 15 */
14112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14120 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14124 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14126 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14127 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14130 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14131 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14132 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14133 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14135 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14140 static struct hda_verb alc861_toshiba_init_verbs[] = {
14141 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14146 /* toggle speaker-output according to the hp-jack state */
14147 static void alc861_toshiba_automute(struct hda_codec *codec)
14149 unsigned int present;
14151 present = snd_hda_codec_read(codec, 0x0f, 0,
14152 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14153 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14154 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14155 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14156 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14159 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14162 if ((res >> 26) == ALC880_HP_EVENT)
14163 alc861_toshiba_automute(codec);
14166 /* pcm configuration: identical with ALC880 */
14167 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14168 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14169 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14170 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14173 #define ALC861_DIGOUT_NID 0x07
14175 static struct hda_channel_mode alc861_8ch_modes[1] = {
14179 static hda_nid_t alc861_dac_nids[4] = {
14180 /* front, surround, clfe, side */
14181 0x03, 0x06, 0x05, 0x04
14184 static hda_nid_t alc660_dac_nids[3] = {
14185 /* front, clfe, surround */
14189 static hda_nid_t alc861_adc_nids[1] = {
14194 static struct hda_input_mux alc861_capture_source = {
14198 { "Front Mic", 0x3 },
14205 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14207 struct alc_spec *spec = codec->spec;
14208 hda_nid_t mix, srcs[5];
14211 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14213 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14216 for (i = 0; i < num; i++) {
14218 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14219 if (type != AC_WID_AUD_OUT)
14221 for (j = 0; j < spec->multiout.num_dacs; j++)
14222 if (spec->multiout.dac_nids[j] == srcs[i])
14224 if (j >= spec->multiout.num_dacs)
14230 /* fill in the dac_nids table from the parsed pin configuration */
14231 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14232 const struct auto_pin_cfg *cfg)
14234 struct alc_spec *spec = codec->spec;
14236 hda_nid_t nid, dac;
14238 spec->multiout.dac_nids = spec->private_dac_nids;
14239 for (i = 0; i < cfg->line_outs; i++) {
14240 nid = cfg->line_out_pins[i];
14241 dac = alc861_look_for_dac(codec, nid);
14244 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14249 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14250 hda_nid_t nid, unsigned int chs)
14252 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14253 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14256 /* add playback controls from the parsed DAC table */
14257 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14258 const struct auto_pin_cfg *cfg)
14260 struct alc_spec *spec = codec->spec;
14261 static const char *chname[4] = {
14262 "Front", "Surround", NULL /*CLFE*/, "Side"
14267 if (cfg->line_outs == 1) {
14268 const char *pfx = NULL;
14271 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14274 nid = spec->multiout.dac_nids[0];
14275 return alc861_create_out_sw(codec, pfx, nid, 3);
14279 for (i = 0; i < cfg->line_outs; i++) {
14280 nid = spec->multiout.dac_nids[i];
14285 err = alc861_create_out_sw(codec, "Center", nid, 1);
14288 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14292 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14300 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14302 struct alc_spec *spec = codec->spec;
14309 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14310 nid = alc861_look_for_dac(codec, pin);
14312 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14315 spec->multiout.hp_nid = nid;
14321 /* create playback/capture controls for input pins */
14322 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14323 const struct auto_pin_cfg *cfg)
14325 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14328 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14330 int pin_type, hda_nid_t dac)
14332 hda_nid_t mix, srcs[5];
14335 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14337 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14339 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14341 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14344 for (i = 0; i < num; i++) {
14346 if (srcs[i] == dac || srcs[i] == 0x15)
14347 mute = AMP_IN_UNMUTE(i);
14349 mute = AMP_IN_MUTE(i);
14350 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14355 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14357 struct alc_spec *spec = codec->spec;
14360 for (i = 0; i < spec->autocfg.line_outs; i++) {
14361 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14362 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14364 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14365 spec->multiout.dac_nids[i]);
14369 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14371 struct alc_spec *spec = codec->spec;
14373 if (spec->autocfg.hp_outs)
14374 alc861_auto_set_output_and_unmute(codec,
14375 spec->autocfg.hp_pins[0],
14377 spec->multiout.hp_nid);
14378 if (spec->autocfg.speaker_outs)
14379 alc861_auto_set_output_and_unmute(codec,
14380 spec->autocfg.speaker_pins[0],
14382 spec->multiout.dac_nids[0]);
14385 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14387 struct alc_spec *spec = codec->spec;
14390 for (i = 0; i < AUTO_PIN_LAST; i++) {
14391 hda_nid_t nid = spec->autocfg.input_pins[i];
14392 if (nid >= 0x0c && nid <= 0x11)
14393 alc_set_input_pin(codec, nid, i);
14397 /* parse the BIOS configuration and set up the alc_spec */
14398 /* return 1 if successful, 0 if the proper config is not found,
14399 * or a negative error code
14401 static int alc861_parse_auto_config(struct hda_codec *codec)
14403 struct alc_spec *spec = codec->spec;
14405 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14407 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14411 if (!spec->autocfg.line_outs)
14412 return 0; /* can't find valid BIOS pin config */
14414 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14417 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14420 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14423 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14427 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14429 if (spec->autocfg.dig_outs)
14430 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14432 if (spec->kctls.list)
14433 add_mixer(spec, spec->kctls.list);
14435 add_verb(spec, alc861_auto_init_verbs);
14437 spec->num_mux_defs = 1;
14438 spec->input_mux = &spec->private_imux[0];
14440 spec->adc_nids = alc861_adc_nids;
14441 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14442 set_capture_mixer(codec);
14444 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14449 /* additional initialization for auto-configuration model */
14450 static void alc861_auto_init(struct hda_codec *codec)
14452 struct alc_spec *spec = codec->spec;
14453 alc861_auto_init_multi_out(codec);
14454 alc861_auto_init_hp_out(codec);
14455 alc861_auto_init_analog_input(codec);
14456 if (spec->unsol_event)
14457 alc_inithook(codec);
14460 #ifdef CONFIG_SND_HDA_POWER_SAVE
14461 static struct hda_amp_list alc861_loopbacks[] = {
14462 { 0x15, HDA_INPUT, 0 },
14463 { 0x15, HDA_INPUT, 1 },
14464 { 0x15, HDA_INPUT, 2 },
14465 { 0x15, HDA_INPUT, 3 },
14472 * configuration and preset
14474 static const char *alc861_models[ALC861_MODEL_LAST] = {
14475 [ALC861_3ST] = "3stack",
14476 [ALC660_3ST] = "3stack-660",
14477 [ALC861_3ST_DIG] = "3stack-dig",
14478 [ALC861_6ST_DIG] = "6stack-dig",
14479 [ALC861_UNIWILL_M31] = "uniwill-m31",
14480 [ALC861_TOSHIBA] = "toshiba",
14481 [ALC861_ASUS] = "asus",
14482 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14483 [ALC861_AUTO] = "auto",
14486 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14487 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14488 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14489 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14490 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14491 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14492 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14493 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14494 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14495 * Any other models that need this preset?
14497 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14498 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14499 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14500 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14501 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14502 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14503 /* FIXME: the below seems conflict */
14504 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14505 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14506 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14510 static struct alc_config_preset alc861_presets[] = {
14512 .mixers = { alc861_3ST_mixer },
14513 .init_verbs = { alc861_threestack_init_verbs },
14514 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14515 .dac_nids = alc861_dac_nids,
14516 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14517 .channel_mode = alc861_threestack_modes,
14519 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14520 .adc_nids = alc861_adc_nids,
14521 .input_mux = &alc861_capture_source,
14523 [ALC861_3ST_DIG] = {
14524 .mixers = { alc861_base_mixer },
14525 .init_verbs = { alc861_threestack_init_verbs },
14526 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14527 .dac_nids = alc861_dac_nids,
14528 .dig_out_nid = ALC861_DIGOUT_NID,
14529 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14530 .channel_mode = alc861_threestack_modes,
14532 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14533 .adc_nids = alc861_adc_nids,
14534 .input_mux = &alc861_capture_source,
14536 [ALC861_6ST_DIG] = {
14537 .mixers = { alc861_base_mixer },
14538 .init_verbs = { alc861_base_init_verbs },
14539 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14540 .dac_nids = alc861_dac_nids,
14541 .dig_out_nid = ALC861_DIGOUT_NID,
14542 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14543 .channel_mode = alc861_8ch_modes,
14544 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14545 .adc_nids = alc861_adc_nids,
14546 .input_mux = &alc861_capture_source,
14549 .mixers = { alc861_3ST_mixer },
14550 .init_verbs = { alc861_threestack_init_verbs },
14551 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14552 .dac_nids = alc660_dac_nids,
14553 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14554 .channel_mode = alc861_threestack_modes,
14556 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14557 .adc_nids = alc861_adc_nids,
14558 .input_mux = &alc861_capture_source,
14560 [ALC861_UNIWILL_M31] = {
14561 .mixers = { alc861_uniwill_m31_mixer },
14562 .init_verbs = { alc861_uniwill_m31_init_verbs },
14563 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14564 .dac_nids = alc861_dac_nids,
14565 .dig_out_nid = ALC861_DIGOUT_NID,
14566 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14567 .channel_mode = alc861_uniwill_m31_modes,
14569 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14570 .adc_nids = alc861_adc_nids,
14571 .input_mux = &alc861_capture_source,
14573 [ALC861_TOSHIBA] = {
14574 .mixers = { alc861_toshiba_mixer },
14575 .init_verbs = { alc861_base_init_verbs,
14576 alc861_toshiba_init_verbs },
14577 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14578 .dac_nids = alc861_dac_nids,
14579 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14580 .channel_mode = alc883_3ST_2ch_modes,
14581 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14582 .adc_nids = alc861_adc_nids,
14583 .input_mux = &alc861_capture_source,
14584 .unsol_event = alc861_toshiba_unsol_event,
14585 .init_hook = alc861_toshiba_automute,
14588 .mixers = { alc861_asus_mixer },
14589 .init_verbs = { alc861_asus_init_verbs },
14590 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14591 .dac_nids = alc861_dac_nids,
14592 .dig_out_nid = ALC861_DIGOUT_NID,
14593 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14594 .channel_mode = alc861_asus_modes,
14597 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14598 .adc_nids = alc861_adc_nids,
14599 .input_mux = &alc861_capture_source,
14601 [ALC861_ASUS_LAPTOP] = {
14602 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14603 .init_verbs = { alc861_asus_init_verbs,
14604 alc861_asus_laptop_init_verbs },
14605 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14606 .dac_nids = alc861_dac_nids,
14607 .dig_out_nid = ALC861_DIGOUT_NID,
14608 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14609 .channel_mode = alc883_3ST_2ch_modes,
14611 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14612 .adc_nids = alc861_adc_nids,
14613 .input_mux = &alc861_capture_source,
14618 static int patch_alc861(struct hda_codec *codec)
14620 struct alc_spec *spec;
14624 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14628 codec->spec = spec;
14630 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14634 if (board_config < 0) {
14635 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14637 board_config = ALC861_AUTO;
14640 if (board_config == ALC861_AUTO) {
14641 /* automatic parse from the BIOS config */
14642 err = alc861_parse_auto_config(codec);
14648 "hda_codec: Cannot set up configuration "
14649 "from BIOS. Using base mode...\n");
14650 board_config = ALC861_3ST_DIG;
14654 err = snd_hda_attach_beep_device(codec, 0x23);
14660 if (board_config != ALC861_AUTO)
14661 setup_preset(codec, &alc861_presets[board_config]);
14663 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14664 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14666 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14667 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14669 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14671 spec->vmaster_nid = 0x03;
14673 codec->patch_ops = alc_patch_ops;
14674 if (board_config == ALC861_AUTO)
14675 spec->init_hook = alc861_auto_init;
14676 #ifdef CONFIG_SND_HDA_POWER_SAVE
14677 if (!spec->loopback.amplist)
14678 spec->loopback.amplist = alc861_loopbacks;
14680 codec->proc_widget_hook = print_realtek_coef;
14686 * ALC861-VD support
14690 * In addition, an independent DAC
14692 #define ALC861VD_DIGOUT_NID 0x06
14694 static hda_nid_t alc861vd_dac_nids[4] = {
14695 /* front, surr, clfe, side surr */
14696 0x02, 0x03, 0x04, 0x05
14699 /* dac_nids for ALC660vd are in a different order - according to
14700 * Realtek's driver.
14701 * This should probably result in a different mixer for 6stack models
14702 * of ALC660vd codecs, but for now there is only 3stack mixer
14703 * - and it is the same as in 861vd.
14704 * adc_nids in ALC660vd are (is) the same as in 861vd
14706 static hda_nid_t alc660vd_dac_nids[3] = {
14707 /* front, rear, clfe, rear_surr */
14711 static hda_nid_t alc861vd_adc_nids[1] = {
14716 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14719 /* FIXME: should be a matrix-type input source selection */
14720 static struct hda_input_mux alc861vd_capture_source = {
14724 { "Front Mic", 0x1 },
14730 static struct hda_input_mux alc861vd_dallas_capture_source = {
14733 { "Ext Mic", 0x0 },
14734 { "Int Mic", 0x1 },
14738 static struct hda_input_mux alc861vd_hp_capture_source = {
14741 { "Front Mic", 0x0 },
14742 { "ATAPI Mic", 0x1 },
14749 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14756 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14757 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14758 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14759 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14760 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14767 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14768 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14769 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14770 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14771 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14775 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14776 { 6, alc861vd_6stack_ch6_init },
14777 { 8, alc861vd_6stack_ch8_init },
14780 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14783 .name = "Channel Mode",
14784 .info = alc_ch_mode_info,
14785 .get = alc_ch_mode_get,
14786 .put = alc_ch_mode_put,
14791 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14792 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14794 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14795 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14796 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14798 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14799 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14801 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14803 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14805 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14806 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14808 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14809 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 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_3st_mixer[] = {
14831 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14832 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14840 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14844 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14845 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14847 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14848 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14853 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14854 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14855 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14856 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14864 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14865 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14866 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14868 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14869 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14874 /* Pin assignment: Speaker=0x14, HP = 0x15,
14875 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14877 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14878 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14879 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14880 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14881 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14882 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14883 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14884 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14885 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14886 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14887 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14891 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14892 * Front Mic=0x18, ATAPI Mic = 0x19,
14894 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14895 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14896 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14897 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14898 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14901 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14902 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14908 * generic initialization of ADC, input mixers and output mixers
14910 static struct hda_verb alc861vd_volume_init_verbs[] = {
14912 * Unmute ADC0 and set the default input to mic-in
14914 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14917 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14918 * the analog-loopback mixer widget
14920 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14927 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14934 * Set up output mixers (0x02 - 0x05)
14936 /* set vol=0 to output mixers */
14937 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14938 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14939 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14940 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14942 /* set up input amps for analog loopback */
14943 /* Amp Indices: DAC = 0, mixer = 1 */
14944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14950 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14951 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14957 * 3-stack pin configuration:
14958 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14960 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14962 * Set pin mode and muting
14964 /* set front pin widgets 0x14 for output */
14965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14967 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14969 /* Mic (rear) pin: input vref at 80% */
14970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14971 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14972 /* Front Mic pin: input vref at 80% */
14973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14975 /* Line In pin: input */
14976 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14978 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14980 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14981 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14982 /* CD pin widget for input */
14983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14989 * 6-stack pin configuration:
14991 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14993 * Set pin mode and muting
14995 /* set front pin widgets 0x14 for output */
14996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14997 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14998 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15000 /* Rear Pin: output 1 (0x0d) */
15001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15004 /* CLFE Pin: output 2 (0x0e) */
15005 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15007 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15008 /* Side Pin: output 3 (0x0f) */
15009 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15010 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15011 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15013 /* Mic (rear) pin: input vref at 80% */
15014 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15016 /* Front Mic pin: input vref at 80% */
15017 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15019 /* Line In pin: input */
15020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15022 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15025 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15026 /* CD pin widget for input */
15027 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15032 static struct hda_verb alc861vd_eapd_verbs[] = {
15033 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15037 static struct hda_verb alc660vd_eapd_verbs[] = {
15038 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15039 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15043 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15047 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15048 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15052 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15054 unsigned int present;
15055 unsigned char bits;
15057 present = snd_hda_codec_read(codec, 0x18, 0,
15058 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15059 bits = present ? HDA_AMP_MUTE : 0;
15060 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15061 HDA_AMP_MUTE, bits);
15064 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15066 struct alc_spec *spec = codec->spec;
15067 spec->autocfg.hp_pins[0] = 0x1b;
15068 spec->autocfg.speaker_pins[0] = 0x14;
15071 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15073 alc_automute_amp(codec);
15074 alc861vd_lenovo_mic_automute(codec);
15077 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15080 switch (res >> 26) {
15081 case ALC880_MIC_EVENT:
15082 alc861vd_lenovo_mic_automute(codec);
15085 alc_automute_amp_unsol_event(codec, res);
15090 static struct hda_verb alc861vd_dallas_verbs[] = {
15091 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15092 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15093 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15094 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15102 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15103 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15109 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15110 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15111 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15112 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15114 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15117 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15118 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15120 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15121 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15125 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15126 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15129 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15130 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15135 /* toggle speaker-output according to the hp-jack state */
15136 static void alc861vd_dallas_setup(struct hda_codec *codec)
15138 struct alc_spec *spec = codec->spec;
15140 spec->autocfg.hp_pins[0] = 0x15;
15141 spec->autocfg.speaker_pins[0] = 0x14;
15144 #ifdef CONFIG_SND_HDA_POWER_SAVE
15145 #define alc861vd_loopbacks alc880_loopbacks
15148 /* pcm configuration: identical with ALC880 */
15149 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15150 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15151 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15152 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15155 * configuration and preset
15157 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15158 [ALC660VD_3ST] = "3stack-660",
15159 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15160 [ALC660VD_ASUS_V1S] = "asus-v1s",
15161 [ALC861VD_3ST] = "3stack",
15162 [ALC861VD_3ST_DIG] = "3stack-digout",
15163 [ALC861VD_6ST_DIG] = "6stack-digout",
15164 [ALC861VD_LENOVO] = "lenovo",
15165 [ALC861VD_DALLAS] = "dallas",
15166 [ALC861VD_HP] = "hp",
15167 [ALC861VD_AUTO] = "auto",
15170 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15171 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15172 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15173 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15174 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15175 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15176 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15177 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15178 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15179 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15180 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15181 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15182 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15183 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15184 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15185 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15189 static struct alc_config_preset alc861vd_presets[] = {
15191 .mixers = { alc861vd_3st_mixer },
15192 .init_verbs = { alc861vd_volume_init_verbs,
15193 alc861vd_3stack_init_verbs },
15194 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15195 .dac_nids = alc660vd_dac_nids,
15196 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15197 .channel_mode = alc861vd_3stack_2ch_modes,
15198 .input_mux = &alc861vd_capture_source,
15200 [ALC660VD_3ST_DIG] = {
15201 .mixers = { alc861vd_3st_mixer },
15202 .init_verbs = { alc861vd_volume_init_verbs,
15203 alc861vd_3stack_init_verbs },
15204 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15205 .dac_nids = alc660vd_dac_nids,
15206 .dig_out_nid = ALC861VD_DIGOUT_NID,
15207 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15208 .channel_mode = alc861vd_3stack_2ch_modes,
15209 .input_mux = &alc861vd_capture_source,
15212 .mixers = { alc861vd_3st_mixer },
15213 .init_verbs = { alc861vd_volume_init_verbs,
15214 alc861vd_3stack_init_verbs },
15215 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15216 .dac_nids = alc861vd_dac_nids,
15217 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15218 .channel_mode = alc861vd_3stack_2ch_modes,
15219 .input_mux = &alc861vd_capture_source,
15221 [ALC861VD_3ST_DIG] = {
15222 .mixers = { alc861vd_3st_mixer },
15223 .init_verbs = { alc861vd_volume_init_verbs,
15224 alc861vd_3stack_init_verbs },
15225 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15226 .dac_nids = alc861vd_dac_nids,
15227 .dig_out_nid = ALC861VD_DIGOUT_NID,
15228 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15229 .channel_mode = alc861vd_3stack_2ch_modes,
15230 .input_mux = &alc861vd_capture_source,
15232 [ALC861VD_6ST_DIG] = {
15233 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15234 .init_verbs = { alc861vd_volume_init_verbs,
15235 alc861vd_6stack_init_verbs },
15236 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15237 .dac_nids = alc861vd_dac_nids,
15238 .dig_out_nid = ALC861VD_DIGOUT_NID,
15239 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15240 .channel_mode = alc861vd_6stack_modes,
15241 .input_mux = &alc861vd_capture_source,
15243 [ALC861VD_LENOVO] = {
15244 .mixers = { alc861vd_lenovo_mixer },
15245 .init_verbs = { alc861vd_volume_init_verbs,
15246 alc861vd_3stack_init_verbs,
15247 alc861vd_eapd_verbs,
15248 alc861vd_lenovo_unsol_verbs },
15249 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15250 .dac_nids = alc660vd_dac_nids,
15251 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15252 .channel_mode = alc861vd_3stack_2ch_modes,
15253 .input_mux = &alc861vd_capture_source,
15254 .unsol_event = alc861vd_lenovo_unsol_event,
15255 .setup = alc861vd_lenovo_setup,
15256 .init_hook = alc861vd_lenovo_init_hook,
15258 [ALC861VD_DALLAS] = {
15259 .mixers = { alc861vd_dallas_mixer },
15260 .init_verbs = { alc861vd_dallas_verbs },
15261 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15262 .dac_nids = alc861vd_dac_nids,
15263 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15264 .channel_mode = alc861vd_3stack_2ch_modes,
15265 .input_mux = &alc861vd_dallas_capture_source,
15266 .unsol_event = alc_automute_amp_unsol_event,
15267 .setup = alc861vd_dallas_setup,
15268 .init_hook = alc_automute_amp,
15271 .mixers = { alc861vd_hp_mixer },
15272 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15273 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15274 .dac_nids = alc861vd_dac_nids,
15275 .dig_out_nid = ALC861VD_DIGOUT_NID,
15276 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15277 .channel_mode = alc861vd_3stack_2ch_modes,
15278 .input_mux = &alc861vd_hp_capture_source,
15279 .unsol_event = alc_automute_amp_unsol_event,
15280 .setup = alc861vd_dallas_setup,
15281 .init_hook = alc_automute_amp,
15283 [ALC660VD_ASUS_V1S] = {
15284 .mixers = { alc861vd_lenovo_mixer },
15285 .init_verbs = { alc861vd_volume_init_verbs,
15286 alc861vd_3stack_init_verbs,
15287 alc861vd_eapd_verbs,
15288 alc861vd_lenovo_unsol_verbs },
15289 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15290 .dac_nids = alc660vd_dac_nids,
15291 .dig_out_nid = ALC861VD_DIGOUT_NID,
15292 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15293 .channel_mode = alc861vd_3stack_2ch_modes,
15294 .input_mux = &alc861vd_capture_source,
15295 .unsol_event = alc861vd_lenovo_unsol_event,
15296 .setup = alc861vd_lenovo_setup,
15297 .init_hook = alc861vd_lenovo_init_hook,
15302 * BIOS auto configuration
15304 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15305 const struct auto_pin_cfg *cfg)
15307 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15311 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15312 hda_nid_t nid, int pin_type, int dac_idx)
15314 alc_set_pin_output(codec, nid, pin_type);
15317 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15319 struct alc_spec *spec = codec->spec;
15322 for (i = 0; i <= HDA_SIDE; i++) {
15323 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15324 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15326 alc861vd_auto_set_output_and_unmute(codec, nid,
15332 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15334 struct alc_spec *spec = codec->spec;
15337 pin = spec->autocfg.hp_pins[0];
15338 if (pin) /* connect to front and use dac 0 */
15339 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15340 pin = spec->autocfg.speaker_pins[0];
15342 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15345 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15347 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15349 struct alc_spec *spec = codec->spec;
15352 for (i = 0; i < AUTO_PIN_LAST; i++) {
15353 hda_nid_t nid = spec->autocfg.input_pins[i];
15354 if (alc_is_input_pin(codec, nid)) {
15355 alc_set_input_pin(codec, nid, i);
15356 if (nid != ALC861VD_PIN_CD_NID &&
15357 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15358 snd_hda_codec_write(codec, nid, 0,
15359 AC_VERB_SET_AMP_GAIN_MUTE,
15365 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15367 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15368 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15370 /* add playback controls from the parsed DAC table */
15371 /* Based on ALC880 version. But ALC861VD has separate,
15372 * different NIDs for mute/unmute switch and volume control */
15373 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15374 const struct auto_pin_cfg *cfg)
15376 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15377 hda_nid_t nid_v, nid_s;
15380 for (i = 0; i < cfg->line_outs; i++) {
15381 if (!spec->multiout.dac_nids[i])
15383 nid_v = alc861vd_idx_to_mixer_vol(
15385 spec->multiout.dac_nids[i]));
15386 nid_s = alc861vd_idx_to_mixer_switch(
15388 spec->multiout.dac_nids[i]));
15392 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15394 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15398 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15400 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15404 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15406 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15410 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15412 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15418 if (cfg->line_outs == 1 &&
15419 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15426 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15427 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15431 if (cfg->line_outs == 1 &&
15432 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15434 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15435 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15444 /* add playback controls for speaker and HP outputs */
15445 /* Based on ALC880 version. But ALC861VD has separate,
15446 * different NIDs for mute/unmute switch and volume control */
15447 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15448 hda_nid_t pin, const char *pfx)
15450 hda_nid_t nid_v, nid_s;
15456 if (alc880_is_fixed_pin(pin)) {
15457 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15458 /* specify the DAC as the extra output */
15459 if (!spec->multiout.hp_nid)
15460 spec->multiout.hp_nid = nid_v;
15462 spec->multiout.extra_out_nid[0] = nid_v;
15463 /* control HP volume/switch on the output mixer amp */
15464 nid_v = alc861vd_idx_to_mixer_vol(
15465 alc880_fixed_pin_idx(pin));
15466 nid_s = alc861vd_idx_to_mixer_switch(
15467 alc880_fixed_pin_idx(pin));
15469 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15470 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15473 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15474 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15477 } else if (alc880_is_multi_pin(pin)) {
15478 /* set manual connection */
15479 /* we have only a switch on HP-out PIN */
15480 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15481 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15488 /* parse the BIOS configuration and set up the alc_spec
15489 * return 1 if successful, 0 if the proper config is not found,
15490 * or a negative error code
15491 * Based on ALC880 version - had to change it to override
15492 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15493 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15495 struct alc_spec *spec = codec->spec;
15497 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15499 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15503 if (!spec->autocfg.line_outs)
15504 return 0; /* can't find valid BIOS pin config */
15506 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15509 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15512 err = alc861vd_auto_create_extra_out(spec,
15513 spec->autocfg.speaker_pins[0],
15517 err = alc861vd_auto_create_extra_out(spec,
15518 spec->autocfg.hp_pins[0],
15522 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15526 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15528 if (spec->autocfg.dig_outs)
15529 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15531 if (spec->kctls.list)
15532 add_mixer(spec, spec->kctls.list);
15534 add_verb(spec, alc861vd_volume_init_verbs);
15536 spec->num_mux_defs = 1;
15537 spec->input_mux = &spec->private_imux[0];
15539 err = alc_auto_add_mic_boost(codec);
15543 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15548 /* additional initialization for auto-configuration model */
15549 static void alc861vd_auto_init(struct hda_codec *codec)
15551 struct alc_spec *spec = codec->spec;
15552 alc861vd_auto_init_multi_out(codec);
15553 alc861vd_auto_init_hp_out(codec);
15554 alc861vd_auto_init_analog_input(codec);
15555 alc861vd_auto_init_input_src(codec);
15556 if (spec->unsol_event)
15557 alc_inithook(codec);
15561 ALC660VD_FIX_ASUS_GPIO1
15565 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15566 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15567 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15568 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15572 static const struct alc_fixup alc861vd_fixups[] = {
15573 [ALC660VD_FIX_ASUS_GPIO1] = {
15574 .verbs = alc660vd_fix_asus_gpio1_verbs,
15578 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15579 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15583 static int patch_alc861vd(struct hda_codec *codec)
15585 struct alc_spec *spec;
15586 int err, board_config;
15588 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15592 codec->spec = spec;
15594 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15598 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15599 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15601 board_config = ALC861VD_AUTO;
15604 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15606 if (board_config == ALC861VD_AUTO) {
15607 /* automatic parse from the BIOS config */
15608 err = alc861vd_parse_auto_config(codec);
15614 "hda_codec: Cannot set up configuration "
15615 "from BIOS. Using base mode...\n");
15616 board_config = ALC861VD_3ST;
15620 err = snd_hda_attach_beep_device(codec, 0x23);
15626 if (board_config != ALC861VD_AUTO)
15627 setup_preset(codec, &alc861vd_presets[board_config]);
15629 if (codec->vendor_id == 0x10ec0660) {
15630 /* always turn on EAPD */
15631 add_verb(spec, alc660vd_eapd_verbs);
15634 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15635 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15637 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15638 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15640 if (!spec->adc_nids) {
15641 spec->adc_nids = alc861vd_adc_nids;
15642 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15644 if (!spec->capsrc_nids)
15645 spec->capsrc_nids = alc861vd_capsrc_nids;
15647 set_capture_mixer(codec);
15648 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15650 spec->vmaster_nid = 0x02;
15652 codec->patch_ops = alc_patch_ops;
15654 if (board_config == ALC861VD_AUTO)
15655 spec->init_hook = alc861vd_auto_init;
15656 #ifdef CONFIG_SND_HDA_POWER_SAVE
15657 if (!spec->loopback.amplist)
15658 spec->loopback.amplist = alc861vd_loopbacks;
15660 codec->proc_widget_hook = print_realtek_coef;
15668 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15669 * configuration. Each pin widget can choose any input DACs and a mixer.
15670 * Each ADC is connected from a mixer of all inputs. This makes possible
15671 * 6-channel independent captures.
15673 * In addition, an independent DAC for the multi-playback (not used in this
15676 #define ALC662_DIGOUT_NID 0x06
15677 #define ALC662_DIGIN_NID 0x0a
15679 static hda_nid_t alc662_dac_nids[4] = {
15680 /* front, rear, clfe, rear_surr */
15684 static hda_nid_t alc272_dac_nids[2] = {
15688 static hda_nid_t alc662_adc_nids[2] = {
15693 static hda_nid_t alc272_adc_nids[1] = {
15698 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15699 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15703 /* FIXME: should be a matrix-type input source selection */
15704 static struct hda_input_mux alc662_capture_source = {
15708 { "Front Mic", 0x1 },
15714 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15722 static struct hda_input_mux alc663_capture_source = {
15726 { "Front Mic", 0x1 },
15731 #if 0 /* set to 1 for testing other input sources below */
15732 static struct hda_input_mux alc272_nc10_capture_source = {
15735 { "Autoselect Mic", 0x0 },
15736 { "Internal Mic", 0x1 },
15737 { "In-0x02", 0x2 },
15738 { "In-0x03", 0x3 },
15739 { "In-0x04", 0x4 },
15740 { "In-0x05", 0x5 },
15741 { "In-0x06", 0x6 },
15742 { "In-0x07", 0x7 },
15743 { "In-0x08", 0x8 },
15744 { "In-0x09", 0x9 },
15745 { "In-0x0a", 0x0a },
15746 { "In-0x0b", 0x0b },
15747 { "In-0x0c", 0x0c },
15748 { "In-0x0d", 0x0d },
15749 { "In-0x0e", 0x0e },
15750 { "In-0x0f", 0x0f },
15758 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15765 static struct hda_verb alc662_3ST_ch2_init[] = {
15766 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15767 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15776 static struct hda_verb alc662_3ST_ch6_init[] = {
15777 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15778 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15779 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15780 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15781 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15782 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15786 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15787 { 2, alc662_3ST_ch2_init },
15788 { 6, alc662_3ST_ch6_init },
15794 static struct hda_verb alc662_sixstack_ch6_init[] = {
15795 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15796 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15797 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15804 static struct hda_verb alc662_sixstack_ch8_init[] = {
15805 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15806 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15807 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15811 static struct hda_channel_mode alc662_5stack_modes[2] = {
15812 { 2, alc662_sixstack_ch6_init },
15813 { 6, alc662_sixstack_ch8_init },
15816 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15817 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15820 static struct snd_kcontrol_new alc662_base_mixer[] = {
15821 /* output mixer control */
15822 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15823 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15824 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15825 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15826 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15827 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15828 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15829 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15830 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15832 /*Input mixer control */
15833 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15834 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15835 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15836 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15837 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15838 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15839 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15840 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15844 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15845 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15846 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15848 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15849 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15854 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15855 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15859 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15860 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15861 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15862 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15863 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15864 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15865 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15866 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15867 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15868 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15872 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15880 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15881 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15882 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15883 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15884 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15889 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15893 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15894 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15895 ALC262_HIPPO_MASTER_SWITCH,
15897 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15898 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15899 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15901 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15902 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15903 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15907 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15908 ALC262_HIPPO_MASTER_SWITCH,
15909 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15910 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15911 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15912 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15913 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15914 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15915 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15921 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15922 .ops = &snd_hda_bind_vol,
15924 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15925 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15930 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15931 .ops = &snd_hda_bind_sw,
15933 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15934 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15939 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15940 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15941 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15947 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15948 .ops = &snd_hda_bind_sw,
15950 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15951 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15952 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15957 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15958 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15959 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15962 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15963 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15968 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15969 .ops = &snd_hda_bind_sw,
15971 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15972 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15973 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15978 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15979 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15980 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15983 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15984 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15988 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15989 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15990 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15994 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15995 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15999 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16000 .ops = &snd_hda_bind_vol,
16002 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16003 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16008 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16009 .ops = &snd_hda_bind_sw,
16011 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16012 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16017 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16018 HDA_BIND_VOL("Master Playback Volume",
16019 &alc663_asus_two_bind_master_vol),
16020 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16021 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16028 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16029 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16030 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16031 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16038 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16040 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16041 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16042 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16047 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16048 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16052 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16053 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16054 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16059 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16060 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16062 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16066 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16068 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16069 .name = "Channel Mode",
16070 .info = alc_ch_mode_info,
16071 .get = alc_ch_mode_get,
16072 .put = alc_ch_mode_put,
16077 static struct hda_verb alc662_init_verbs[] = {
16078 /* ADC: mute amp left and right */
16079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16080 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16081 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16091 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16096 /* Front Pin: output 0 (0x0c) */
16097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16098 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16100 /* Rear Pin: output 1 (0x0d) */
16101 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16102 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16104 /* CLFE Pin: output 2 (0x0e) */
16105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16106 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16108 /* Mic (rear) pin: input vref at 80% */
16109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16111 /* Front Mic pin: input vref at 80% */
16112 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16113 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16114 /* Line In pin: input */
16115 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16117 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16120 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16121 /* CD pin widget for input */
16122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16124 /* FIXME: use matrix-type input source selection */
16125 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16130 /* always trun on EAPD */
16131 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16132 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16137 static struct hda_verb alc662_sue_init_verbs[] = {
16138 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16139 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16143 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16144 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16145 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16149 /* Set Unsolicited Event*/
16150 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16151 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16152 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16157 * generic initialization of ADC, input mixers and output mixers
16159 static struct hda_verb alc662_auto_init_verbs[] = {
16161 * Unmute ADC and set the default input to mic-in
16163 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16166 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16168 * Note: PASD motherboards uses the Line In 2 as the input for front
16169 * panel mic (mic 2)
16171 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16179 * Set up output mixers (0x0c - 0x0f)
16181 /* set vol=0 to output mixers */
16182 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16183 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16184 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16186 /* set up input amps for analog loopback */
16187 /* Amp Indices: DAC = 0, mixer = 1 */
16188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16196 /* FIXME: use matrix-type input source selection */
16197 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16204 /* additional verbs for ALC663 */
16205 static struct hda_verb alc663_auto_init_verbs[] = {
16206 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16207 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16211 static struct hda_verb alc663_m51va_init_verbs[] = {
16212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16213 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16214 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16215 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16216 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16220 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16224 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16225 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16226 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16227 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16230 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16231 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16235 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16236 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16237 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16238 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16239 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16240 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16242 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16243 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16247 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16250 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16258 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16259 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16260 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16261 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16262 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16265 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16268 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16269 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16270 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16274 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16275 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16276 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16277 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16278 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16279 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16284 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16285 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16286 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16290 static struct hda_verb alc663_g71v_init_verbs[] = {
16291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16292 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16293 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
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, 0x00}, /* Headphone */
16299 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
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 hda_verb alc663_g50v_init_verbs[] = {
16306 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16307 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16308 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16310 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16311 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16315 static struct hda_verb alc662_ecs_init_verbs[] = {
16316 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16318 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16319 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16323 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16324 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16325 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16327 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16328 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16329 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16330 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16334 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16338 static struct hda_verb alc272_dell_init_verbs[] = {
16339 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16340 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16343 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16344 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16345 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16348 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16349 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16353 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16354 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16355 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16359 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16360 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16361 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16365 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16367 unsigned int present;
16368 unsigned char bits;
16370 present = snd_hda_codec_read(codec, 0x14, 0,
16371 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16372 bits = present ? HDA_AMP_MUTE : 0;
16373 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16374 HDA_AMP_MUTE, bits);
16377 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16379 unsigned int present;
16380 unsigned char bits;
16382 present = snd_hda_codec_read(codec, 0x1b, 0,
16383 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16384 bits = present ? HDA_AMP_MUTE : 0;
16385 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16386 HDA_AMP_MUTE, bits);
16387 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16388 HDA_AMP_MUTE, bits);
16391 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16394 if ((res >> 26) == ALC880_HP_EVENT)
16395 alc662_lenovo_101e_all_automute(codec);
16396 if ((res >> 26) == ALC880_FRONT_EVENT)
16397 alc662_lenovo_101e_ispeaker_automute(codec);
16400 /* unsolicited event for HP jack sensing */
16401 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16404 if ((res >> 26) == ALC880_MIC_EVENT)
16405 alc_mic_automute(codec);
16407 alc262_hippo_unsol_event(codec, res);
16410 static void alc662_eeepc_setup(struct hda_codec *codec)
16412 struct alc_spec *spec = codec->spec;
16414 alc262_hippo1_setup(codec);
16415 spec->ext_mic.pin = 0x18;
16416 spec->ext_mic.mux_idx = 0;
16417 spec->int_mic.pin = 0x19;
16418 spec->int_mic.mux_idx = 1;
16419 spec->auto_mic = 1;
16422 static void alc662_eeepc_inithook(struct hda_codec *codec)
16424 alc262_hippo_automute(codec);
16425 alc_mic_automute(codec);
16428 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16430 struct alc_spec *spec = codec->spec;
16432 spec->autocfg.hp_pins[0] = 0x14;
16433 spec->autocfg.speaker_pins[0] = 0x1b;
16436 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16438 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16440 unsigned int present;
16441 unsigned char bits;
16443 present = snd_hda_codec_read(codec, 0x21, 0,
16444 AC_VERB_GET_PIN_SENSE, 0)
16445 & AC_PINSENSE_PRESENCE;
16446 bits = present ? HDA_AMP_MUTE : 0;
16447 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16448 AMP_IN_MUTE(0), bits);
16449 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16450 AMP_IN_MUTE(0), bits);
16453 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16455 unsigned int present;
16456 unsigned char bits;
16458 present = snd_hda_codec_read(codec, 0x21, 0,
16459 AC_VERB_GET_PIN_SENSE, 0)
16460 & AC_PINSENSE_PRESENCE;
16461 bits = present ? HDA_AMP_MUTE : 0;
16462 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16463 AMP_IN_MUTE(0), bits);
16464 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16465 AMP_IN_MUTE(0), bits);
16466 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16467 AMP_IN_MUTE(0), bits);
16468 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16469 AMP_IN_MUTE(0), bits);
16472 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16474 unsigned int present;
16475 unsigned char bits;
16477 present = snd_hda_codec_read(codec, 0x15, 0,
16478 AC_VERB_GET_PIN_SENSE, 0)
16479 & AC_PINSENSE_PRESENCE;
16480 bits = present ? HDA_AMP_MUTE : 0;
16481 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16482 AMP_IN_MUTE(0), bits);
16483 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16484 AMP_IN_MUTE(0), bits);
16485 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16486 AMP_IN_MUTE(0), bits);
16487 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16488 AMP_IN_MUTE(0), bits);
16491 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16493 unsigned int present;
16494 unsigned char bits;
16496 present = snd_hda_codec_read(codec, 0x1b, 0,
16497 AC_VERB_GET_PIN_SENSE, 0)
16498 & AC_PINSENSE_PRESENCE;
16499 bits = present ? 0 : PIN_OUT;
16500 snd_hda_codec_write(codec, 0x14, 0,
16501 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16504 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16506 unsigned int present1, present2;
16508 present1 = snd_hda_codec_read(codec, 0x21, 0,
16509 AC_VERB_GET_PIN_SENSE, 0)
16510 & AC_PINSENSE_PRESENCE;
16511 present2 = snd_hda_codec_read(codec, 0x15, 0,
16512 AC_VERB_GET_PIN_SENSE, 0)
16513 & AC_PINSENSE_PRESENCE;
16515 if (present1 || present2) {
16516 snd_hda_codec_write_cache(codec, 0x14, 0,
16517 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16519 snd_hda_codec_write_cache(codec, 0x14, 0,
16520 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16524 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16526 unsigned int present1, present2;
16528 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16529 AC_VERB_GET_PIN_SENSE, 0)
16530 & AC_PINSENSE_PRESENCE;
16531 present2 = snd_hda_codec_read(codec, 0x15, 0,
16532 AC_VERB_GET_PIN_SENSE, 0)
16533 & AC_PINSENSE_PRESENCE;
16535 if (present1 || present2) {
16536 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16537 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16538 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16539 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16541 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16542 AMP_IN_MUTE(0), 0);
16543 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16544 AMP_IN_MUTE(0), 0);
16548 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16551 switch (res >> 26) {
16552 case ALC880_HP_EVENT:
16553 alc663_m51va_speaker_automute(codec);
16555 case ALC880_MIC_EVENT:
16556 alc_mic_automute(codec);
16561 static void alc663_m51va_setup(struct hda_codec *codec)
16563 struct alc_spec *spec = codec->spec;
16564 spec->ext_mic.pin = 0x18;
16565 spec->ext_mic.mux_idx = 0;
16566 spec->int_mic.pin = 0x12;
16567 spec->int_mic.mux_idx = 1;
16568 spec->auto_mic = 1;
16571 static void alc663_m51va_inithook(struct hda_codec *codec)
16573 alc663_m51va_speaker_automute(codec);
16574 alc_mic_automute(codec);
16577 /* ***************** Mode1 ******************************/
16578 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16579 #define alc663_mode1_setup alc663_m51va_setup
16580 #define alc663_mode1_inithook alc663_m51va_inithook
16582 /* ***************** Mode2 ******************************/
16583 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16586 switch (res >> 26) {
16587 case ALC880_HP_EVENT:
16588 alc662_f5z_speaker_automute(codec);
16590 case ALC880_MIC_EVENT:
16591 alc_mic_automute(codec);
16596 #define alc662_mode2_setup alc663_m51va_setup
16598 static void alc662_mode2_inithook(struct hda_codec *codec)
16600 alc662_f5z_speaker_automute(codec);
16601 alc_mic_automute(codec);
16603 /* ***************** Mode3 ******************************/
16604 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16607 switch (res >> 26) {
16608 case ALC880_HP_EVENT:
16609 alc663_two_hp_m1_speaker_automute(codec);
16611 case ALC880_MIC_EVENT:
16612 alc_mic_automute(codec);
16617 #define alc663_mode3_setup alc663_m51va_setup
16619 static void alc663_mode3_inithook(struct hda_codec *codec)
16621 alc663_two_hp_m1_speaker_automute(codec);
16622 alc_mic_automute(codec);
16624 /* ***************** Mode4 ******************************/
16625 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16628 switch (res >> 26) {
16629 case ALC880_HP_EVENT:
16630 alc663_21jd_two_speaker_automute(codec);
16632 case ALC880_MIC_EVENT:
16633 alc_mic_automute(codec);
16638 #define alc663_mode4_setup alc663_m51va_setup
16640 static void alc663_mode4_inithook(struct hda_codec *codec)
16642 alc663_21jd_two_speaker_automute(codec);
16643 alc_mic_automute(codec);
16645 /* ***************** Mode5 ******************************/
16646 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16649 switch (res >> 26) {
16650 case ALC880_HP_EVENT:
16651 alc663_15jd_two_speaker_automute(codec);
16653 case ALC880_MIC_EVENT:
16654 alc_mic_automute(codec);
16659 #define alc663_mode5_setup alc663_m51va_setup
16661 static void alc663_mode5_inithook(struct hda_codec *codec)
16663 alc663_15jd_two_speaker_automute(codec);
16664 alc_mic_automute(codec);
16666 /* ***************** Mode6 ******************************/
16667 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16670 switch (res >> 26) {
16671 case ALC880_HP_EVENT:
16672 alc663_two_hp_m2_speaker_automute(codec);
16674 case ALC880_MIC_EVENT:
16675 alc_mic_automute(codec);
16680 #define alc663_mode6_setup alc663_m51va_setup
16682 static void alc663_mode6_inithook(struct hda_codec *codec)
16684 alc663_two_hp_m2_speaker_automute(codec);
16685 alc_mic_automute(codec);
16688 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16690 unsigned int present;
16691 unsigned char bits;
16693 present = snd_hda_codec_read(codec, 0x21, 0,
16694 AC_VERB_GET_PIN_SENSE, 0)
16695 & AC_PINSENSE_PRESENCE;
16696 bits = present ? HDA_AMP_MUTE : 0;
16697 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16698 HDA_AMP_MUTE, bits);
16699 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16700 HDA_AMP_MUTE, bits);
16703 static void alc663_g71v_front_automute(struct hda_codec *codec)
16705 unsigned int present;
16706 unsigned char bits;
16708 present = snd_hda_codec_read(codec, 0x15, 0,
16709 AC_VERB_GET_PIN_SENSE, 0)
16710 & AC_PINSENSE_PRESENCE;
16711 bits = present ? HDA_AMP_MUTE : 0;
16712 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16713 HDA_AMP_MUTE, bits);
16716 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16719 switch (res >> 26) {
16720 case ALC880_HP_EVENT:
16721 alc663_g71v_hp_automute(codec);
16723 case ALC880_FRONT_EVENT:
16724 alc663_g71v_front_automute(codec);
16726 case ALC880_MIC_EVENT:
16727 alc_mic_automute(codec);
16732 #define alc663_g71v_setup alc663_m51va_setup
16734 static void alc663_g71v_inithook(struct hda_codec *codec)
16736 alc663_g71v_front_automute(codec);
16737 alc663_g71v_hp_automute(codec);
16738 alc_mic_automute(codec);
16741 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16744 switch (res >> 26) {
16745 case ALC880_HP_EVENT:
16746 alc663_m51va_speaker_automute(codec);
16748 case ALC880_MIC_EVENT:
16749 alc_mic_automute(codec);
16754 #define alc663_g50v_setup alc663_m51va_setup
16756 static void alc663_g50v_inithook(struct hda_codec *codec)
16758 alc663_m51va_speaker_automute(codec);
16759 alc_mic_automute(codec);
16762 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16763 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16764 ALC262_HIPPO_MASTER_SWITCH,
16766 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16767 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16768 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16770 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16771 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16772 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16776 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16777 /* Master Playback automatically created from Speaker and Headphone */
16778 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16779 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16780 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16781 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16783 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16784 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16785 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16787 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16788 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16789 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16793 #ifdef CONFIG_SND_HDA_POWER_SAVE
16794 #define alc662_loopbacks alc880_loopbacks
16798 /* pcm configuration: identical with ALC880 */
16799 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16800 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16801 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16802 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16805 * configuration and preset
16807 static const char *alc662_models[ALC662_MODEL_LAST] = {
16808 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16809 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16810 [ALC662_3ST_6ch] = "3stack-6ch",
16811 [ALC662_5ST_DIG] = "6stack-dig",
16812 [ALC662_LENOVO_101E] = "lenovo-101e",
16813 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16814 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16815 [ALC662_ECS] = "ecs",
16816 [ALC663_ASUS_M51VA] = "m51va",
16817 [ALC663_ASUS_G71V] = "g71v",
16818 [ALC663_ASUS_H13] = "h13",
16819 [ALC663_ASUS_G50V] = "g50v",
16820 [ALC663_ASUS_MODE1] = "asus-mode1",
16821 [ALC662_ASUS_MODE2] = "asus-mode2",
16822 [ALC663_ASUS_MODE3] = "asus-mode3",
16823 [ALC663_ASUS_MODE4] = "asus-mode4",
16824 [ALC663_ASUS_MODE5] = "asus-mode5",
16825 [ALC663_ASUS_MODE6] = "asus-mode6",
16826 [ALC272_DELL] = "dell",
16827 [ALC272_DELL_ZM1] = "dell-zm1",
16828 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16829 [ALC662_AUTO] = "auto",
16832 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16833 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16834 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16835 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16836 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16837 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16838 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16839 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16840 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16841 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16842 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16843 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16844 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16845 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16846 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16847 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16848 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16849 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16850 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16851 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16852 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16853 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16854 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16855 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16856 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16857 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16858 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16859 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16860 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16861 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16862 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16863 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16864 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16865 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16866 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16867 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16868 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16869 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16870 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16871 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16872 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16873 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16874 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16875 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16876 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16877 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16878 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16879 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16880 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16881 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16882 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16883 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16884 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16885 ALC662_3ST_6ch_DIG),
16886 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16887 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16888 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16889 ALC662_3ST_6ch_DIG),
16890 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16891 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16892 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16893 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16894 ALC662_3ST_6ch_DIG),
16895 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16900 static struct alc_config_preset alc662_presets[] = {
16901 [ALC662_3ST_2ch_DIG] = {
16902 .mixers = { alc662_3ST_2ch_mixer },
16903 .init_verbs = { alc662_init_verbs },
16904 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16905 .dac_nids = alc662_dac_nids,
16906 .dig_out_nid = ALC662_DIGOUT_NID,
16907 .dig_in_nid = ALC662_DIGIN_NID,
16908 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16909 .channel_mode = alc662_3ST_2ch_modes,
16910 .input_mux = &alc662_capture_source,
16912 [ALC662_3ST_6ch_DIG] = {
16913 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16914 .init_verbs = { alc662_init_verbs },
16915 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16916 .dac_nids = alc662_dac_nids,
16917 .dig_out_nid = ALC662_DIGOUT_NID,
16918 .dig_in_nid = ALC662_DIGIN_NID,
16919 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16920 .channel_mode = alc662_3ST_6ch_modes,
16922 .input_mux = &alc662_capture_source,
16924 [ALC662_3ST_6ch] = {
16925 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16926 .init_verbs = { alc662_init_verbs },
16927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16928 .dac_nids = alc662_dac_nids,
16929 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16930 .channel_mode = alc662_3ST_6ch_modes,
16932 .input_mux = &alc662_capture_source,
16934 [ALC662_5ST_DIG] = {
16935 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16936 .init_verbs = { alc662_init_verbs },
16937 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16938 .dac_nids = alc662_dac_nids,
16939 .dig_out_nid = ALC662_DIGOUT_NID,
16940 .dig_in_nid = ALC662_DIGIN_NID,
16941 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16942 .channel_mode = alc662_5stack_modes,
16943 .input_mux = &alc662_capture_source,
16945 [ALC662_LENOVO_101E] = {
16946 .mixers = { alc662_lenovo_101e_mixer },
16947 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16948 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16949 .dac_nids = alc662_dac_nids,
16950 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16951 .channel_mode = alc662_3ST_2ch_modes,
16952 .input_mux = &alc662_lenovo_101e_capture_source,
16953 .unsol_event = alc662_lenovo_101e_unsol_event,
16954 .init_hook = alc662_lenovo_101e_all_automute,
16956 [ALC662_ASUS_EEEPC_P701] = {
16957 .mixers = { alc662_eeepc_p701_mixer },
16958 .init_verbs = { alc662_init_verbs,
16959 alc662_eeepc_sue_init_verbs },
16960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16961 .dac_nids = alc662_dac_nids,
16962 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16963 .channel_mode = alc662_3ST_2ch_modes,
16964 .unsol_event = alc662_eeepc_unsol_event,
16965 .setup = alc662_eeepc_setup,
16966 .init_hook = alc662_eeepc_inithook,
16968 [ALC662_ASUS_EEEPC_EP20] = {
16969 .mixers = { alc662_eeepc_ep20_mixer,
16970 alc662_chmode_mixer },
16971 .init_verbs = { alc662_init_verbs,
16972 alc662_eeepc_ep20_sue_init_verbs },
16973 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16974 .dac_nids = alc662_dac_nids,
16975 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16976 .channel_mode = alc662_3ST_6ch_modes,
16977 .input_mux = &alc662_lenovo_101e_capture_source,
16978 .unsol_event = alc662_eeepc_unsol_event,
16979 .setup = alc662_eeepc_ep20_setup,
16980 .init_hook = alc662_eeepc_ep20_inithook,
16983 .mixers = { alc662_ecs_mixer },
16984 .init_verbs = { alc662_init_verbs,
16985 alc662_ecs_init_verbs },
16986 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16987 .dac_nids = alc662_dac_nids,
16988 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16989 .channel_mode = alc662_3ST_2ch_modes,
16990 .unsol_event = alc662_eeepc_unsol_event,
16991 .setup = alc662_eeepc_setup,
16992 .init_hook = alc662_eeepc_inithook,
16994 [ALC663_ASUS_M51VA] = {
16995 .mixers = { alc663_m51va_mixer },
16996 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16997 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16998 .dac_nids = alc662_dac_nids,
16999 .dig_out_nid = ALC662_DIGOUT_NID,
17000 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17001 .channel_mode = alc662_3ST_2ch_modes,
17002 .unsol_event = alc663_m51va_unsol_event,
17003 .setup = alc663_m51va_setup,
17004 .init_hook = alc663_m51va_inithook,
17006 [ALC663_ASUS_G71V] = {
17007 .mixers = { alc663_g71v_mixer },
17008 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17009 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17010 .dac_nids = alc662_dac_nids,
17011 .dig_out_nid = ALC662_DIGOUT_NID,
17012 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17013 .channel_mode = alc662_3ST_2ch_modes,
17014 .unsol_event = alc663_g71v_unsol_event,
17015 .setup = alc663_g71v_setup,
17016 .init_hook = alc663_g71v_inithook,
17018 [ALC663_ASUS_H13] = {
17019 .mixers = { alc663_m51va_mixer },
17020 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17021 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17022 .dac_nids = alc662_dac_nids,
17023 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17024 .channel_mode = alc662_3ST_2ch_modes,
17025 .unsol_event = alc663_m51va_unsol_event,
17026 .init_hook = alc663_m51va_inithook,
17028 [ALC663_ASUS_G50V] = {
17029 .mixers = { alc663_g50v_mixer },
17030 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17031 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17032 .dac_nids = alc662_dac_nids,
17033 .dig_out_nid = ALC662_DIGOUT_NID,
17034 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17035 .channel_mode = alc662_3ST_6ch_modes,
17036 .input_mux = &alc663_capture_source,
17037 .unsol_event = alc663_g50v_unsol_event,
17038 .setup = alc663_g50v_setup,
17039 .init_hook = alc663_g50v_inithook,
17041 [ALC663_ASUS_MODE1] = {
17042 .mixers = { alc663_m51va_mixer },
17043 .cap_mixer = alc662_auto_capture_mixer,
17044 .init_verbs = { alc662_init_verbs,
17045 alc663_21jd_amic_init_verbs },
17046 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17048 .dac_nids = alc662_dac_nids,
17049 .dig_out_nid = ALC662_DIGOUT_NID,
17050 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17051 .channel_mode = alc662_3ST_2ch_modes,
17052 .unsol_event = alc663_mode1_unsol_event,
17053 .setup = alc663_mode1_setup,
17054 .init_hook = alc663_mode1_inithook,
17056 [ALC662_ASUS_MODE2] = {
17057 .mixers = { alc662_1bjd_mixer },
17058 .cap_mixer = alc662_auto_capture_mixer,
17059 .init_verbs = { alc662_init_verbs,
17060 alc662_1bjd_amic_init_verbs },
17061 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17062 .dac_nids = alc662_dac_nids,
17063 .dig_out_nid = ALC662_DIGOUT_NID,
17064 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17065 .channel_mode = alc662_3ST_2ch_modes,
17066 .unsol_event = alc662_mode2_unsol_event,
17067 .setup = alc662_mode2_setup,
17068 .init_hook = alc662_mode2_inithook,
17070 [ALC663_ASUS_MODE3] = {
17071 .mixers = { alc663_two_hp_m1_mixer },
17072 .cap_mixer = alc662_auto_capture_mixer,
17073 .init_verbs = { alc662_init_verbs,
17074 alc663_two_hp_amic_m1_init_verbs },
17075 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17077 .dac_nids = alc662_dac_nids,
17078 .dig_out_nid = ALC662_DIGOUT_NID,
17079 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17080 .channel_mode = alc662_3ST_2ch_modes,
17081 .unsol_event = alc663_mode3_unsol_event,
17082 .setup = alc663_mode3_setup,
17083 .init_hook = alc663_mode3_inithook,
17085 [ALC663_ASUS_MODE4] = {
17086 .mixers = { alc663_asus_21jd_clfe_mixer },
17087 .cap_mixer = alc662_auto_capture_mixer,
17088 .init_verbs = { alc662_init_verbs,
17089 alc663_21jd_amic_init_verbs},
17090 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17092 .dac_nids = alc662_dac_nids,
17093 .dig_out_nid = ALC662_DIGOUT_NID,
17094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17095 .channel_mode = alc662_3ST_2ch_modes,
17096 .unsol_event = alc663_mode4_unsol_event,
17097 .setup = alc663_mode4_setup,
17098 .init_hook = alc663_mode4_inithook,
17100 [ALC663_ASUS_MODE5] = {
17101 .mixers = { alc663_asus_15jd_clfe_mixer },
17102 .cap_mixer = alc662_auto_capture_mixer,
17103 .init_verbs = { alc662_init_verbs,
17104 alc663_15jd_amic_init_verbs },
17105 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17107 .dac_nids = alc662_dac_nids,
17108 .dig_out_nid = ALC662_DIGOUT_NID,
17109 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17110 .channel_mode = alc662_3ST_2ch_modes,
17111 .unsol_event = alc663_mode5_unsol_event,
17112 .setup = alc663_mode5_setup,
17113 .init_hook = alc663_mode5_inithook,
17115 [ALC663_ASUS_MODE6] = {
17116 .mixers = { alc663_two_hp_m2_mixer },
17117 .cap_mixer = alc662_auto_capture_mixer,
17118 .init_verbs = { alc662_init_verbs,
17119 alc663_two_hp_amic_m2_init_verbs },
17120 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17122 .dac_nids = alc662_dac_nids,
17123 .dig_out_nid = ALC662_DIGOUT_NID,
17124 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17125 .channel_mode = alc662_3ST_2ch_modes,
17126 .unsol_event = alc663_mode6_unsol_event,
17127 .setup = alc663_mode6_setup,
17128 .init_hook = alc663_mode6_inithook,
17131 .mixers = { alc663_m51va_mixer },
17132 .cap_mixer = alc272_auto_capture_mixer,
17133 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17134 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17135 .dac_nids = alc662_dac_nids,
17136 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17137 .adc_nids = alc272_adc_nids,
17138 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17139 .capsrc_nids = alc272_capsrc_nids,
17140 .channel_mode = alc662_3ST_2ch_modes,
17141 .unsol_event = alc663_m51va_unsol_event,
17142 .setup = alc663_m51va_setup,
17143 .init_hook = alc663_m51va_inithook,
17145 [ALC272_DELL_ZM1] = {
17146 .mixers = { alc663_m51va_mixer },
17147 .cap_mixer = alc662_auto_capture_mixer,
17148 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17149 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17150 .dac_nids = alc662_dac_nids,
17151 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17152 .adc_nids = alc662_adc_nids,
17154 .capsrc_nids = alc662_capsrc_nids,
17155 .channel_mode = alc662_3ST_2ch_modes,
17156 .unsol_event = alc663_m51va_unsol_event,
17157 .setup = alc663_m51va_setup,
17158 .init_hook = alc663_m51va_inithook,
17160 [ALC272_SAMSUNG_NC10] = {
17161 .mixers = { alc272_nc10_mixer },
17162 .init_verbs = { alc662_init_verbs,
17163 alc663_21jd_amic_init_verbs },
17164 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17165 .dac_nids = alc272_dac_nids,
17166 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17167 .channel_mode = alc662_3ST_2ch_modes,
17168 /*.input_mux = &alc272_nc10_capture_source,*/
17169 .unsol_event = alc663_mode4_unsol_event,
17170 .setup = alc663_mode4_setup,
17171 .init_hook = alc663_mode4_inithook,
17177 * BIOS auto configuration
17180 /* convert from MIX nid to DAC */
17181 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17185 else if (nid >= 0x0c && nid <= 0x0e)
17186 return nid - 0x0c + 0x02;
17191 /* get MIX nid connected to the given pin targeted to DAC */
17192 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17198 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17199 for (i = 0; i < num; i++) {
17200 if (alc662_mix_to_dac(mix[i]) == dac)
17206 /* look for an empty DAC slot */
17207 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17209 struct alc_spec *spec = codec->spec;
17213 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17216 for (i = 0; i < num; i++) {
17217 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17220 for (j = 0; j < spec->multiout.num_dacs; j++)
17221 if (spec->multiout.dac_nids[j] == nid)
17223 if (j >= spec->multiout.num_dacs)
17229 /* fill in the dac_nids table from the parsed pin configuration */
17230 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17231 const struct auto_pin_cfg *cfg)
17233 struct alc_spec *spec = codec->spec;
17237 spec->multiout.dac_nids = spec->private_dac_nids;
17238 for (i = 0; i < cfg->line_outs; i++) {
17239 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17242 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17247 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17248 hda_nid_t nid, unsigned int chs)
17250 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17251 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17254 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17255 hda_nid_t nid, unsigned int chs)
17257 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17258 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17261 #define alc662_add_stereo_vol(spec, pfx, nid) \
17262 alc662_add_vol_ctl(spec, pfx, nid, 3)
17263 #define alc662_add_stereo_sw(spec, pfx, nid) \
17264 alc662_add_sw_ctl(spec, pfx, nid, 3)
17266 /* add playback controls from the parsed DAC table */
17267 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17268 const struct auto_pin_cfg *cfg)
17270 struct alc_spec *spec = codec->spec;
17271 static const char *chname[4] = {
17272 "Front", "Surround", NULL /*CLFE*/, "Side"
17274 hda_nid_t nid, mix;
17277 for (i = 0; i < cfg->line_outs; i++) {
17278 nid = spec->multiout.dac_nids[i];
17281 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17286 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17289 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17292 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17295 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17300 if (cfg->line_outs == 1 &&
17301 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17308 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17311 if (cfg->line_outs == 1 &&
17312 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17314 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17322 /* add playback controls for speaker and HP outputs */
17323 /* return DAC nid if any new DAC is assigned */
17324 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17327 struct alc_spec *spec = codec->spec;
17328 hda_nid_t nid, mix;
17333 nid = alc662_look_for_dac(codec, pin);
17335 /* the corresponding DAC is already occupied */
17336 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17337 return 0; /* no way */
17338 /* create a switch only */
17339 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17340 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17343 mix = alc662_dac_to_mix(codec, pin, nid);
17346 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17349 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17355 /* create playback/capture controls for input pins */
17356 #define alc662_auto_create_input_ctls \
17357 alc882_auto_create_input_ctls
17359 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17360 hda_nid_t nid, int pin_type,
17366 alc_set_pin_output(codec, nid, pin_type);
17367 /* need the manual connection? */
17368 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17371 for (i = 0; i < num; i++) {
17372 if (alc662_mix_to_dac(srcs[i]) != dac)
17374 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17379 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17381 struct alc_spec *spec = codec->spec;
17382 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17385 for (i = 0; i <= HDA_SIDE; i++) {
17386 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17388 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17389 spec->multiout.dac_nids[i]);
17393 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17395 struct alc_spec *spec = codec->spec;
17398 pin = spec->autocfg.hp_pins[0];
17400 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17401 spec->multiout.hp_nid);
17402 pin = spec->autocfg.speaker_pins[0];
17404 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17405 spec->multiout.extra_out_nid[0]);
17408 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17410 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17412 struct alc_spec *spec = codec->spec;
17415 for (i = 0; i < AUTO_PIN_LAST; i++) {
17416 hda_nid_t nid = spec->autocfg.input_pins[i];
17417 if (alc_is_input_pin(codec, nid)) {
17418 alc_set_input_pin(codec, nid, i);
17419 if (nid != ALC662_PIN_CD_NID &&
17420 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17421 snd_hda_codec_write(codec, nid, 0,
17422 AC_VERB_SET_AMP_GAIN_MUTE,
17428 #define alc662_auto_init_input_src alc882_auto_init_input_src
17430 static int alc662_parse_auto_config(struct hda_codec *codec)
17432 struct alc_spec *spec = codec->spec;
17434 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17436 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17440 if (!spec->autocfg.line_outs)
17441 return 0; /* can't find valid BIOS pin config */
17443 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17446 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17449 err = alc662_auto_create_extra_out(codec,
17450 spec->autocfg.speaker_pins[0],
17455 spec->multiout.extra_out_nid[0] = err;
17456 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17461 spec->multiout.hp_nid = err;
17462 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17466 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17468 if (spec->autocfg.dig_outs)
17469 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17471 if (spec->kctls.list)
17472 add_mixer(spec, spec->kctls.list);
17474 spec->num_mux_defs = 1;
17475 spec->input_mux = &spec->private_imux[0];
17477 add_verb(spec, alc662_auto_init_verbs);
17478 if (codec->vendor_id == 0x10ec0663)
17479 add_verb(spec, alc663_auto_init_verbs);
17481 err = alc_auto_add_mic_boost(codec);
17485 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17490 /* additional initialization for auto-configuration model */
17491 static void alc662_auto_init(struct hda_codec *codec)
17493 struct alc_spec *spec = codec->spec;
17494 alc662_auto_init_multi_out(codec);
17495 alc662_auto_init_hp_out(codec);
17496 alc662_auto_init_analog_input(codec);
17497 alc662_auto_init_input_src(codec);
17498 if (spec->unsol_event)
17499 alc_inithook(codec);
17502 static int patch_alc662(struct hda_codec *codec)
17504 struct alc_spec *spec;
17505 int err, board_config;
17507 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17511 codec->spec = spec;
17513 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17515 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17518 if (board_config < 0) {
17519 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17521 board_config = ALC662_AUTO;
17524 if (board_config == ALC662_AUTO) {
17525 /* automatic parse from the BIOS config */
17526 err = alc662_parse_auto_config(codec);
17532 "hda_codec: Cannot set up configuration "
17533 "from BIOS. Using base mode...\n");
17534 board_config = ALC662_3ST_2ch_DIG;
17538 err = snd_hda_attach_beep_device(codec, 0x1);
17544 if (board_config != ALC662_AUTO)
17545 setup_preset(codec, &alc662_presets[board_config]);
17547 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17548 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17550 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17551 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17553 if (!spec->adc_nids) {
17554 spec->adc_nids = alc662_adc_nids;
17555 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17557 if (!spec->capsrc_nids)
17558 spec->capsrc_nids = alc662_capsrc_nids;
17560 if (!spec->cap_mixer)
17561 set_capture_mixer(codec);
17562 if (codec->vendor_id == 0x10ec0662)
17563 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17565 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17567 spec->vmaster_nid = 0x02;
17569 codec->patch_ops = alc_patch_ops;
17570 if (board_config == ALC662_AUTO)
17571 spec->init_hook = alc662_auto_init;
17572 #ifdef CONFIG_SND_HDA_POWER_SAVE
17573 if (!spec->loopback.amplist)
17574 spec->loopback.amplist = alc662_loopbacks;
17576 codec->proc_widget_hook = print_realtek_coef;
17584 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17585 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17586 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17587 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17588 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17589 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17590 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17591 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17592 .patch = patch_alc861 },
17593 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17594 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17595 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17596 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17597 .patch = patch_alc882 },
17598 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17599 .patch = patch_alc662 },
17600 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17601 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17602 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17603 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17604 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17605 .patch = patch_alc882 },
17606 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17607 .patch = patch_alc882 },
17608 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17609 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17610 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17611 .patch = patch_alc882 },
17612 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17613 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17614 {} /* terminator */
17617 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17619 MODULE_LICENSE("GPL");
17620 MODULE_DESCRIPTION("Realtek HD-audio codec");
17622 static struct hda_codec_preset_list realtek_list = {
17623 .preset = snd_hda_preset_realtek,
17624 .owner = THIS_MODULE,
17627 static int __init patch_realtek_init(void)
17629 return snd_hda_add_codec_preset(&realtek_list);
17632 static void __exit patch_realtek_exit(void)
17634 snd_hda_delete_codec_preset(&realtek_list);
17637 module_init(patch_realtek_init)
17638 module_exit(patch_realtek_exit)