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 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4693 spec->slave_dig_outs[i - 1] = dig_nid;
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_AUTO), /* no quirk */
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 or 5,2,
8916 * so apparently no perfect solution yet
8918 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8919 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
8923 static struct alc_config_preset alc882_presets[] = {
8924 [ALC882_3ST_DIG] = {
8925 .mixers = { alc882_base_mixer },
8926 .init_verbs = { alc882_base_init_verbs,
8927 alc882_adc1_init_verbs },
8928 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8929 .dac_nids = alc882_dac_nids,
8930 .dig_out_nid = ALC882_DIGOUT_NID,
8931 .dig_in_nid = ALC882_DIGIN_NID,
8932 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8933 .channel_mode = alc882_ch_modes,
8935 .input_mux = &alc882_capture_source,
8937 [ALC882_6ST_DIG] = {
8938 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8939 .init_verbs = { alc882_base_init_verbs,
8940 alc882_adc1_init_verbs },
8941 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8942 .dac_nids = alc882_dac_nids,
8943 .dig_out_nid = ALC882_DIGOUT_NID,
8944 .dig_in_nid = ALC882_DIGIN_NID,
8945 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8946 .channel_mode = alc882_sixstack_modes,
8947 .input_mux = &alc882_capture_source,
8950 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8951 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8952 alc882_eapd_verbs },
8953 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8954 .dac_nids = alc882_dac_nids,
8955 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8956 .channel_mode = alc882_sixstack_modes,
8957 .input_mux = &alc882_capture_source,
8960 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8961 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8962 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8963 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8964 .dac_nids = alc882_dac_nids,
8965 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8966 .channel_mode = alc880_threestack_modes,
8968 .input_mux = &alc882_capture_source,
8969 .dig_out_nid = ALC882_DIGOUT_NID,
8972 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8973 .init_verbs = { alc885_mbp3_init_verbs,
8974 alc880_gpio1_init_verbs },
8976 .dac_nids = alc882_dac_nids,
8978 .channel_mode = alc885_mbp_4ch_modes,
8979 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
8980 .input_mux = &alc882_capture_source,
8981 .dig_out_nid = ALC882_DIGOUT_NID,
8982 .dig_in_nid = ALC882_DIGIN_NID,
8983 .unsol_event = alc_automute_amp_unsol_event,
8984 .setup = alc885_mbp3_setup,
8985 .init_hook = alc_automute_amp,
8988 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8989 .init_verbs = { alc885_mb5_init_verbs,
8990 alc880_gpio1_init_verbs },
8991 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8992 .dac_nids = alc882_dac_nids,
8993 .channel_mode = alc885_mb5_6ch_modes,
8994 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8995 .input_mux = &mb5_capture_source,
8996 .dig_out_nid = ALC882_DIGOUT_NID,
8997 .dig_in_nid = ALC882_DIGIN_NID,
9000 .mixers = { alc882_macpro_mixer },
9001 .init_verbs = { alc882_macpro_init_verbs },
9002 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9003 .dac_nids = alc882_dac_nids,
9004 .dig_out_nid = ALC882_DIGOUT_NID,
9005 .dig_in_nid = ALC882_DIGIN_NID,
9006 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9007 .channel_mode = alc882_ch_modes,
9008 .input_mux = &alc882_capture_source,
9009 .init_hook = alc885_macpro_init_hook,
9012 .mixers = { alc885_imac24_mixer },
9013 .init_verbs = { alc885_imac24_init_verbs },
9014 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9015 .dac_nids = alc882_dac_nids,
9016 .dig_out_nid = ALC882_DIGOUT_NID,
9017 .dig_in_nid = ALC882_DIGIN_NID,
9018 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9019 .channel_mode = alc882_ch_modes,
9020 .input_mux = &alc882_capture_source,
9021 .unsol_event = alc_automute_amp_unsol_event,
9022 .setup = alc885_imac24_setup,
9023 .init_hook = alc885_imac24_init_hook,
9026 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9027 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9028 alc880_gpio3_init_verbs, alc882_targa_verbs},
9029 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9030 .dac_nids = alc882_dac_nids,
9031 .dig_out_nid = ALC882_DIGOUT_NID,
9032 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9033 .adc_nids = alc882_adc_nids,
9034 .capsrc_nids = alc882_capsrc_nids,
9035 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9036 .channel_mode = alc882_3ST_6ch_modes,
9038 .input_mux = &alc882_capture_source,
9039 .unsol_event = alc882_targa_unsol_event,
9040 .setup = alc882_targa_setup,
9041 .init_hook = alc882_targa_automute,
9043 [ALC882_ASUS_A7J] = {
9044 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9045 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9046 alc882_asus_a7j_verbs},
9047 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9048 .dac_nids = alc882_dac_nids,
9049 .dig_out_nid = ALC882_DIGOUT_NID,
9050 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9051 .adc_nids = alc882_adc_nids,
9052 .capsrc_nids = alc882_capsrc_nids,
9053 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9054 .channel_mode = alc882_3ST_6ch_modes,
9056 .input_mux = &alc882_capture_source,
9058 [ALC882_ASUS_A7M] = {
9059 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9060 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9061 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9062 alc882_asus_a7m_verbs },
9063 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9064 .dac_nids = alc882_dac_nids,
9065 .dig_out_nid = ALC882_DIGOUT_NID,
9066 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9067 .channel_mode = alc880_threestack_modes,
9069 .input_mux = &alc882_capture_source,
9071 [ALC883_3ST_2ch_DIG] = {
9072 .mixers = { alc883_3ST_2ch_mixer },
9073 .init_verbs = { alc883_init_verbs },
9074 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9075 .dac_nids = alc883_dac_nids,
9076 .dig_out_nid = ALC883_DIGOUT_NID,
9077 .dig_in_nid = ALC883_DIGIN_NID,
9078 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9079 .channel_mode = alc883_3ST_2ch_modes,
9080 .input_mux = &alc883_capture_source,
9082 [ALC883_3ST_6ch_DIG] = {
9083 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9084 .init_verbs = { alc883_init_verbs },
9085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9086 .dac_nids = alc883_dac_nids,
9087 .dig_out_nid = ALC883_DIGOUT_NID,
9088 .dig_in_nid = ALC883_DIGIN_NID,
9089 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9090 .channel_mode = alc883_3ST_6ch_modes,
9092 .input_mux = &alc883_capture_source,
9094 [ALC883_3ST_6ch] = {
9095 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9096 .init_verbs = { alc883_init_verbs },
9097 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9098 .dac_nids = alc883_dac_nids,
9099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9100 .channel_mode = alc883_3ST_6ch_modes,
9102 .input_mux = &alc883_capture_source,
9104 [ALC883_3ST_6ch_INTEL] = {
9105 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9106 .init_verbs = { alc883_init_verbs },
9107 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9108 .dac_nids = alc883_dac_nids,
9109 .dig_out_nid = ALC883_DIGOUT_NID,
9110 .dig_in_nid = ALC883_DIGIN_NID,
9111 .slave_dig_outs = alc883_slave_dig_outs,
9112 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9113 .channel_mode = alc883_3ST_6ch_intel_modes,
9115 .input_mux = &alc883_3stack_6ch_intel,
9118 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9119 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9120 alc_hp15_unsol_verbs },
9121 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9122 .dac_nids = alc883_dac_nids,
9123 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9124 .adc_nids = alc889_adc_nids,
9125 .dig_out_nid = ALC883_DIGOUT_NID,
9126 .dig_in_nid = ALC883_DIGIN_NID,
9127 .slave_dig_outs = alc883_slave_dig_outs,
9128 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9129 .channel_mode = alc889_8ch_intel_modes,
9130 .capsrc_nids = alc889_capsrc_nids,
9131 .input_mux = &alc889_capture_source,
9132 .setup = alc889_automute_setup,
9133 .init_hook = alc_automute_amp,
9134 .unsol_event = alc_automute_amp_unsol_event,
9138 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9139 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9140 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9141 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9142 .dac_nids = alc883_dac_nids,
9143 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9144 .adc_nids = alc889_adc_nids,
9145 .dig_out_nid = ALC883_DIGOUT_NID,
9146 .dig_in_nid = ALC883_DIGIN_NID,
9147 .slave_dig_outs = alc883_slave_dig_outs,
9148 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9149 .channel_mode = alc889_8ch_intel_modes,
9150 .capsrc_nids = alc889_capsrc_nids,
9151 .input_mux = &alc889_capture_source,
9152 .setup = alc889_automute_setup,
9153 .init_hook = alc889_intel_init_hook,
9154 .unsol_event = alc_automute_amp_unsol_event,
9157 [ALC883_6ST_DIG] = {
9158 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9159 .init_verbs = { alc883_init_verbs },
9160 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9161 .dac_nids = alc883_dac_nids,
9162 .dig_out_nid = ALC883_DIGOUT_NID,
9163 .dig_in_nid = ALC883_DIGIN_NID,
9164 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9165 .channel_mode = alc883_sixstack_modes,
9166 .input_mux = &alc883_capture_source,
9168 [ALC883_TARGA_DIG] = {
9169 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9170 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9171 alc883_targa_verbs},
9172 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9173 .dac_nids = alc883_dac_nids,
9174 .dig_out_nid = ALC883_DIGOUT_NID,
9175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9176 .channel_mode = alc883_3ST_6ch_modes,
9178 .input_mux = &alc883_capture_source,
9179 .unsol_event = alc883_targa_unsol_event,
9180 .setup = alc882_targa_setup,
9181 .init_hook = alc882_targa_automute,
9183 [ALC883_TARGA_2ch_DIG] = {
9184 .mixers = { alc883_targa_2ch_mixer},
9185 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9186 alc883_targa_verbs},
9187 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9188 .dac_nids = alc883_dac_nids,
9189 .adc_nids = alc883_adc_nids_alt,
9190 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9191 .dig_out_nid = ALC883_DIGOUT_NID,
9192 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9193 .channel_mode = alc883_3ST_2ch_modes,
9194 .input_mux = &alc883_capture_source,
9195 .unsol_event = alc883_targa_unsol_event,
9196 .setup = alc882_targa_setup,
9197 .init_hook = alc882_targa_automute,
9199 [ALC883_TARGA_8ch_DIG] = {
9200 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9201 alc883_chmode_mixer },
9202 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9203 alc883_targa_verbs },
9204 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9205 .dac_nids = alc883_dac_nids,
9206 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9207 .adc_nids = alc883_adc_nids_rev,
9208 .capsrc_nids = alc883_capsrc_nids_rev,
9209 .dig_out_nid = ALC883_DIGOUT_NID,
9210 .dig_in_nid = ALC883_DIGIN_NID,
9211 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9212 .channel_mode = alc883_4ST_8ch_modes,
9214 .input_mux = &alc883_capture_source,
9215 .unsol_event = alc883_targa_unsol_event,
9216 .setup = alc882_targa_setup,
9217 .init_hook = alc882_targa_automute,
9220 .mixers = { alc883_base_mixer },
9221 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9222 * and the headphone jack. Turn this on and rely on the
9223 * standard mute methods whenever the user wants to turn
9224 * these outputs off.
9226 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9228 .dac_nids = alc883_dac_nids,
9229 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9230 .channel_mode = alc883_3ST_2ch_modes,
9231 .input_mux = &alc883_capture_source,
9233 [ALC883_ACER_ASPIRE] = {
9234 .mixers = { alc883_acer_aspire_mixer },
9235 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9237 .dac_nids = alc883_dac_nids,
9238 .dig_out_nid = ALC883_DIGOUT_NID,
9239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9240 .channel_mode = alc883_3ST_2ch_modes,
9241 .input_mux = &alc883_capture_source,
9242 .unsol_event = alc_automute_amp_unsol_event,
9243 .setup = alc883_acer_aspire_setup,
9244 .init_hook = alc_automute_amp,
9246 [ALC888_ACER_ASPIRE_4930G] = {
9247 .mixers = { alc888_base_mixer,
9248 alc883_chmode_mixer },
9249 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9250 alc888_acer_aspire_4930g_verbs },
9251 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9252 .dac_nids = alc883_dac_nids,
9253 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9254 .adc_nids = alc883_adc_nids_rev,
9255 .capsrc_nids = alc883_capsrc_nids_rev,
9256 .dig_out_nid = ALC883_DIGOUT_NID,
9257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9258 .channel_mode = alc883_3ST_6ch_modes,
9261 ARRAY_SIZE(alc888_2_capture_sources),
9262 .input_mux = alc888_2_capture_sources,
9263 .unsol_event = alc_automute_amp_unsol_event,
9264 .setup = alc888_acer_aspire_4930g_setup,
9265 .init_hook = alc_automute_amp,
9267 [ALC888_ACER_ASPIRE_6530G] = {
9268 .mixers = { alc888_acer_aspire_6530_mixer },
9269 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9270 alc888_acer_aspire_6530g_verbs },
9271 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9272 .dac_nids = alc883_dac_nids,
9273 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9274 .adc_nids = alc883_adc_nids_rev,
9275 .capsrc_nids = alc883_capsrc_nids_rev,
9276 .dig_out_nid = ALC883_DIGOUT_NID,
9277 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9278 .channel_mode = alc883_3ST_2ch_modes,
9280 ARRAY_SIZE(alc888_2_capture_sources),
9281 .input_mux = alc888_acer_aspire_6530_sources,
9282 .unsol_event = alc_automute_amp_unsol_event,
9283 .setup = alc888_acer_aspire_6530g_setup,
9284 .init_hook = alc_automute_amp,
9286 [ALC888_ACER_ASPIRE_8930G] = {
9287 .mixers = { alc888_base_mixer,
9288 alc883_chmode_mixer },
9289 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9290 alc889_acer_aspire_8930g_verbs },
9291 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9292 .dac_nids = alc883_dac_nids,
9293 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9294 .adc_nids = alc889_adc_nids,
9295 .capsrc_nids = alc889_capsrc_nids,
9296 .dig_out_nid = ALC883_DIGOUT_NID,
9297 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9298 .channel_mode = alc883_3ST_6ch_modes,
9300 .const_channel_count = 6,
9302 ARRAY_SIZE(alc889_capture_sources),
9303 .input_mux = alc889_capture_sources,
9304 .unsol_event = alc_automute_amp_unsol_event,
9305 .setup = alc889_acer_aspire_8930g_setup,
9306 .init_hook = alc_automute_amp,
9308 [ALC888_ACER_ASPIRE_7730G] = {
9309 .mixers = { alc883_3ST_6ch_mixer,
9310 alc883_chmode_mixer },
9311 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9312 alc888_acer_aspire_7730G_verbs },
9313 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9314 .dac_nids = alc883_dac_nids,
9315 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9316 .adc_nids = alc883_adc_nids_rev,
9317 .capsrc_nids = alc883_capsrc_nids_rev,
9318 .dig_out_nid = ALC883_DIGOUT_NID,
9319 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9320 .channel_mode = alc883_3ST_6ch_modes,
9322 .const_channel_count = 6,
9323 .input_mux = &alc883_capture_source,
9324 .unsol_event = alc_automute_amp_unsol_event,
9325 .setup = alc888_acer_aspire_6530g_setup,
9326 .init_hook = alc_automute_amp,
9329 .mixers = { alc883_fivestack_mixer,
9330 alc883_chmode_mixer },
9331 .init_verbs = { alc883_init_verbs,
9332 alc883_medion_eapd_verbs },
9333 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9334 .dac_nids = alc883_dac_nids,
9335 .adc_nids = alc883_adc_nids_alt,
9336 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9337 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9338 .channel_mode = alc883_sixstack_modes,
9339 .input_mux = &alc883_capture_source,
9341 [ALC883_MEDION_MD2] = {
9342 .mixers = { alc883_medion_md2_mixer},
9343 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9344 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9345 .dac_nids = alc883_dac_nids,
9346 .dig_out_nid = ALC883_DIGOUT_NID,
9347 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9348 .channel_mode = alc883_3ST_2ch_modes,
9349 .input_mux = &alc883_capture_source,
9350 .unsol_event = alc_automute_amp_unsol_event,
9351 .setup = alc883_medion_md2_setup,
9352 .init_hook = alc_automute_amp,
9354 [ALC883_LAPTOP_EAPD] = {
9355 .mixers = { alc883_base_mixer },
9356 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9358 .dac_nids = alc883_dac_nids,
9359 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9360 .channel_mode = alc883_3ST_2ch_modes,
9361 .input_mux = &alc883_capture_source,
9363 [ALC883_CLEVO_M540R] = {
9364 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9365 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9366 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9367 .dac_nids = alc883_dac_nids,
9368 .dig_out_nid = ALC883_DIGOUT_NID,
9369 .dig_in_nid = ALC883_DIGIN_NID,
9370 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9371 .channel_mode = alc883_3ST_6ch_clevo_modes,
9373 .input_mux = &alc883_capture_source,
9374 /* This machine has the hardware HP auto-muting, thus
9375 * we need no software mute via unsol event
9378 [ALC883_CLEVO_M720] = {
9379 .mixers = { alc883_clevo_m720_mixer },
9380 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9381 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9382 .dac_nids = alc883_dac_nids,
9383 .dig_out_nid = ALC883_DIGOUT_NID,
9384 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9385 .channel_mode = alc883_3ST_2ch_modes,
9386 .input_mux = &alc883_capture_source,
9387 .unsol_event = alc883_clevo_m720_unsol_event,
9388 .setup = alc883_clevo_m720_setup,
9389 .init_hook = alc883_clevo_m720_init_hook,
9391 [ALC883_LENOVO_101E_2ch] = {
9392 .mixers = { alc883_lenovo_101e_2ch_mixer},
9393 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9394 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9395 .dac_nids = alc883_dac_nids,
9396 .adc_nids = alc883_adc_nids_alt,
9397 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9398 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9399 .channel_mode = alc883_3ST_2ch_modes,
9400 .input_mux = &alc883_lenovo_101e_capture_source,
9401 .unsol_event = alc883_lenovo_101e_unsol_event,
9402 .init_hook = alc883_lenovo_101e_all_automute,
9404 [ALC883_LENOVO_NB0763] = {
9405 .mixers = { alc883_lenovo_nb0763_mixer },
9406 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9410 .channel_mode = alc883_3ST_2ch_modes,
9412 .input_mux = &alc883_lenovo_nb0763_capture_source,
9413 .unsol_event = alc_automute_amp_unsol_event,
9414 .setup = alc883_medion_md2_setup,
9415 .init_hook = alc_automute_amp,
9417 [ALC888_LENOVO_MS7195_DIG] = {
9418 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9419 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9420 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9421 .dac_nids = alc883_dac_nids,
9422 .dig_out_nid = ALC883_DIGOUT_NID,
9423 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9424 .channel_mode = alc883_3ST_6ch_modes,
9426 .input_mux = &alc883_capture_source,
9427 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9428 .init_hook = alc888_lenovo_ms7195_front_automute,
9430 [ALC883_HAIER_W66] = {
9431 .mixers = { alc883_targa_2ch_mixer},
9432 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9434 .dac_nids = alc883_dac_nids,
9435 .dig_out_nid = ALC883_DIGOUT_NID,
9436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9437 .channel_mode = alc883_3ST_2ch_modes,
9438 .input_mux = &alc883_capture_source,
9439 .unsol_event = alc_automute_amp_unsol_event,
9440 .setup = alc883_haier_w66_setup,
9441 .init_hook = alc_automute_amp,
9444 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9445 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9446 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9447 .dac_nids = alc883_dac_nids,
9448 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9449 .channel_mode = alc888_3st_hp_modes,
9451 .input_mux = &alc883_capture_source,
9452 .unsol_event = alc_automute_amp_unsol_event,
9453 .setup = alc888_3st_hp_setup,
9454 .init_hook = alc_automute_amp,
9456 [ALC888_6ST_DELL] = {
9457 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9458 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9459 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9460 .dac_nids = alc883_dac_nids,
9461 .dig_out_nid = ALC883_DIGOUT_NID,
9462 .dig_in_nid = ALC883_DIGIN_NID,
9463 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9464 .channel_mode = alc883_sixstack_modes,
9465 .input_mux = &alc883_capture_source,
9466 .unsol_event = alc_automute_amp_unsol_event,
9467 .setup = alc888_6st_dell_setup,
9468 .init_hook = alc_automute_amp,
9471 .mixers = { alc883_mitac_mixer },
9472 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9473 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9474 .dac_nids = alc883_dac_nids,
9475 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9476 .channel_mode = alc883_3ST_2ch_modes,
9477 .input_mux = &alc883_capture_source,
9478 .unsol_event = alc_automute_amp_unsol_event,
9479 .setup = alc883_mitac_setup,
9480 .init_hook = alc_automute_amp,
9482 [ALC883_FUJITSU_PI2515] = {
9483 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9484 .init_verbs = { alc883_init_verbs,
9485 alc883_2ch_fujitsu_pi2515_verbs},
9486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9487 .dac_nids = alc883_dac_nids,
9488 .dig_out_nid = ALC883_DIGOUT_NID,
9489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9490 .channel_mode = alc883_3ST_2ch_modes,
9491 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9492 .unsol_event = alc_automute_amp_unsol_event,
9493 .setup = alc883_2ch_fujitsu_pi2515_setup,
9494 .init_hook = alc_automute_amp,
9496 [ALC888_FUJITSU_XA3530] = {
9497 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9498 .init_verbs = { alc883_init_verbs,
9499 alc888_fujitsu_xa3530_verbs },
9500 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9501 .dac_nids = alc883_dac_nids,
9502 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9503 .adc_nids = alc883_adc_nids_rev,
9504 .capsrc_nids = alc883_capsrc_nids_rev,
9505 .dig_out_nid = ALC883_DIGOUT_NID,
9506 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9507 .channel_mode = alc888_4ST_8ch_intel_modes,
9509 ARRAY_SIZE(alc888_2_capture_sources),
9510 .input_mux = alc888_2_capture_sources,
9511 .unsol_event = alc_automute_amp_unsol_event,
9512 .setup = alc888_fujitsu_xa3530_setup,
9513 .init_hook = alc_automute_amp,
9515 [ALC888_LENOVO_SKY] = {
9516 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9517 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9518 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9519 .dac_nids = alc883_dac_nids,
9520 .dig_out_nid = ALC883_DIGOUT_NID,
9521 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9522 .channel_mode = alc883_sixstack_modes,
9524 .input_mux = &alc883_lenovo_sky_capture_source,
9525 .unsol_event = alc_automute_amp_unsol_event,
9526 .setup = alc888_lenovo_sky_setup,
9527 .init_hook = alc_automute_amp,
9529 [ALC888_ASUS_M90V] = {
9530 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9531 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9533 .dac_nids = alc883_dac_nids,
9534 .dig_out_nid = ALC883_DIGOUT_NID,
9535 .dig_in_nid = ALC883_DIGIN_NID,
9536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9537 .channel_mode = alc883_3ST_6ch_modes,
9539 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9540 .unsol_event = alc_sku_unsol_event,
9541 .setup = alc883_mode2_setup,
9542 .init_hook = alc_inithook,
9544 [ALC888_ASUS_EEE1601] = {
9545 .mixers = { alc883_asus_eee1601_mixer },
9546 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9547 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9548 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9549 .dac_nids = alc883_dac_nids,
9550 .dig_out_nid = ALC883_DIGOUT_NID,
9551 .dig_in_nid = ALC883_DIGIN_NID,
9552 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9553 .channel_mode = alc883_3ST_2ch_modes,
9555 .input_mux = &alc883_asus_eee1601_capture_source,
9556 .unsol_event = alc_sku_unsol_event,
9557 .init_hook = alc883_eee1601_inithook,
9559 [ALC1200_ASUS_P5Q] = {
9560 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9561 .init_verbs = { alc883_init_verbs },
9562 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9563 .dac_nids = alc883_dac_nids,
9564 .dig_out_nid = ALC1200_DIGOUT_NID,
9565 .dig_in_nid = ALC883_DIGIN_NID,
9566 .slave_dig_outs = alc1200_slave_dig_outs,
9567 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9568 .channel_mode = alc883_sixstack_modes,
9569 .input_mux = &alc883_capture_source,
9572 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9573 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9574 alc880_gpio1_init_verbs },
9575 .adc_nids = alc883_adc_nids,
9576 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9577 .dac_nids = alc883_dac_nids,
9578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9579 .channel_mode = alc889A_mb31_6ch_modes,
9580 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9581 .input_mux = &alc889A_mb31_capture_source,
9582 .dig_out_nid = ALC883_DIGOUT_NID,
9583 .unsol_event = alc889A_mb31_unsol_event,
9584 .init_hook = alc889A_mb31_automute,
9586 [ALC883_SONY_VAIO_TT] = {
9587 .mixers = { alc883_vaiott_mixer },
9588 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9590 .dac_nids = alc883_dac_nids,
9591 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9592 .channel_mode = alc883_3ST_2ch_modes,
9593 .input_mux = &alc883_capture_source,
9594 .unsol_event = alc_automute_amp_unsol_event,
9595 .setup = alc883_vaiott_setup,
9596 .init_hook = alc_automute_amp,
9605 PINFIX_ABIT_AW9D_MAX
9608 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9609 { 0x15, 0x01080104 }, /* side */
9610 { 0x16, 0x01011012 }, /* rear */
9611 { 0x17, 0x01016011 }, /* clfe */
9615 static const struct alc_fixup alc882_fixups[] = {
9616 [PINFIX_ABIT_AW9D_MAX] = {
9617 .pins = alc882_abit_aw9d_pinfix
9621 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9622 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9627 * BIOS auto configuration
9629 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9630 const struct auto_pin_cfg *cfg)
9632 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9635 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9636 hda_nid_t nid, int pin_type,
9640 struct alc_spec *spec = codec->spec;
9643 alc_set_pin_output(codec, nid, pin_type);
9644 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9647 idx = spec->multiout.dac_nids[dac_idx] - 2;
9648 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9652 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9654 struct alc_spec *spec = codec->spec;
9657 for (i = 0; i <= HDA_SIDE; i++) {
9658 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9659 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9661 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9666 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9668 struct alc_spec *spec = codec->spec;
9671 pin = spec->autocfg.hp_pins[0];
9672 if (pin) /* connect to front */
9674 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9675 pin = spec->autocfg.speaker_pins[0];
9677 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9680 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9682 struct alc_spec *spec = codec->spec;
9685 for (i = 0; i < AUTO_PIN_LAST; i++) {
9686 hda_nid_t nid = spec->autocfg.input_pins[i];
9689 alc_set_input_pin(codec, nid, i);
9690 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9691 snd_hda_codec_write(codec, nid, 0,
9692 AC_VERB_SET_AMP_GAIN_MUTE,
9697 static void alc882_auto_init_input_src(struct hda_codec *codec)
9699 struct alc_spec *spec = codec->spec;
9702 for (c = 0; c < spec->num_adc_nids; c++) {
9703 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9704 hda_nid_t nid = spec->capsrc_nids[c];
9705 unsigned int mux_idx;
9706 const struct hda_input_mux *imux;
9707 int conns, mute, idx, item;
9709 conns = snd_hda_get_connections(codec, nid, conn_list,
9710 ARRAY_SIZE(conn_list));
9713 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9714 imux = &spec->input_mux[mux_idx];
9715 for (idx = 0; idx < conns; idx++) {
9716 /* if the current connection is the selected one,
9717 * unmute it as default - otherwise mute it
9719 mute = AMP_IN_MUTE(idx);
9720 for (item = 0; item < imux->num_items; item++) {
9721 if (imux->items[item].index == idx) {
9722 if (spec->cur_mux[c] == item)
9723 mute = AMP_IN_UNMUTE(idx);
9727 /* check if we have a selector or mixer
9728 * we could check for the widget type instead, but
9729 * just check for Amp-In presence (in case of mixer
9730 * without amp-in there is something wrong, this
9731 * function shouldn't be used or capsrc nid is wrong)
9733 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9734 snd_hda_codec_write(codec, nid, 0,
9735 AC_VERB_SET_AMP_GAIN_MUTE,
9737 else if (mute != AMP_IN_MUTE(idx))
9738 snd_hda_codec_write(codec, nid, 0,
9739 AC_VERB_SET_CONNECT_SEL,
9745 /* add mic boosts if needed */
9746 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9748 struct alc_spec *spec = codec->spec;
9752 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9753 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9754 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9756 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9760 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9761 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9762 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9764 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9771 /* almost identical with ALC880 parser... */
9772 static int alc882_parse_auto_config(struct hda_codec *codec)
9774 struct alc_spec *spec = codec->spec;
9775 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9778 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9782 if (!spec->autocfg.line_outs)
9783 return 0; /* can't find valid BIOS pin config */
9785 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9788 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9791 err = alc880_auto_create_extra_out(spec,
9792 spec->autocfg.speaker_pins[0],
9796 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9800 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9804 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9806 /* check multiple SPDIF-out (for recent codecs) */
9807 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9809 err = snd_hda_get_connections(codec,
9810 spec->autocfg.dig_out_pins[i],
9815 spec->multiout.dig_out_nid = dig_nid;
9817 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9818 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9820 spec->slave_dig_outs[i - 1] = dig_nid;
9823 if (spec->autocfg.dig_in_pin)
9824 spec->dig_in_nid = ALC880_DIGIN_NID;
9826 if (spec->kctls.list)
9827 add_mixer(spec, spec->kctls.list);
9829 add_verb(spec, alc883_auto_init_verbs);
9830 /* if ADC 0x07 is available, initialize it, too */
9831 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9832 add_verb(spec, alc882_adc1_init_verbs);
9834 spec->num_mux_defs = 1;
9835 spec->input_mux = &spec->private_imux[0];
9837 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9839 err = alc_auto_add_mic_boost(codec);
9843 return 1; /* config found */
9846 /* additional initialization for auto-configuration model */
9847 static void alc882_auto_init(struct hda_codec *codec)
9849 struct alc_spec *spec = codec->spec;
9850 alc882_auto_init_multi_out(codec);
9851 alc882_auto_init_hp_out(codec);
9852 alc882_auto_init_analog_input(codec);
9853 alc882_auto_init_input_src(codec);
9854 if (spec->unsol_event)
9855 alc_inithook(codec);
9858 static int patch_alc882(struct hda_codec *codec)
9860 struct alc_spec *spec;
9861 int err, board_config;
9863 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9869 switch (codec->vendor_id) {
9874 /* ALC883 and variants */
9875 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9879 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9883 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9884 board_config = snd_hda_check_board_codec_sid_config(codec,
9885 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9887 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9888 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9890 board_config = ALC882_AUTO;
9893 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9895 if (board_config == ALC882_AUTO) {
9896 /* automatic parse from the BIOS config */
9897 err = alc882_parse_auto_config(codec);
9903 "hda_codec: Cannot set up configuration "
9904 "from BIOS. Using base mode...\n");
9905 board_config = ALC882_3ST_DIG;
9909 err = snd_hda_attach_beep_device(codec, 0x1);
9915 if (board_config != ALC882_AUTO)
9916 setup_preset(codec, &alc882_presets[board_config]);
9918 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9919 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9920 /* FIXME: setup DAC5 */
9921 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9922 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9924 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9925 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9927 if (codec->vendor_id == 0x10ec0888)
9928 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9930 if (!spec->adc_nids && spec->input_mux) {
9932 spec->num_adc_nids = 0;
9933 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9935 hda_nid_t nid = alc882_adc_nids[i];
9936 unsigned int wcap = get_wcaps(codec, nid);
9938 wcap = get_wcaps_type(wcap);
9939 if (wcap != AC_WID_AUD_IN)
9941 spec->private_adc_nids[spec->num_adc_nids] = nid;
9942 err = snd_hda_get_connections(codec, nid, &cap, 1);
9945 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9946 spec->num_adc_nids++;
9948 spec->adc_nids = spec->private_adc_nids;
9949 spec->capsrc_nids = spec->private_capsrc_nids;
9952 set_capture_mixer(codec);
9953 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9955 spec->vmaster_nid = 0x0c;
9957 codec->patch_ops = alc_patch_ops;
9958 if (board_config == ALC882_AUTO)
9959 spec->init_hook = alc882_auto_init;
9960 #ifdef CONFIG_SND_HDA_POWER_SAVE
9961 if (!spec->loopback.amplist)
9962 spec->loopback.amplist = alc882_loopbacks;
9964 codec->proc_widget_hook = print_realtek_coef;
9974 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9975 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9977 #define alc262_dac_nids alc260_dac_nids
9978 #define alc262_adc_nids alc882_adc_nids
9979 #define alc262_adc_nids_alt alc882_adc_nids_alt
9980 #define alc262_capsrc_nids alc882_capsrc_nids
9981 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9983 #define alc262_modes alc260_modes
9984 #define alc262_capture_source alc882_capture_source
9986 static hda_nid_t alc262_dmic_adc_nids[1] = {
9991 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9993 static struct snd_kcontrol_new alc262_base_mixer[] = {
9994 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9995 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10002 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10003 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10004 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10005 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10008 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10009 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10013 /* update HP, line and mono-out pins according to the master switch */
10014 static void alc262_hp_master_update(struct hda_codec *codec)
10016 struct alc_spec *spec = codec->spec;
10017 int val = spec->master_sw;
10019 /* HP & line-out */
10020 snd_hda_codec_write_cache(codec, 0x1b, 0,
10021 AC_VERB_SET_PIN_WIDGET_CONTROL,
10023 snd_hda_codec_write_cache(codec, 0x15, 0,
10024 AC_VERB_SET_PIN_WIDGET_CONTROL,
10026 /* mono (speaker) depending on the HP jack sense */
10027 val = val && !spec->jack_present;
10028 snd_hda_codec_write_cache(codec, 0x16, 0,
10029 AC_VERB_SET_PIN_WIDGET_CONTROL,
10030 val ? PIN_OUT : 0);
10033 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10035 struct alc_spec *spec = codec->spec;
10036 unsigned int presence;
10037 presence = snd_hda_codec_read(codec, 0x1b, 0,
10038 AC_VERB_GET_PIN_SENSE, 0);
10039 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10040 alc262_hp_master_update(codec);
10043 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10045 if ((res >> 26) != ALC880_HP_EVENT)
10047 alc262_hp_bpc_automute(codec);
10050 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10052 struct alc_spec *spec = codec->spec;
10053 unsigned int presence;
10054 presence = snd_hda_codec_read(codec, 0x15, 0,
10055 AC_VERB_GET_PIN_SENSE, 0);
10056 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
10057 alc262_hp_master_update(codec);
10060 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10063 if ((res >> 26) != ALC880_HP_EVENT)
10065 alc262_hp_wildwest_automute(codec);
10068 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10070 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10071 struct snd_ctl_elem_value *ucontrol)
10073 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10074 struct alc_spec *spec = codec->spec;
10075 int val = !!*ucontrol->value.integer.value;
10077 if (val == spec->master_sw)
10079 spec->master_sw = val;
10080 alc262_hp_master_update(codec);
10084 #define ALC262_HP_MASTER_SWITCH \
10086 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10087 .name = "Master Playback Switch", \
10088 .info = snd_ctl_boolean_mono_info, \
10089 .get = alc262_hp_master_sw_get, \
10090 .put = alc262_hp_master_sw_put, \
10093 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10094 ALC262_HP_MASTER_SWITCH,
10095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10096 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10098 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10100 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10110 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10111 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10112 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10113 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10117 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10118 ALC262_HP_MASTER_SWITCH,
10119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10120 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10123 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10125 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10127 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10137 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10138 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10139 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10140 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10144 /* mute/unmute internal speaker according to the hp jack and mute state */
10145 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10147 struct alc_spec *spec = codec->spec;
10149 spec->autocfg.hp_pins[0] = 0x15;
10150 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10153 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10154 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10155 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10164 static struct hda_verb alc262_hp_t5735_verbs[] = {
10165 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10168 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10172 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10173 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10176 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10182 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10184 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10185 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10188 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10196 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10203 /* bind hp and internal speaker mute (with plug check) as master switch */
10204 static void alc262_hippo_master_update(struct hda_codec *codec)
10206 struct alc_spec *spec = codec->spec;
10207 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10208 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10209 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10213 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10214 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10215 HDA_AMP_MUTE, mute);
10216 /* mute internal speaker per jack sense */
10217 if (spec->jack_present)
10218 mute = HDA_AMP_MUTE;
10220 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10221 HDA_AMP_MUTE, mute);
10222 if (speaker_nid && speaker_nid != line_nid)
10223 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10224 HDA_AMP_MUTE, mute);
10227 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10229 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10230 struct snd_ctl_elem_value *ucontrol)
10232 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10233 struct alc_spec *spec = codec->spec;
10234 int val = !!*ucontrol->value.integer.value;
10236 if (val == spec->master_sw)
10238 spec->master_sw = val;
10239 alc262_hippo_master_update(codec);
10243 #define ALC262_HIPPO_MASTER_SWITCH \
10245 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10246 .name = "Master Playback Switch", \
10247 .info = snd_ctl_boolean_mono_info, \
10248 .get = alc262_hippo_master_sw_get, \
10249 .put = alc262_hippo_master_sw_put, \
10252 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10253 ALC262_HIPPO_MASTER_SWITCH,
10254 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10255 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10256 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10261 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10262 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10263 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10264 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10269 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10270 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10271 ALC262_HIPPO_MASTER_SWITCH,
10272 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10273 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10275 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10276 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10278 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10279 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10280 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10281 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10285 /* mute/unmute internal speaker according to the hp jack and mute state */
10286 static void alc262_hippo_automute(struct hda_codec *codec)
10288 struct alc_spec *spec = codec->spec;
10289 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10290 unsigned int present;
10292 /* need to execute and sync at first */
10293 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10294 present = snd_hda_codec_read(codec, hp_nid, 0,
10295 AC_VERB_GET_PIN_SENSE, 0);
10296 spec->jack_present = (present & 0x80000000) != 0;
10297 alc262_hippo_master_update(codec);
10300 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10302 if ((res >> 26) != ALC880_HP_EVENT)
10304 alc262_hippo_automute(codec);
10307 static void alc262_hippo_setup(struct hda_codec *codec)
10309 struct alc_spec *spec = codec->spec;
10311 spec->autocfg.hp_pins[0] = 0x15;
10312 spec->autocfg.speaker_pins[0] = 0x14;
10315 static void alc262_hippo1_setup(struct hda_codec *codec)
10317 struct alc_spec *spec = codec->spec;
10319 spec->autocfg.hp_pins[0] = 0x1b;
10320 spec->autocfg.speaker_pins[0] = 0x14;
10324 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10325 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10326 ALC262_HIPPO_MASTER_SWITCH,
10327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10329 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10330 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10334 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10335 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10336 ALC262_HIPPO_MASTER_SWITCH,
10337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10340 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10341 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10345 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10346 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10347 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10348 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10349 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10355 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10357 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10361 static struct hda_verb alc262_tyan_verbs[] = {
10362 /* Headphone automute */
10363 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10364 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10367 /* P11 AUX_IN, white 4-pin connector */
10368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10369 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10370 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10371 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10376 /* unsolicited event for HP jack sensing */
10377 static void alc262_tyan_setup(struct hda_codec *codec)
10379 struct alc_spec *spec = codec->spec;
10381 spec->autocfg.hp_pins[0] = 0x1b;
10382 spec->autocfg.speaker_pins[0] = 0x15;
10386 #define alc262_capture_mixer alc882_capture_mixer
10387 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10390 * generic initialization of ADC, input mixers and output mixers
10392 static struct hda_verb alc262_init_verbs[] = {
10394 * Unmute ADC0-2 and set the default input to mic-in
10396 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10398 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10400 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10403 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10405 * Note: PASD motherboards uses the Line In 2 as the input for
10406 * front panel mic (mic 2)
10408 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10409 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10410 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10411 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10416 * Set up output mixers (0x0c - 0x0e)
10418 /* set vol=0 to output mixers */
10419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10422 /* set up input amps for analog loopback */
10423 /* Amp Indices: DAC = 0, mixer = 1 */
10424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10433 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10435 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10436 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10439 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10440 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10442 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10447 /* FIXME: use matrix-type input source selection */
10448 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10449 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10468 static struct hda_verb alc262_eapd_verbs[] = {
10469 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10470 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10474 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10476 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10484 static struct hda_verb alc262_sony_unsol_verbs[] = {
10485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10486 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10487 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10489 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10490 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10494 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10495 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10496 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10497 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10503 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10504 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10507 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10508 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10510 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10511 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10515 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10517 struct alc_spec *spec = codec->spec;
10519 spec->autocfg.hp_pins[0] = 0x15;
10520 spec->autocfg.speaker_pins[0] = 0x14;
10521 spec->ext_mic.pin = 0x18;
10522 spec->ext_mic.mux_idx = 0;
10523 spec->int_mic.pin = 0x12;
10524 spec->int_mic.mux_idx = 9;
10525 spec->auto_mic = 1;
10531 * 0x16 = internal speaker
10532 * 0x18 = external mic
10535 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10536 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10537 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10543 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10548 static struct hda_verb alc262_nec_verbs[] = {
10549 /* Unmute Speaker */
10550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10553 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10556 /* External mic to headphone */
10557 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10558 /* External mic to speaker */
10559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10565 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10566 * 0x1b = port replicator headphone out
10569 #define ALC_HP_EVENT 0x37
10571 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10572 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10574 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10579 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10580 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10581 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10585 static struct hda_input_mux alc262_fujitsu_capture_source = {
10589 { "Int Mic", 0x1 },
10594 static struct hda_input_mux alc262_HP_capture_source = {
10598 { "Front Mic", 0x1 },
10605 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10609 { "Front Mic", 0x2 },
10615 /* mute/unmute internal speaker according to the hp jacks and mute state */
10616 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10618 struct alc_spec *spec = codec->spec;
10621 if (force || !spec->sense_updated) {
10622 unsigned int present;
10623 /* need to execute and sync at first */
10624 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10625 /* check laptop HP jack */
10626 present = snd_hda_codec_read(codec, 0x14, 0,
10627 AC_VERB_GET_PIN_SENSE, 0);
10628 /* need to execute and sync at first */
10629 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10630 /* check docking HP jack */
10631 present |= snd_hda_codec_read(codec, 0x1b, 0,
10632 AC_VERB_GET_PIN_SENSE, 0);
10633 if (present & AC_PINSENSE_PRESENCE)
10634 spec->jack_present = 1;
10636 spec->jack_present = 0;
10637 spec->sense_updated = 1;
10639 /* unmute internal speaker only if both HPs are unplugged and
10640 * master switch is on
10642 if (spec->jack_present)
10643 mute = HDA_AMP_MUTE;
10645 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10646 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10647 HDA_AMP_MUTE, mute);
10650 /* unsolicited event for HP jack sensing */
10651 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10654 if ((res >> 26) != ALC_HP_EVENT)
10656 alc262_fujitsu_automute(codec, 1);
10659 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10661 alc262_fujitsu_automute(codec, 1);
10664 /* bind volumes of both NID 0x0c and 0x0d */
10665 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10666 .ops = &snd_hda_bind_vol,
10668 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10669 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10674 /* mute/unmute internal speaker according to the hp jack and mute state */
10675 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10677 struct alc_spec *spec = codec->spec;
10680 if (force || !spec->sense_updated) {
10681 unsigned int present_int_hp;
10682 /* need to execute and sync at first */
10683 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10684 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10685 AC_VERB_GET_PIN_SENSE, 0);
10686 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10687 spec->sense_updated = 1;
10689 if (spec->jack_present) {
10690 /* mute internal speaker */
10691 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10692 HDA_AMP_MUTE, HDA_AMP_MUTE);
10693 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10694 HDA_AMP_MUTE, HDA_AMP_MUTE);
10696 /* unmute internal speaker if necessary */
10697 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10698 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10699 HDA_AMP_MUTE, mute);
10700 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10701 HDA_AMP_MUTE, mute);
10705 /* unsolicited event for HP jack sensing */
10706 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10709 if ((res >> 26) != ALC_HP_EVENT)
10711 alc262_lenovo_3000_automute(codec, 1);
10714 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10715 int dir, int idx, long *valp)
10719 for (i = 0; i < 2; i++, valp++)
10720 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10722 *valp ? 0 : HDA_AMP_MUTE);
10726 /* bind hp and internal speaker mute (with plug check) */
10727 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10728 struct snd_ctl_elem_value *ucontrol)
10730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10731 long *valp = ucontrol->value.integer.value;
10734 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10735 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10737 alc262_fujitsu_automute(codec, 0);
10741 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10742 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10744 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10745 .name = "Master Playback Switch",
10746 .info = snd_hda_mixer_amp_switch_info,
10747 .get = snd_hda_mixer_amp_switch_get,
10748 .put = alc262_fujitsu_master_sw_put,
10749 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10751 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10752 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10753 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10756 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10757 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10758 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10762 /* bind hp and internal speaker mute (with plug check) */
10763 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10764 struct snd_ctl_elem_value *ucontrol)
10766 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10767 long *valp = ucontrol->value.integer.value;
10770 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10772 alc262_lenovo_3000_automute(codec, 0);
10776 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10777 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10780 .name = "Master Playback Switch",
10781 .info = snd_hda_mixer_amp_switch_info,
10782 .get = snd_hda_mixer_amp_switch_get,
10783 .put = alc262_lenovo_3000_master_sw_put,
10784 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10789 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10791 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10792 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10793 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10797 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10798 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10799 ALC262_HIPPO_MASTER_SWITCH,
10800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10803 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10804 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10805 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10809 /* additional init verbs for Benq laptops */
10810 static struct hda_verb alc262_EAPD_verbs[] = {
10811 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10812 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10816 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10817 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10820 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10821 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10825 /* Samsung Q1 Ultra Vista model setup */
10826 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10827 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10828 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10831 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10832 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10836 static struct hda_verb alc262_ultra_verbs[] = {
10838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10844 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10845 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10849 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10850 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10851 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10855 /* ADC, choose mic */
10856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10865 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10869 /* mute/unmute internal speaker according to the hp jack and mute state */
10870 static void alc262_ultra_automute(struct hda_codec *codec)
10872 struct alc_spec *spec = codec->spec;
10876 /* auto-mute only when HP is used as HP */
10877 if (!spec->cur_mux[0]) {
10878 unsigned int present;
10879 /* need to execute and sync at first */
10880 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10881 present = snd_hda_codec_read(codec, 0x15, 0,
10882 AC_VERB_GET_PIN_SENSE, 0);
10883 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10884 if (spec->jack_present)
10885 mute = HDA_AMP_MUTE;
10887 /* mute/unmute internal speaker */
10888 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10889 HDA_AMP_MUTE, mute);
10890 /* mute/unmute HP */
10891 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10892 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10895 /* unsolicited event for HP jack sensing */
10896 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10899 if ((res >> 26) != ALC880_HP_EVENT)
10901 alc262_ultra_automute(codec);
10904 static struct hda_input_mux alc262_ultra_capture_source = {
10908 { "Headphone", 0x7 },
10912 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10913 struct snd_ctl_elem_value *ucontrol)
10915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10916 struct alc_spec *spec = codec->spec;
10919 ret = alc_mux_enum_put(kcontrol, ucontrol);
10922 /* reprogram the HP pin as mic or HP according to the input source */
10923 snd_hda_codec_write_cache(codec, 0x15, 0,
10924 AC_VERB_SET_PIN_WIDGET_CONTROL,
10925 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10926 alc262_ultra_automute(codec); /* mute/unmute HP */
10930 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10931 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10932 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10935 .name = "Capture Source",
10936 .info = alc_mux_enum_info,
10937 .get = alc_mux_enum_get,
10938 .put = alc262_ultra_mux_enum_put,
10943 /* We use two mixers depending on the output pin; 0x16 is a mono output
10944 * and thus it's bound with a different mixer.
10945 * This function returns which mixer amp should be used.
10947 static int alc262_check_volbit(hda_nid_t nid)
10951 else if (nid == 0x16)
10957 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
10958 const char *pfx, int *vbits)
10963 vbit = alc262_check_volbit(nid);
10966 if (*vbits & vbit) /* a volume control for this mixer already there */
10970 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
10972 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
10973 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
10976 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
10984 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
10986 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
10987 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
10990 /* add playback controls from the parsed DAC table */
10991 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10992 const struct auto_pin_cfg *cfg)
10998 spec->multiout.num_dacs = 1; /* only use one dac */
10999 spec->multiout.dac_nids = spec->private_dac_nids;
11000 spec->multiout.dac_nids[0] = 2;
11002 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11004 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11008 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11011 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11014 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11018 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11019 alc262_check_volbit(cfg->speaker_pins[0]) |
11020 alc262_check_volbit(cfg->hp_pins[0]);
11021 if (vbits == 1 || vbits == 2)
11022 pfx = "Master"; /* only one mixer is used */
11023 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11028 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11031 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11035 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11042 #define alc262_auto_create_input_ctls \
11043 alc880_auto_create_input_ctls
11046 * generic initialization of ADC, input mixers and output mixers
11048 static struct hda_verb alc262_volume_init_verbs[] = {
11050 * Unmute ADC0-2 and set the default input to mic-in
11052 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11054 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11056 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11057 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11059 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11061 * Note: PASD motherboards uses the Line In 2 as the input for
11062 * front panel mic (mic 2)
11064 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11072 * Set up output mixers (0x0c - 0x0f)
11074 /* set vol=0 to output mixers */
11075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11079 /* set up input amps for analog loopback */
11080 /* Amp Indices: DAC = 0, mixer = 1 */
11081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11083 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11084 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11086 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11088 /* FIXME: use matrix-type input source selection */
11089 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11090 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11109 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11111 * Unmute ADC0-2 and set the default input to mic-in
11113 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11115 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11117 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11120 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11122 * Note: PASD motherboards uses the Line In 2 as the input for
11123 * front panel mic (mic 2)
11125 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11135 * Set up output mixers (0x0c - 0x0e)
11137 /* set vol=0 to output mixers */
11138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11142 /* set up input amps for analog loopback */
11143 /* Amp Indices: DAC = 0, mixer = 1 */
11144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11147 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11151 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11153 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11158 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11159 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11162 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11164 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11167 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11168 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11169 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11171 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11172 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11175 /* FIXME: use matrix-type input source selection */
11176 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11177 /* Input mixer1: only unmute Mic */
11178 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11195 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11196 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11213 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11215 * Unmute ADC0-2 and set the default input to mic-in
11217 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11224 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11226 * Note: PASD motherboards uses the Line In 2 as the input for front
11227 * panel mic (mic 2)
11229 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11239 * Set up output mixers (0x0c - 0x0e)
11241 /* set vol=0 to output mixers */
11242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11246 /* set up input amps for analog loopback */
11247 /* Amp Indices: DAC = 0, mixer = 1 */
11248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11262 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11267 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11268 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11270 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11272 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11273 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11274 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11275 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11277 /* FIXME: use matrix-type input source selection */
11278 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11279 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11285 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11293 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11301 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11309 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11313 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11321 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11322 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11327 #ifdef CONFIG_SND_HDA_POWER_SAVE
11328 #define alc262_loopbacks alc880_loopbacks
11331 /* pcm configuration: identical with ALC880 */
11332 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11333 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11334 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11335 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11338 * BIOS auto configuration
11340 static int alc262_parse_auto_config(struct hda_codec *codec)
11342 struct alc_spec *spec = codec->spec;
11344 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11346 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11350 if (!spec->autocfg.line_outs) {
11351 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11352 spec->multiout.max_channels = 2;
11353 spec->no_analog = 1;
11356 return 0; /* can't find valid BIOS pin config */
11358 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11361 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11365 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11368 if (spec->autocfg.dig_outs) {
11369 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11370 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11372 if (spec->autocfg.dig_in_pin)
11373 spec->dig_in_nid = ALC262_DIGIN_NID;
11375 if (spec->kctls.list)
11376 add_mixer(spec, spec->kctls.list);
11378 add_verb(spec, alc262_volume_init_verbs);
11379 spec->num_mux_defs = 1;
11380 spec->input_mux = &spec->private_imux[0];
11382 err = alc_auto_add_mic_boost(codec);
11386 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11391 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11392 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11393 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11394 #define alc262_auto_init_input_src alc882_auto_init_input_src
11397 /* init callback for auto-configuration model -- overriding the default init */
11398 static void alc262_auto_init(struct hda_codec *codec)
11400 struct alc_spec *spec = codec->spec;
11401 alc262_auto_init_multi_out(codec);
11402 alc262_auto_init_hp_out(codec);
11403 alc262_auto_init_analog_input(codec);
11404 alc262_auto_init_input_src(codec);
11405 if (spec->unsol_event)
11406 alc_inithook(codec);
11410 * configuration and preset
11412 static const char *alc262_models[ALC262_MODEL_LAST] = {
11413 [ALC262_BASIC] = "basic",
11414 [ALC262_HIPPO] = "hippo",
11415 [ALC262_HIPPO_1] = "hippo_1",
11416 [ALC262_FUJITSU] = "fujitsu",
11417 [ALC262_HP_BPC] = "hp-bpc",
11418 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11419 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11420 [ALC262_HP_RP5700] = "hp-rp5700",
11421 [ALC262_BENQ_ED8] = "benq",
11422 [ALC262_BENQ_T31] = "benq-t31",
11423 [ALC262_SONY_ASSAMD] = "sony-assamd",
11424 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11425 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11426 [ALC262_ULTRA] = "ultra",
11427 [ALC262_LENOVO_3000] = "lenovo-3000",
11428 [ALC262_NEC] = "nec",
11429 [ALC262_TYAN] = "tyan",
11430 [ALC262_AUTO] = "auto",
11433 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11434 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11435 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11436 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11438 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11440 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11442 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11443 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11444 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11445 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11446 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11447 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11448 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11449 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11450 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11451 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11452 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11453 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11454 ALC262_HP_TC_T5735),
11455 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11456 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11457 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11458 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11459 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11460 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11461 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11462 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11463 ALC262_SONY_ASSAMD),
11464 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11465 ALC262_TOSHIBA_RX1),
11466 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11467 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11468 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11469 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11470 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11472 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11473 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11474 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11475 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11476 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11480 static struct alc_config_preset alc262_presets[] = {
11482 .mixers = { alc262_base_mixer },
11483 .init_verbs = { alc262_init_verbs },
11484 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11485 .dac_nids = alc262_dac_nids,
11487 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11488 .channel_mode = alc262_modes,
11489 .input_mux = &alc262_capture_source,
11492 .mixers = { alc262_hippo_mixer },
11493 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11494 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11495 .dac_nids = alc262_dac_nids,
11497 .dig_out_nid = ALC262_DIGOUT_NID,
11498 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11499 .channel_mode = alc262_modes,
11500 .input_mux = &alc262_capture_source,
11501 .unsol_event = alc262_hippo_unsol_event,
11502 .setup = alc262_hippo_setup,
11503 .init_hook = alc262_hippo_automute,
11505 [ALC262_HIPPO_1] = {
11506 .mixers = { alc262_hippo1_mixer },
11507 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11508 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11509 .dac_nids = alc262_dac_nids,
11511 .dig_out_nid = ALC262_DIGOUT_NID,
11512 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11513 .channel_mode = alc262_modes,
11514 .input_mux = &alc262_capture_source,
11515 .unsol_event = alc262_hippo_unsol_event,
11516 .setup = alc262_hippo1_setup,
11517 .init_hook = alc262_hippo_automute,
11519 [ALC262_FUJITSU] = {
11520 .mixers = { alc262_fujitsu_mixer },
11521 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11522 alc262_fujitsu_unsol_verbs },
11523 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11524 .dac_nids = alc262_dac_nids,
11526 .dig_out_nid = ALC262_DIGOUT_NID,
11527 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11528 .channel_mode = alc262_modes,
11529 .input_mux = &alc262_fujitsu_capture_source,
11530 .unsol_event = alc262_fujitsu_unsol_event,
11531 .init_hook = alc262_fujitsu_init_hook,
11533 [ALC262_HP_BPC] = {
11534 .mixers = { alc262_HP_BPC_mixer },
11535 .init_verbs = { alc262_HP_BPC_init_verbs },
11536 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11537 .dac_nids = alc262_dac_nids,
11539 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11540 .channel_mode = alc262_modes,
11541 .input_mux = &alc262_HP_capture_source,
11542 .unsol_event = alc262_hp_bpc_unsol_event,
11543 .init_hook = alc262_hp_bpc_automute,
11545 [ALC262_HP_BPC_D7000_WF] = {
11546 .mixers = { alc262_HP_BPC_WildWest_mixer },
11547 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11548 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11549 .dac_nids = alc262_dac_nids,
11551 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11552 .channel_mode = alc262_modes,
11553 .input_mux = &alc262_HP_D7000_capture_source,
11554 .unsol_event = alc262_hp_wildwest_unsol_event,
11555 .init_hook = alc262_hp_wildwest_automute,
11557 [ALC262_HP_BPC_D7000_WL] = {
11558 .mixers = { alc262_HP_BPC_WildWest_mixer,
11559 alc262_HP_BPC_WildWest_option_mixer },
11560 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11561 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11562 .dac_nids = alc262_dac_nids,
11564 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11565 .channel_mode = alc262_modes,
11566 .input_mux = &alc262_HP_D7000_capture_source,
11567 .unsol_event = alc262_hp_wildwest_unsol_event,
11568 .init_hook = alc262_hp_wildwest_automute,
11570 [ALC262_HP_TC_T5735] = {
11571 .mixers = { alc262_hp_t5735_mixer },
11572 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11573 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11574 .dac_nids = alc262_dac_nids,
11576 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11577 .channel_mode = alc262_modes,
11578 .input_mux = &alc262_capture_source,
11579 .unsol_event = alc_automute_amp_unsol_event,
11580 .setup = alc262_hp_t5735_setup,
11581 .init_hook = alc_automute_amp,
11583 [ALC262_HP_RP5700] = {
11584 .mixers = { alc262_hp_rp5700_mixer },
11585 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11586 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11587 .dac_nids = alc262_dac_nids,
11588 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11589 .channel_mode = alc262_modes,
11590 .input_mux = &alc262_hp_rp5700_capture_source,
11592 [ALC262_BENQ_ED8] = {
11593 .mixers = { alc262_base_mixer },
11594 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11595 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11596 .dac_nids = alc262_dac_nids,
11598 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11599 .channel_mode = alc262_modes,
11600 .input_mux = &alc262_capture_source,
11602 [ALC262_SONY_ASSAMD] = {
11603 .mixers = { alc262_sony_mixer },
11604 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11605 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11606 .dac_nids = alc262_dac_nids,
11608 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11609 .channel_mode = alc262_modes,
11610 .input_mux = &alc262_capture_source,
11611 .unsol_event = alc262_hippo_unsol_event,
11612 .setup = alc262_hippo_setup,
11613 .init_hook = alc262_hippo_automute,
11615 [ALC262_BENQ_T31] = {
11616 .mixers = { alc262_benq_t31_mixer },
11617 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11618 alc_hp15_unsol_verbs },
11619 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11620 .dac_nids = alc262_dac_nids,
11622 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11623 .channel_mode = alc262_modes,
11624 .input_mux = &alc262_capture_source,
11625 .unsol_event = alc262_hippo_unsol_event,
11626 .setup = alc262_hippo_setup,
11627 .init_hook = alc262_hippo_automute,
11630 .mixers = { alc262_ultra_mixer },
11631 .cap_mixer = alc262_ultra_capture_mixer,
11632 .init_verbs = { alc262_ultra_verbs },
11633 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11634 .dac_nids = alc262_dac_nids,
11635 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11636 .channel_mode = alc262_modes,
11637 .input_mux = &alc262_ultra_capture_source,
11638 .adc_nids = alc262_adc_nids, /* ADC0 */
11639 .capsrc_nids = alc262_capsrc_nids,
11640 .num_adc_nids = 1, /* single ADC */
11641 .unsol_event = alc262_ultra_unsol_event,
11642 .init_hook = alc262_ultra_automute,
11644 [ALC262_LENOVO_3000] = {
11645 .mixers = { alc262_lenovo_3000_mixer },
11646 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11647 alc262_lenovo_3000_unsol_verbs },
11648 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11649 .dac_nids = alc262_dac_nids,
11651 .dig_out_nid = ALC262_DIGOUT_NID,
11652 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11653 .channel_mode = alc262_modes,
11654 .input_mux = &alc262_fujitsu_capture_source,
11655 .unsol_event = alc262_lenovo_3000_unsol_event,
11658 .mixers = { alc262_nec_mixer },
11659 .init_verbs = { alc262_nec_verbs },
11660 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11661 .dac_nids = alc262_dac_nids,
11663 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11664 .channel_mode = alc262_modes,
11665 .input_mux = &alc262_capture_source,
11667 [ALC262_TOSHIBA_S06] = {
11668 .mixers = { alc262_toshiba_s06_mixer },
11669 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11670 alc262_eapd_verbs },
11671 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11672 .capsrc_nids = alc262_dmic_capsrc_nids,
11673 .dac_nids = alc262_dac_nids,
11674 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11675 .num_adc_nids = 1, /* single ADC */
11676 .dig_out_nid = ALC262_DIGOUT_NID,
11677 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11678 .channel_mode = alc262_modes,
11679 .unsol_event = alc_sku_unsol_event,
11680 .setup = alc262_toshiba_s06_setup,
11681 .init_hook = alc_inithook,
11683 [ALC262_TOSHIBA_RX1] = {
11684 .mixers = { alc262_toshiba_rx1_mixer },
11685 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11686 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11687 .dac_nids = alc262_dac_nids,
11689 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11690 .channel_mode = alc262_modes,
11691 .input_mux = &alc262_capture_source,
11692 .unsol_event = alc262_hippo_unsol_event,
11693 .setup = alc262_hippo_setup,
11694 .init_hook = alc262_hippo_automute,
11697 .mixers = { alc262_tyan_mixer },
11698 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11699 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11700 .dac_nids = alc262_dac_nids,
11702 .dig_out_nid = ALC262_DIGOUT_NID,
11703 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11704 .channel_mode = alc262_modes,
11705 .input_mux = &alc262_capture_source,
11706 .unsol_event = alc_automute_amp_unsol_event,
11707 .setup = alc262_tyan_setup,
11708 .init_hook = alc_automute_amp,
11712 static int patch_alc262(struct hda_codec *codec)
11714 struct alc_spec *spec;
11718 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11722 codec->spec = spec;
11724 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11729 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11730 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11731 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11732 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11736 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11738 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11742 if (board_config < 0) {
11743 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11745 board_config = ALC262_AUTO;
11748 if (board_config == ALC262_AUTO) {
11749 /* automatic parse from the BIOS config */
11750 err = alc262_parse_auto_config(codec);
11756 "hda_codec: Cannot set up configuration "
11757 "from BIOS. Using base mode...\n");
11758 board_config = ALC262_BASIC;
11762 if (!spec->no_analog) {
11763 err = snd_hda_attach_beep_device(codec, 0x1);
11770 if (board_config != ALC262_AUTO)
11771 setup_preset(codec, &alc262_presets[board_config]);
11773 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11774 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11776 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11777 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11779 if (!spec->adc_nids && spec->input_mux) {
11781 /* check whether the digital-mic has to be supported */
11782 for (i = 0; i < spec->input_mux->num_items; i++) {
11783 if (spec->input_mux->items[i].index >= 9)
11786 if (i < spec->input_mux->num_items) {
11787 /* use only ADC0 */
11788 spec->adc_nids = alc262_dmic_adc_nids;
11789 spec->num_adc_nids = 1;
11790 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11792 /* all analog inputs */
11793 /* check whether NID 0x07 is valid */
11794 unsigned int wcap = get_wcaps(codec, 0x07);
11797 wcap = get_wcaps_type(wcap);
11798 if (wcap != AC_WID_AUD_IN) {
11799 spec->adc_nids = alc262_adc_nids_alt;
11800 spec->num_adc_nids =
11801 ARRAY_SIZE(alc262_adc_nids_alt);
11802 spec->capsrc_nids = alc262_capsrc_nids_alt;
11804 spec->adc_nids = alc262_adc_nids;
11805 spec->num_adc_nids =
11806 ARRAY_SIZE(alc262_adc_nids);
11807 spec->capsrc_nids = alc262_capsrc_nids;
11811 if (!spec->cap_mixer && !spec->no_analog)
11812 set_capture_mixer(codec);
11813 if (!spec->no_analog)
11814 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11816 spec->vmaster_nid = 0x0c;
11818 codec->patch_ops = alc_patch_ops;
11819 if (board_config == ALC262_AUTO)
11820 spec->init_hook = alc262_auto_init;
11821 #ifdef CONFIG_SND_HDA_POWER_SAVE
11822 if (!spec->loopback.amplist)
11823 spec->loopback.amplist = alc262_loopbacks;
11825 codec->proc_widget_hook = print_realtek_coef;
11831 * ALC268 channel source setting (2 channel)
11833 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11834 #define alc268_modes alc260_modes
11836 static hda_nid_t alc268_dac_nids[2] = {
11841 static hda_nid_t alc268_adc_nids[2] = {
11846 static hda_nid_t alc268_adc_nids_alt[1] = {
11851 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11853 static struct snd_kcontrol_new alc268_base_mixer[] = {
11854 /* output mixer control */
11855 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11856 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11857 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11859 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11860 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11861 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11865 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11866 /* output mixer control */
11867 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11868 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11869 ALC262_HIPPO_MASTER_SWITCH,
11870 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11871 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11872 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11876 /* bind Beep switches of both NID 0x0f and 0x10 */
11877 static struct hda_bind_ctls alc268_bind_beep_sw = {
11878 .ops = &snd_hda_bind_sw,
11880 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11881 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11886 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11887 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11888 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11892 static struct hda_verb alc268_eapd_verbs[] = {
11893 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11894 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11898 /* Toshiba specific */
11899 static struct hda_verb alc268_toshiba_verbs[] = {
11900 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11904 /* Acer specific */
11905 /* bind volumes of both NID 0x02 and 0x03 */
11906 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11907 .ops = &snd_hda_bind_vol,
11909 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11910 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11915 /* mute/unmute internal speaker according to the hp jack and mute state */
11916 static void alc268_acer_automute(struct hda_codec *codec, int force)
11918 struct alc_spec *spec = codec->spec;
11921 if (force || !spec->sense_updated) {
11922 unsigned int present;
11923 present = snd_hda_codec_read(codec, 0x14, 0,
11924 AC_VERB_GET_PIN_SENSE, 0);
11925 spec->jack_present = (present & 0x80000000) != 0;
11926 spec->sense_updated = 1;
11928 if (spec->jack_present)
11929 mute = HDA_AMP_MUTE; /* mute internal speaker */
11930 else /* unmute internal speaker if necessary */
11931 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11932 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11933 HDA_AMP_MUTE, mute);
11937 /* bind hp and internal speaker mute (with plug check) */
11938 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11939 struct snd_ctl_elem_value *ucontrol)
11941 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11942 long *valp = ucontrol->value.integer.value;
11945 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11947 alc268_acer_automute(codec, 0);
11951 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11952 /* output mixer control */
11953 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11955 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11956 .name = "Master Playback Switch",
11957 .info = snd_hda_mixer_amp_switch_info,
11958 .get = snd_hda_mixer_amp_switch_get,
11959 .put = alc268_acer_master_sw_put,
11960 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11962 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11966 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11967 /* output mixer control */
11968 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11971 .name = "Master Playback Switch",
11972 .info = snd_hda_mixer_amp_switch_info,
11973 .get = snd_hda_mixer_amp_switch_get,
11974 .put = alc268_acer_master_sw_put,
11975 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11977 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11978 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11979 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11983 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11984 /* output mixer control */
11985 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11988 .name = "Master Playback Switch",
11989 .info = snd_hda_mixer_amp_switch_info,
11990 .get = snd_hda_mixer_amp_switch_get,
11991 .put = alc268_acer_master_sw_put,
11992 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11995 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11999 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12000 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12002 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12003 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12004 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12009 static struct hda_verb alc268_acer_verbs[] = {
12010 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12011 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12014 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12016 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12020 /* unsolicited event for HP jack sensing */
12021 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12022 #define alc268_toshiba_setup alc262_hippo_setup
12023 #define alc268_toshiba_automute alc262_hippo_automute
12025 static void alc268_acer_unsol_event(struct hda_codec *codec,
12028 if ((res >> 26) != ALC880_HP_EVENT)
12030 alc268_acer_automute(codec, 1);
12033 static void alc268_acer_init_hook(struct hda_codec *codec)
12035 alc268_acer_automute(codec, 1);
12038 /* toggle speaker-output according to the hp-jack state */
12039 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12041 unsigned int present;
12042 unsigned char bits;
12044 present = snd_hda_codec_read(codec, 0x15, 0,
12045 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12046 bits = present ? AMP_IN_MUTE(0) : 0;
12047 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12048 AMP_IN_MUTE(0), bits);
12049 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12050 AMP_IN_MUTE(0), bits);
12053 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12056 switch (res >> 26) {
12057 case ALC880_HP_EVENT:
12058 alc268_aspire_one_speaker_automute(codec);
12060 case ALC880_MIC_EVENT:
12061 alc_mic_automute(codec);
12066 static void alc268_acer_lc_setup(struct hda_codec *codec)
12068 struct alc_spec *spec = codec->spec;
12069 spec->ext_mic.pin = 0x18;
12070 spec->ext_mic.mux_idx = 0;
12071 spec->int_mic.pin = 0x12;
12072 spec->int_mic.mux_idx = 6;
12073 spec->auto_mic = 1;
12076 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12078 alc268_aspire_one_speaker_automute(codec);
12079 alc_mic_automute(codec);
12082 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12083 /* output mixer control */
12084 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12085 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12086 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12088 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12089 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12093 static struct hda_verb alc268_dell_verbs[] = {
12094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12096 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12097 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12101 /* mute/unmute internal speaker according to the hp jack and mute state */
12102 static void alc268_dell_setup(struct hda_codec *codec)
12104 struct alc_spec *spec = codec->spec;
12106 spec->autocfg.hp_pins[0] = 0x15;
12107 spec->autocfg.speaker_pins[0] = 0x14;
12108 spec->ext_mic.pin = 0x18;
12109 spec->ext_mic.mux_idx = 0;
12110 spec->int_mic.pin = 0x19;
12111 spec->int_mic.mux_idx = 1;
12112 spec->auto_mic = 1;
12115 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12116 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12117 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12118 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12119 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12120 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12121 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12122 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12123 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12127 static struct hda_verb alc267_quanta_il1_verbs[] = {
12128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12129 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12133 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12135 struct alc_spec *spec = codec->spec;
12136 spec->autocfg.hp_pins[0] = 0x15;
12137 spec->autocfg.speaker_pins[0] = 0x14;
12138 spec->ext_mic.pin = 0x18;
12139 spec->ext_mic.mux_idx = 0;
12140 spec->int_mic.pin = 0x19;
12141 spec->int_mic.mux_idx = 1;
12142 spec->auto_mic = 1;
12146 * generic initialization of ADC, input mixers and output mixers
12148 static struct hda_verb alc268_base_init_verbs[] = {
12149 /* Unmute DAC0-1 and set vol = 0 */
12150 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12151 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12154 * Set up output mixers (0x0c - 0x0e)
12156 /* set vol=0 to output mixers */
12157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12158 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12160 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12161 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12166 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12168 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12169 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12170 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12174 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12175 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12176 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12178 /* set PCBEEP vol = 0, mute connections */
12179 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12180 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12181 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12183 /* Unmute Selector 23h,24h and set the default input to mic-in */
12185 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12187 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12194 * generic initialization of ADC, input mixers and output mixers
12196 static struct hda_verb alc268_volume_init_verbs[] = {
12197 /* set output DAC */
12198 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12199 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12201 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12204 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12205 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12208 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12209 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12214 /* set PCBEEP vol = 0, mute connections */
12215 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12217 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12222 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12223 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12224 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12228 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12229 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12230 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12235 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12236 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12237 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12238 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12239 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12244 static struct hda_input_mux alc268_capture_source = {
12248 { "Front Mic", 0x1 },
12254 static struct hda_input_mux alc268_acer_capture_source = {
12258 { "Internal Mic", 0x1 },
12263 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12267 { "Internal Mic", 0x6 },
12272 #ifdef CONFIG_SND_DEBUG
12273 static struct snd_kcontrol_new alc268_test_mixer[] = {
12274 /* Volume widgets */
12275 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12276 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12277 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12278 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12279 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12280 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12281 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12282 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12283 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12284 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12285 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12286 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12287 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12288 /* The below appears problematic on some hardwares */
12289 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12290 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12291 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12292 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12293 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12295 /* Modes for retasking pin widgets */
12296 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12297 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12298 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12299 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12301 /* Controls for GPIO pins, assuming they are configured as outputs */
12302 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12303 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12304 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12305 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12307 /* Switches to allow the digital SPDIF output pin to be enabled.
12308 * The ALC268 does not have an SPDIF input.
12310 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12312 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12313 * this output to turn on an external amplifier.
12315 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12316 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12322 /* create input playback/capture controls for the given pin */
12323 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12324 const char *ctlname, int idx)
12340 if (spec->multiout.dac_nids[0] != dac &&
12341 spec->multiout.dac_nids[1] != dac) {
12342 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12343 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12347 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12351 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12352 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12354 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12355 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12361 /* add playback controls from the parsed DAC table */
12362 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12363 const struct auto_pin_cfg *cfg)
12368 spec->multiout.dac_nids = spec->private_dac_nids;
12370 nid = cfg->line_out_pins[0];
12373 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12377 err = alc268_new_analog_output(spec, nid, name, 0);
12382 nid = cfg->speaker_pins[0];
12384 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12385 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12389 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12393 nid = cfg->hp_pins[0];
12395 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12400 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12402 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12403 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12410 /* create playback/capture controls for input pins */
12411 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12412 const struct auto_pin_cfg *cfg)
12414 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12417 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12418 hda_nid_t nid, int pin_type)
12422 alc_set_pin_output(codec, nid, pin_type);
12423 if (nid == 0x14 || nid == 0x16)
12427 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12430 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12432 struct alc_spec *spec = codec->spec;
12433 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12435 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12436 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12440 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12442 struct alc_spec *spec = codec->spec;
12445 pin = spec->autocfg.hp_pins[0];
12447 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12448 pin = spec->autocfg.speaker_pins[0];
12450 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12453 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12455 struct alc_spec *spec = codec->spec;
12456 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12457 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12458 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12459 unsigned int dac_vol1, dac_vol2;
12461 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12462 snd_hda_codec_write(codec, speaker_nid, 0,
12463 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12464 /* mute mixer inputs from 0x1d */
12465 snd_hda_codec_write(codec, 0x0f, 0,
12466 AC_VERB_SET_AMP_GAIN_MUTE,
12468 snd_hda_codec_write(codec, 0x10, 0,
12469 AC_VERB_SET_AMP_GAIN_MUTE,
12472 /* unmute mixer inputs from 0x1d */
12473 snd_hda_codec_write(codec, 0x0f, 0,
12474 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12475 snd_hda_codec_write(codec, 0x10, 0,
12476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12479 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12480 if (line_nid == 0x14)
12481 dac_vol2 = AMP_OUT_ZERO;
12482 else if (line_nid == 0x15)
12483 dac_vol1 = AMP_OUT_ZERO;
12484 if (hp_nid == 0x14)
12485 dac_vol2 = AMP_OUT_ZERO;
12486 else if (hp_nid == 0x15)
12487 dac_vol1 = AMP_OUT_ZERO;
12488 if (line_nid != 0x16 || hp_nid != 0x16 ||
12489 spec->autocfg.line_out_pins[1] != 0x16 ||
12490 spec->autocfg.line_out_pins[2] != 0x16)
12491 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12493 snd_hda_codec_write(codec, 0x02, 0,
12494 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12495 snd_hda_codec_write(codec, 0x03, 0,
12496 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12499 /* pcm configuration: identical with ALC880 */
12500 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12501 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12502 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12503 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12506 * BIOS auto configuration
12508 static int alc268_parse_auto_config(struct hda_codec *codec)
12510 struct alc_spec *spec = codec->spec;
12512 static hda_nid_t alc268_ignore[] = { 0 };
12514 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12518 if (!spec->autocfg.line_outs) {
12519 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12520 spec->multiout.max_channels = 2;
12521 spec->no_analog = 1;
12524 return 0; /* can't find valid BIOS pin config */
12526 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12529 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12533 spec->multiout.max_channels = 2;
12536 /* digital only support output */
12537 if (spec->autocfg.dig_outs) {
12538 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12539 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12541 if (spec->kctls.list)
12542 add_mixer(spec, spec->kctls.list);
12544 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12545 add_mixer(spec, alc268_beep_mixer);
12547 add_verb(spec, alc268_volume_init_verbs);
12548 spec->num_mux_defs = 2;
12549 spec->input_mux = &spec->private_imux[0];
12551 err = alc_auto_add_mic_boost(codec);
12555 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12560 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12562 /* init callback for auto-configuration model -- overriding the default init */
12563 static void alc268_auto_init(struct hda_codec *codec)
12565 struct alc_spec *spec = codec->spec;
12566 alc268_auto_init_multi_out(codec);
12567 alc268_auto_init_hp_out(codec);
12568 alc268_auto_init_mono_speaker_out(codec);
12569 alc268_auto_init_analog_input(codec);
12570 if (spec->unsol_event)
12571 alc_inithook(codec);
12575 * configuration and preset
12577 static const char *alc268_models[ALC268_MODEL_LAST] = {
12578 [ALC267_QUANTA_IL1] = "quanta-il1",
12579 [ALC268_3ST] = "3stack",
12580 [ALC268_TOSHIBA] = "toshiba",
12581 [ALC268_ACER] = "acer",
12582 [ALC268_ACER_DMIC] = "acer-dmic",
12583 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12584 [ALC268_DELL] = "dell",
12585 [ALC268_ZEPTO] = "zepto",
12586 #ifdef CONFIG_SND_DEBUG
12587 [ALC268_TEST] = "test",
12589 [ALC268_AUTO] = "auto",
12592 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12593 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12594 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12595 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12596 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12597 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12598 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12599 ALC268_ACER_ASPIRE_ONE),
12600 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12601 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12602 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12603 /* almost compatible with toshiba but with optional digital outs;
12604 * auto-probing seems working fine
12606 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12608 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12609 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12610 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12611 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12612 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12613 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12617 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12618 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12619 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12620 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12621 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12626 static struct alc_config_preset alc268_presets[] = {
12627 [ALC267_QUANTA_IL1] = {
12628 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12629 alc268_capture_nosrc_mixer },
12630 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12631 alc267_quanta_il1_verbs },
12632 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12633 .dac_nids = alc268_dac_nids,
12634 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12635 .adc_nids = alc268_adc_nids_alt,
12637 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12638 .channel_mode = alc268_modes,
12639 .unsol_event = alc_sku_unsol_event,
12640 .setup = alc267_quanta_il1_setup,
12641 .init_hook = alc_inithook,
12644 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12645 alc268_beep_mixer },
12646 .init_verbs = { alc268_base_init_verbs },
12647 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12648 .dac_nids = alc268_dac_nids,
12649 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12650 .adc_nids = alc268_adc_nids_alt,
12651 .capsrc_nids = alc268_capsrc_nids,
12653 .dig_out_nid = ALC268_DIGOUT_NID,
12654 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12655 .channel_mode = alc268_modes,
12656 .input_mux = &alc268_capture_source,
12658 [ALC268_TOSHIBA] = {
12659 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12660 alc268_beep_mixer },
12661 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12662 alc268_toshiba_verbs },
12663 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12664 .dac_nids = alc268_dac_nids,
12665 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12666 .adc_nids = alc268_adc_nids_alt,
12667 .capsrc_nids = alc268_capsrc_nids,
12669 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12670 .channel_mode = alc268_modes,
12671 .input_mux = &alc268_capture_source,
12672 .unsol_event = alc268_toshiba_unsol_event,
12673 .setup = alc268_toshiba_setup,
12674 .init_hook = alc268_toshiba_automute,
12677 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12678 alc268_beep_mixer },
12679 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12680 alc268_acer_verbs },
12681 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12682 .dac_nids = alc268_dac_nids,
12683 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12684 .adc_nids = alc268_adc_nids_alt,
12685 .capsrc_nids = alc268_capsrc_nids,
12687 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12688 .channel_mode = alc268_modes,
12689 .input_mux = &alc268_acer_capture_source,
12690 .unsol_event = alc268_acer_unsol_event,
12691 .init_hook = alc268_acer_init_hook,
12693 [ALC268_ACER_DMIC] = {
12694 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12695 alc268_beep_mixer },
12696 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12697 alc268_acer_verbs },
12698 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12699 .dac_nids = alc268_dac_nids,
12700 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12701 .adc_nids = alc268_adc_nids_alt,
12702 .capsrc_nids = alc268_capsrc_nids,
12704 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12705 .channel_mode = alc268_modes,
12706 .input_mux = &alc268_acer_dmic_capture_source,
12707 .unsol_event = alc268_acer_unsol_event,
12708 .init_hook = alc268_acer_init_hook,
12710 [ALC268_ACER_ASPIRE_ONE] = {
12711 .mixers = { alc268_acer_aspire_one_mixer,
12713 alc268_capture_nosrc_mixer },
12714 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12715 alc268_acer_aspire_one_verbs },
12716 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12717 .dac_nids = alc268_dac_nids,
12718 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12719 .adc_nids = alc268_adc_nids_alt,
12720 .capsrc_nids = alc268_capsrc_nids,
12722 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12723 .channel_mode = alc268_modes,
12724 .unsol_event = alc268_acer_lc_unsol_event,
12725 .setup = alc268_acer_lc_setup,
12726 .init_hook = alc268_acer_lc_init_hook,
12729 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12730 alc268_capture_nosrc_mixer },
12731 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12732 alc268_dell_verbs },
12733 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12734 .dac_nids = alc268_dac_nids,
12735 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12736 .adc_nids = alc268_adc_nids_alt,
12737 .capsrc_nids = alc268_capsrc_nids,
12739 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12740 .channel_mode = alc268_modes,
12741 .unsol_event = alc_sku_unsol_event,
12742 .setup = alc268_dell_setup,
12743 .init_hook = alc_inithook,
12746 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12747 alc268_beep_mixer },
12748 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12749 alc268_toshiba_verbs },
12750 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12751 .dac_nids = alc268_dac_nids,
12752 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12753 .adc_nids = alc268_adc_nids_alt,
12754 .capsrc_nids = alc268_capsrc_nids,
12756 .dig_out_nid = ALC268_DIGOUT_NID,
12757 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12758 .channel_mode = alc268_modes,
12759 .input_mux = &alc268_capture_source,
12760 .setup = alc268_toshiba_setup,
12761 .init_hook = alc268_toshiba_automute,
12763 #ifdef CONFIG_SND_DEBUG
12765 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12766 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12767 alc268_volume_init_verbs },
12768 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12769 .dac_nids = alc268_dac_nids,
12770 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12771 .adc_nids = alc268_adc_nids_alt,
12772 .capsrc_nids = alc268_capsrc_nids,
12774 .dig_out_nid = ALC268_DIGOUT_NID,
12775 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12776 .channel_mode = alc268_modes,
12777 .input_mux = &alc268_capture_source,
12782 static int patch_alc268(struct hda_codec *codec)
12784 struct alc_spec *spec;
12786 int i, has_beep, err;
12788 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12792 codec->spec = spec;
12794 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12798 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12799 board_config = snd_hda_check_board_codec_sid_config(codec,
12800 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12802 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12803 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12805 board_config = ALC268_AUTO;
12808 if (board_config == ALC268_AUTO) {
12809 /* automatic parse from the BIOS config */
12810 err = alc268_parse_auto_config(codec);
12816 "hda_codec: Cannot set up configuration "
12817 "from BIOS. Using base mode...\n");
12818 board_config = ALC268_3ST;
12822 if (board_config != ALC268_AUTO)
12823 setup_preset(codec, &alc268_presets[board_config]);
12825 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12826 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12827 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12829 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12832 for (i = 0; i < spec->num_mixers; i++) {
12833 if (spec->mixers[i] == alc268_beep_mixer) {
12840 err = snd_hda_attach_beep_device(codec, 0x1);
12845 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12846 /* override the amp caps for beep generator */
12847 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12848 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12849 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12850 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12851 (0 << AC_AMPCAP_MUTE_SHIFT));
12854 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12855 /* check whether NID 0x07 is valid */
12856 unsigned int wcap = get_wcaps(codec, 0x07);
12859 spec->capsrc_nids = alc268_capsrc_nids;
12861 wcap = get_wcaps_type(wcap);
12862 if (spec->auto_mic ||
12863 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12864 spec->adc_nids = alc268_adc_nids_alt;
12865 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12866 if (spec->auto_mic)
12867 fixup_automic_adc(codec);
12868 if (spec->auto_mic || spec->input_mux->num_items == 1)
12869 add_mixer(spec, alc268_capture_nosrc_mixer);
12871 add_mixer(spec, alc268_capture_alt_mixer);
12873 spec->adc_nids = alc268_adc_nids;
12874 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12875 add_mixer(spec, alc268_capture_mixer);
12877 /* set default input source */
12878 for (i = 0; i < spec->num_adc_nids; i++)
12879 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12880 0, AC_VERB_SET_CONNECT_SEL,
12881 i < spec->num_mux_defs ?
12882 spec->input_mux[i].items[0].index :
12883 spec->input_mux->items[0].index);
12886 spec->vmaster_nid = 0x02;
12888 codec->patch_ops = alc_patch_ops;
12889 if (board_config == ALC268_AUTO)
12890 spec->init_hook = alc268_auto_init;
12892 codec->proc_widget_hook = print_realtek_coef;
12898 * ALC269 channel source setting (2 channel)
12900 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12902 #define alc269_dac_nids alc260_dac_nids
12904 static hda_nid_t alc269_adc_nids[1] = {
12909 static hda_nid_t alc269_capsrc_nids[1] = {
12913 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12917 #define alc269_modes alc260_modes
12918 #define alc269_capture_source alc880_lg_lw_capture_source
12920 static struct snd_kcontrol_new alc269_base_mixer[] = {
12921 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12922 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12925 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12927 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12928 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12929 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12930 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12931 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12932 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12936 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12937 /* output mixer control */
12938 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12941 .name = "Master Playback Switch",
12942 .info = snd_hda_mixer_amp_switch_info,
12943 .get = snd_hda_mixer_amp_switch_get,
12944 .put = alc268_acer_master_sw_put,
12945 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12949 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12950 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12951 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12952 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12956 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12957 /* output mixer control */
12958 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12961 .name = "Master Playback Switch",
12962 .info = snd_hda_mixer_amp_switch_info,
12963 .get = snd_hda_mixer_amp_switch_get,
12964 .put = alc268_acer_master_sw_put,
12965 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12969 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12970 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12971 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12972 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12973 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12974 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12975 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12979 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12980 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12987 /* capture mixer elements */
12988 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12989 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12990 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12996 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12998 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12999 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13000 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13002 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13003 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13004 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13008 static struct hda_verb alc269_lifebook_verbs[] = {
13009 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13010 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13011 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13012 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13013 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13014 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13016 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13017 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13018 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13022 /* toggle speaker-output according to the hp-jack state */
13023 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13025 unsigned int present;
13026 unsigned char bits;
13028 present = snd_hda_codec_read(codec, 0x15, 0,
13029 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13030 bits = present ? AMP_IN_MUTE(0) : 0;
13031 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13032 AMP_IN_MUTE(0), bits);
13033 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13034 AMP_IN_MUTE(0), bits);
13036 snd_hda_codec_write(codec, 0x20, 0,
13037 AC_VERB_SET_COEF_INDEX, 0x0c);
13038 snd_hda_codec_write(codec, 0x20, 0,
13039 AC_VERB_SET_PROC_COEF, 0x680);
13041 snd_hda_codec_write(codec, 0x20, 0,
13042 AC_VERB_SET_COEF_INDEX, 0x0c);
13043 snd_hda_codec_write(codec, 0x20, 0,
13044 AC_VERB_SET_PROC_COEF, 0x480);
13047 /* toggle speaker-output according to the hp-jacks state */
13048 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13050 unsigned int present;
13051 unsigned char bits;
13053 /* Check laptop headphone socket */
13054 present = snd_hda_codec_read(codec, 0x15, 0,
13055 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13057 /* Check port replicator headphone socket */
13058 present |= snd_hda_codec_read(codec, 0x1a, 0,
13059 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13061 bits = present ? AMP_IN_MUTE(0) : 0;
13062 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13063 AMP_IN_MUTE(0), bits);
13064 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13065 AMP_IN_MUTE(0), bits);
13067 snd_hda_codec_write(codec, 0x20, 0,
13068 AC_VERB_SET_COEF_INDEX, 0x0c);
13069 snd_hda_codec_write(codec, 0x20, 0,
13070 AC_VERB_SET_PROC_COEF, 0x680);
13072 snd_hda_codec_write(codec, 0x20, 0,
13073 AC_VERB_SET_COEF_INDEX, 0x0c);
13074 snd_hda_codec_write(codec, 0x20, 0,
13075 AC_VERB_SET_PROC_COEF, 0x480);
13078 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13080 unsigned int present_laptop;
13081 unsigned int present_dock;
13083 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
13084 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13086 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
13087 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13089 /* Laptop mic port overrides dock mic port, design decision */
13091 snd_hda_codec_write(codec, 0x23, 0,
13092 AC_VERB_SET_CONNECT_SEL, 0x3);
13093 if (present_laptop)
13094 snd_hda_codec_write(codec, 0x23, 0,
13095 AC_VERB_SET_CONNECT_SEL, 0x0);
13096 if (!present_dock && !present_laptop)
13097 snd_hda_codec_write(codec, 0x23, 0,
13098 AC_VERB_SET_CONNECT_SEL, 0x1);
13101 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13104 switch (res >> 26) {
13105 case ALC880_HP_EVENT:
13106 alc269_quanta_fl1_speaker_automute(codec);
13108 case ALC880_MIC_EVENT:
13109 alc_mic_automute(codec);
13114 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13117 if ((res >> 26) == ALC880_HP_EVENT)
13118 alc269_lifebook_speaker_automute(codec);
13119 if ((res >> 26) == ALC880_MIC_EVENT)
13120 alc269_lifebook_mic_autoswitch(codec);
13123 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13125 struct alc_spec *spec = codec->spec;
13126 spec->ext_mic.pin = 0x18;
13127 spec->ext_mic.mux_idx = 0;
13128 spec->int_mic.pin = 0x19;
13129 spec->int_mic.mux_idx = 1;
13130 spec->auto_mic = 1;
13133 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13135 alc269_quanta_fl1_speaker_automute(codec);
13136 alc_mic_automute(codec);
13139 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13141 alc269_lifebook_speaker_automute(codec);
13142 alc269_lifebook_mic_autoswitch(codec);
13145 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13146 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13147 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13149 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13150 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13151 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13156 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13157 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13158 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13159 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13161 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13162 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13166 /* toggle speaker-output according to the hp-jack state */
13167 static void alc269_speaker_automute(struct hda_codec *codec)
13169 unsigned int present;
13170 unsigned char bits;
13172 present = snd_hda_codec_read(codec, 0x15, 0,
13173 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13174 bits = present ? AMP_IN_MUTE(0) : 0;
13175 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13176 AMP_IN_MUTE(0), bits);
13177 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13178 AMP_IN_MUTE(0), bits);
13181 /* unsolicited event for HP jack sensing */
13182 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13185 switch (res >> 26) {
13186 case ALC880_HP_EVENT:
13187 alc269_speaker_automute(codec);
13189 case ALC880_MIC_EVENT:
13190 alc_mic_automute(codec);
13195 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13197 struct alc_spec *spec = codec->spec;
13198 spec->ext_mic.pin = 0x18;
13199 spec->ext_mic.mux_idx = 0;
13200 spec->int_mic.pin = 0x12;
13201 spec->int_mic.mux_idx = 5;
13202 spec->auto_mic = 1;
13205 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13207 struct alc_spec *spec = codec->spec;
13208 spec->ext_mic.pin = 0x18;
13209 spec->ext_mic.mux_idx = 0;
13210 spec->int_mic.pin = 0x19;
13211 spec->int_mic.mux_idx = 1;
13212 spec->auto_mic = 1;
13215 static void alc269_eeepc_inithook(struct hda_codec *codec)
13217 alc269_speaker_automute(codec);
13218 alc_mic_automute(codec);
13222 * generic initialization of ADC, input mixers and output mixers
13224 static struct hda_verb alc269_init_verbs[] = {
13226 * Unmute ADC0 and set the default input to mic-in
13228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13230 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13231 * analog-loopback mixer widget
13232 * Note: PASD motherboards uses the Line In 2 as the input for
13233 * front panel mic (mic 2)
13235 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13243 * Set up output mixers (0x0c - 0x0e)
13245 /* set vol=0 to output mixers */
13246 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13247 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13249 /* set up input amps for analog loopback */
13250 /* Amp Indices: DAC = 0, mixer = 1 */
13251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13261 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13263 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13264 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13266 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13268 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13270 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13274 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13275 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13277 /* FIXME: use matrix-type input source selection */
13278 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13279 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13286 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13287 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13291 #define alc269_auto_create_multi_out_ctls \
13292 alc268_auto_create_multi_out_ctls
13293 #define alc269_auto_create_input_ctls \
13294 alc268_auto_create_input_ctls
13296 #ifdef CONFIG_SND_HDA_POWER_SAVE
13297 #define alc269_loopbacks alc880_loopbacks
13300 /* pcm configuration: identical with ALC880 */
13301 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13302 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13303 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13304 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13306 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13310 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13311 /* NID is set in alc_build_pcms */
13313 .open = alc880_playback_pcm_open,
13314 .prepare = alc880_playback_pcm_prepare,
13315 .cleanup = alc880_playback_pcm_cleanup
13319 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13323 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13324 /* NID is set in alc_build_pcms */
13328 * BIOS auto configuration
13330 static int alc269_parse_auto_config(struct hda_codec *codec)
13332 struct alc_spec *spec = codec->spec;
13334 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13336 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13341 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13344 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13348 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13350 if (spec->autocfg.dig_outs)
13351 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13353 if (spec->kctls.list)
13354 add_mixer(spec, spec->kctls.list);
13356 add_verb(spec, alc269_init_verbs);
13357 spec->num_mux_defs = 1;
13358 spec->input_mux = &spec->private_imux[0];
13359 /* set default input source */
13360 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13361 0, AC_VERB_SET_CONNECT_SEL,
13362 spec->input_mux->items[0].index);
13364 err = alc_auto_add_mic_boost(codec);
13368 if (!spec->cap_mixer && !spec->no_analog)
13369 set_capture_mixer(codec);
13371 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13376 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13377 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13378 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13381 /* init callback for auto-configuration model -- overriding the default init */
13382 static void alc269_auto_init(struct hda_codec *codec)
13384 struct alc_spec *spec = codec->spec;
13385 alc269_auto_init_multi_out(codec);
13386 alc269_auto_init_hp_out(codec);
13387 alc269_auto_init_analog_input(codec);
13388 if (spec->unsol_event)
13389 alc_inithook(codec);
13393 * configuration and preset
13395 static const char *alc269_models[ALC269_MODEL_LAST] = {
13396 [ALC269_BASIC] = "basic",
13397 [ALC269_QUANTA_FL1] = "quanta",
13398 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13399 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13400 [ALC269_FUJITSU] = "fujitsu",
13401 [ALC269_LIFEBOOK] = "lifebook",
13402 [ALC269_AUTO] = "auto",
13405 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13406 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13407 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13408 ALC269_ASUS_EEEPC_P703),
13409 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13410 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13411 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13412 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13413 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13414 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13415 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13416 ALC269_ASUS_EEEPC_P901),
13417 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13418 ALC269_ASUS_EEEPC_P901),
13419 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13420 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13421 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13425 static struct alc_config_preset alc269_presets[] = {
13427 .mixers = { alc269_base_mixer },
13428 .init_verbs = { alc269_init_verbs },
13429 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13430 .dac_nids = alc269_dac_nids,
13432 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13433 .channel_mode = alc269_modes,
13434 .input_mux = &alc269_capture_source,
13436 [ALC269_QUANTA_FL1] = {
13437 .mixers = { alc269_quanta_fl1_mixer },
13438 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13439 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13440 .dac_nids = alc269_dac_nids,
13442 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13443 .channel_mode = alc269_modes,
13444 .input_mux = &alc269_capture_source,
13445 .unsol_event = alc269_quanta_fl1_unsol_event,
13446 .setup = alc269_quanta_fl1_setup,
13447 .init_hook = alc269_quanta_fl1_init_hook,
13449 [ALC269_ASUS_EEEPC_P703] = {
13450 .mixers = { alc269_eeepc_mixer },
13451 .cap_mixer = alc269_epc_capture_mixer,
13452 .init_verbs = { alc269_init_verbs,
13453 alc269_eeepc_amic_init_verbs },
13454 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13455 .dac_nids = alc269_dac_nids,
13457 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13458 .channel_mode = alc269_modes,
13459 .unsol_event = alc269_eeepc_unsol_event,
13460 .setup = alc269_eeepc_amic_setup,
13461 .init_hook = alc269_eeepc_inithook,
13463 [ALC269_ASUS_EEEPC_P901] = {
13464 .mixers = { alc269_eeepc_mixer },
13465 .cap_mixer = alc269_epc_capture_mixer,
13466 .init_verbs = { alc269_init_verbs,
13467 alc269_eeepc_dmic_init_verbs },
13468 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13469 .dac_nids = alc269_dac_nids,
13471 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13472 .channel_mode = alc269_modes,
13473 .unsol_event = alc269_eeepc_unsol_event,
13474 .setup = alc269_eeepc_dmic_setup,
13475 .init_hook = alc269_eeepc_inithook,
13477 [ALC269_FUJITSU] = {
13478 .mixers = { alc269_fujitsu_mixer },
13479 .cap_mixer = alc269_epc_capture_mixer,
13480 .init_verbs = { alc269_init_verbs,
13481 alc269_eeepc_dmic_init_verbs },
13482 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13483 .dac_nids = alc269_dac_nids,
13485 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13486 .channel_mode = alc269_modes,
13487 .unsol_event = alc269_eeepc_unsol_event,
13488 .setup = alc269_eeepc_dmic_setup,
13489 .init_hook = alc269_eeepc_inithook,
13491 [ALC269_LIFEBOOK] = {
13492 .mixers = { alc269_lifebook_mixer },
13493 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13494 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13495 .dac_nids = alc269_dac_nids,
13497 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13498 .channel_mode = alc269_modes,
13499 .input_mux = &alc269_capture_source,
13500 .unsol_event = alc269_lifebook_unsol_event,
13501 .init_hook = alc269_lifebook_init_hook,
13505 static int patch_alc269(struct hda_codec *codec)
13507 struct alc_spec *spec;
13511 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13515 codec->spec = spec;
13517 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13519 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13523 if (board_config < 0) {
13524 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13526 board_config = ALC269_AUTO;
13529 if (board_config == ALC269_AUTO) {
13530 /* automatic parse from the BIOS config */
13531 err = alc269_parse_auto_config(codec);
13537 "hda_codec: Cannot set up configuration "
13538 "from BIOS. Using base mode...\n");
13539 board_config = ALC269_BASIC;
13543 err = snd_hda_attach_beep_device(codec, 0x1);
13549 if (board_config != ALC269_AUTO)
13550 setup_preset(codec, &alc269_presets[board_config]);
13552 if (codec->subsystem_id == 0x17aa3bf8) {
13553 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13554 * fix the sample rate of analog I/O to 44.1kHz
13556 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13557 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13559 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13560 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13562 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13563 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13565 spec->adc_nids = alc269_adc_nids;
13566 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13567 spec->capsrc_nids = alc269_capsrc_nids;
13568 if (!spec->cap_mixer)
13569 set_capture_mixer(codec);
13570 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13572 spec->vmaster_nid = 0x02;
13574 codec->patch_ops = alc_patch_ops;
13575 if (board_config == ALC269_AUTO)
13576 spec->init_hook = alc269_auto_init;
13577 #ifdef CONFIG_SND_HDA_POWER_SAVE
13578 if (!spec->loopback.amplist)
13579 spec->loopback.amplist = alc269_loopbacks;
13581 codec->proc_widget_hook = print_realtek_coef;
13587 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13591 * set the path ways for 2 channel output
13592 * need to set the codec line out and mic 1 pin widgets to inputs
13594 static struct hda_verb alc861_threestack_ch2_init[] = {
13595 /* set pin widget 1Ah (line in) for input */
13596 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13597 /* set pin widget 18h (mic1/2) for input, for mic also enable
13600 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13604 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13605 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13611 * need to set the codec line out and mic 1 pin widgets to outputs
13613 static struct hda_verb alc861_threestack_ch6_init[] = {
13614 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13615 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13616 /* set pin widget 18h (mic1) for output (CLFE)*/
13617 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13619 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13620 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13622 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13624 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13625 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13630 static struct hda_channel_mode alc861_threestack_modes[2] = {
13631 { 2, alc861_threestack_ch2_init },
13632 { 6, alc861_threestack_ch6_init },
13634 /* Set mic1 as input and unmute the mixer */
13635 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13636 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13637 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13640 /* Set mic1 as output and mute mixer */
13641 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13642 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13643 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13647 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13648 { 2, alc861_uniwill_m31_ch2_init },
13649 { 4, alc861_uniwill_m31_ch4_init },
13652 /* Set mic1 and line-in as input and unmute the mixer */
13653 static struct hda_verb alc861_asus_ch2_init[] = {
13654 /* set pin widget 1Ah (line in) for input */
13655 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13656 /* set pin widget 18h (mic1/2) for input, for mic also enable
13659 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13661 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13663 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13664 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13668 /* Set mic1 nad line-in as output and mute mixer */
13669 static struct hda_verb alc861_asus_ch6_init[] = {
13670 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13671 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13672 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13673 /* set pin widget 18h (mic1) for output (CLFE)*/
13674 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13675 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13676 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13677 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13679 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13681 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13682 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13687 static struct hda_channel_mode alc861_asus_modes[2] = {
13688 { 2, alc861_asus_ch2_init },
13689 { 6, alc861_asus_ch6_init },
13694 static struct snd_kcontrol_new alc861_base_mixer[] = {
13695 /* output mixer control */
13696 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13697 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13698 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13699 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13700 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13702 /*Input mixer control */
13703 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13704 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13705 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13706 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13707 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13708 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13710 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13717 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13718 /* output mixer control */
13719 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13720 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13721 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13722 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13723 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13725 /* Input mixer control */
13726 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13727 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13728 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13729 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13730 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13731 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13733 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13734 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13738 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13739 .name = "Channel Mode",
13740 .info = alc_ch_mode_info,
13741 .get = alc_ch_mode_get,
13742 .put = alc_ch_mode_put,
13743 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13748 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13749 /* output mixer control */
13750 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13752 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13757 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13758 /* output mixer control */
13759 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13760 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13761 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13762 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13763 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13765 /* Input mixer control */
13766 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13767 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13768 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13769 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13770 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13771 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13773 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13774 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13778 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13779 .name = "Channel Mode",
13780 .info = alc_ch_mode_info,
13781 .get = alc_ch_mode_get,
13782 .put = alc_ch_mode_put,
13783 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13788 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13789 /* output mixer control */
13790 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13791 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13792 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13793 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13794 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13796 /* Input mixer control */
13797 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13798 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13799 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13800 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13801 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13802 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13804 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13809 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13810 .name = "Channel Mode",
13811 .info = alc_ch_mode_info,
13812 .get = alc_ch_mode_get,
13813 .put = alc_ch_mode_put,
13814 .private_value = ARRAY_SIZE(alc861_asus_modes),
13819 /* additional mixer */
13820 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13821 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13822 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13827 * generic initialization of ADC, input mixers and output mixers
13829 static struct hda_verb alc861_base_init_verbs[] = {
13831 * Unmute ADC0 and set the default input to mic-in
13833 /* port-A for surround (rear panel) */
13834 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13835 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13836 /* port-B for mic-in (rear panel) with vref */
13837 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13838 /* port-C for line-in (rear panel) */
13839 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13840 /* port-D for Front */
13841 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13842 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13843 /* port-E for HP out (front panel) */
13844 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13845 /* route front PCM to HP */
13846 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13847 /* port-F for mic-in (front panel) with vref */
13848 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13849 /* port-G for CLFE (rear panel) */
13850 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13851 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13852 /* port-H for side (rear panel) */
13853 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13854 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13856 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13857 /* route front mic to ADC1*/
13858 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13861 /* Unmute DAC0~3 & spdif out*/
13862 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13863 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13864 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13865 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13868 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13869 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13870 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13871 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13872 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13874 /* Unmute Stereo Mixer 15 */
13875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13882 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13883 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13885 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13887 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13888 /* hp used DAC 3 (Front) */
13889 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13895 static struct hda_verb alc861_threestack_init_verbs[] = {
13897 * Unmute ADC0 and set the default input to mic-in
13899 /* port-A for surround (rear panel) */
13900 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13901 /* port-B for mic-in (rear panel) with vref */
13902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13903 /* port-C for line-in (rear panel) */
13904 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13905 /* port-D for Front */
13906 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13907 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13908 /* port-E for HP out (front panel) */
13909 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13910 /* route front PCM to HP */
13911 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13912 /* port-F for mic-in (front panel) with vref */
13913 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13914 /* port-G for CLFE (rear panel) */
13915 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13916 /* port-H for side (rear panel) */
13917 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13919 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13920 /* route front mic to ADC1*/
13921 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13922 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13923 /* Unmute DAC0~3 & spdif out*/
13924 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13925 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13926 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13927 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13930 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13931 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13932 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13933 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13934 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13936 /* Unmute Stereo Mixer 15 */
13937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13942 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13944 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13945 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13946 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13947 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13949 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13950 /* hp used DAC 3 (Front) */
13951 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13952 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13956 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13958 * Unmute ADC0 and set the default input to mic-in
13960 /* port-A for surround (rear panel) */
13961 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13962 /* port-B for mic-in (rear panel) with vref */
13963 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13964 /* port-C for line-in (rear panel) */
13965 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13966 /* port-D for Front */
13967 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13968 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13969 /* port-E for HP out (front panel) */
13970 /* this has to be set to VREF80 */
13971 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13972 /* route front PCM to HP */
13973 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13974 /* port-F for mic-in (front panel) with vref */
13975 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13976 /* port-G for CLFE (rear panel) */
13977 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13978 /* port-H for side (rear panel) */
13979 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13981 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13982 /* route front mic to ADC1*/
13983 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 /* Unmute DAC0~3 & spdif out*/
13986 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13987 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13988 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13989 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13992 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13993 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13994 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13995 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13998 /* Unmute Stereo Mixer 15 */
13999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14004 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14005 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14006 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14009 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14012 /* hp used DAC 3 (Front) */
14013 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14014 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14018 static struct hda_verb alc861_asus_init_verbs[] = {
14020 * Unmute ADC0 and set the default input to mic-in
14022 /* port-A for surround (rear panel)
14023 * according to codec#0 this is the HP jack
14025 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14026 /* route front PCM to HP */
14027 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14028 /* port-B for mic-in (rear panel) with vref */
14029 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14030 /* port-C for line-in (rear panel) */
14031 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14032 /* port-D for Front */
14033 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14034 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14035 /* port-E for HP out (front panel) */
14036 /* this has to be set to VREF80 */
14037 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14038 /* route front PCM to HP */
14039 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14040 /* port-F for mic-in (front panel) with vref */
14041 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14042 /* port-G for CLFE (rear panel) */
14043 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14044 /* port-H for side (rear panel) */
14045 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14047 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14048 /* route front mic to ADC1*/
14049 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14050 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14051 /* Unmute DAC0~3 & spdif out*/
14052 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14055 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14057 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14058 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14059 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14060 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14061 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14063 /* Unmute Stereo Mixer 15 */
14064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14070 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14072 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14073 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14075 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14077 /* hp used DAC 3 (Front) */
14078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14083 /* additional init verbs for ASUS laptops */
14084 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14085 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14086 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14091 * generic initialization of ADC, input mixers and output mixers
14093 static struct hda_verb alc861_auto_init_verbs[] = {
14095 * Unmute ADC0 and set the default input to mic-in
14097 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14098 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14100 /* Unmute DAC0~3 & spdif out*/
14101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14104 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14107 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14108 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14110 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14113 /* Unmute Stereo Mixer 15 */
14114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14119 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14120 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14130 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14132 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14133 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14134 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14137 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14142 static struct hda_verb alc861_toshiba_init_verbs[] = {
14143 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14148 /* toggle speaker-output according to the hp-jack state */
14149 static void alc861_toshiba_automute(struct hda_codec *codec)
14151 unsigned int present;
14153 present = snd_hda_codec_read(codec, 0x0f, 0,
14154 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14155 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14156 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14157 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14158 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14161 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14164 if ((res >> 26) == ALC880_HP_EVENT)
14165 alc861_toshiba_automute(codec);
14168 /* pcm configuration: identical with ALC880 */
14169 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14170 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14171 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14172 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14175 #define ALC861_DIGOUT_NID 0x07
14177 static struct hda_channel_mode alc861_8ch_modes[1] = {
14181 static hda_nid_t alc861_dac_nids[4] = {
14182 /* front, surround, clfe, side */
14183 0x03, 0x06, 0x05, 0x04
14186 static hda_nid_t alc660_dac_nids[3] = {
14187 /* front, clfe, surround */
14191 static hda_nid_t alc861_adc_nids[1] = {
14196 static struct hda_input_mux alc861_capture_source = {
14200 { "Front Mic", 0x3 },
14207 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14209 struct alc_spec *spec = codec->spec;
14210 hda_nid_t mix, srcs[5];
14213 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14215 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14218 for (i = 0; i < num; i++) {
14220 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14221 if (type != AC_WID_AUD_OUT)
14223 for (j = 0; j < spec->multiout.num_dacs; j++)
14224 if (spec->multiout.dac_nids[j] == srcs[i])
14226 if (j >= spec->multiout.num_dacs)
14232 /* fill in the dac_nids table from the parsed pin configuration */
14233 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14234 const struct auto_pin_cfg *cfg)
14236 struct alc_spec *spec = codec->spec;
14238 hda_nid_t nid, dac;
14240 spec->multiout.dac_nids = spec->private_dac_nids;
14241 for (i = 0; i < cfg->line_outs; i++) {
14242 nid = cfg->line_out_pins[i];
14243 dac = alc861_look_for_dac(codec, nid);
14246 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14251 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14252 hda_nid_t nid, unsigned int chs)
14254 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14255 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14258 /* add playback controls from the parsed DAC table */
14259 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14260 const struct auto_pin_cfg *cfg)
14262 struct alc_spec *spec = codec->spec;
14263 static const char *chname[4] = {
14264 "Front", "Surround", NULL /*CLFE*/, "Side"
14269 if (cfg->line_outs == 1) {
14270 const char *pfx = NULL;
14273 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14276 nid = spec->multiout.dac_nids[0];
14277 return alc861_create_out_sw(codec, pfx, nid, 3);
14281 for (i = 0; i < cfg->line_outs; i++) {
14282 nid = spec->multiout.dac_nids[i];
14287 err = alc861_create_out_sw(codec, "Center", nid, 1);
14290 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14294 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14302 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14304 struct alc_spec *spec = codec->spec;
14311 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14312 nid = alc861_look_for_dac(codec, pin);
14314 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14317 spec->multiout.hp_nid = nid;
14323 /* create playback/capture controls for input pins */
14324 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14325 const struct auto_pin_cfg *cfg)
14327 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14330 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14332 int pin_type, hda_nid_t dac)
14334 hda_nid_t mix, srcs[5];
14337 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14339 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14341 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14343 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14346 for (i = 0; i < num; i++) {
14348 if (srcs[i] == dac || srcs[i] == 0x15)
14349 mute = AMP_IN_UNMUTE(i);
14351 mute = AMP_IN_MUTE(i);
14352 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14357 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14359 struct alc_spec *spec = codec->spec;
14362 for (i = 0; i < spec->autocfg.line_outs; i++) {
14363 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14364 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14366 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14367 spec->multiout.dac_nids[i]);
14371 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14373 struct alc_spec *spec = codec->spec;
14375 if (spec->autocfg.hp_outs)
14376 alc861_auto_set_output_and_unmute(codec,
14377 spec->autocfg.hp_pins[0],
14379 spec->multiout.hp_nid);
14380 if (spec->autocfg.speaker_outs)
14381 alc861_auto_set_output_and_unmute(codec,
14382 spec->autocfg.speaker_pins[0],
14384 spec->multiout.dac_nids[0]);
14387 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14389 struct alc_spec *spec = codec->spec;
14392 for (i = 0; i < AUTO_PIN_LAST; i++) {
14393 hda_nid_t nid = spec->autocfg.input_pins[i];
14394 if (nid >= 0x0c && nid <= 0x11)
14395 alc_set_input_pin(codec, nid, i);
14399 /* parse the BIOS configuration and set up the alc_spec */
14400 /* return 1 if successful, 0 if the proper config is not found,
14401 * or a negative error code
14403 static int alc861_parse_auto_config(struct hda_codec *codec)
14405 struct alc_spec *spec = codec->spec;
14407 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14409 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14413 if (!spec->autocfg.line_outs)
14414 return 0; /* can't find valid BIOS pin config */
14416 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14419 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14422 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14425 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14429 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14431 if (spec->autocfg.dig_outs)
14432 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14434 if (spec->kctls.list)
14435 add_mixer(spec, spec->kctls.list);
14437 add_verb(spec, alc861_auto_init_verbs);
14439 spec->num_mux_defs = 1;
14440 spec->input_mux = &spec->private_imux[0];
14442 spec->adc_nids = alc861_adc_nids;
14443 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14444 set_capture_mixer(codec);
14446 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14451 /* additional initialization for auto-configuration model */
14452 static void alc861_auto_init(struct hda_codec *codec)
14454 struct alc_spec *spec = codec->spec;
14455 alc861_auto_init_multi_out(codec);
14456 alc861_auto_init_hp_out(codec);
14457 alc861_auto_init_analog_input(codec);
14458 if (spec->unsol_event)
14459 alc_inithook(codec);
14462 #ifdef CONFIG_SND_HDA_POWER_SAVE
14463 static struct hda_amp_list alc861_loopbacks[] = {
14464 { 0x15, HDA_INPUT, 0 },
14465 { 0x15, HDA_INPUT, 1 },
14466 { 0x15, HDA_INPUT, 2 },
14467 { 0x15, HDA_INPUT, 3 },
14474 * configuration and preset
14476 static const char *alc861_models[ALC861_MODEL_LAST] = {
14477 [ALC861_3ST] = "3stack",
14478 [ALC660_3ST] = "3stack-660",
14479 [ALC861_3ST_DIG] = "3stack-dig",
14480 [ALC861_6ST_DIG] = "6stack-dig",
14481 [ALC861_UNIWILL_M31] = "uniwill-m31",
14482 [ALC861_TOSHIBA] = "toshiba",
14483 [ALC861_ASUS] = "asus",
14484 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14485 [ALC861_AUTO] = "auto",
14488 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14489 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14490 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14491 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14492 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14493 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14494 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14495 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14496 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14497 * Any other models that need this preset?
14499 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14500 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14501 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14502 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14503 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14504 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14505 /* FIXME: the below seems conflict */
14506 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14507 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14508 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14512 static struct alc_config_preset alc861_presets[] = {
14514 .mixers = { alc861_3ST_mixer },
14515 .init_verbs = { alc861_threestack_init_verbs },
14516 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14517 .dac_nids = alc861_dac_nids,
14518 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14519 .channel_mode = alc861_threestack_modes,
14521 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14522 .adc_nids = alc861_adc_nids,
14523 .input_mux = &alc861_capture_source,
14525 [ALC861_3ST_DIG] = {
14526 .mixers = { alc861_base_mixer },
14527 .init_verbs = { alc861_threestack_init_verbs },
14528 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14529 .dac_nids = alc861_dac_nids,
14530 .dig_out_nid = ALC861_DIGOUT_NID,
14531 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14532 .channel_mode = alc861_threestack_modes,
14534 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14535 .adc_nids = alc861_adc_nids,
14536 .input_mux = &alc861_capture_source,
14538 [ALC861_6ST_DIG] = {
14539 .mixers = { alc861_base_mixer },
14540 .init_verbs = { alc861_base_init_verbs },
14541 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14542 .dac_nids = alc861_dac_nids,
14543 .dig_out_nid = ALC861_DIGOUT_NID,
14544 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14545 .channel_mode = alc861_8ch_modes,
14546 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14547 .adc_nids = alc861_adc_nids,
14548 .input_mux = &alc861_capture_source,
14551 .mixers = { alc861_3ST_mixer },
14552 .init_verbs = { alc861_threestack_init_verbs },
14553 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14554 .dac_nids = alc660_dac_nids,
14555 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14556 .channel_mode = alc861_threestack_modes,
14558 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14559 .adc_nids = alc861_adc_nids,
14560 .input_mux = &alc861_capture_source,
14562 [ALC861_UNIWILL_M31] = {
14563 .mixers = { alc861_uniwill_m31_mixer },
14564 .init_verbs = { alc861_uniwill_m31_init_verbs },
14565 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14566 .dac_nids = alc861_dac_nids,
14567 .dig_out_nid = ALC861_DIGOUT_NID,
14568 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14569 .channel_mode = alc861_uniwill_m31_modes,
14571 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14572 .adc_nids = alc861_adc_nids,
14573 .input_mux = &alc861_capture_source,
14575 [ALC861_TOSHIBA] = {
14576 .mixers = { alc861_toshiba_mixer },
14577 .init_verbs = { alc861_base_init_verbs,
14578 alc861_toshiba_init_verbs },
14579 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14580 .dac_nids = alc861_dac_nids,
14581 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14582 .channel_mode = alc883_3ST_2ch_modes,
14583 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14584 .adc_nids = alc861_adc_nids,
14585 .input_mux = &alc861_capture_source,
14586 .unsol_event = alc861_toshiba_unsol_event,
14587 .init_hook = alc861_toshiba_automute,
14590 .mixers = { alc861_asus_mixer },
14591 .init_verbs = { alc861_asus_init_verbs },
14592 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14593 .dac_nids = alc861_dac_nids,
14594 .dig_out_nid = ALC861_DIGOUT_NID,
14595 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14596 .channel_mode = alc861_asus_modes,
14599 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14600 .adc_nids = alc861_adc_nids,
14601 .input_mux = &alc861_capture_source,
14603 [ALC861_ASUS_LAPTOP] = {
14604 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14605 .init_verbs = { alc861_asus_init_verbs,
14606 alc861_asus_laptop_init_verbs },
14607 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14608 .dac_nids = alc861_dac_nids,
14609 .dig_out_nid = ALC861_DIGOUT_NID,
14610 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14611 .channel_mode = alc883_3ST_2ch_modes,
14613 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14614 .adc_nids = alc861_adc_nids,
14615 .input_mux = &alc861_capture_source,
14620 static int patch_alc861(struct hda_codec *codec)
14622 struct alc_spec *spec;
14626 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14630 codec->spec = spec;
14632 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14636 if (board_config < 0) {
14637 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14639 board_config = ALC861_AUTO;
14642 if (board_config == ALC861_AUTO) {
14643 /* automatic parse from the BIOS config */
14644 err = alc861_parse_auto_config(codec);
14650 "hda_codec: Cannot set up configuration "
14651 "from BIOS. Using base mode...\n");
14652 board_config = ALC861_3ST_DIG;
14656 err = snd_hda_attach_beep_device(codec, 0x23);
14662 if (board_config != ALC861_AUTO)
14663 setup_preset(codec, &alc861_presets[board_config]);
14665 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14666 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14668 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14669 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14671 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14673 spec->vmaster_nid = 0x03;
14675 codec->patch_ops = alc_patch_ops;
14676 if (board_config == ALC861_AUTO)
14677 spec->init_hook = alc861_auto_init;
14678 #ifdef CONFIG_SND_HDA_POWER_SAVE
14679 if (!spec->loopback.amplist)
14680 spec->loopback.amplist = alc861_loopbacks;
14682 codec->proc_widget_hook = print_realtek_coef;
14688 * ALC861-VD support
14692 * In addition, an independent DAC
14694 #define ALC861VD_DIGOUT_NID 0x06
14696 static hda_nid_t alc861vd_dac_nids[4] = {
14697 /* front, surr, clfe, side surr */
14698 0x02, 0x03, 0x04, 0x05
14701 /* dac_nids for ALC660vd are in a different order - according to
14702 * Realtek's driver.
14703 * This should probably result in a different mixer for 6stack models
14704 * of ALC660vd codecs, but for now there is only 3stack mixer
14705 * - and it is the same as in 861vd.
14706 * adc_nids in ALC660vd are (is) the same as in 861vd
14708 static hda_nid_t alc660vd_dac_nids[3] = {
14709 /* front, rear, clfe, rear_surr */
14713 static hda_nid_t alc861vd_adc_nids[1] = {
14718 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14721 /* FIXME: should be a matrix-type input source selection */
14722 static struct hda_input_mux alc861vd_capture_source = {
14726 { "Front Mic", 0x1 },
14732 static struct hda_input_mux alc861vd_dallas_capture_source = {
14735 { "Ext Mic", 0x0 },
14736 { "Int Mic", 0x1 },
14740 static struct hda_input_mux alc861vd_hp_capture_source = {
14743 { "Front Mic", 0x0 },
14744 { "ATAPI Mic", 0x1 },
14751 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14758 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14759 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14760 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14761 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14762 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14769 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14770 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14771 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14772 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14773 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14777 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14778 { 6, alc861vd_6stack_ch6_init },
14779 { 8, alc861vd_6stack_ch8_init },
14782 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14785 .name = "Channel Mode",
14786 .info = alc_ch_mode_info,
14787 .get = alc_ch_mode_get,
14788 .put = alc_ch_mode_put,
14793 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14794 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14796 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14797 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14798 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14800 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14801 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14803 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14805 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14807 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14808 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14810 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14811 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14815 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14823 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14824 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14826 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14827 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14832 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14833 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14834 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14842 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14843 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14844 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14849 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14850 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14855 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14856 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14857 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14858 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14866 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14867 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14868 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14870 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14871 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14876 /* Pin assignment: Speaker=0x14, HP = 0x15,
14877 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14879 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14880 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14881 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14883 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14884 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14885 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14886 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14887 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14888 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14889 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14893 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14894 * Front Mic=0x18, ATAPI Mic = 0x19,
14896 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14897 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14898 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14899 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14900 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14901 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14903 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14904 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14910 * generic initialization of ADC, input mixers and output mixers
14912 static struct hda_verb alc861vd_volume_init_verbs[] = {
14914 * Unmute ADC0 and set the default input to mic-in
14916 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14919 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14920 * the analog-loopback mixer widget
14922 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14929 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14936 * Set up output mixers (0x02 - 0x05)
14938 /* set vol=0 to output mixers */
14939 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14940 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14941 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14942 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14944 /* set up input amps for analog loopback */
14945 /* Amp Indices: DAC = 0, mixer = 1 */
14946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14952 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14959 * 3-stack pin configuration:
14960 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14962 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14964 * Set pin mode and muting
14966 /* set front pin widgets 0x14 for output */
14967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14968 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14969 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14971 /* Mic (rear) pin: input vref at 80% */
14972 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14974 /* Front Mic pin: input vref at 80% */
14975 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14977 /* Line In pin: input */
14978 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14980 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14981 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14982 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14983 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14984 /* CD pin widget for input */
14985 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14991 * 6-stack pin configuration:
14993 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14995 * Set pin mode and muting
14997 /* set front pin widgets 0x14 for output */
14998 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15000 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15002 /* Rear Pin: output 1 (0x0d) */
15003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15004 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15006 /* CLFE Pin: output 2 (0x0e) */
15007 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15008 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15009 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15010 /* Side Pin: output 3 (0x0f) */
15011 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15013 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15015 /* Mic (rear) pin: input vref at 80% */
15016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15018 /* Front Mic pin: input vref at 80% */
15019 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15020 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15021 /* Line In pin: input */
15022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15024 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15028 /* CD pin widget for input */
15029 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15034 static struct hda_verb alc861vd_eapd_verbs[] = {
15035 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15039 static struct hda_verb alc660vd_eapd_verbs[] = {
15040 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15041 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15045 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15049 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15050 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15054 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15056 unsigned int present;
15057 unsigned char bits;
15059 present = snd_hda_codec_read(codec, 0x18, 0,
15060 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15061 bits = present ? HDA_AMP_MUTE : 0;
15062 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15063 HDA_AMP_MUTE, bits);
15066 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15068 struct alc_spec *spec = codec->spec;
15069 spec->autocfg.hp_pins[0] = 0x1b;
15070 spec->autocfg.speaker_pins[0] = 0x14;
15073 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15075 alc_automute_amp(codec);
15076 alc861vd_lenovo_mic_automute(codec);
15079 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15082 switch (res >> 26) {
15083 case ALC880_MIC_EVENT:
15084 alc861vd_lenovo_mic_automute(codec);
15087 alc_automute_amp_unsol_event(codec, res);
15092 static struct hda_verb alc861vd_dallas_verbs[] = {
15093 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15094 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15095 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15096 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15109 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15111 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15113 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15114 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15116 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15117 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15118 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15119 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15121 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15123 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15125 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15126 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15127 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15131 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15132 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15137 /* toggle speaker-output according to the hp-jack state */
15138 static void alc861vd_dallas_setup(struct hda_codec *codec)
15140 struct alc_spec *spec = codec->spec;
15142 spec->autocfg.hp_pins[0] = 0x15;
15143 spec->autocfg.speaker_pins[0] = 0x14;
15146 #ifdef CONFIG_SND_HDA_POWER_SAVE
15147 #define alc861vd_loopbacks alc880_loopbacks
15150 /* pcm configuration: identical with ALC880 */
15151 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15152 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15153 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15154 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15157 * configuration and preset
15159 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15160 [ALC660VD_3ST] = "3stack-660",
15161 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15162 [ALC660VD_ASUS_V1S] = "asus-v1s",
15163 [ALC861VD_3ST] = "3stack",
15164 [ALC861VD_3ST_DIG] = "3stack-digout",
15165 [ALC861VD_6ST_DIG] = "6stack-digout",
15166 [ALC861VD_LENOVO] = "lenovo",
15167 [ALC861VD_DALLAS] = "dallas",
15168 [ALC861VD_HP] = "hp",
15169 [ALC861VD_AUTO] = "auto",
15172 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15173 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15174 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15175 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15176 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15177 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15178 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15179 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15180 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15181 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15182 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15183 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15184 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15185 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15186 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15187 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15191 static struct alc_config_preset alc861vd_presets[] = {
15193 .mixers = { alc861vd_3st_mixer },
15194 .init_verbs = { alc861vd_volume_init_verbs,
15195 alc861vd_3stack_init_verbs },
15196 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15197 .dac_nids = alc660vd_dac_nids,
15198 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15199 .channel_mode = alc861vd_3stack_2ch_modes,
15200 .input_mux = &alc861vd_capture_source,
15202 [ALC660VD_3ST_DIG] = {
15203 .mixers = { alc861vd_3st_mixer },
15204 .init_verbs = { alc861vd_volume_init_verbs,
15205 alc861vd_3stack_init_verbs },
15206 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15207 .dac_nids = alc660vd_dac_nids,
15208 .dig_out_nid = ALC861VD_DIGOUT_NID,
15209 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15210 .channel_mode = alc861vd_3stack_2ch_modes,
15211 .input_mux = &alc861vd_capture_source,
15214 .mixers = { alc861vd_3st_mixer },
15215 .init_verbs = { alc861vd_volume_init_verbs,
15216 alc861vd_3stack_init_verbs },
15217 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15218 .dac_nids = alc861vd_dac_nids,
15219 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15220 .channel_mode = alc861vd_3stack_2ch_modes,
15221 .input_mux = &alc861vd_capture_source,
15223 [ALC861VD_3ST_DIG] = {
15224 .mixers = { alc861vd_3st_mixer },
15225 .init_verbs = { alc861vd_volume_init_verbs,
15226 alc861vd_3stack_init_verbs },
15227 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15228 .dac_nids = alc861vd_dac_nids,
15229 .dig_out_nid = ALC861VD_DIGOUT_NID,
15230 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15231 .channel_mode = alc861vd_3stack_2ch_modes,
15232 .input_mux = &alc861vd_capture_source,
15234 [ALC861VD_6ST_DIG] = {
15235 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15236 .init_verbs = { alc861vd_volume_init_verbs,
15237 alc861vd_6stack_init_verbs },
15238 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15239 .dac_nids = alc861vd_dac_nids,
15240 .dig_out_nid = ALC861VD_DIGOUT_NID,
15241 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15242 .channel_mode = alc861vd_6stack_modes,
15243 .input_mux = &alc861vd_capture_source,
15245 [ALC861VD_LENOVO] = {
15246 .mixers = { alc861vd_lenovo_mixer },
15247 .init_verbs = { alc861vd_volume_init_verbs,
15248 alc861vd_3stack_init_verbs,
15249 alc861vd_eapd_verbs,
15250 alc861vd_lenovo_unsol_verbs },
15251 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15252 .dac_nids = alc660vd_dac_nids,
15253 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15254 .channel_mode = alc861vd_3stack_2ch_modes,
15255 .input_mux = &alc861vd_capture_source,
15256 .unsol_event = alc861vd_lenovo_unsol_event,
15257 .setup = alc861vd_lenovo_setup,
15258 .init_hook = alc861vd_lenovo_init_hook,
15260 [ALC861VD_DALLAS] = {
15261 .mixers = { alc861vd_dallas_mixer },
15262 .init_verbs = { alc861vd_dallas_verbs },
15263 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15264 .dac_nids = alc861vd_dac_nids,
15265 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15266 .channel_mode = alc861vd_3stack_2ch_modes,
15267 .input_mux = &alc861vd_dallas_capture_source,
15268 .unsol_event = alc_automute_amp_unsol_event,
15269 .setup = alc861vd_dallas_setup,
15270 .init_hook = alc_automute_amp,
15273 .mixers = { alc861vd_hp_mixer },
15274 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15275 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15276 .dac_nids = alc861vd_dac_nids,
15277 .dig_out_nid = ALC861VD_DIGOUT_NID,
15278 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15279 .channel_mode = alc861vd_3stack_2ch_modes,
15280 .input_mux = &alc861vd_hp_capture_source,
15281 .unsol_event = alc_automute_amp_unsol_event,
15282 .setup = alc861vd_dallas_setup,
15283 .init_hook = alc_automute_amp,
15285 [ALC660VD_ASUS_V1S] = {
15286 .mixers = { alc861vd_lenovo_mixer },
15287 .init_verbs = { alc861vd_volume_init_verbs,
15288 alc861vd_3stack_init_verbs,
15289 alc861vd_eapd_verbs,
15290 alc861vd_lenovo_unsol_verbs },
15291 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15292 .dac_nids = alc660vd_dac_nids,
15293 .dig_out_nid = ALC861VD_DIGOUT_NID,
15294 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15295 .channel_mode = alc861vd_3stack_2ch_modes,
15296 .input_mux = &alc861vd_capture_source,
15297 .unsol_event = alc861vd_lenovo_unsol_event,
15298 .setup = alc861vd_lenovo_setup,
15299 .init_hook = alc861vd_lenovo_init_hook,
15304 * BIOS auto configuration
15306 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15307 const struct auto_pin_cfg *cfg)
15309 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15313 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15314 hda_nid_t nid, int pin_type, int dac_idx)
15316 alc_set_pin_output(codec, nid, pin_type);
15319 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15321 struct alc_spec *spec = codec->spec;
15324 for (i = 0; i <= HDA_SIDE; i++) {
15325 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15326 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15328 alc861vd_auto_set_output_and_unmute(codec, nid,
15334 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15336 struct alc_spec *spec = codec->spec;
15339 pin = spec->autocfg.hp_pins[0];
15340 if (pin) /* connect to front and use dac 0 */
15341 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15342 pin = spec->autocfg.speaker_pins[0];
15344 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15347 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15349 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15351 struct alc_spec *spec = codec->spec;
15354 for (i = 0; i < AUTO_PIN_LAST; i++) {
15355 hda_nid_t nid = spec->autocfg.input_pins[i];
15356 if (alc_is_input_pin(codec, nid)) {
15357 alc_set_input_pin(codec, nid, i);
15358 if (nid != ALC861VD_PIN_CD_NID &&
15359 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15360 snd_hda_codec_write(codec, nid, 0,
15361 AC_VERB_SET_AMP_GAIN_MUTE,
15367 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15369 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15370 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15372 /* add playback controls from the parsed DAC table */
15373 /* Based on ALC880 version. But ALC861VD has separate,
15374 * different NIDs for mute/unmute switch and volume control */
15375 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15376 const struct auto_pin_cfg *cfg)
15378 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15379 hda_nid_t nid_v, nid_s;
15382 for (i = 0; i < cfg->line_outs; i++) {
15383 if (!spec->multiout.dac_nids[i])
15385 nid_v = alc861vd_idx_to_mixer_vol(
15387 spec->multiout.dac_nids[i]));
15388 nid_s = alc861vd_idx_to_mixer_switch(
15390 spec->multiout.dac_nids[i]));
15394 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15396 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15400 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15402 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15406 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15408 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15412 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15414 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15420 if (cfg->line_outs == 1 &&
15421 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15428 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15429 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15433 if (cfg->line_outs == 1 &&
15434 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15436 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15437 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15446 /* add playback controls for speaker and HP outputs */
15447 /* Based on ALC880 version. But ALC861VD has separate,
15448 * different NIDs for mute/unmute switch and volume control */
15449 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15450 hda_nid_t pin, const char *pfx)
15452 hda_nid_t nid_v, nid_s;
15458 if (alc880_is_fixed_pin(pin)) {
15459 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15460 /* specify the DAC as the extra output */
15461 if (!spec->multiout.hp_nid)
15462 spec->multiout.hp_nid = nid_v;
15464 spec->multiout.extra_out_nid[0] = nid_v;
15465 /* control HP volume/switch on the output mixer amp */
15466 nid_v = alc861vd_idx_to_mixer_vol(
15467 alc880_fixed_pin_idx(pin));
15468 nid_s = alc861vd_idx_to_mixer_switch(
15469 alc880_fixed_pin_idx(pin));
15471 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15472 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15475 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15476 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15479 } else if (alc880_is_multi_pin(pin)) {
15480 /* set manual connection */
15481 /* we have only a switch on HP-out PIN */
15482 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15483 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15490 /* parse the BIOS configuration and set up the alc_spec
15491 * return 1 if successful, 0 if the proper config is not found,
15492 * or a negative error code
15493 * Based on ALC880 version - had to change it to override
15494 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15495 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15497 struct alc_spec *spec = codec->spec;
15499 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15501 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15505 if (!spec->autocfg.line_outs)
15506 return 0; /* can't find valid BIOS pin config */
15508 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15511 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15514 err = alc861vd_auto_create_extra_out(spec,
15515 spec->autocfg.speaker_pins[0],
15519 err = alc861vd_auto_create_extra_out(spec,
15520 spec->autocfg.hp_pins[0],
15524 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15528 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15530 if (spec->autocfg.dig_outs)
15531 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15533 if (spec->kctls.list)
15534 add_mixer(spec, spec->kctls.list);
15536 add_verb(spec, alc861vd_volume_init_verbs);
15538 spec->num_mux_defs = 1;
15539 spec->input_mux = &spec->private_imux[0];
15541 err = alc_auto_add_mic_boost(codec);
15545 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15550 /* additional initialization for auto-configuration model */
15551 static void alc861vd_auto_init(struct hda_codec *codec)
15553 struct alc_spec *spec = codec->spec;
15554 alc861vd_auto_init_multi_out(codec);
15555 alc861vd_auto_init_hp_out(codec);
15556 alc861vd_auto_init_analog_input(codec);
15557 alc861vd_auto_init_input_src(codec);
15558 if (spec->unsol_event)
15559 alc_inithook(codec);
15563 ALC660VD_FIX_ASUS_GPIO1
15567 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15568 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15569 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15570 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15574 static const struct alc_fixup alc861vd_fixups[] = {
15575 [ALC660VD_FIX_ASUS_GPIO1] = {
15576 .verbs = alc660vd_fix_asus_gpio1_verbs,
15580 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15581 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15585 static int patch_alc861vd(struct hda_codec *codec)
15587 struct alc_spec *spec;
15588 int err, board_config;
15590 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15594 codec->spec = spec;
15596 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15600 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15601 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15603 board_config = ALC861VD_AUTO;
15606 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15608 if (board_config == ALC861VD_AUTO) {
15609 /* automatic parse from the BIOS config */
15610 err = alc861vd_parse_auto_config(codec);
15616 "hda_codec: Cannot set up configuration "
15617 "from BIOS. Using base mode...\n");
15618 board_config = ALC861VD_3ST;
15622 err = snd_hda_attach_beep_device(codec, 0x23);
15628 if (board_config != ALC861VD_AUTO)
15629 setup_preset(codec, &alc861vd_presets[board_config]);
15631 if (codec->vendor_id == 0x10ec0660) {
15632 /* always turn on EAPD */
15633 add_verb(spec, alc660vd_eapd_verbs);
15636 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15637 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15639 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15640 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15642 if (!spec->adc_nids) {
15643 spec->adc_nids = alc861vd_adc_nids;
15644 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15646 if (!spec->capsrc_nids)
15647 spec->capsrc_nids = alc861vd_capsrc_nids;
15649 set_capture_mixer(codec);
15650 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15652 spec->vmaster_nid = 0x02;
15654 codec->patch_ops = alc_patch_ops;
15656 if (board_config == ALC861VD_AUTO)
15657 spec->init_hook = alc861vd_auto_init;
15658 #ifdef CONFIG_SND_HDA_POWER_SAVE
15659 if (!spec->loopback.amplist)
15660 spec->loopback.amplist = alc861vd_loopbacks;
15662 codec->proc_widget_hook = print_realtek_coef;
15670 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15671 * configuration. Each pin widget can choose any input DACs and a mixer.
15672 * Each ADC is connected from a mixer of all inputs. This makes possible
15673 * 6-channel independent captures.
15675 * In addition, an independent DAC for the multi-playback (not used in this
15678 #define ALC662_DIGOUT_NID 0x06
15679 #define ALC662_DIGIN_NID 0x0a
15681 static hda_nid_t alc662_dac_nids[4] = {
15682 /* front, rear, clfe, rear_surr */
15686 static hda_nid_t alc272_dac_nids[2] = {
15690 static hda_nid_t alc662_adc_nids[2] = {
15695 static hda_nid_t alc272_adc_nids[1] = {
15700 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15701 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15705 /* FIXME: should be a matrix-type input source selection */
15706 static struct hda_input_mux alc662_capture_source = {
15710 { "Front Mic", 0x1 },
15716 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15724 static struct hda_input_mux alc663_capture_source = {
15728 { "Front Mic", 0x1 },
15733 #if 0 /* set to 1 for testing other input sources below */
15734 static struct hda_input_mux alc272_nc10_capture_source = {
15737 { "Autoselect Mic", 0x0 },
15738 { "Internal Mic", 0x1 },
15739 { "In-0x02", 0x2 },
15740 { "In-0x03", 0x3 },
15741 { "In-0x04", 0x4 },
15742 { "In-0x05", 0x5 },
15743 { "In-0x06", 0x6 },
15744 { "In-0x07", 0x7 },
15745 { "In-0x08", 0x8 },
15746 { "In-0x09", 0x9 },
15747 { "In-0x0a", 0x0a },
15748 { "In-0x0b", 0x0b },
15749 { "In-0x0c", 0x0c },
15750 { "In-0x0d", 0x0d },
15751 { "In-0x0e", 0x0e },
15752 { "In-0x0f", 0x0f },
15760 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15767 static struct hda_verb alc662_3ST_ch2_init[] = {
15768 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15769 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15770 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15771 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15778 static struct hda_verb alc662_3ST_ch6_init[] = {
15779 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15780 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15781 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15784 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15788 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15789 { 2, alc662_3ST_ch2_init },
15790 { 6, alc662_3ST_ch6_init },
15796 static struct hda_verb alc662_sixstack_ch6_init[] = {
15797 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15798 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15799 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15806 static struct hda_verb alc662_sixstack_ch8_init[] = {
15807 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15808 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15809 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15813 static struct hda_channel_mode alc662_5stack_modes[2] = {
15814 { 2, alc662_sixstack_ch6_init },
15815 { 6, alc662_sixstack_ch8_init },
15818 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15819 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15822 static struct snd_kcontrol_new alc662_base_mixer[] = {
15823 /* output mixer control */
15824 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15825 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15826 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15827 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15828 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15829 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15830 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15831 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15832 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15834 /*Input mixer control */
15835 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15836 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15837 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15838 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15839 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15840 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15846 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15847 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15848 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15856 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15857 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15861 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15862 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15863 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15864 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15865 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15866 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15867 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15868 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15869 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15870 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15871 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15872 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15873 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15874 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15877 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15878 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15882 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15883 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15884 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15885 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15886 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15888 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15889 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15895 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15896 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15897 ALC262_HIPPO_MASTER_SWITCH,
15899 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15900 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15901 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15903 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15904 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15905 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15909 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15910 ALC262_HIPPO_MASTER_SWITCH,
15911 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15912 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15913 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15914 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15915 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15916 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15917 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15923 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15924 .ops = &snd_hda_bind_vol,
15926 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15927 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15932 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15933 .ops = &snd_hda_bind_sw,
15935 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15936 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15941 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15942 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15943 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15949 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15950 .ops = &snd_hda_bind_sw,
15952 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15953 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15954 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15959 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15960 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15961 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15964 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15965 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15970 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15971 .ops = &snd_hda_bind_sw,
15973 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15974 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15975 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15980 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15981 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15982 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15985 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15986 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15990 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15996 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15997 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16001 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16002 .ops = &snd_hda_bind_vol,
16004 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16005 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16010 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16011 .ops = &snd_hda_bind_sw,
16013 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16014 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16019 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16020 HDA_BIND_VOL("Master Playback Volume",
16021 &alc663_asus_two_bind_master_vol),
16022 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16023 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16024 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16030 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16031 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16032 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16033 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16040 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16041 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16042 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16043 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16044 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16049 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16050 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16054 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16055 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16056 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16061 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16062 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16068 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16071 .name = "Channel Mode",
16072 .info = alc_ch_mode_info,
16073 .get = alc_ch_mode_get,
16074 .put = alc_ch_mode_put,
16079 static struct hda_verb alc662_init_verbs[] = {
16080 /* ADC: mute amp left and right */
16081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16082 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16083 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16093 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16094 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16095 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16096 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16098 /* Front Pin: output 0 (0x0c) */
16099 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16100 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16102 /* Rear Pin: output 1 (0x0d) */
16103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16104 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16106 /* CLFE Pin: output 2 (0x0e) */
16107 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16108 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16110 /* Mic (rear) pin: input vref at 80% */
16111 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16112 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16113 /* Front Mic pin: input vref at 80% */
16114 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16115 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16116 /* Line In pin: input */
16117 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16118 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16119 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16120 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16121 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16122 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16123 /* CD pin widget for input */
16124 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16126 /* FIXME: use matrix-type input source selection */
16127 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16130 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16132 /* always trun on EAPD */
16133 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16134 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16139 static struct hda_verb alc662_sue_init_verbs[] = {
16140 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16141 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16145 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16146 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16151 /* Set Unsolicited Event*/
16152 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16154 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16159 * generic initialization of ADC, input mixers and output mixers
16161 static struct hda_verb alc662_auto_init_verbs[] = {
16163 * Unmute ADC and set the default input to mic-in
16165 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16166 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16168 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16170 * Note: PASD motherboards uses the Line In 2 as the input for front
16171 * panel mic (mic 2)
16173 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16181 * Set up output mixers (0x0c - 0x0f)
16183 /* set vol=0 to output mixers */
16184 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16185 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16186 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16188 /* set up input amps for analog loopback */
16189 /* Amp Indices: DAC = 0, mixer = 1 */
16190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16198 /* FIXME: use matrix-type input source selection */
16199 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16206 /* additional verbs for ALC663 */
16207 static struct hda_verb alc663_auto_init_verbs[] = {
16208 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16209 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16213 static struct hda_verb alc663_m51va_init_verbs[] = {
16214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16216 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16217 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16218 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16220 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16221 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16222 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16226 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16227 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16228 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16229 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16231 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16232 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16233 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16237 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16238 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16239 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16240 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16241 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16242 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16243 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16244 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16245 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16249 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16251 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16252 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16255 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16256 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16260 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16261 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16262 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16263 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16264 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16266 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16267 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16269 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16271 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16272 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16276 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16277 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16280 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16281 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16286 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16287 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16288 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16292 static struct hda_verb alc663_g71v_init_verbs[] = {
16293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16294 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16295 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16297 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16298 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16299 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16301 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16303 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16307 static struct hda_verb alc663_g50v_init_verbs[] = {
16308 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16309 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16310 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16312 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16313 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16317 static struct hda_verb alc662_ecs_init_verbs[] = {
16318 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16320 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16325 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16326 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16327 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16329 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16330 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16331 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16332 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16335 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16336 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16340 static struct hda_verb alc272_dell_init_verbs[] = {
16341 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16342 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16344 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16345 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16346 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16347 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16350 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16351 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16355 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16356 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16357 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16361 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16362 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16363 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16367 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16369 unsigned int present;
16370 unsigned char bits;
16372 present = snd_hda_codec_read(codec, 0x14, 0,
16373 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16374 bits = present ? HDA_AMP_MUTE : 0;
16375 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16376 HDA_AMP_MUTE, bits);
16379 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16381 unsigned int present;
16382 unsigned char bits;
16384 present = snd_hda_codec_read(codec, 0x1b, 0,
16385 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16386 bits = present ? HDA_AMP_MUTE : 0;
16387 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16388 HDA_AMP_MUTE, bits);
16389 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16390 HDA_AMP_MUTE, bits);
16393 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16396 if ((res >> 26) == ALC880_HP_EVENT)
16397 alc662_lenovo_101e_all_automute(codec);
16398 if ((res >> 26) == ALC880_FRONT_EVENT)
16399 alc662_lenovo_101e_ispeaker_automute(codec);
16402 /* unsolicited event for HP jack sensing */
16403 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16406 if ((res >> 26) == ALC880_MIC_EVENT)
16407 alc_mic_automute(codec);
16409 alc262_hippo_unsol_event(codec, res);
16412 static void alc662_eeepc_setup(struct hda_codec *codec)
16414 struct alc_spec *spec = codec->spec;
16416 alc262_hippo1_setup(codec);
16417 spec->ext_mic.pin = 0x18;
16418 spec->ext_mic.mux_idx = 0;
16419 spec->int_mic.pin = 0x19;
16420 spec->int_mic.mux_idx = 1;
16421 spec->auto_mic = 1;
16424 static void alc662_eeepc_inithook(struct hda_codec *codec)
16426 alc262_hippo_automute(codec);
16427 alc_mic_automute(codec);
16430 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16432 struct alc_spec *spec = codec->spec;
16434 spec->autocfg.hp_pins[0] = 0x14;
16435 spec->autocfg.speaker_pins[0] = 0x1b;
16438 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16440 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16442 unsigned int present;
16443 unsigned char bits;
16445 present = snd_hda_codec_read(codec, 0x21, 0,
16446 AC_VERB_GET_PIN_SENSE, 0)
16447 & AC_PINSENSE_PRESENCE;
16448 bits = present ? HDA_AMP_MUTE : 0;
16449 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16450 AMP_IN_MUTE(0), bits);
16451 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16452 AMP_IN_MUTE(0), bits);
16455 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16457 unsigned int present;
16458 unsigned char bits;
16460 present = snd_hda_codec_read(codec, 0x21, 0,
16461 AC_VERB_GET_PIN_SENSE, 0)
16462 & AC_PINSENSE_PRESENCE;
16463 bits = present ? HDA_AMP_MUTE : 0;
16464 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16465 AMP_IN_MUTE(0), bits);
16466 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16467 AMP_IN_MUTE(0), bits);
16468 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16469 AMP_IN_MUTE(0), bits);
16470 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16471 AMP_IN_MUTE(0), bits);
16474 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16476 unsigned int present;
16477 unsigned char bits;
16479 present = snd_hda_codec_read(codec, 0x15, 0,
16480 AC_VERB_GET_PIN_SENSE, 0)
16481 & AC_PINSENSE_PRESENCE;
16482 bits = present ? HDA_AMP_MUTE : 0;
16483 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16484 AMP_IN_MUTE(0), bits);
16485 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16486 AMP_IN_MUTE(0), bits);
16487 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16488 AMP_IN_MUTE(0), bits);
16489 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16490 AMP_IN_MUTE(0), bits);
16493 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16495 unsigned int present;
16496 unsigned char bits;
16498 present = snd_hda_codec_read(codec, 0x1b, 0,
16499 AC_VERB_GET_PIN_SENSE, 0)
16500 & AC_PINSENSE_PRESENCE;
16501 bits = present ? 0 : PIN_OUT;
16502 snd_hda_codec_write(codec, 0x14, 0,
16503 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16506 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16508 unsigned int present1, present2;
16510 present1 = snd_hda_codec_read(codec, 0x21, 0,
16511 AC_VERB_GET_PIN_SENSE, 0)
16512 & AC_PINSENSE_PRESENCE;
16513 present2 = snd_hda_codec_read(codec, 0x15, 0,
16514 AC_VERB_GET_PIN_SENSE, 0)
16515 & AC_PINSENSE_PRESENCE;
16517 if (present1 || present2) {
16518 snd_hda_codec_write_cache(codec, 0x14, 0,
16519 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16521 snd_hda_codec_write_cache(codec, 0x14, 0,
16522 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16526 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16528 unsigned int present1, present2;
16530 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16531 AC_VERB_GET_PIN_SENSE, 0)
16532 & AC_PINSENSE_PRESENCE;
16533 present2 = snd_hda_codec_read(codec, 0x15, 0,
16534 AC_VERB_GET_PIN_SENSE, 0)
16535 & AC_PINSENSE_PRESENCE;
16537 if (present1 || present2) {
16538 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16539 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16540 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16541 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16543 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16544 AMP_IN_MUTE(0), 0);
16545 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16546 AMP_IN_MUTE(0), 0);
16550 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16553 switch (res >> 26) {
16554 case ALC880_HP_EVENT:
16555 alc663_m51va_speaker_automute(codec);
16557 case ALC880_MIC_EVENT:
16558 alc_mic_automute(codec);
16563 static void alc663_m51va_setup(struct hda_codec *codec)
16565 struct alc_spec *spec = codec->spec;
16566 spec->ext_mic.pin = 0x18;
16567 spec->ext_mic.mux_idx = 0;
16568 spec->int_mic.pin = 0x12;
16569 spec->int_mic.mux_idx = 1;
16570 spec->auto_mic = 1;
16573 static void alc663_m51va_inithook(struct hda_codec *codec)
16575 alc663_m51va_speaker_automute(codec);
16576 alc_mic_automute(codec);
16579 /* ***************** Mode1 ******************************/
16580 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16581 #define alc663_mode1_setup alc663_m51va_setup
16582 #define alc663_mode1_inithook alc663_m51va_inithook
16584 /* ***************** Mode2 ******************************/
16585 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16588 switch (res >> 26) {
16589 case ALC880_HP_EVENT:
16590 alc662_f5z_speaker_automute(codec);
16592 case ALC880_MIC_EVENT:
16593 alc_mic_automute(codec);
16598 #define alc662_mode2_setup alc663_m51va_setup
16600 static void alc662_mode2_inithook(struct hda_codec *codec)
16602 alc662_f5z_speaker_automute(codec);
16603 alc_mic_automute(codec);
16605 /* ***************** Mode3 ******************************/
16606 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16609 switch (res >> 26) {
16610 case ALC880_HP_EVENT:
16611 alc663_two_hp_m1_speaker_automute(codec);
16613 case ALC880_MIC_EVENT:
16614 alc_mic_automute(codec);
16619 #define alc663_mode3_setup alc663_m51va_setup
16621 static void alc663_mode3_inithook(struct hda_codec *codec)
16623 alc663_two_hp_m1_speaker_automute(codec);
16624 alc_mic_automute(codec);
16626 /* ***************** Mode4 ******************************/
16627 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16630 switch (res >> 26) {
16631 case ALC880_HP_EVENT:
16632 alc663_21jd_two_speaker_automute(codec);
16634 case ALC880_MIC_EVENT:
16635 alc_mic_automute(codec);
16640 #define alc663_mode4_setup alc663_m51va_setup
16642 static void alc663_mode4_inithook(struct hda_codec *codec)
16644 alc663_21jd_two_speaker_automute(codec);
16645 alc_mic_automute(codec);
16647 /* ***************** Mode5 ******************************/
16648 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16651 switch (res >> 26) {
16652 case ALC880_HP_EVENT:
16653 alc663_15jd_two_speaker_automute(codec);
16655 case ALC880_MIC_EVENT:
16656 alc_mic_automute(codec);
16661 #define alc663_mode5_setup alc663_m51va_setup
16663 static void alc663_mode5_inithook(struct hda_codec *codec)
16665 alc663_15jd_two_speaker_automute(codec);
16666 alc_mic_automute(codec);
16668 /* ***************** Mode6 ******************************/
16669 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16672 switch (res >> 26) {
16673 case ALC880_HP_EVENT:
16674 alc663_two_hp_m2_speaker_automute(codec);
16676 case ALC880_MIC_EVENT:
16677 alc_mic_automute(codec);
16682 #define alc663_mode6_setup alc663_m51va_setup
16684 static void alc663_mode6_inithook(struct hda_codec *codec)
16686 alc663_two_hp_m2_speaker_automute(codec);
16687 alc_mic_automute(codec);
16690 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16692 unsigned int present;
16693 unsigned char bits;
16695 present = snd_hda_codec_read(codec, 0x21, 0,
16696 AC_VERB_GET_PIN_SENSE, 0)
16697 & AC_PINSENSE_PRESENCE;
16698 bits = present ? HDA_AMP_MUTE : 0;
16699 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16700 HDA_AMP_MUTE, bits);
16701 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16702 HDA_AMP_MUTE, bits);
16705 static void alc663_g71v_front_automute(struct hda_codec *codec)
16707 unsigned int present;
16708 unsigned char bits;
16710 present = snd_hda_codec_read(codec, 0x15, 0,
16711 AC_VERB_GET_PIN_SENSE, 0)
16712 & AC_PINSENSE_PRESENCE;
16713 bits = present ? HDA_AMP_MUTE : 0;
16714 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16715 HDA_AMP_MUTE, bits);
16718 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16721 switch (res >> 26) {
16722 case ALC880_HP_EVENT:
16723 alc663_g71v_hp_automute(codec);
16725 case ALC880_FRONT_EVENT:
16726 alc663_g71v_front_automute(codec);
16728 case ALC880_MIC_EVENT:
16729 alc_mic_automute(codec);
16734 #define alc663_g71v_setup alc663_m51va_setup
16736 static void alc663_g71v_inithook(struct hda_codec *codec)
16738 alc663_g71v_front_automute(codec);
16739 alc663_g71v_hp_automute(codec);
16740 alc_mic_automute(codec);
16743 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16746 switch (res >> 26) {
16747 case ALC880_HP_EVENT:
16748 alc663_m51va_speaker_automute(codec);
16750 case ALC880_MIC_EVENT:
16751 alc_mic_automute(codec);
16756 #define alc663_g50v_setup alc663_m51va_setup
16758 static void alc663_g50v_inithook(struct hda_codec *codec)
16760 alc663_m51va_speaker_automute(codec);
16761 alc_mic_automute(codec);
16764 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16765 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16766 ALC262_HIPPO_MASTER_SWITCH,
16768 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16769 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16770 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16772 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16773 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16774 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16778 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16779 /* Master Playback automatically created from Speaker and Headphone */
16780 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16781 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16782 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16783 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16785 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16786 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16787 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16789 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16790 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16791 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16795 #ifdef CONFIG_SND_HDA_POWER_SAVE
16796 #define alc662_loopbacks alc880_loopbacks
16800 /* pcm configuration: identical with ALC880 */
16801 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16802 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16803 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16804 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16807 * configuration and preset
16809 static const char *alc662_models[ALC662_MODEL_LAST] = {
16810 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16811 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16812 [ALC662_3ST_6ch] = "3stack-6ch",
16813 [ALC662_5ST_DIG] = "6stack-dig",
16814 [ALC662_LENOVO_101E] = "lenovo-101e",
16815 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16816 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16817 [ALC662_ECS] = "ecs",
16818 [ALC663_ASUS_M51VA] = "m51va",
16819 [ALC663_ASUS_G71V] = "g71v",
16820 [ALC663_ASUS_H13] = "h13",
16821 [ALC663_ASUS_G50V] = "g50v",
16822 [ALC663_ASUS_MODE1] = "asus-mode1",
16823 [ALC662_ASUS_MODE2] = "asus-mode2",
16824 [ALC663_ASUS_MODE3] = "asus-mode3",
16825 [ALC663_ASUS_MODE4] = "asus-mode4",
16826 [ALC663_ASUS_MODE5] = "asus-mode5",
16827 [ALC663_ASUS_MODE6] = "asus-mode6",
16828 [ALC272_DELL] = "dell",
16829 [ALC272_DELL_ZM1] = "dell-zm1",
16830 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16831 [ALC662_AUTO] = "auto",
16834 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16835 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16836 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16837 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16838 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16839 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16840 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16841 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16842 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16843 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16844 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16845 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16846 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16847 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16848 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16849 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16850 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16851 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16852 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16853 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16854 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16855 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16856 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16857 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16858 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16859 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16860 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16861 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16862 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16863 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16864 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16865 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16866 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16867 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16868 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16869 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16870 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16871 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16872 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16873 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16874 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16875 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16876 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16877 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16878 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16879 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16880 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16881 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16882 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16883 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16884 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16885 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16886 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16887 ALC662_3ST_6ch_DIG),
16888 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16889 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16890 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16891 ALC662_3ST_6ch_DIG),
16892 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16893 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16894 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16895 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16896 ALC662_3ST_6ch_DIG),
16897 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16902 static struct alc_config_preset alc662_presets[] = {
16903 [ALC662_3ST_2ch_DIG] = {
16904 .mixers = { alc662_3ST_2ch_mixer },
16905 .init_verbs = { alc662_init_verbs },
16906 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16907 .dac_nids = alc662_dac_nids,
16908 .dig_out_nid = ALC662_DIGOUT_NID,
16909 .dig_in_nid = ALC662_DIGIN_NID,
16910 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16911 .channel_mode = alc662_3ST_2ch_modes,
16912 .input_mux = &alc662_capture_source,
16914 [ALC662_3ST_6ch_DIG] = {
16915 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16916 .init_verbs = { alc662_init_verbs },
16917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16918 .dac_nids = alc662_dac_nids,
16919 .dig_out_nid = ALC662_DIGOUT_NID,
16920 .dig_in_nid = ALC662_DIGIN_NID,
16921 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16922 .channel_mode = alc662_3ST_6ch_modes,
16924 .input_mux = &alc662_capture_source,
16926 [ALC662_3ST_6ch] = {
16927 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16928 .init_verbs = { alc662_init_verbs },
16929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16930 .dac_nids = alc662_dac_nids,
16931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16932 .channel_mode = alc662_3ST_6ch_modes,
16934 .input_mux = &alc662_capture_source,
16936 [ALC662_5ST_DIG] = {
16937 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16938 .init_verbs = { alc662_init_verbs },
16939 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16940 .dac_nids = alc662_dac_nids,
16941 .dig_out_nid = ALC662_DIGOUT_NID,
16942 .dig_in_nid = ALC662_DIGIN_NID,
16943 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16944 .channel_mode = alc662_5stack_modes,
16945 .input_mux = &alc662_capture_source,
16947 [ALC662_LENOVO_101E] = {
16948 .mixers = { alc662_lenovo_101e_mixer },
16949 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16950 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16951 .dac_nids = alc662_dac_nids,
16952 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16953 .channel_mode = alc662_3ST_2ch_modes,
16954 .input_mux = &alc662_lenovo_101e_capture_source,
16955 .unsol_event = alc662_lenovo_101e_unsol_event,
16956 .init_hook = alc662_lenovo_101e_all_automute,
16958 [ALC662_ASUS_EEEPC_P701] = {
16959 .mixers = { alc662_eeepc_p701_mixer },
16960 .init_verbs = { alc662_init_verbs,
16961 alc662_eeepc_sue_init_verbs },
16962 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16963 .dac_nids = alc662_dac_nids,
16964 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16965 .channel_mode = alc662_3ST_2ch_modes,
16966 .unsol_event = alc662_eeepc_unsol_event,
16967 .setup = alc662_eeepc_setup,
16968 .init_hook = alc662_eeepc_inithook,
16970 [ALC662_ASUS_EEEPC_EP20] = {
16971 .mixers = { alc662_eeepc_ep20_mixer,
16972 alc662_chmode_mixer },
16973 .init_verbs = { alc662_init_verbs,
16974 alc662_eeepc_ep20_sue_init_verbs },
16975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16976 .dac_nids = alc662_dac_nids,
16977 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16978 .channel_mode = alc662_3ST_6ch_modes,
16979 .input_mux = &alc662_lenovo_101e_capture_source,
16980 .unsol_event = alc662_eeepc_unsol_event,
16981 .setup = alc662_eeepc_ep20_setup,
16982 .init_hook = alc662_eeepc_ep20_inithook,
16985 .mixers = { alc662_ecs_mixer },
16986 .init_verbs = { alc662_init_verbs,
16987 alc662_ecs_init_verbs },
16988 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16989 .dac_nids = alc662_dac_nids,
16990 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16991 .channel_mode = alc662_3ST_2ch_modes,
16992 .unsol_event = alc662_eeepc_unsol_event,
16993 .setup = alc662_eeepc_setup,
16994 .init_hook = alc662_eeepc_inithook,
16996 [ALC663_ASUS_M51VA] = {
16997 .mixers = { alc663_m51va_mixer },
16998 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16999 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17000 .dac_nids = alc662_dac_nids,
17001 .dig_out_nid = ALC662_DIGOUT_NID,
17002 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17003 .channel_mode = alc662_3ST_2ch_modes,
17004 .unsol_event = alc663_m51va_unsol_event,
17005 .setup = alc663_m51va_setup,
17006 .init_hook = alc663_m51va_inithook,
17008 [ALC663_ASUS_G71V] = {
17009 .mixers = { alc663_g71v_mixer },
17010 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17011 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17012 .dac_nids = alc662_dac_nids,
17013 .dig_out_nid = ALC662_DIGOUT_NID,
17014 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17015 .channel_mode = alc662_3ST_2ch_modes,
17016 .unsol_event = alc663_g71v_unsol_event,
17017 .setup = alc663_g71v_setup,
17018 .init_hook = alc663_g71v_inithook,
17020 [ALC663_ASUS_H13] = {
17021 .mixers = { alc663_m51va_mixer },
17022 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17023 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17024 .dac_nids = alc662_dac_nids,
17025 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17026 .channel_mode = alc662_3ST_2ch_modes,
17027 .unsol_event = alc663_m51va_unsol_event,
17028 .init_hook = alc663_m51va_inithook,
17030 [ALC663_ASUS_G50V] = {
17031 .mixers = { alc663_g50v_mixer },
17032 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17033 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17034 .dac_nids = alc662_dac_nids,
17035 .dig_out_nid = ALC662_DIGOUT_NID,
17036 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17037 .channel_mode = alc662_3ST_6ch_modes,
17038 .input_mux = &alc663_capture_source,
17039 .unsol_event = alc663_g50v_unsol_event,
17040 .setup = alc663_g50v_setup,
17041 .init_hook = alc663_g50v_inithook,
17043 [ALC663_ASUS_MODE1] = {
17044 .mixers = { alc663_m51va_mixer },
17045 .cap_mixer = alc662_auto_capture_mixer,
17046 .init_verbs = { alc662_init_verbs,
17047 alc663_21jd_amic_init_verbs },
17048 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17050 .dac_nids = alc662_dac_nids,
17051 .dig_out_nid = ALC662_DIGOUT_NID,
17052 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17053 .channel_mode = alc662_3ST_2ch_modes,
17054 .unsol_event = alc663_mode1_unsol_event,
17055 .setup = alc663_mode1_setup,
17056 .init_hook = alc663_mode1_inithook,
17058 [ALC662_ASUS_MODE2] = {
17059 .mixers = { alc662_1bjd_mixer },
17060 .cap_mixer = alc662_auto_capture_mixer,
17061 .init_verbs = { alc662_init_verbs,
17062 alc662_1bjd_amic_init_verbs },
17063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17064 .dac_nids = alc662_dac_nids,
17065 .dig_out_nid = ALC662_DIGOUT_NID,
17066 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17067 .channel_mode = alc662_3ST_2ch_modes,
17068 .unsol_event = alc662_mode2_unsol_event,
17069 .setup = alc662_mode2_setup,
17070 .init_hook = alc662_mode2_inithook,
17072 [ALC663_ASUS_MODE3] = {
17073 .mixers = { alc663_two_hp_m1_mixer },
17074 .cap_mixer = alc662_auto_capture_mixer,
17075 .init_verbs = { alc662_init_verbs,
17076 alc663_two_hp_amic_m1_init_verbs },
17077 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17079 .dac_nids = alc662_dac_nids,
17080 .dig_out_nid = ALC662_DIGOUT_NID,
17081 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17082 .channel_mode = alc662_3ST_2ch_modes,
17083 .unsol_event = alc663_mode3_unsol_event,
17084 .setup = alc663_mode3_setup,
17085 .init_hook = alc663_mode3_inithook,
17087 [ALC663_ASUS_MODE4] = {
17088 .mixers = { alc663_asus_21jd_clfe_mixer },
17089 .cap_mixer = alc662_auto_capture_mixer,
17090 .init_verbs = { alc662_init_verbs,
17091 alc663_21jd_amic_init_verbs},
17092 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17094 .dac_nids = alc662_dac_nids,
17095 .dig_out_nid = ALC662_DIGOUT_NID,
17096 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17097 .channel_mode = alc662_3ST_2ch_modes,
17098 .unsol_event = alc663_mode4_unsol_event,
17099 .setup = alc663_mode4_setup,
17100 .init_hook = alc663_mode4_inithook,
17102 [ALC663_ASUS_MODE5] = {
17103 .mixers = { alc663_asus_15jd_clfe_mixer },
17104 .cap_mixer = alc662_auto_capture_mixer,
17105 .init_verbs = { alc662_init_verbs,
17106 alc663_15jd_amic_init_verbs },
17107 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17109 .dac_nids = alc662_dac_nids,
17110 .dig_out_nid = ALC662_DIGOUT_NID,
17111 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17112 .channel_mode = alc662_3ST_2ch_modes,
17113 .unsol_event = alc663_mode5_unsol_event,
17114 .setup = alc663_mode5_setup,
17115 .init_hook = alc663_mode5_inithook,
17117 [ALC663_ASUS_MODE6] = {
17118 .mixers = { alc663_two_hp_m2_mixer },
17119 .cap_mixer = alc662_auto_capture_mixer,
17120 .init_verbs = { alc662_init_verbs,
17121 alc663_two_hp_amic_m2_init_verbs },
17122 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17124 .dac_nids = alc662_dac_nids,
17125 .dig_out_nid = ALC662_DIGOUT_NID,
17126 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17127 .channel_mode = alc662_3ST_2ch_modes,
17128 .unsol_event = alc663_mode6_unsol_event,
17129 .setup = alc663_mode6_setup,
17130 .init_hook = alc663_mode6_inithook,
17133 .mixers = { alc663_m51va_mixer },
17134 .cap_mixer = alc272_auto_capture_mixer,
17135 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17136 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17137 .dac_nids = alc662_dac_nids,
17138 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17139 .adc_nids = alc272_adc_nids,
17140 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17141 .capsrc_nids = alc272_capsrc_nids,
17142 .channel_mode = alc662_3ST_2ch_modes,
17143 .unsol_event = alc663_m51va_unsol_event,
17144 .setup = alc663_m51va_setup,
17145 .init_hook = alc663_m51va_inithook,
17147 [ALC272_DELL_ZM1] = {
17148 .mixers = { alc663_m51va_mixer },
17149 .cap_mixer = alc662_auto_capture_mixer,
17150 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17151 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17152 .dac_nids = alc662_dac_nids,
17153 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17154 .adc_nids = alc662_adc_nids,
17156 .capsrc_nids = alc662_capsrc_nids,
17157 .channel_mode = alc662_3ST_2ch_modes,
17158 .unsol_event = alc663_m51va_unsol_event,
17159 .setup = alc663_m51va_setup,
17160 .init_hook = alc663_m51va_inithook,
17162 [ALC272_SAMSUNG_NC10] = {
17163 .mixers = { alc272_nc10_mixer },
17164 .init_verbs = { alc662_init_verbs,
17165 alc663_21jd_amic_init_verbs },
17166 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17167 .dac_nids = alc272_dac_nids,
17168 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17169 .channel_mode = alc662_3ST_2ch_modes,
17170 /*.input_mux = &alc272_nc10_capture_source,*/
17171 .unsol_event = alc663_mode4_unsol_event,
17172 .setup = alc663_mode4_setup,
17173 .init_hook = alc663_mode4_inithook,
17179 * BIOS auto configuration
17182 /* convert from MIX nid to DAC */
17183 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17187 else if (nid >= 0x0c && nid <= 0x0e)
17188 return nid - 0x0c + 0x02;
17193 /* get MIX nid connected to the given pin targeted to DAC */
17194 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17200 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17201 for (i = 0; i < num; i++) {
17202 if (alc662_mix_to_dac(mix[i]) == dac)
17208 /* look for an empty DAC slot */
17209 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17211 struct alc_spec *spec = codec->spec;
17215 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17218 for (i = 0; i < num; i++) {
17219 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17222 for (j = 0; j < spec->multiout.num_dacs; j++)
17223 if (spec->multiout.dac_nids[j] == nid)
17225 if (j >= spec->multiout.num_dacs)
17231 /* fill in the dac_nids table from the parsed pin configuration */
17232 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17233 const struct auto_pin_cfg *cfg)
17235 struct alc_spec *spec = codec->spec;
17239 spec->multiout.dac_nids = spec->private_dac_nids;
17240 for (i = 0; i < cfg->line_outs; i++) {
17241 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17244 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17249 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17250 hda_nid_t nid, unsigned int chs)
17252 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17253 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17256 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17257 hda_nid_t nid, unsigned int chs)
17259 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17260 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17263 #define alc662_add_stereo_vol(spec, pfx, nid) \
17264 alc662_add_vol_ctl(spec, pfx, nid, 3)
17265 #define alc662_add_stereo_sw(spec, pfx, nid) \
17266 alc662_add_sw_ctl(spec, pfx, nid, 3)
17268 /* add playback controls from the parsed DAC table */
17269 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17270 const struct auto_pin_cfg *cfg)
17272 struct alc_spec *spec = codec->spec;
17273 static const char *chname[4] = {
17274 "Front", "Surround", NULL /*CLFE*/, "Side"
17276 hda_nid_t nid, mix;
17279 for (i = 0; i < cfg->line_outs; i++) {
17280 nid = spec->multiout.dac_nids[i];
17283 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17288 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17291 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17294 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17297 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17302 if (cfg->line_outs == 1 &&
17303 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17310 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17313 if (cfg->line_outs == 1 &&
17314 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17316 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17324 /* add playback controls for speaker and HP outputs */
17325 /* return DAC nid if any new DAC is assigned */
17326 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17329 struct alc_spec *spec = codec->spec;
17330 hda_nid_t nid, mix;
17335 nid = alc662_look_for_dac(codec, pin);
17337 /* the corresponding DAC is already occupied */
17338 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17339 return 0; /* no way */
17340 /* create a switch only */
17341 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17342 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17345 mix = alc662_dac_to_mix(codec, pin, nid);
17348 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17351 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17357 /* create playback/capture controls for input pins */
17358 #define alc662_auto_create_input_ctls \
17359 alc882_auto_create_input_ctls
17361 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17362 hda_nid_t nid, int pin_type,
17368 alc_set_pin_output(codec, nid, pin_type);
17369 /* need the manual connection? */
17370 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17373 for (i = 0; i < num; i++) {
17374 if (alc662_mix_to_dac(srcs[i]) != dac)
17376 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17381 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17383 struct alc_spec *spec = codec->spec;
17384 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17387 for (i = 0; i <= HDA_SIDE; i++) {
17388 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17390 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17391 spec->multiout.dac_nids[i]);
17395 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17397 struct alc_spec *spec = codec->spec;
17400 pin = spec->autocfg.hp_pins[0];
17402 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17403 spec->multiout.hp_nid);
17404 pin = spec->autocfg.speaker_pins[0];
17406 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17407 spec->multiout.extra_out_nid[0]);
17410 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17412 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17414 struct alc_spec *spec = codec->spec;
17417 for (i = 0; i < AUTO_PIN_LAST; i++) {
17418 hda_nid_t nid = spec->autocfg.input_pins[i];
17419 if (alc_is_input_pin(codec, nid)) {
17420 alc_set_input_pin(codec, nid, i);
17421 if (nid != ALC662_PIN_CD_NID &&
17422 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17423 snd_hda_codec_write(codec, nid, 0,
17424 AC_VERB_SET_AMP_GAIN_MUTE,
17430 #define alc662_auto_init_input_src alc882_auto_init_input_src
17432 static int alc662_parse_auto_config(struct hda_codec *codec)
17434 struct alc_spec *spec = codec->spec;
17436 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17438 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17442 if (!spec->autocfg.line_outs)
17443 return 0; /* can't find valid BIOS pin config */
17445 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17448 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17451 err = alc662_auto_create_extra_out(codec,
17452 spec->autocfg.speaker_pins[0],
17457 spec->multiout.extra_out_nid[0] = err;
17458 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17463 spec->multiout.hp_nid = err;
17464 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17468 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17470 if (spec->autocfg.dig_outs)
17471 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17473 if (spec->kctls.list)
17474 add_mixer(spec, spec->kctls.list);
17476 spec->num_mux_defs = 1;
17477 spec->input_mux = &spec->private_imux[0];
17479 add_verb(spec, alc662_auto_init_verbs);
17480 if (codec->vendor_id == 0x10ec0663)
17481 add_verb(spec, alc663_auto_init_verbs);
17483 err = alc_auto_add_mic_boost(codec);
17487 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17492 /* additional initialization for auto-configuration model */
17493 static void alc662_auto_init(struct hda_codec *codec)
17495 struct alc_spec *spec = codec->spec;
17496 alc662_auto_init_multi_out(codec);
17497 alc662_auto_init_hp_out(codec);
17498 alc662_auto_init_analog_input(codec);
17499 alc662_auto_init_input_src(codec);
17500 if (spec->unsol_event)
17501 alc_inithook(codec);
17504 static int patch_alc662(struct hda_codec *codec)
17506 struct alc_spec *spec;
17507 int err, board_config;
17509 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17513 codec->spec = spec;
17515 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17517 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17520 if (board_config < 0) {
17521 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17523 board_config = ALC662_AUTO;
17526 if (board_config == ALC662_AUTO) {
17527 /* automatic parse from the BIOS config */
17528 err = alc662_parse_auto_config(codec);
17534 "hda_codec: Cannot set up configuration "
17535 "from BIOS. Using base mode...\n");
17536 board_config = ALC662_3ST_2ch_DIG;
17540 err = snd_hda_attach_beep_device(codec, 0x1);
17546 if (board_config != ALC662_AUTO)
17547 setup_preset(codec, &alc662_presets[board_config]);
17549 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17550 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17552 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17553 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17555 if (!spec->adc_nids) {
17556 spec->adc_nids = alc662_adc_nids;
17557 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17559 if (!spec->capsrc_nids)
17560 spec->capsrc_nids = alc662_capsrc_nids;
17562 if (!spec->cap_mixer)
17563 set_capture_mixer(codec);
17564 if (codec->vendor_id == 0x10ec0662)
17565 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17567 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17569 spec->vmaster_nid = 0x02;
17571 codec->patch_ops = alc_patch_ops;
17572 if (board_config == ALC662_AUTO)
17573 spec->init_hook = alc662_auto_init;
17574 #ifdef CONFIG_SND_HDA_POWER_SAVE
17575 if (!spec->loopback.amplist)
17576 spec->loopback.amplist = alc662_loopbacks;
17578 codec->proc_widget_hook = print_realtek_coef;
17586 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17587 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17588 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17589 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17590 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17591 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17592 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17593 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17594 .patch = patch_alc861 },
17595 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17596 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17597 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17598 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17599 .patch = patch_alc882 },
17600 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17601 .patch = patch_alc662 },
17602 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17603 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17604 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17605 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17606 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17607 .patch = patch_alc882 },
17608 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17609 .patch = patch_alc882 },
17610 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17611 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17612 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17613 .patch = patch_alc882 },
17614 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17615 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17616 {} /* terminator */
17619 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17621 MODULE_LICENSE("GPL");
17622 MODULE_DESCRIPTION("Realtek HD-audio codec");
17624 static struct hda_codec_preset_list realtek_list = {
17625 .preset = snd_hda_preset_realtek,
17626 .owner = THIS_MODULE,
17629 static int __init patch_realtek_init(void)
17631 return snd_hda_add_codec_preset(&realtek_list);
17634 static void __exit patch_realtek_exit(void)
17636 snd_hda_delete_codec_preset(&realtek_list);
17639 module_init(patch_realtek_init)
17640 module_exit(patch_realtek_exit)