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 */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
341 /* for pin sensing */
342 unsigned int sense_updated: 1;
343 unsigned int jack_present: 1;
344 unsigned int master_sw: 1;
345 unsigned int auto_mic:1;
348 unsigned int no_analog :1; /* digital I/O only */
351 /* for virtual master */
352 hda_nid_t vmaster_nid;
353 #ifdef CONFIG_SND_HDA_POWER_SAVE
354 struct hda_loopback_check loopback;
359 unsigned int pll_coef_idx, pll_coef_bit;
363 * configuration template - to be copied to the spec instance
365 struct alc_config_preset {
366 struct snd_kcontrol_new *mixers[5]; /* should be identical size
369 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
370 const struct hda_verb *init_verbs[5];
371 unsigned int num_dacs;
373 hda_nid_t dig_out_nid; /* optional */
374 hda_nid_t hp_nid; /* optional */
375 hda_nid_t *slave_dig_outs;
376 unsigned int num_adc_nids;
378 hda_nid_t *capsrc_nids;
379 hda_nid_t dig_in_nid;
380 unsigned int num_channel_mode;
381 const struct hda_channel_mode *channel_mode;
383 int const_channel_count;
384 unsigned int num_mux_defs;
385 const struct hda_input_mux *input_mux;
386 void (*unsol_event)(struct hda_codec *, unsigned int);
387 void (*setup)(struct hda_codec *);
388 void (*init_hook)(struct hda_codec *);
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_amp_list *loopbacks;
398 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
399 struct snd_ctl_elem_info *uinfo)
401 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
402 struct alc_spec *spec = codec->spec;
403 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
404 if (mux_idx >= spec->num_mux_defs)
406 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
409 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
410 struct snd_ctl_elem_value *ucontrol)
412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
413 struct alc_spec *spec = codec->spec;
414 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
416 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
420 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 struct alc_spec *spec = codec->spec;
425 const struct hda_input_mux *imux;
426 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
427 unsigned int mux_idx;
428 hda_nid_t nid = spec->capsrc_nids ?
429 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
432 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
433 imux = &spec->input_mux[mux_idx];
435 type = get_wcaps_type(get_wcaps(codec, nid));
436 if (type == AC_WID_AUD_MIX) {
437 /* Matrix-mixer style (e.g. ALC882) */
438 unsigned int *cur_val = &spec->cur_mux[adc_idx];
441 idx = ucontrol->value.enumerated.item[0];
442 if (idx >= imux->num_items)
443 idx = imux->num_items - 1;
446 for (i = 0; i < imux->num_items; i++) {
447 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
448 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
449 imux->items[i].index,
455 /* MUX style (e.g. ALC880) */
456 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
457 &spec->cur_mux[adc_idx]);
462 * channel mode setting
464 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_info *uinfo)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 struct alc_spec *spec = codec->spec;
469 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
470 spec->num_channel_mode);
473 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_value *ucontrol)
476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
477 struct alc_spec *spec = codec->spec;
478 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
479 spec->num_channel_mode,
480 spec->ext_channel_count);
483 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
484 struct snd_ctl_elem_value *ucontrol)
486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
487 struct alc_spec *spec = codec->spec;
488 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
489 spec->num_channel_mode,
490 &spec->ext_channel_count);
491 if (err >= 0 && !spec->const_channel_count) {
492 spec->multiout.max_channels = spec->ext_channel_count;
493 if (spec->need_dac_fix)
494 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
500 * Control the mode of pin widget settings via the mixer. "pc" is used
501 * instead of "%" to avoid consequences of accidently treating the % as
502 * being part of a format specifier. Maximum allowed length of a value is
503 * 63 characters plus NULL terminator.
505 * Note: some retasking pin complexes seem to ignore requests for input
506 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
507 * are requested. Therefore order this list so that this behaviour will not
508 * cause problems when mixer clients move through the enum sequentially.
509 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
512 static char *alc_pin_mode_names[] = {
513 "Mic 50pc bias", "Mic 80pc bias",
514 "Line in", "Line out", "Headphone out",
516 static unsigned char alc_pin_mode_values[] = {
517 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
519 /* The control can present all 5 options, or it can limit the options based
520 * in the pin being assumed to be exclusively an input or an output pin. In
521 * addition, "input" pins may or may not process the mic bias option
522 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
523 * accept requests for bias as of chip versions up to March 2006) and/or
524 * wiring in the computer.
526 #define ALC_PIN_DIR_IN 0x00
527 #define ALC_PIN_DIR_OUT 0x01
528 #define ALC_PIN_DIR_INOUT 0x02
529 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
530 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
532 /* Info about the pin modes supported by the different pin direction modes.
533 * For each direction the minimum and maximum values are given.
535 static signed char alc_pin_mode_dir_info[5][2] = {
536 { 0, 2 }, /* ALC_PIN_DIR_IN */
537 { 3, 4 }, /* ALC_PIN_DIR_OUT */
538 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
539 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
540 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
542 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
543 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
544 #define alc_pin_mode_n_items(_dir) \
545 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
547 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
548 struct snd_ctl_elem_info *uinfo)
550 unsigned int item_num = uinfo->value.enumerated.item;
551 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
553 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
555 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
557 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
558 item_num = alc_pin_mode_min(dir);
559 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
563 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
564 struct snd_ctl_elem_value *ucontrol)
567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
568 hda_nid_t nid = kcontrol->private_value & 0xffff;
569 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
570 long *valp = ucontrol->value.integer.value;
571 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
572 AC_VERB_GET_PIN_WIDGET_CONTROL,
575 /* Find enumerated value for current pinctl setting */
576 i = alc_pin_mode_min(dir);
577 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
579 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
583 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
584 struct snd_ctl_elem_value *ucontrol)
587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
588 hda_nid_t nid = kcontrol->private_value & 0xffff;
589 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
590 long val = *ucontrol->value.integer.value;
591 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
592 AC_VERB_GET_PIN_WIDGET_CONTROL,
595 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
596 val = alc_pin_mode_min(dir);
598 change = pinctl != alc_pin_mode_values[val];
600 /* Set pin mode to that requested */
601 snd_hda_codec_write_cache(codec, nid, 0,
602 AC_VERB_SET_PIN_WIDGET_CONTROL,
603 alc_pin_mode_values[val]);
605 /* Also enable the retasking pin's input/output as required
606 * for the requested pin mode. Enum values of 2 or less are
609 * Dynamically switching the input/output buffers probably
610 * reduces noise slightly (particularly on input) so we'll
611 * do it. However, having both input and output buffers
612 * enabled simultaneously doesn't seem to be problematic if
613 * this turns out to be necessary in the future.
616 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
617 HDA_AMP_MUTE, HDA_AMP_MUTE);
618 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
621 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
622 HDA_AMP_MUTE, HDA_AMP_MUTE);
623 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
630 #define ALC_PIN_MODE(xname, nid, dir) \
631 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
632 .info = alc_pin_mode_info, \
633 .get = alc_pin_mode_get, \
634 .put = alc_pin_mode_put, \
635 .private_value = nid | (dir<<16) }
637 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
638 * together using a mask with more than one bit set. This control is
639 * currently used only by the ALC260 test model. At this stage they are not
640 * needed for any "production" models.
642 #ifdef CONFIG_SND_DEBUG
643 #define alc_gpio_data_info snd_ctl_boolean_mono_info
645 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
646 struct snd_ctl_elem_value *ucontrol)
648 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
649 hda_nid_t nid = kcontrol->private_value & 0xffff;
650 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
651 long *valp = ucontrol->value.integer.value;
652 unsigned int val = snd_hda_codec_read(codec, nid, 0,
653 AC_VERB_GET_GPIO_DATA, 0x00);
655 *valp = (val & mask) != 0;
658 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
659 struct snd_ctl_elem_value *ucontrol)
662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
663 hda_nid_t nid = kcontrol->private_value & 0xffff;
664 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
665 long val = *ucontrol->value.integer.value;
666 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
667 AC_VERB_GET_GPIO_DATA,
670 /* Set/unset the masked GPIO bit(s) as needed */
671 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
676 snd_hda_codec_write_cache(codec, nid, 0,
677 AC_VERB_SET_GPIO_DATA, gpio_data);
681 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
682 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
683 .info = alc_gpio_data_info, \
684 .get = alc_gpio_data_get, \
685 .put = alc_gpio_data_put, \
686 .private_value = nid | (mask<<16) }
687 #endif /* CONFIG_SND_DEBUG */
689 /* A switch control to allow the enabling of the digital IO pins on the
690 * ALC260. This is incredibly simplistic; the intention of this control is
691 * to provide something in the test model allowing digital outputs to be
692 * identified if present. If models are found which can utilise these
693 * outputs a more complete mixer control can be devised for those models if
696 #ifdef CONFIG_SND_DEBUG
697 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
699 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
703 hda_nid_t nid = kcontrol->private_value & 0xffff;
704 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
705 long *valp = ucontrol->value.integer.value;
706 unsigned int val = snd_hda_codec_read(codec, nid, 0,
707 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
709 *valp = (val & mask) != 0;
712 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
713 struct snd_ctl_elem_value *ucontrol)
716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
717 hda_nid_t nid = kcontrol->private_value & 0xffff;
718 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
719 long val = *ucontrol->value.integer.value;
720 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
721 AC_VERB_GET_DIGI_CONVERT_1,
724 /* Set/unset the masked control bit(s) as needed */
725 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
730 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
735 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
736 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
737 .info = alc_spdif_ctrl_info, \
738 .get = alc_spdif_ctrl_get, \
739 .put = alc_spdif_ctrl_put, \
740 .private_value = nid | (mask<<16) }
741 #endif /* CONFIG_SND_DEBUG */
743 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
744 * Again, this is only used in the ALC26x test models to help identify when
745 * the EAPD line must be asserted for features to work.
747 #ifdef CONFIG_SND_DEBUG
748 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
750 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
751 struct snd_ctl_elem_value *ucontrol)
753 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
754 hda_nid_t nid = kcontrol->private_value & 0xffff;
755 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
756 long *valp = ucontrol->value.integer.value;
757 unsigned int val = snd_hda_codec_read(codec, nid, 0,
758 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
760 *valp = (val & mask) != 0;
764 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
765 struct snd_ctl_elem_value *ucontrol)
768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
769 hda_nid_t nid = kcontrol->private_value & 0xffff;
770 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
771 long val = *ucontrol->value.integer.value;
772 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
773 AC_VERB_GET_EAPD_BTLENABLE,
776 /* Set/unset the masked control bit(s) as needed */
777 change = (!val ? 0 : mask) != (ctrl_data & mask);
782 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
788 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
789 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
790 .info = alc_eapd_ctrl_info, \
791 .get = alc_eapd_ctrl_get, \
792 .put = alc_eapd_ctrl_put, \
793 .private_value = nid | (mask<<16) }
794 #endif /* CONFIG_SND_DEBUG */
797 * set up the input pin config (depending on the given auto-pin type)
799 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
802 unsigned int val = PIN_IN;
804 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
806 pincap = snd_hda_query_pin_caps(codec, nid);
807 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
808 if (pincap & AC_PINCAP_VREF_80)
810 else if (pincap & AC_PINCAP_VREF_50)
812 else if (pincap & AC_PINCAP_VREF_100)
814 else if (pincap & AC_PINCAP_VREF_GRD)
817 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
822 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
824 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
826 spec->mixers[spec->num_mixers++] = mix;
829 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
831 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
833 spec->init_verbs[spec->num_init_verbs++] = verb;
836 #ifdef CONFIG_PROC_FS
840 static void print_realtek_coef(struct snd_info_buffer *buffer,
841 struct hda_codec *codec, hda_nid_t nid)
847 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
848 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
849 coeff = snd_hda_codec_read(codec, nid, 0,
850 AC_VERB_GET_COEF_INDEX, 0);
851 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
854 #define print_realtek_coef NULL
858 * set up from the preset table
860 static void setup_preset(struct hda_codec *codec,
861 const struct alc_config_preset *preset)
863 struct alc_spec *spec = codec->spec;
866 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
867 add_mixer(spec, preset->mixers[i]);
868 spec->cap_mixer = preset->cap_mixer;
869 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
871 add_verb(spec, preset->init_verbs[i]);
873 spec->channel_mode = preset->channel_mode;
874 spec->num_channel_mode = preset->num_channel_mode;
875 spec->need_dac_fix = preset->need_dac_fix;
876 spec->const_channel_count = preset->const_channel_count;
878 if (preset->const_channel_count)
879 spec->multiout.max_channels = preset->const_channel_count;
881 spec->multiout.max_channels = spec->channel_mode[0].channels;
882 spec->ext_channel_count = spec->channel_mode[0].channels;
884 spec->multiout.num_dacs = preset->num_dacs;
885 spec->multiout.dac_nids = preset->dac_nids;
886 spec->multiout.dig_out_nid = preset->dig_out_nid;
887 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
888 spec->multiout.hp_nid = preset->hp_nid;
890 spec->num_mux_defs = preset->num_mux_defs;
891 if (!spec->num_mux_defs)
892 spec->num_mux_defs = 1;
893 spec->input_mux = preset->input_mux;
895 spec->num_adc_nids = preset->num_adc_nids;
896 spec->adc_nids = preset->adc_nids;
897 spec->capsrc_nids = preset->capsrc_nids;
898 spec->dig_in_nid = preset->dig_in_nid;
900 spec->unsol_event = preset->unsol_event;
901 spec->init_hook = preset->init_hook;
902 #ifdef CONFIG_SND_HDA_POWER_SAVE
903 spec->loopback.amplist = preset->loopbacks;
907 preset->setup(codec);
910 /* Enable GPIO mask and set output */
911 static struct hda_verb alc_gpio1_init_verbs[] = {
912 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
913 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
914 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
918 static struct hda_verb alc_gpio2_init_verbs[] = {
919 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
920 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
921 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
925 static struct hda_verb alc_gpio3_init_verbs[] = {
926 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
927 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
928 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
933 * Fix hardware PLL issue
934 * On some codecs, the analog PLL gating control must be off while
935 * the default value is 1.
937 static void alc_fix_pll(struct hda_codec *codec)
939 struct alc_spec *spec = codec->spec;
944 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
946 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
947 AC_VERB_GET_PROC_COEF, 0);
948 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
950 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
951 val & ~(1 << spec->pll_coef_bit));
954 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
955 unsigned int coef_idx, unsigned int coef_bit)
957 struct alc_spec *spec = codec->spec;
959 spec->pll_coef_idx = coef_idx;
960 spec->pll_coef_bit = coef_bit;
964 static void alc_automute_pin(struct hda_codec *codec)
966 struct alc_spec *spec = codec->spec;
967 unsigned int nid = spec->autocfg.hp_pins[0];
972 spec->jack_present = snd_hda_jack_detect(codec, nid);
973 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
974 nid = spec->autocfg.speaker_pins[i];
977 snd_hda_codec_write(codec, nid, 0,
978 AC_VERB_SET_PIN_WIDGET_CONTROL,
979 spec->jack_present ? 0 : PIN_OUT);
983 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
986 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
989 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
990 for (i = 0; i < nums; i++)
996 static void alc_mic_automute(struct hda_codec *codec)
998 struct alc_spec *spec = codec->spec;
999 struct alc_mic_route *dead, *alive;
1000 unsigned int present, type;
1003 if (!spec->auto_mic)
1005 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1007 if (snd_BUG_ON(!spec->adc_nids))
1010 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1012 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1014 alive = &spec->ext_mic;
1015 dead = &spec->int_mic;
1017 alive = &spec->int_mic;
1018 dead = &spec->ext_mic;
1021 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1022 if (type == AC_WID_AUD_MIX) {
1023 /* Matrix-mixer style (e.g. ALC882) */
1024 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1027 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1029 HDA_AMP_MUTE, HDA_AMP_MUTE);
1031 /* MUX style (e.g. ALC880) */
1032 snd_hda_codec_write_cache(codec, cap_nid, 0,
1033 AC_VERB_SET_CONNECT_SEL,
1037 /* FIXME: analog mixer */
1040 /* unsolicited event for HP jack sensing */
1041 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1043 if (codec->vendor_id == 0x10ec0880)
1048 case ALC880_HP_EVENT:
1049 alc_automute_pin(codec);
1051 case ALC880_MIC_EVENT:
1052 alc_mic_automute(codec);
1057 static void alc_inithook(struct hda_codec *codec)
1059 alc_automute_pin(codec);
1060 alc_mic_automute(codec);
1063 /* additional initialization for ALC888 variants */
1064 static void alc888_coef_init(struct hda_codec *codec)
1068 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1069 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1070 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1071 if ((tmp & 0xf0) == 0x20)
1073 snd_hda_codec_read(codec, 0x20, 0,
1074 AC_VERB_SET_PROC_COEF, 0x830);
1077 snd_hda_codec_read(codec, 0x20, 0,
1078 AC_VERB_SET_PROC_COEF, 0x3030);
1081 static void alc889_coef_init(struct hda_codec *codec)
1085 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1086 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1087 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1088 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1091 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1096 case ALC_INIT_GPIO1:
1097 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1099 case ALC_INIT_GPIO2:
1100 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1102 case ALC_INIT_GPIO3:
1103 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1105 case ALC_INIT_DEFAULT:
1106 switch (codec->vendor_id) {
1108 snd_hda_codec_write(codec, 0x0f, 0,
1109 AC_VERB_SET_EAPD_BTLENABLE, 2);
1110 snd_hda_codec_write(codec, 0x10, 0,
1111 AC_VERB_SET_EAPD_BTLENABLE, 2);
1123 snd_hda_codec_write(codec, 0x14, 0,
1124 AC_VERB_SET_EAPD_BTLENABLE, 2);
1125 snd_hda_codec_write(codec, 0x15, 0,
1126 AC_VERB_SET_EAPD_BTLENABLE, 2);
1129 switch (codec->vendor_id) {
1131 snd_hda_codec_write(codec, 0x1a, 0,
1132 AC_VERB_SET_COEF_INDEX, 7);
1133 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1134 AC_VERB_GET_PROC_COEF, 0);
1135 snd_hda_codec_write(codec, 0x1a, 0,
1136 AC_VERB_SET_COEF_INDEX, 7);
1137 snd_hda_codec_write(codec, 0x1a, 0,
1138 AC_VERB_SET_PROC_COEF,
1148 alc889_coef_init(codec);
1151 alc888_coef_init(codec);
1155 snd_hda_codec_write(codec, 0x20, 0,
1156 AC_VERB_SET_COEF_INDEX, 7);
1157 tmp = snd_hda_codec_read(codec, 0x20, 0,
1158 AC_VERB_GET_PROC_COEF, 0);
1159 snd_hda_codec_write(codec, 0x20, 0,
1160 AC_VERB_SET_COEF_INDEX, 7);
1161 snd_hda_codec_write(codec, 0x20, 0,
1162 AC_VERB_SET_PROC_COEF,
1170 static void alc_init_auto_hp(struct hda_codec *codec)
1172 struct alc_spec *spec = codec->spec;
1174 if (!spec->autocfg.hp_pins[0])
1177 if (!spec->autocfg.speaker_pins[0]) {
1178 if (spec->autocfg.line_out_pins[0] &&
1179 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1180 spec->autocfg.speaker_pins[0] =
1181 spec->autocfg.line_out_pins[0];
1186 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1187 spec->autocfg.hp_pins[0]);
1188 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1189 AC_VERB_SET_UNSOLICITED_ENABLE,
1190 AC_USRSP_EN | ALC880_HP_EVENT);
1191 spec->unsol_event = alc_sku_unsol_event;
1194 static void alc_init_auto_mic(struct hda_codec *codec)
1196 struct alc_spec *spec = codec->spec;
1197 struct auto_pin_cfg *cfg = &spec->autocfg;
1198 hda_nid_t fixed, ext;
1201 /* there must be only two mic inputs exclusively */
1202 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1203 if (cfg->input_pins[i])
1207 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1208 hda_nid_t nid = cfg->input_pins[i];
1209 unsigned int defcfg;
1212 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1213 switch (get_defcfg_connect(defcfg)) {
1214 case AC_JACK_PORT_FIXED:
1216 return; /* already occupied */
1219 case AC_JACK_PORT_COMPLEX:
1221 return; /* already occupied */
1225 return; /* invalid entry */
1228 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1229 return; /* no unsol support */
1230 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1232 spec->ext_mic.pin = ext;
1233 spec->int_mic.pin = fixed;
1234 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1235 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1237 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1238 AC_VERB_SET_UNSOLICITED_ENABLE,
1239 AC_USRSP_EN | ALC880_MIC_EVENT);
1240 spec->unsol_event = alc_sku_unsol_event;
1243 /* check subsystem ID and set up device-specific initialization;
1244 * return 1 if initialized, 0 if invalid SSID
1246 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1247 * 31 ~ 16 : Manufacture ID
1249 * 7 ~ 0 : Assembly ID
1250 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1252 static int alc_subsystem_id(struct hda_codec *codec,
1253 hda_nid_t porta, hda_nid_t porte,
1256 unsigned int ass, tmp, i;
1258 struct alc_spec *spec = codec->spec;
1260 ass = codec->subsystem_id & 0xffff;
1261 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1264 /* invalid SSID, check the special NID pin defcfg instead */
1266 * 31~30 : port connectivity
1269 * 19~16 : Check sum (15:1)
1274 if (codec->vendor_id == 0x10ec0260)
1276 ass = snd_hda_codec_get_pincfg(codec, nid);
1277 snd_printd("realtek: No valid SSID, "
1278 "checking pincfg 0x%08x for NID 0x%x\n",
1280 if (!(ass & 1) && !(ass & 0x100000))
1282 if ((ass >> 30) != 1) /* no physical connection */
1287 for (i = 1; i < 16; i++) {
1291 if (((ass >> 16) & 0xf) != tmp)
1294 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1295 ass & 0xffff, codec->vendor_id);
1299 * 2 : 0 --> Desktop, 1 --> Laptop
1300 * 3~5 : External Amplifier control
1303 tmp = (ass & 0x38) >> 3; /* external Amp control */
1306 spec->init_amp = ALC_INIT_GPIO1;
1309 spec->init_amp = ALC_INIT_GPIO2;
1312 spec->init_amp = ALC_INIT_GPIO3;
1315 spec->init_amp = ALC_INIT_DEFAULT;
1319 /* is laptop or Desktop and enable the function "Mute internal speaker
1320 * when the external headphone out jack is plugged"
1322 if (!(ass & 0x8000))
1325 * 10~8 : Jack location
1326 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1328 * 15 : 1 --> enable the function "Mute internal speaker
1329 * when the external headphone out jack is plugged"
1331 if (!spec->autocfg.hp_pins[0]) {
1333 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1342 for (i = 0; i < spec->autocfg.line_outs; i++)
1343 if (spec->autocfg.line_out_pins[i] == nid)
1345 spec->autocfg.hp_pins[0] = nid;
1348 alc_init_auto_hp(codec);
1349 alc_init_auto_mic(codec);
1353 static void alc_ssid_check(struct hda_codec *codec,
1354 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1356 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1357 struct alc_spec *spec = codec->spec;
1358 snd_printd("realtek: "
1359 "Enable default setup for auto mode as fallback\n");
1360 spec->init_amp = ALC_INIT_DEFAULT;
1361 alc_init_auto_hp(codec);
1362 alc_init_auto_mic(codec);
1367 * Fix-up pin default configurations and add default verbs
1376 const struct alc_pincfg *pins;
1377 const struct hda_verb *verbs;
1380 static void alc_pick_fixup(struct hda_codec *codec,
1381 const struct snd_pci_quirk *quirk,
1382 const struct alc_fixup *fix)
1384 const struct alc_pincfg *cfg;
1386 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1390 fix += quirk->value;
1393 for (; cfg->nid; cfg++)
1394 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1397 add_verb(codec->spec, fix->verbs);
1400 static int alc_read_coef_idx(struct hda_codec *codec,
1401 unsigned int coef_idx)
1404 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1406 val = snd_hda_codec_read(codec, 0x20, 0,
1407 AC_VERB_GET_PROC_COEF, 0);
1418 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1419 /* Mic-in jack as mic in */
1420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1422 /* Line-in jack as Line in */
1423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1425 /* Line-Out as Front */
1426 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1433 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1434 /* Mic-in jack as mic in */
1435 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1436 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1437 /* Line-in jack as Surround */
1438 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1439 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1440 /* Line-Out as Front */
1441 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1448 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1449 /* Mic-in jack as CLFE */
1450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1452 /* Line-in jack as Surround */
1453 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1454 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1455 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1456 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1463 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1464 /* Mic-in jack as CLFE */
1465 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1466 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1467 /* Line-in jack as Surround */
1468 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1469 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1470 /* Line-Out as Side */
1471 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1475 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1476 { 2, alc888_4ST_ch2_intel_init },
1477 { 4, alc888_4ST_ch4_intel_init },
1478 { 6, alc888_4ST_ch6_intel_init },
1479 { 8, alc888_4ST_ch8_intel_init },
1483 * ALC888 Fujitsu Siemens Amillo xa3530
1486 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1487 /* Front Mic: set to PIN_IN (empty by default) */
1488 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1489 /* Connect Internal HP to Front */
1490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1491 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1492 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1493 /* Connect Bass HP to Front */
1494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1496 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1497 /* Connect Line-Out side jack (SPDIF) to Side */
1498 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1500 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1501 /* Connect Mic jack to CLFE */
1502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1504 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1505 /* Connect Line-in jack to Surround */
1506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1508 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1509 /* Connect HP out jack to Front */
1510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1512 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1513 /* Enable unsolicited event for HP jack and Line-out jack */
1514 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1515 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1519 static void alc_automute_amp(struct hda_codec *codec)
1521 struct alc_spec *spec = codec->spec;
1526 spec->jack_present = 0;
1527 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1528 nid = spec->autocfg.hp_pins[i];
1531 if (snd_hda_jack_detect(codec, nid)) {
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},
1669 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1670 * which makes the stereo useless. However, either the mic or the ALC889
1671 * makes the signal become a difference/sum signal instead of standard
1672 * stereo, which is annoying. So instead we flip this bit which makes the
1673 * codec replicate the sum signal to both channels, turning it into a
1676 /* DMIC_CONTROL? Init value = 0x0001 */
1677 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1678 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1682 static struct hda_input_mux alc888_2_capture_sources[2] = {
1683 /* Front mic only available on one ADC */
1690 { "Front Mic", 0xb },
1703 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1704 /* Interal mic only available on one ADC */
1711 { "Input Mix", 0xa },
1721 { "Input Mix", 0xa },
1726 static struct hda_input_mux alc889_capture_sources[3] = {
1727 /* Digital mic only available on first "ADC" */
1734 { "Front Mic", 0xb },
1735 { "Input Mix", 0xa },
1744 { "Input Mix", 0xa },
1753 { "Input Mix", 0xa },
1758 static struct snd_kcontrol_new alc888_base_mixer[] = {
1759 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1762 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1763 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1765 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1771 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1772 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1773 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1780 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1781 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1782 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1783 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1784 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1785 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1787 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1788 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1789 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1799 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1801 struct alc_spec *spec = codec->spec;
1803 spec->autocfg.hp_pins[0] = 0x15;
1804 spec->autocfg.speaker_pins[0] = 0x14;
1805 spec->autocfg.speaker_pins[1] = 0x16;
1806 spec->autocfg.speaker_pins[2] = 0x17;
1809 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1811 struct alc_spec *spec = codec->spec;
1813 spec->autocfg.hp_pins[0] = 0x15;
1814 spec->autocfg.speaker_pins[0] = 0x14;
1815 spec->autocfg.speaker_pins[1] = 0x16;
1816 spec->autocfg.speaker_pins[2] = 0x17;
1819 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1821 struct alc_spec *spec = codec->spec;
1823 spec->autocfg.hp_pins[0] = 0x15;
1824 spec->autocfg.speaker_pins[0] = 0x14;
1825 spec->autocfg.speaker_pins[1] = 0x16;
1826 spec->autocfg.speaker_pins[2] = 0x1b;
1830 * ALC880 3-stack model
1832 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1833 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1834 * F-Mic = 0x1b, HP = 0x19
1837 static hda_nid_t alc880_dac_nids[4] = {
1838 /* front, rear, clfe, rear_surr */
1839 0x02, 0x05, 0x04, 0x03
1842 static hda_nid_t alc880_adc_nids[3] = {
1847 /* The datasheet says the node 0x07 is connected from inputs,
1848 * but it shows zero connection in the real implementation on some devices.
1849 * Note: this is a 915GAV bug, fixed on 915GLV
1851 static hda_nid_t alc880_adc_nids_alt[2] = {
1856 #define ALC880_DIGOUT_NID 0x06
1857 #define ALC880_DIGIN_NID 0x0a
1859 static struct hda_input_mux alc880_capture_source = {
1863 { "Front Mic", 0x3 },
1869 /* channel source setting (2/6 channel selection for 3-stack) */
1871 static struct hda_verb alc880_threestack_ch2_init[] = {
1872 /* set line-in to input, mute it */
1873 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1874 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1875 /* set mic-in to input vref 80%, mute it */
1876 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1877 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1882 static struct hda_verb alc880_threestack_ch6_init[] = {
1883 /* set line-in to output, unmute it */
1884 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1885 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1886 /* set mic-in to output, unmute it */
1887 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1888 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1892 static struct hda_channel_mode alc880_threestack_modes[2] = {
1893 { 2, alc880_threestack_ch2_init },
1894 { 6, alc880_threestack_ch6_init },
1897 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1899 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1900 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1901 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1902 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1903 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1904 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1905 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1906 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1907 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1908 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1909 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1912 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1917 .name = "Channel Mode",
1918 .info = alc_ch_mode_info,
1919 .get = alc_ch_mode_get,
1920 .put = alc_ch_mode_put,
1925 /* capture mixer elements */
1926 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1927 struct snd_ctl_elem_info *uinfo)
1929 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1930 struct alc_spec *spec = codec->spec;
1933 mutex_lock(&codec->control_mutex);
1934 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1936 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1937 mutex_unlock(&codec->control_mutex);
1941 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1942 unsigned int size, unsigned int __user *tlv)
1944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1945 struct alc_spec *spec = codec->spec;
1948 mutex_lock(&codec->control_mutex);
1949 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1951 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1952 mutex_unlock(&codec->control_mutex);
1956 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1957 struct snd_ctl_elem_value *ucontrol);
1959 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1960 struct snd_ctl_elem_value *ucontrol,
1963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1964 struct alc_spec *spec = codec->spec;
1965 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1968 mutex_lock(&codec->control_mutex);
1969 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1971 err = func(kcontrol, ucontrol);
1972 mutex_unlock(&codec->control_mutex);
1976 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1977 struct snd_ctl_elem_value *ucontrol)
1979 return alc_cap_getput_caller(kcontrol, ucontrol,
1980 snd_hda_mixer_amp_volume_get);
1983 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1984 struct snd_ctl_elem_value *ucontrol)
1986 return alc_cap_getput_caller(kcontrol, ucontrol,
1987 snd_hda_mixer_amp_volume_put);
1990 /* capture mixer elements */
1991 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1993 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1994 struct snd_ctl_elem_value *ucontrol)
1996 return alc_cap_getput_caller(kcontrol, ucontrol,
1997 snd_hda_mixer_amp_switch_get);
2000 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2001 struct snd_ctl_elem_value *ucontrol)
2003 return alc_cap_getput_caller(kcontrol, ucontrol,
2004 snd_hda_mixer_amp_switch_put);
2007 #define _DEFINE_CAPMIX(num) \
2009 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2010 .name = "Capture Switch", \
2011 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2013 .info = alc_cap_sw_info, \
2014 .get = alc_cap_sw_get, \
2015 .put = alc_cap_sw_put, \
2018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2019 .name = "Capture Volume", \
2020 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2021 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2022 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2024 .info = alc_cap_vol_info, \
2025 .get = alc_cap_vol_get, \
2026 .put = alc_cap_vol_put, \
2027 .tlv = { .c = alc_cap_vol_tlv }, \
2030 #define _DEFINE_CAPSRC(num) \
2032 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2033 /* .name = "Capture Source", */ \
2034 .name = "Input Source", \
2036 .info = alc_mux_enum_info, \
2037 .get = alc_mux_enum_get, \
2038 .put = alc_mux_enum_put, \
2041 #define DEFINE_CAPMIX(num) \
2042 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2043 _DEFINE_CAPMIX(num), \
2044 _DEFINE_CAPSRC(num), \
2048 #define DEFINE_CAPMIX_NOSRC(num) \
2049 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2050 _DEFINE_CAPMIX(num), \
2054 /* up to three ADCs */
2058 DEFINE_CAPMIX_NOSRC(1);
2059 DEFINE_CAPMIX_NOSRC(2);
2060 DEFINE_CAPMIX_NOSRC(3);
2063 * ALC880 5-stack model
2065 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2067 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2068 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2071 /* additional mixers to alc880_three_stack_mixer */
2072 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2073 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2074 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2078 /* channel source setting (6/8 channel selection for 5-stack) */
2080 static struct hda_verb alc880_fivestack_ch6_init[] = {
2081 /* set line-in to input, mute it */
2082 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2083 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2088 static struct hda_verb alc880_fivestack_ch8_init[] = {
2089 /* set line-in to output, unmute it */
2090 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2091 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2095 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2096 { 6, alc880_fivestack_ch6_init },
2097 { 8, alc880_fivestack_ch8_init },
2102 * ALC880 6-stack model
2104 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2105 * Side = 0x05 (0x0f)
2106 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2107 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2110 static hda_nid_t alc880_6st_dac_nids[4] = {
2111 /* front, rear, clfe, rear_surr */
2112 0x02, 0x03, 0x04, 0x05
2115 static struct hda_input_mux alc880_6stack_capture_source = {
2119 { "Front Mic", 0x1 },
2125 /* fixed 8-channels */
2126 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2130 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2132 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2133 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2134 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2135 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2136 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2137 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2138 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2139 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2140 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2151 .name = "Channel Mode",
2152 .info = alc_ch_mode_info,
2153 .get = alc_ch_mode_get,
2154 .put = alc_ch_mode_put,
2163 * W810 has rear IO for:
2166 * Center/LFE (DAC 04)
2169 * The system also has a pair of internal speakers, and a headphone jack.
2170 * These are both connected to Line2 on the codec, hence to DAC 02.
2172 * There is a variable resistor to control the speaker or headphone
2173 * volume. This is a hardware-only device without a software API.
2175 * Plugging headphones in will disable the internal speakers. This is
2176 * implemented in hardware, not via the driver using jack sense. In
2177 * a similar fashion, plugging into the rear socket marked "front" will
2178 * disable both the speakers and headphones.
2180 * For input, there's a microphone jack, and an "audio in" jack.
2181 * These may not do anything useful with this driver yet, because I
2182 * haven't setup any initialization verbs for these yet...
2185 static hda_nid_t alc880_w810_dac_nids[3] = {
2186 /* front, rear/surround, clfe */
2190 /* fixed 6 channels */
2191 static struct hda_channel_mode alc880_w810_modes[1] = {
2195 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2196 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2197 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2198 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2200 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2201 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2202 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2203 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2204 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2213 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2214 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2218 static hda_nid_t alc880_z71v_dac_nids[1] = {
2221 #define ALC880_Z71V_HP_DAC 0x03
2223 /* fixed 2 channels */
2224 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2228 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2230 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2231 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2232 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2242 * ALC880 F1734 model
2244 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2245 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2248 static hda_nid_t alc880_f1734_dac_nids[1] = {
2251 #define ALC880_F1734_HP_DAC 0x02
2253 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2255 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2257 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2260 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2265 static struct hda_input_mux alc880_f1734_capture_source = {
2277 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2278 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2279 * Mic = 0x18, Line = 0x1a
2282 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2283 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2285 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2286 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2287 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2288 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2289 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2290 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2291 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2292 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2293 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2296 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2297 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2299 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2301 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2302 .name = "Channel Mode",
2303 .info = alc_ch_mode_info,
2304 .get = alc_ch_mode_get,
2305 .put = alc_ch_mode_put,
2311 * ALC880 ASUS W1V model
2313 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2314 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2315 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2318 /* additional mixers to alc880_asus_mixer */
2319 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2320 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2321 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2326 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2327 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2328 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2330 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2331 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2335 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2340 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2342 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2343 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2344 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2345 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2346 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2347 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2348 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2350 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2355 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2358 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2359 .name = "Channel Mode",
2360 .info = alc_ch_mode_info,
2361 .get = alc_ch_mode_get,
2362 .put = alc_ch_mode_put,
2367 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2373 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2374 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2375 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2376 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2377 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2381 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2382 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2383 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2384 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2385 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2392 * virtual master controls
2396 * slave controls for virtual master
2398 static const char *alc_slave_vols[] = {
2399 "Front Playback Volume",
2400 "Surround Playback Volume",
2401 "Center Playback Volume",
2402 "LFE Playback Volume",
2403 "Side Playback Volume",
2404 "Headphone Playback Volume",
2405 "Speaker Playback Volume",
2406 "Mono Playback Volume",
2407 "Line-Out Playback Volume",
2408 "PCM Playback Volume",
2412 static const char *alc_slave_sws[] = {
2413 "Front Playback Switch",
2414 "Surround Playback Switch",
2415 "Center Playback Switch",
2416 "LFE Playback Switch",
2417 "Side Playback Switch",
2418 "Headphone Playback Switch",
2419 "Speaker Playback Switch",
2420 "Mono Playback Switch",
2421 "IEC958 Playback Switch",
2422 "Line-Out Playback Switch",
2423 "PCM Playback Switch",
2428 * build control elements
2431 static void alc_free_kctls(struct hda_codec *codec);
2433 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2434 /* additional beep mixers; the actual parameters are overwritten at build */
2435 static struct snd_kcontrol_new alc_beep_mixer[] = {
2436 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2437 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2442 static int alc_build_controls(struct hda_codec *codec)
2444 struct alc_spec *spec = codec->spec;
2448 for (i = 0; i < spec->num_mixers; i++) {
2449 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2453 if (spec->cap_mixer) {
2454 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2458 if (spec->multiout.dig_out_nid) {
2459 err = snd_hda_create_spdif_out_ctls(codec,
2460 spec->multiout.dig_out_nid);
2463 if (!spec->no_analog) {
2464 err = snd_hda_create_spdif_share_sw(codec,
2468 spec->multiout.share_spdif = 1;
2471 if (spec->dig_in_nid) {
2472 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2477 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2478 /* create beep controls if needed */
2479 if (spec->beep_amp) {
2480 struct snd_kcontrol_new *knew;
2481 for (knew = alc_beep_mixer; knew->name; knew++) {
2482 struct snd_kcontrol *kctl;
2483 kctl = snd_ctl_new1(knew, codec);
2486 kctl->private_value = spec->beep_amp;
2487 err = snd_hda_ctl_add(codec,
2488 get_amp_nid_(spec->beep_amp), kctl);
2495 /* if we have no master control, let's create it */
2496 if (!spec->no_analog &&
2497 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2498 unsigned int vmaster_tlv[4];
2499 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2500 HDA_OUTPUT, vmaster_tlv);
2501 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2502 vmaster_tlv, alc_slave_vols);
2506 if (!spec->no_analog &&
2507 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2508 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2509 NULL, alc_slave_sws);
2514 alc_free_kctls(codec); /* no longer needed */
2520 * initialize the codec volumes, etc
2524 * generic initialization of ADC, input mixers and output mixers
2526 static struct hda_verb alc880_volume_init_verbs[] = {
2528 * Unmute ADC0-2 and set the default input to mic-in
2530 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2532 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2534 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2537 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2539 * Note: PASD motherboards uses the Line In 2 as the input for front
2542 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2552 * Set up output mixers (0x0c - 0x0f)
2554 /* set vol=0 to output mixers */
2555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2559 /* set up input amps for analog loopback */
2560 /* Amp Indices: DAC = 0, mixer = 1 */
2561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2567 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2568 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2574 * 3-stack pin configuration:
2575 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2577 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2579 * preset connection lists of input pins
2580 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2582 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2583 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2584 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2587 * Set pin mode and muting
2589 /* set front pin widgets 0x14 for output */
2590 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2592 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2594 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2595 /* Mic2 (as headphone out) for HP output */
2596 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2597 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2598 /* Line In pin widget for input */
2599 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2600 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2601 /* Line2 (as front mic) pin widget for input and vref at 80% */
2602 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2603 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2604 /* CD pin widget for input */
2605 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2611 * 5-stack pin configuration:
2612 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2613 * line-in/side = 0x1a, f-mic = 0x1b
2615 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2617 * preset connection lists of input pins
2618 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2620 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2621 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2624 * Set pin mode and muting
2626 /* set pin widgets 0x14-0x17 for output */
2627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2630 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2631 /* unmute pins for output (no gain on this amp) */
2632 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2637 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2638 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2640 /* Mic2 (as headphone out) for HP output */
2641 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2642 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2643 /* Line In pin widget for input */
2644 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2645 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2646 /* Line2 (as front mic) pin widget for input and vref at 80% */
2647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2648 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2649 /* CD pin widget for input */
2650 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2656 * W810 pin configuration:
2657 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2659 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2660 /* hphone/speaker input selector: front DAC */
2661 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2668 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2670 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2671 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2677 * Z71V pin configuration:
2678 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2680 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2682 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2687 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2695 * 6-stack pin configuration:
2696 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2697 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2699 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2700 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2708 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2709 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2713 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2714 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2715 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2717 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2725 * Uniwill pin configuration:
2726 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2729 static struct hda_verb alc880_uniwill_init_verbs[] = {
2730 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2736 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2737 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2739 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2747 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2753 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2754 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2757 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2758 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2765 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2767 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2768 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2774 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2783 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2784 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2785 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2786 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2788 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2790 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2791 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2796 static struct hda_verb alc880_beep_init_verbs[] = {
2797 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2801 /* auto-toggle front mic */
2802 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2804 unsigned int present;
2807 present = snd_hda_jack_detect(codec, 0x18);
2808 bits = present ? HDA_AMP_MUTE : 0;
2809 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2812 static void alc880_uniwill_setup(struct hda_codec *codec)
2814 struct alc_spec *spec = codec->spec;
2816 spec->autocfg.hp_pins[0] = 0x14;
2817 spec->autocfg.speaker_pins[0] = 0x15;
2818 spec->autocfg.speaker_pins[0] = 0x16;
2821 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2823 alc_automute_amp(codec);
2824 alc880_uniwill_mic_automute(codec);
2827 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2830 /* Looks like the unsol event is incompatible with the standard
2831 * definition. 4bit tag is placed at 28 bit!
2833 switch (res >> 28) {
2834 case ALC880_MIC_EVENT:
2835 alc880_uniwill_mic_automute(codec);
2838 alc_automute_amp_unsol_event(codec, res);
2843 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2845 struct alc_spec *spec = codec->spec;
2847 spec->autocfg.hp_pins[0] = 0x14;
2848 spec->autocfg.speaker_pins[0] = 0x15;
2851 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2853 unsigned int present;
2855 present = snd_hda_codec_read(codec, 0x21, 0,
2856 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2857 present &= HDA_AMP_VOLMASK;
2858 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2859 HDA_AMP_VOLMASK, present);
2860 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2861 HDA_AMP_VOLMASK, present);
2864 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2867 /* Looks like the unsol event is incompatible with the standard
2868 * definition. 4bit tag is placed at 28 bit!
2870 if ((res >> 28) == ALC880_DCVOL_EVENT)
2871 alc880_uniwill_p53_dcvol_automute(codec);
2873 alc_automute_amp_unsol_event(codec, res);
2877 * F1734 pin configuration:
2878 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2880 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2881 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2882 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2883 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2884 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2885 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2892 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2893 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2894 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2895 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2896 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2897 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2899 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2900 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2902 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2903 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2909 * ASUS pin configuration:
2910 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2912 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2913 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2914 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2915 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2916 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2919 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2921 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2928 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2929 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2930 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2933 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2935 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2940 /* Enable GPIO mask and set output */
2941 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2942 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2943 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2945 /* Clevo m520g init */
2946 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2947 /* headphone output */
2948 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2953 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2954 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2956 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2957 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2958 /* Mic1 (rear panel) */
2959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2960 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2961 /* Mic2 (front panel) */
2962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2965 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2966 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2967 /* change to EAPD mode */
2968 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2969 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2974 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2975 /* change to EAPD mode */
2976 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2977 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2979 /* Headphone output */
2980 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2982 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2983 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2985 /* Line In pin widget for input */
2986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2987 /* CD pin widget for input */
2988 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2989 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2992 /* change to EAPD mode */
2993 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2994 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3000 * LG m1 express dual
3003 * Rear Line-In/Out (blue): 0x14
3004 * Build-in Mic-In: 0x15
3006 * HP-Out (green): 0x1b
3007 * Mic-In/Out (red): 0x19
3011 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3012 static hda_nid_t alc880_lg_dac_nids[3] = {
3016 /* seems analog CD is not working */
3017 static struct hda_input_mux alc880_lg_capture_source = {
3022 { "Internal Mic", 0x6 },
3026 /* 2,4,6 channel modes */
3027 static struct hda_verb alc880_lg_ch2_init[] = {
3028 /* set line-in and mic-in to input */
3029 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3030 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3034 static struct hda_verb alc880_lg_ch4_init[] = {
3035 /* set line-in to out and mic-in to input */
3036 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3037 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3041 static struct hda_verb alc880_lg_ch6_init[] = {
3042 /* set line-in and mic-in to output */
3043 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3044 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3048 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3049 { 2, alc880_lg_ch2_init },
3050 { 4, alc880_lg_ch4_init },
3051 { 6, alc880_lg_ch6_init },
3054 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3055 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3056 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3057 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3058 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3059 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3060 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3061 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3062 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3067 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3068 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3071 .name = "Channel Mode",
3072 .info = alc_ch_mode_info,
3073 .get = alc_ch_mode_get,
3074 .put = alc_ch_mode_put,
3079 static struct hda_verb alc880_lg_init_verbs[] = {
3080 /* set capture source to mic-in */
3081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3082 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3083 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3084 /* mute all amp mixer inputs */
3085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3088 /* line-in to input */
3089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3095 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3096 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3097 /* mic-in to input */
3098 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3099 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3100 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3102 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3104 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3106 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3110 /* toggle speaker-output according to the hp-jack state */
3111 static void alc880_lg_setup(struct hda_codec *codec)
3113 struct alc_spec *spec = codec->spec;
3115 spec->autocfg.hp_pins[0] = 0x1b;
3116 spec->autocfg.speaker_pins[0] = 0x17;
3125 * Built-in Mic-In: 0x19
3131 static struct hda_input_mux alc880_lg_lw_capture_source = {
3135 { "Internal Mic", 0x1 },
3140 #define alc880_lg_lw_modes alc880_threestack_modes
3142 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3145 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3146 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3147 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3148 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3149 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3150 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3155 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3156 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3159 .name = "Channel Mode",
3160 .info = alc_ch_mode_info,
3161 .get = alc_ch_mode_get,
3162 .put = alc_ch_mode_put,
3167 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3168 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3169 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3170 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3172 /* set capture source to mic-in */
3173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3174 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3175 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3182 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 /* mic-in to input */
3184 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3190 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3194 /* toggle speaker-output according to the hp-jack state */
3195 static void alc880_lg_lw_setup(struct hda_codec *codec)
3197 struct alc_spec *spec = codec->spec;
3199 spec->autocfg.hp_pins[0] = 0x1b;
3200 spec->autocfg.speaker_pins[0] = 0x14;
3203 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3204 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3205 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3208 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3209 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3213 static struct hda_input_mux alc880_medion_rim_capture_source = {
3217 { "Internal Mic", 0x1 },
3221 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3222 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3227 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3230 /* Mic2 (as headphone out) for HP output */
3231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3233 /* Internal Speaker */
3234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3235 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3237 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3238 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3240 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3244 /* toggle speaker-output according to the hp-jack state */
3245 static void alc880_medion_rim_automute(struct hda_codec *codec)
3247 struct alc_spec *spec = codec->spec;
3248 alc_automute_amp(codec);
3250 if (spec->jack_present)
3251 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3253 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3256 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3259 /* Looks like the unsol event is incompatible with the standard
3260 * definition. 4bit tag is placed at 28 bit!
3262 if ((res >> 28) == ALC880_HP_EVENT)
3263 alc880_medion_rim_automute(codec);
3266 static void alc880_medion_rim_setup(struct hda_codec *codec)
3268 struct alc_spec *spec = codec->spec;
3270 spec->autocfg.hp_pins[0] = 0x14;
3271 spec->autocfg.speaker_pins[0] = 0x1b;
3274 #ifdef CONFIG_SND_HDA_POWER_SAVE
3275 static struct hda_amp_list alc880_loopbacks[] = {
3276 { 0x0b, HDA_INPUT, 0 },
3277 { 0x0b, HDA_INPUT, 1 },
3278 { 0x0b, HDA_INPUT, 2 },
3279 { 0x0b, HDA_INPUT, 3 },
3280 { 0x0b, HDA_INPUT, 4 },
3284 static struct hda_amp_list alc880_lg_loopbacks[] = {
3285 { 0x0b, HDA_INPUT, 1 },
3286 { 0x0b, HDA_INPUT, 6 },
3287 { 0x0b, HDA_INPUT, 7 },
3296 static int alc_init(struct hda_codec *codec)
3298 struct alc_spec *spec = codec->spec;
3302 alc_auto_init_amp(codec, spec->init_amp);
3304 for (i = 0; i < spec->num_init_verbs; i++)
3305 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3307 if (spec->init_hook)
3308 spec->init_hook(codec);
3313 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3315 struct alc_spec *spec = codec->spec;
3317 if (spec->unsol_event)
3318 spec->unsol_event(codec, res);
3321 #ifdef CONFIG_SND_HDA_POWER_SAVE
3322 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3324 struct alc_spec *spec = codec->spec;
3325 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3330 * Analog playback callbacks
3332 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3333 struct hda_codec *codec,
3334 struct snd_pcm_substream *substream)
3336 struct alc_spec *spec = codec->spec;
3337 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3341 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3342 struct hda_codec *codec,
3343 unsigned int stream_tag,
3344 unsigned int format,
3345 struct snd_pcm_substream *substream)
3347 struct alc_spec *spec = codec->spec;
3348 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3349 stream_tag, format, substream);
3352 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3353 struct hda_codec *codec,
3354 struct snd_pcm_substream *substream)
3356 struct alc_spec *spec = codec->spec;
3357 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3363 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3364 struct hda_codec *codec,
3365 struct snd_pcm_substream *substream)
3367 struct alc_spec *spec = codec->spec;
3368 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3371 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3372 struct hda_codec *codec,
3373 unsigned int stream_tag,
3374 unsigned int format,
3375 struct snd_pcm_substream *substream)
3377 struct alc_spec *spec = codec->spec;
3378 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3379 stream_tag, format, substream);
3382 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3383 struct hda_codec *codec,
3384 struct snd_pcm_substream *substream)
3386 struct alc_spec *spec = codec->spec;
3387 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3390 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3391 struct hda_codec *codec,
3392 struct snd_pcm_substream *substream)
3394 struct alc_spec *spec = codec->spec;
3395 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3401 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3402 struct hda_codec *codec,
3403 unsigned int stream_tag,
3404 unsigned int format,
3405 struct snd_pcm_substream *substream)
3407 struct alc_spec *spec = codec->spec;
3409 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3410 stream_tag, 0, format);
3414 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3415 struct hda_codec *codec,
3416 struct snd_pcm_substream *substream)
3418 struct alc_spec *spec = codec->spec;
3420 snd_hda_codec_cleanup_stream(codec,
3421 spec->adc_nids[substream->number + 1]);
3428 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3432 /* NID is set in alc_build_pcms */
3434 .open = alc880_playback_pcm_open,
3435 .prepare = alc880_playback_pcm_prepare,
3436 .cleanup = alc880_playback_pcm_cleanup
3440 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3444 /* NID is set in alc_build_pcms */
3447 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3451 /* NID is set in alc_build_pcms */
3454 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3455 .substreams = 2, /* can be overridden */
3458 /* NID is set in alc_build_pcms */
3460 .prepare = alc880_alt_capture_pcm_prepare,
3461 .cleanup = alc880_alt_capture_pcm_cleanup
3465 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3469 /* NID is set in alc_build_pcms */
3471 .open = alc880_dig_playback_pcm_open,
3472 .close = alc880_dig_playback_pcm_close,
3473 .prepare = alc880_dig_playback_pcm_prepare,
3474 .cleanup = alc880_dig_playback_pcm_cleanup
3478 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3482 /* NID is set in alc_build_pcms */
3485 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3486 static struct hda_pcm_stream alc_pcm_null_stream = {
3492 static int alc_build_pcms(struct hda_codec *codec)
3494 struct alc_spec *spec = codec->spec;
3495 struct hda_pcm *info = spec->pcm_rec;
3498 codec->num_pcms = 1;
3499 codec->pcm_info = info;
3501 if (spec->no_analog)
3504 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3505 "%s Analog", codec->chip_name);
3506 info->name = spec->stream_name_analog;
3508 if (spec->stream_analog_playback) {
3509 if (snd_BUG_ON(!spec->multiout.dac_nids))
3511 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3512 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3514 if (spec->stream_analog_capture) {
3515 if (snd_BUG_ON(!spec->adc_nids))
3517 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3518 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3521 if (spec->channel_mode) {
3522 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3523 for (i = 0; i < spec->num_channel_mode; i++) {
3524 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3525 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3531 /* SPDIF for stream index #1 */
3532 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3533 snprintf(spec->stream_name_digital,
3534 sizeof(spec->stream_name_digital),
3535 "%s Digital", codec->chip_name);
3536 codec->num_pcms = 2;
3537 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3538 info = spec->pcm_rec + 1;
3539 info->name = spec->stream_name_digital;
3540 if (spec->dig_out_type)
3541 info->pcm_type = spec->dig_out_type;
3543 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3544 if (spec->multiout.dig_out_nid &&
3545 spec->stream_digital_playback) {
3546 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3547 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3549 if (spec->dig_in_nid &&
3550 spec->stream_digital_capture) {
3551 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3552 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3554 /* FIXME: do we need this for all Realtek codec models? */
3555 codec->spdif_status_reset = 1;
3558 if (spec->no_analog)
3561 /* If the use of more than one ADC is requested for the current
3562 * model, configure a second analog capture-only PCM.
3564 /* Additional Analaog capture for index #2 */
3565 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3566 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3567 codec->num_pcms = 3;
3568 info = spec->pcm_rec + 2;
3569 info->name = spec->stream_name_analog;
3570 if (spec->alt_dac_nid) {
3571 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3572 *spec->stream_analog_alt_playback;
3573 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3576 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3577 alc_pcm_null_stream;
3578 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3580 if (spec->num_adc_nids > 1) {
3581 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3582 *spec->stream_analog_alt_capture;
3583 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3585 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3586 spec->num_adc_nids - 1;
3588 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3589 alc_pcm_null_stream;
3590 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3597 static void alc_free_kctls(struct hda_codec *codec)
3599 struct alc_spec *spec = codec->spec;
3601 if (spec->kctls.list) {
3602 struct snd_kcontrol_new *kctl = spec->kctls.list;
3604 for (i = 0; i < spec->kctls.used; i++)
3605 kfree(kctl[i].name);
3607 snd_array_free(&spec->kctls);
3610 static void alc_free(struct hda_codec *codec)
3612 struct alc_spec *spec = codec->spec;
3617 alc_free_kctls(codec);
3619 snd_hda_detach_beep_device(codec);
3622 #ifdef SND_HDA_NEEDS_RESUME
3623 static int alc_resume(struct hda_codec *codec)
3625 codec->patch_ops.init(codec);
3626 snd_hda_codec_resume_amp(codec);
3627 snd_hda_codec_resume_cache(codec);
3634 static struct hda_codec_ops alc_patch_ops = {
3635 .build_controls = alc_build_controls,
3636 .build_pcms = alc_build_pcms,
3639 .unsol_event = alc_unsol_event,
3640 #ifdef SND_HDA_NEEDS_RESUME
3641 .resume = alc_resume,
3643 #ifdef CONFIG_SND_HDA_POWER_SAVE
3644 .check_power_status = alc_check_power_status,
3650 * Test configuration for debugging
3652 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3655 #ifdef CONFIG_SND_DEBUG
3656 static hda_nid_t alc880_test_dac_nids[4] = {
3657 0x02, 0x03, 0x04, 0x05
3660 static struct hda_input_mux alc880_test_capture_source = {
3669 { "Surround", 0x6 },
3673 static struct hda_channel_mode alc880_test_modes[4] = {
3680 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3681 struct snd_ctl_elem_info *uinfo)
3683 static char *texts[] = {
3684 "N/A", "Line Out", "HP Out",
3685 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3687 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3689 uinfo->value.enumerated.items = 8;
3690 if (uinfo->value.enumerated.item >= 8)
3691 uinfo->value.enumerated.item = 7;
3692 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3696 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3697 struct snd_ctl_elem_value *ucontrol)
3699 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3700 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3701 unsigned int pin_ctl, item = 0;
3703 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3704 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3705 if (pin_ctl & AC_PINCTL_OUT_EN) {
3706 if (pin_ctl & AC_PINCTL_HP_EN)
3710 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3711 switch (pin_ctl & AC_PINCTL_VREFEN) {
3712 case AC_PINCTL_VREF_HIZ: item = 3; break;
3713 case AC_PINCTL_VREF_50: item = 4; break;
3714 case AC_PINCTL_VREF_GRD: item = 5; break;
3715 case AC_PINCTL_VREF_80: item = 6; break;
3716 case AC_PINCTL_VREF_100: item = 7; break;
3719 ucontrol->value.enumerated.item[0] = item;
3723 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3724 struct snd_ctl_elem_value *ucontrol)
3726 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3727 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3728 static unsigned int ctls[] = {
3729 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3730 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3731 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3732 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3733 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3734 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3736 unsigned int old_ctl, new_ctl;
3738 old_ctl = snd_hda_codec_read(codec, nid, 0,
3739 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3740 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3741 if (old_ctl != new_ctl) {
3743 snd_hda_codec_write_cache(codec, nid, 0,
3744 AC_VERB_SET_PIN_WIDGET_CONTROL,
3746 val = ucontrol->value.enumerated.item[0] >= 3 ?
3748 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3755 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3756 struct snd_ctl_elem_info *uinfo)
3758 static char *texts[] = {
3759 "Front", "Surround", "CLFE", "Side"
3761 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3763 uinfo->value.enumerated.items = 4;
3764 if (uinfo->value.enumerated.item >= 4)
3765 uinfo->value.enumerated.item = 3;
3766 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3770 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3771 struct snd_ctl_elem_value *ucontrol)
3773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3774 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3777 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3778 ucontrol->value.enumerated.item[0] = sel & 3;
3782 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3783 struct snd_ctl_elem_value *ucontrol)
3785 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3786 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3789 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3790 if (ucontrol->value.enumerated.item[0] != sel) {
3791 sel = ucontrol->value.enumerated.item[0] & 3;
3792 snd_hda_codec_write_cache(codec, nid, 0,
3793 AC_VERB_SET_CONNECT_SEL, sel);
3799 #define PIN_CTL_TEST(xname,nid) { \
3800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3802 .info = alc_test_pin_ctl_info, \
3803 .get = alc_test_pin_ctl_get, \
3804 .put = alc_test_pin_ctl_put, \
3805 .private_value = nid \
3808 #define PIN_SRC_TEST(xname,nid) { \
3809 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3811 .info = alc_test_pin_src_info, \
3812 .get = alc_test_pin_src_get, \
3813 .put = alc_test_pin_src_put, \
3814 .private_value = nid \
3817 static struct snd_kcontrol_new alc880_test_mixer[] = {
3818 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3819 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3820 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3821 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3822 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3823 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3824 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3825 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3826 PIN_CTL_TEST("Front Pin Mode", 0x14),
3827 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3828 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3829 PIN_CTL_TEST("Side Pin Mode", 0x17),
3830 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3831 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3832 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3833 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3834 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3835 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3836 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3837 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3838 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3839 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3840 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3841 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3842 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3843 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3844 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3845 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3850 .name = "Channel Mode",
3851 .info = alc_ch_mode_info,
3852 .get = alc_ch_mode_get,
3853 .put = alc_ch_mode_put,
3858 static struct hda_verb alc880_test_init_verbs[] = {
3859 /* Unmute inputs of 0x0c - 0x0f */
3860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3862 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3863 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3864 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3866 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3867 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3868 /* Vol output for 0x0c-0x0f */
3869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3870 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3871 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3873 /* Set output pins 0x14-0x17 */
3874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3877 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3878 /* Unmute output pins 0x14-0x17 */
3879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3882 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3883 /* Set input pins 0x18-0x1c */
3884 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3886 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3887 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3888 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3889 /* Mute input pins 0x18-0x1b */
3890 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3893 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3896 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3898 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3900 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3901 /* Analog input/passthru */
3902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3904 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3905 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3906 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3914 static const char *alc880_models[ALC880_MODEL_LAST] = {
3915 [ALC880_3ST] = "3stack",
3916 [ALC880_TCL_S700] = "tcl",
3917 [ALC880_3ST_DIG] = "3stack-digout",
3918 [ALC880_CLEVO] = "clevo",
3919 [ALC880_5ST] = "5stack",
3920 [ALC880_5ST_DIG] = "5stack-digout",
3921 [ALC880_W810] = "w810",
3922 [ALC880_Z71V] = "z71v",
3923 [ALC880_6ST] = "6stack",
3924 [ALC880_6ST_DIG] = "6stack-digout",
3925 [ALC880_ASUS] = "asus",
3926 [ALC880_ASUS_W1V] = "asus-w1v",
3927 [ALC880_ASUS_DIG] = "asus-dig",
3928 [ALC880_ASUS_DIG2] = "asus-dig2",
3929 [ALC880_UNIWILL_DIG] = "uniwill",
3930 [ALC880_UNIWILL_P53] = "uniwill-p53",
3931 [ALC880_FUJITSU] = "fujitsu",
3932 [ALC880_F1734] = "F1734",
3934 [ALC880_LG_LW] = "lg-lw",
3935 [ALC880_MEDION_RIM] = "medion",
3936 #ifdef CONFIG_SND_DEBUG
3937 [ALC880_TEST] = "test",
3939 [ALC880_AUTO] = "auto",
3942 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3943 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3944 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3945 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3946 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3947 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3948 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3949 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3950 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3951 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3952 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3953 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3954 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3955 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3956 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3957 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3958 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3959 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3960 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3961 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3962 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3963 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3964 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3965 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3966 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3967 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3968 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3969 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3970 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3971 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3972 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3973 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3974 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3975 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3976 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3977 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3978 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3979 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3980 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3981 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3982 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3983 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3984 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3985 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3986 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3987 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3988 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3989 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3990 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3991 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3992 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3993 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3994 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3995 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3996 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3997 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3998 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3999 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4000 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4001 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4002 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4003 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4004 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4005 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4006 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4007 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4008 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4009 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4010 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4012 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4013 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4014 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4019 * ALC880 codec presets
4021 static struct alc_config_preset alc880_presets[] = {
4023 .mixers = { alc880_three_stack_mixer },
4024 .init_verbs = { alc880_volume_init_verbs,
4025 alc880_pin_3stack_init_verbs },
4026 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4027 .dac_nids = alc880_dac_nids,
4028 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4029 .channel_mode = alc880_threestack_modes,
4031 .input_mux = &alc880_capture_source,
4033 [ALC880_3ST_DIG] = {
4034 .mixers = { alc880_three_stack_mixer },
4035 .init_verbs = { alc880_volume_init_verbs,
4036 alc880_pin_3stack_init_verbs },
4037 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4038 .dac_nids = alc880_dac_nids,
4039 .dig_out_nid = ALC880_DIGOUT_NID,
4040 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4041 .channel_mode = alc880_threestack_modes,
4043 .input_mux = &alc880_capture_source,
4045 [ALC880_TCL_S700] = {
4046 .mixers = { alc880_tcl_s700_mixer },
4047 .init_verbs = { alc880_volume_init_verbs,
4048 alc880_pin_tcl_S700_init_verbs,
4049 alc880_gpio2_init_verbs },
4050 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4051 .dac_nids = alc880_dac_nids,
4052 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4053 .num_adc_nids = 1, /* single ADC */
4055 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4056 .channel_mode = alc880_2_jack_modes,
4057 .input_mux = &alc880_capture_source,
4060 .mixers = { alc880_three_stack_mixer,
4061 alc880_five_stack_mixer},
4062 .init_verbs = { alc880_volume_init_verbs,
4063 alc880_pin_5stack_init_verbs },
4064 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4065 .dac_nids = alc880_dac_nids,
4066 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4067 .channel_mode = alc880_fivestack_modes,
4068 .input_mux = &alc880_capture_source,
4070 [ALC880_5ST_DIG] = {
4071 .mixers = { alc880_three_stack_mixer,
4072 alc880_five_stack_mixer },
4073 .init_verbs = { alc880_volume_init_verbs,
4074 alc880_pin_5stack_init_verbs },
4075 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4076 .dac_nids = alc880_dac_nids,
4077 .dig_out_nid = ALC880_DIGOUT_NID,
4078 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4079 .channel_mode = alc880_fivestack_modes,
4080 .input_mux = &alc880_capture_source,
4083 .mixers = { alc880_six_stack_mixer },
4084 .init_verbs = { alc880_volume_init_verbs,
4085 alc880_pin_6stack_init_verbs },
4086 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4087 .dac_nids = alc880_6st_dac_nids,
4088 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4089 .channel_mode = alc880_sixstack_modes,
4090 .input_mux = &alc880_6stack_capture_source,
4092 [ALC880_6ST_DIG] = {
4093 .mixers = { alc880_six_stack_mixer },
4094 .init_verbs = { alc880_volume_init_verbs,
4095 alc880_pin_6stack_init_verbs },
4096 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4097 .dac_nids = alc880_6st_dac_nids,
4098 .dig_out_nid = ALC880_DIGOUT_NID,
4099 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4100 .channel_mode = alc880_sixstack_modes,
4101 .input_mux = &alc880_6stack_capture_source,
4104 .mixers = { alc880_w810_base_mixer },
4105 .init_verbs = { alc880_volume_init_verbs,
4106 alc880_pin_w810_init_verbs,
4107 alc880_gpio2_init_verbs },
4108 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4109 .dac_nids = alc880_w810_dac_nids,
4110 .dig_out_nid = ALC880_DIGOUT_NID,
4111 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4112 .channel_mode = alc880_w810_modes,
4113 .input_mux = &alc880_capture_source,
4116 .mixers = { alc880_z71v_mixer },
4117 .init_verbs = { alc880_volume_init_verbs,
4118 alc880_pin_z71v_init_verbs },
4119 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4120 .dac_nids = alc880_z71v_dac_nids,
4121 .dig_out_nid = ALC880_DIGOUT_NID,
4123 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4124 .channel_mode = alc880_2_jack_modes,
4125 .input_mux = &alc880_capture_source,
4128 .mixers = { alc880_f1734_mixer },
4129 .init_verbs = { alc880_volume_init_verbs,
4130 alc880_pin_f1734_init_verbs },
4131 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4132 .dac_nids = alc880_f1734_dac_nids,
4134 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4135 .channel_mode = alc880_2_jack_modes,
4136 .input_mux = &alc880_f1734_capture_source,
4137 .unsol_event = alc880_uniwill_p53_unsol_event,
4138 .setup = alc880_uniwill_p53_setup,
4139 .init_hook = alc_automute_amp,
4142 .mixers = { alc880_asus_mixer },
4143 .init_verbs = { alc880_volume_init_verbs,
4144 alc880_pin_asus_init_verbs,
4145 alc880_gpio1_init_verbs },
4146 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4147 .dac_nids = alc880_asus_dac_nids,
4148 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4149 .channel_mode = alc880_asus_modes,
4151 .input_mux = &alc880_capture_source,
4153 [ALC880_ASUS_DIG] = {
4154 .mixers = { alc880_asus_mixer },
4155 .init_verbs = { alc880_volume_init_verbs,
4156 alc880_pin_asus_init_verbs,
4157 alc880_gpio1_init_verbs },
4158 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4159 .dac_nids = alc880_asus_dac_nids,
4160 .dig_out_nid = ALC880_DIGOUT_NID,
4161 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4162 .channel_mode = alc880_asus_modes,
4164 .input_mux = &alc880_capture_source,
4166 [ALC880_ASUS_DIG2] = {
4167 .mixers = { alc880_asus_mixer },
4168 .init_verbs = { alc880_volume_init_verbs,
4169 alc880_pin_asus_init_verbs,
4170 alc880_gpio2_init_verbs }, /* use GPIO2 */
4171 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4172 .dac_nids = alc880_asus_dac_nids,
4173 .dig_out_nid = ALC880_DIGOUT_NID,
4174 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4175 .channel_mode = alc880_asus_modes,
4177 .input_mux = &alc880_capture_source,
4179 [ALC880_ASUS_W1V] = {
4180 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4181 .init_verbs = { alc880_volume_init_verbs,
4182 alc880_pin_asus_init_verbs,
4183 alc880_gpio1_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_asus_modes),
4188 .channel_mode = alc880_asus_modes,
4190 .input_mux = &alc880_capture_source,
4192 [ALC880_UNIWILL_DIG] = {
4193 .mixers = { alc880_asus_mixer },
4194 .init_verbs = { alc880_volume_init_verbs,
4195 alc880_pin_asus_init_verbs },
4196 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4197 .dac_nids = alc880_asus_dac_nids,
4198 .dig_out_nid = ALC880_DIGOUT_NID,
4199 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4200 .channel_mode = alc880_asus_modes,
4202 .input_mux = &alc880_capture_source,
4204 [ALC880_UNIWILL] = {
4205 .mixers = { alc880_uniwill_mixer },
4206 .init_verbs = { alc880_volume_init_verbs,
4207 alc880_uniwill_init_verbs },
4208 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4209 .dac_nids = alc880_asus_dac_nids,
4210 .dig_out_nid = ALC880_DIGOUT_NID,
4211 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4212 .channel_mode = alc880_threestack_modes,
4214 .input_mux = &alc880_capture_source,
4215 .unsol_event = alc880_uniwill_unsol_event,
4216 .setup = alc880_uniwill_setup,
4217 .init_hook = alc880_uniwill_init_hook,
4219 [ALC880_UNIWILL_P53] = {
4220 .mixers = { alc880_uniwill_p53_mixer },
4221 .init_verbs = { alc880_volume_init_verbs,
4222 alc880_uniwill_p53_init_verbs },
4223 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4224 .dac_nids = alc880_asus_dac_nids,
4225 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4226 .channel_mode = alc880_threestack_modes,
4227 .input_mux = &alc880_capture_source,
4228 .unsol_event = alc880_uniwill_p53_unsol_event,
4229 .setup = alc880_uniwill_p53_setup,
4230 .init_hook = alc_automute_amp,
4232 [ALC880_FUJITSU] = {
4233 .mixers = { alc880_fujitsu_mixer },
4234 .init_verbs = { alc880_volume_init_verbs,
4235 alc880_uniwill_p53_init_verbs,
4236 alc880_beep_init_verbs },
4237 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4238 .dac_nids = alc880_dac_nids,
4239 .dig_out_nid = ALC880_DIGOUT_NID,
4240 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4241 .channel_mode = alc880_2_jack_modes,
4242 .input_mux = &alc880_capture_source,
4243 .unsol_event = alc880_uniwill_p53_unsol_event,
4244 .setup = alc880_uniwill_p53_setup,
4245 .init_hook = alc_automute_amp,
4248 .mixers = { alc880_three_stack_mixer },
4249 .init_verbs = { alc880_volume_init_verbs,
4250 alc880_pin_clevo_init_verbs },
4251 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4252 .dac_nids = alc880_dac_nids,
4254 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4255 .channel_mode = alc880_threestack_modes,
4257 .input_mux = &alc880_capture_source,
4260 .mixers = { alc880_lg_mixer },
4261 .init_verbs = { alc880_volume_init_verbs,
4262 alc880_lg_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4264 .dac_nids = alc880_lg_dac_nids,
4265 .dig_out_nid = ALC880_DIGOUT_NID,
4266 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4267 .channel_mode = alc880_lg_ch_modes,
4269 .input_mux = &alc880_lg_capture_source,
4270 .unsol_event = alc_automute_amp_unsol_event,
4271 .setup = alc880_lg_setup,
4272 .init_hook = alc_automute_amp,
4273 #ifdef CONFIG_SND_HDA_POWER_SAVE
4274 .loopbacks = alc880_lg_loopbacks,
4278 .mixers = { alc880_lg_lw_mixer },
4279 .init_verbs = { alc880_volume_init_verbs,
4280 alc880_lg_lw_init_verbs },
4281 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4282 .dac_nids = alc880_dac_nids,
4283 .dig_out_nid = ALC880_DIGOUT_NID,
4284 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4285 .channel_mode = alc880_lg_lw_modes,
4286 .input_mux = &alc880_lg_lw_capture_source,
4287 .unsol_event = alc_automute_amp_unsol_event,
4288 .setup = alc880_lg_lw_setup,
4289 .init_hook = alc_automute_amp,
4291 [ALC880_MEDION_RIM] = {
4292 .mixers = { alc880_medion_rim_mixer },
4293 .init_verbs = { alc880_volume_init_verbs,
4294 alc880_medion_rim_init_verbs,
4295 alc_gpio2_init_verbs },
4296 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4297 .dac_nids = alc880_dac_nids,
4298 .dig_out_nid = ALC880_DIGOUT_NID,
4299 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4300 .channel_mode = alc880_2_jack_modes,
4301 .input_mux = &alc880_medion_rim_capture_source,
4302 .unsol_event = alc880_medion_rim_unsol_event,
4303 .setup = alc880_medion_rim_setup,
4304 .init_hook = alc880_medion_rim_automute,
4306 #ifdef CONFIG_SND_DEBUG
4308 .mixers = { alc880_test_mixer },
4309 .init_verbs = { alc880_test_init_verbs },
4310 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4311 .dac_nids = alc880_test_dac_nids,
4312 .dig_out_nid = ALC880_DIGOUT_NID,
4313 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4314 .channel_mode = alc880_test_modes,
4315 .input_mux = &alc880_test_capture_source,
4321 * Automatic parse of I/O pins from the BIOS configuration
4326 ALC_CTL_WIDGET_MUTE,
4329 static struct snd_kcontrol_new alc880_control_templates[] = {
4330 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4331 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4332 HDA_BIND_MUTE(NULL, 0, 0, 0),
4335 /* add dynamic controls */
4336 static int add_control(struct alc_spec *spec, int type, const char *name,
4339 struct snd_kcontrol_new *knew;
4341 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4342 knew = snd_array_new(&spec->kctls);
4345 *knew = alc880_control_templates[type];
4346 knew->name = kstrdup(name, GFP_KERNEL);
4349 if (get_amp_nid_(val))
4350 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4351 knew->private_value = val;
4355 static int add_control_with_pfx(struct alc_spec *spec, int type,
4356 const char *pfx, const char *dir,
4357 const char *sfx, unsigned long val)
4360 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4361 return add_control(spec, type, name, val);
4364 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4365 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4366 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4367 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4369 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4370 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4371 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4372 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4373 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4374 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4375 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4376 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4377 #define ALC880_PIN_CD_NID 0x1c
4379 /* fill in the dac_nids table from the parsed pin configuration */
4380 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4381 const struct auto_pin_cfg *cfg)
4387 memset(assigned, 0, sizeof(assigned));
4388 spec->multiout.dac_nids = spec->private_dac_nids;
4390 /* check the pins hardwired to audio widget */
4391 for (i = 0; i < cfg->line_outs; i++) {
4392 nid = cfg->line_out_pins[i];
4393 if (alc880_is_fixed_pin(nid)) {
4394 int idx = alc880_fixed_pin_idx(nid);
4395 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4399 /* left pins can be connect to any audio widget */
4400 for (i = 0; i < cfg->line_outs; i++) {
4401 nid = cfg->line_out_pins[i];
4402 if (alc880_is_fixed_pin(nid))
4404 /* search for an empty channel */
4405 for (j = 0; j < cfg->line_outs; j++) {
4407 spec->multiout.dac_nids[i] =
4408 alc880_idx_to_dac(j);
4414 spec->multiout.num_dacs = cfg->line_outs;
4418 /* add playback controls from the parsed DAC table */
4419 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4420 const struct auto_pin_cfg *cfg)
4422 static const char *chname[4] = {
4423 "Front", "Surround", NULL /*CLFE*/, "Side"
4428 for (i = 0; i < cfg->line_outs; i++) {
4429 if (!spec->multiout.dac_nids[i])
4431 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4434 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4436 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4440 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4442 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4446 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4448 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4452 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4454 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4460 if (cfg->line_outs == 1 &&
4461 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4465 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4466 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4470 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4471 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4480 /* add playback controls for speaker and HP outputs */
4481 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4490 if (alc880_is_fixed_pin(pin)) {
4491 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4492 /* specify the DAC as the extra output */
4493 if (!spec->multiout.hp_nid)
4494 spec->multiout.hp_nid = nid;
4496 spec->multiout.extra_out_nid[0] = nid;
4497 /* control HP volume/switch on the output mixer amp */
4498 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4499 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4500 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4503 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4504 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4507 } else if (alc880_is_multi_pin(pin)) {
4508 /* set manual connection */
4509 /* we have only a switch on HP-out PIN */
4510 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4511 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4518 /* create input playback/capture controls for the given pin */
4519 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4520 const char *ctlname,
4521 int idx, hda_nid_t mix_nid)
4525 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4526 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4529 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4530 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4536 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4538 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4539 return (pincap & AC_PINCAP_IN) != 0;
4542 /* create playback/capture controls for input pins */
4543 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4544 const struct auto_pin_cfg *cfg,
4546 hda_nid_t cap1, hda_nid_t cap2)
4548 struct alc_spec *spec = codec->spec;
4549 struct hda_input_mux *imux = &spec->private_imux[0];
4552 for (i = 0; i < AUTO_PIN_LAST; i++) {
4555 pin = cfg->input_pins[i];
4556 if (!alc_is_input_pin(codec, pin))
4560 idx = get_connection_index(codec, mixer, pin);
4562 err = new_analog_input(spec, pin,
4563 auto_pin_cfg_labels[i],
4572 idx = get_connection_index(codec, cap1, pin);
4573 if (idx < 0 && cap2)
4574 idx = get_connection_index(codec, cap2, pin);
4576 imux->items[imux->num_items].label =
4577 auto_pin_cfg_labels[i];
4578 imux->items[imux->num_items].index = idx;
4585 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4586 const struct auto_pin_cfg *cfg)
4588 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4591 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4592 unsigned int pin_type)
4594 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4597 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4601 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4602 hda_nid_t nid, int pin_type,
4605 alc_set_pin_output(codec, nid, pin_type);
4606 /* need the manual connection? */
4607 if (alc880_is_multi_pin(nid)) {
4608 struct alc_spec *spec = codec->spec;
4609 int idx = alc880_multi_pin_idx(nid);
4610 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4611 AC_VERB_SET_CONNECT_SEL,
4612 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4616 static int get_pin_type(int line_out_type)
4618 if (line_out_type == AUTO_PIN_HP_OUT)
4624 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4626 struct alc_spec *spec = codec->spec;
4629 for (i = 0; i < spec->autocfg.line_outs; i++) {
4630 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4631 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4632 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4636 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4638 struct alc_spec *spec = codec->spec;
4641 pin = spec->autocfg.speaker_pins[0];
4642 if (pin) /* connect to front */
4643 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4644 pin = spec->autocfg.hp_pins[0];
4645 if (pin) /* connect to front */
4646 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4649 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4651 struct alc_spec *spec = codec->spec;
4654 for (i = 0; i < AUTO_PIN_LAST; i++) {
4655 hda_nid_t nid = spec->autocfg.input_pins[i];
4656 if (alc_is_input_pin(codec, nid)) {
4657 alc_set_input_pin(codec, nid, i);
4658 if (nid != ALC880_PIN_CD_NID &&
4659 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4660 snd_hda_codec_write(codec, nid, 0,
4661 AC_VERB_SET_AMP_GAIN_MUTE,
4667 /* parse the BIOS configuration and set up the alc_spec */
4668 /* return 1 if successful, 0 if the proper config is not found,
4669 * or a negative error code
4671 static int alc880_parse_auto_config(struct hda_codec *codec)
4673 struct alc_spec *spec = codec->spec;
4675 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4677 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4681 if (!spec->autocfg.line_outs)
4682 return 0; /* can't find valid BIOS pin config */
4684 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4687 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4690 err = alc880_auto_create_extra_out(spec,
4691 spec->autocfg.speaker_pins[0],
4695 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4699 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4703 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4705 /* check multiple SPDIF-out (for recent codecs) */
4706 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4708 err = snd_hda_get_connections(codec,
4709 spec->autocfg.dig_out_pins[i],
4714 spec->multiout.dig_out_nid = dig_nid;
4716 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4717 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4719 spec->slave_dig_outs[i - 1] = dig_nid;
4722 if (spec->autocfg.dig_in_pin)
4723 spec->dig_in_nid = ALC880_DIGIN_NID;
4725 if (spec->kctls.list)
4726 add_mixer(spec, spec->kctls.list);
4728 add_verb(spec, alc880_volume_init_verbs);
4730 spec->num_mux_defs = 1;
4731 spec->input_mux = &spec->private_imux[0];
4733 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4738 /* additional initialization for auto-configuration model */
4739 static void alc880_auto_init(struct hda_codec *codec)
4741 struct alc_spec *spec = codec->spec;
4742 alc880_auto_init_multi_out(codec);
4743 alc880_auto_init_extra_out(codec);
4744 alc880_auto_init_analog_input(codec);
4745 if (spec->unsol_event)
4746 alc_inithook(codec);
4749 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4750 * one of two digital mic pins, e.g. on ALC272
4752 static void fixup_automic_adc(struct hda_codec *codec)
4754 struct alc_spec *spec = codec->spec;
4757 for (i = 0; i < spec->num_adc_nids; i++) {
4758 hda_nid_t cap = spec->capsrc_nids ?
4759 spec->capsrc_nids[i] : spec->adc_nids[i];
4762 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4765 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4768 spec->int_mic.mux_idx = iidx;
4769 spec->ext_mic.mux_idx = eidx;
4770 if (spec->capsrc_nids)
4771 spec->capsrc_nids += i;
4772 spec->adc_nids += i;
4773 spec->num_adc_nids = 1;
4776 snd_printd(KERN_INFO "hda_codec: %s: "
4777 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4778 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4779 spec->auto_mic = 0; /* disable auto-mic to be sure */
4782 static void set_capture_mixer(struct hda_codec *codec)
4784 struct alc_spec *spec = codec->spec;
4785 static struct snd_kcontrol_new *caps[2][3] = {
4786 { alc_capture_mixer_nosrc1,
4787 alc_capture_mixer_nosrc2,
4788 alc_capture_mixer_nosrc3 },
4789 { alc_capture_mixer1,
4791 alc_capture_mixer3 },
4793 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4795 if (spec->auto_mic) {
4797 fixup_automic_adc(codec);
4798 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4802 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4806 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4807 #define set_beep_amp(spec, nid, idx, dir) \
4808 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4810 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4814 * OK, here we have finally the patch for ALC880
4817 static int patch_alc880(struct hda_codec *codec)
4819 struct alc_spec *spec;
4823 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4829 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4832 if (board_config < 0) {
4833 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4835 board_config = ALC880_AUTO;
4838 if (board_config == ALC880_AUTO) {
4839 /* automatic parse from the BIOS config */
4840 err = alc880_parse_auto_config(codec);
4846 "hda_codec: Cannot set up configuration "
4847 "from BIOS. Using 3-stack mode...\n");
4848 board_config = ALC880_3ST;
4852 err = snd_hda_attach_beep_device(codec, 0x1);
4858 if (board_config != ALC880_AUTO)
4859 setup_preset(codec, &alc880_presets[board_config]);
4861 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4862 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4863 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4865 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4866 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4868 if (!spec->adc_nids && spec->input_mux) {
4869 /* check whether NID 0x07 is valid */
4870 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4872 wcap = get_wcaps_type(wcap);
4873 if (wcap != AC_WID_AUD_IN) {
4874 spec->adc_nids = alc880_adc_nids_alt;
4875 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4877 spec->adc_nids = alc880_adc_nids;
4878 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4881 set_capture_mixer(codec);
4882 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4884 spec->vmaster_nid = 0x0c;
4886 codec->patch_ops = alc_patch_ops;
4887 if (board_config == ALC880_AUTO)
4888 spec->init_hook = alc880_auto_init;
4889 #ifdef CONFIG_SND_HDA_POWER_SAVE
4890 if (!spec->loopback.amplist)
4891 spec->loopback.amplist = alc880_loopbacks;
4893 codec->proc_widget_hook = print_realtek_coef;
4903 static hda_nid_t alc260_dac_nids[1] = {
4908 static hda_nid_t alc260_adc_nids[1] = {
4913 static hda_nid_t alc260_adc_nids_alt[1] = {
4918 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4919 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4921 static hda_nid_t alc260_dual_adc_nids[2] = {
4926 #define ALC260_DIGOUT_NID 0x03
4927 #define ALC260_DIGIN_NID 0x06
4929 static struct hda_input_mux alc260_capture_source = {
4933 { "Front Mic", 0x1 },
4939 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4940 * headphone jack and the internal CD lines since these are the only pins at
4941 * which audio can appear. For flexibility, also allow the option of
4942 * recording the mixer output on the second ADC (ADC0 doesn't have a
4943 * connection to the mixer output).
4945 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4949 { "Mic/Line", 0x0 },
4951 { "Headphone", 0x2 },
4957 { "Mic/Line", 0x0 },
4959 { "Headphone", 0x2 },
4966 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4967 * the Fujitsu S702x, but jacks are marked differently.
4969 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4976 { "Headphone", 0x5 },
4985 { "Headphone", 0x6 },
4991 /* Maxdata Favorit 100XS */
4992 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4996 { "Line/Mic", 0x0 },
5003 { "Line/Mic", 0x0 },
5011 * This is just place-holder, so there's something for alc_build_pcms to look
5012 * at when it calculates the maximum number of channels. ALC260 has no mixer
5013 * element which allows changing the channel mode, so the verb list is
5016 static struct hda_channel_mode alc260_modes[1] = {
5021 /* Mixer combinations
5023 * basic: base_output + input + pc_beep + capture
5024 * HP: base_output + input + capture_alt
5025 * HP_3013: hp_3013 + input + capture
5026 * fujitsu: fujitsu + capture
5027 * acer: acer + capture
5030 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5031 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5032 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5033 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5034 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5035 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5036 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5040 static struct snd_kcontrol_new alc260_input_mixer[] = {
5041 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5042 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5043 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5044 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5046 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5047 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5048 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5052 /* update HP, line and mono out pins according to the master switch */
5053 static void alc260_hp_master_update(struct hda_codec *codec,
5054 hda_nid_t hp, hda_nid_t line,
5057 struct alc_spec *spec = codec->spec;
5058 unsigned int val = spec->master_sw ? PIN_HP : 0;
5059 /* change HP and line-out pins */
5060 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5062 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5064 /* mono (speaker) depending on the HP jack sense */
5065 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5066 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5070 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5071 struct snd_ctl_elem_value *ucontrol)
5073 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5074 struct alc_spec *spec = codec->spec;
5075 *ucontrol->value.integer.value = spec->master_sw;
5079 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5080 struct snd_ctl_elem_value *ucontrol)
5082 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5083 struct alc_spec *spec = codec->spec;
5084 int val = !!*ucontrol->value.integer.value;
5085 hda_nid_t hp, line, mono;
5087 if (val == spec->master_sw)
5089 spec->master_sw = val;
5090 hp = (kcontrol->private_value >> 16) & 0xff;
5091 line = (kcontrol->private_value >> 8) & 0xff;
5092 mono = kcontrol->private_value & 0xff;
5093 alc260_hp_master_update(codec, hp, line, mono);
5097 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5100 .name = "Master Playback Switch",
5101 .info = snd_ctl_boolean_mono_info,
5102 .get = alc260_hp_master_sw_get,
5103 .put = alc260_hp_master_sw_put,
5104 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5106 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5107 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5108 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5109 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5110 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5112 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5116 static struct hda_verb alc260_hp_unsol_verbs[] = {
5117 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5121 static void alc260_hp_automute(struct hda_codec *codec)
5123 struct alc_spec *spec = codec->spec;
5125 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5126 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5129 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5131 if ((res >> 26) == ALC880_HP_EVENT)
5132 alc260_hp_automute(codec);
5135 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5138 .name = "Master Playback Switch",
5139 .info = snd_ctl_boolean_mono_info,
5140 .get = alc260_hp_master_sw_get,
5141 .put = alc260_hp_master_sw_put,
5142 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5144 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5145 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5146 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5147 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5150 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5151 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5155 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5156 .ops = &snd_hda_bind_vol,
5158 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5159 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5160 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5165 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5166 .ops = &snd_hda_bind_sw,
5168 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5169 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5174 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5175 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5176 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5177 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5178 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5182 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5183 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5187 static void alc260_hp_3013_automute(struct hda_codec *codec)
5189 struct alc_spec *spec = codec->spec;
5191 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5192 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5195 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5198 if ((res >> 26) == ALC880_HP_EVENT)
5199 alc260_hp_3013_automute(codec);
5202 static void alc260_hp_3012_automute(struct hda_codec *codec)
5204 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5206 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5208 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5210 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5214 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5217 if ((res >> 26) == ALC880_HP_EVENT)
5218 alc260_hp_3012_automute(codec);
5221 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5222 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5224 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5225 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5226 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5227 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5228 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5229 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5230 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5231 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5232 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5233 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5234 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5238 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5239 * versions of the ALC260 don't act on requests to enable mic bias from NID
5240 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5241 * datasheet doesn't mention this restriction. At this stage it's not clear
5242 * whether this behaviour is intentional or is a hardware bug in chip
5243 * revisions available in early 2006. Therefore for now allow the
5244 * "Headphone Jack Mode" control to span all choices, but if it turns out
5245 * that the lack of mic bias for this NID is intentional we could change the
5246 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5248 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5249 * don't appear to make the mic bias available from the "line" jack, even
5250 * though the NID used for this jack (0x14) can supply it. The theory is
5251 * that perhaps Acer have included blocking capacitors between the ALC260
5252 * and the output jack. If this turns out to be the case for all such
5253 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5254 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5256 * The C20x Tablet series have a mono internal speaker which is controlled
5257 * via the chip's Mono sum widget and pin complex, so include the necessary
5258 * controls for such models. On models without a "mono speaker" the control
5259 * won't do anything.
5261 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5262 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5263 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5264 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5265 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5267 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5269 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5270 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5272 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5273 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5274 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5275 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5276 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5280 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5282 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5283 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5284 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5285 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5286 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5287 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5288 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5292 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5293 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5295 static struct snd_kcontrol_new alc260_will_mixer[] = {
5296 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5297 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5299 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5300 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5301 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5302 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5303 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5304 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5305 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5309 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5310 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5312 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5313 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5314 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5316 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5317 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5318 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5319 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5320 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5321 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5322 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5327 * initialization verbs
5329 static struct hda_verb alc260_init_verbs[] = {
5330 /* Line In pin widget for input */
5331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5332 /* CD pin widget for input */
5333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5334 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5335 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5336 /* Mic2 (front panel) pin widget for input and vref at 80% */
5337 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5338 /* LINE-2 is used for line-out in rear */
5339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5340 /* select line-out */
5341 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5343 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5345 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5347 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5348 /* mute capture amp left and right */
5349 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5350 /* set connection select to line in (default select for this ADC) */
5351 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5352 /* mute capture amp left and right */
5353 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5354 /* set connection select to line in (default select for this ADC) */
5355 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5356 /* set vol=0 Line-Out mixer amp left and right */
5357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5358 /* unmute pin widget amp left and right (no gain on this amp) */
5359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5360 /* set vol=0 HP mixer amp left and right */
5361 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5362 /* unmute pin widget amp left and right (no gain on this amp) */
5363 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5364 /* set vol=0 Mono mixer amp left and right */
5365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5366 /* unmute pin widget amp left and right (no gain on this amp) */
5367 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5368 /* unmute LINE-2 out pin */
5369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5370 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5373 /* mute analog inputs */
5374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5379 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5380 /* mute Front out path */
5381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5383 /* mute Headphone out path */
5384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5385 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5386 /* mute Mono out path */
5387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5388 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5392 #if 0 /* should be identical with alc260_init_verbs? */
5393 static struct hda_verb alc260_hp_init_verbs[] = {
5394 /* Headphone and output */
5395 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5397 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5398 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5399 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5400 /* Mic2 (front panel) pin widget for input and vref at 80% */
5401 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5402 /* Line In pin widget for input */
5403 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5404 /* Line-2 pin widget for output */
5405 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5406 /* CD pin widget for input */
5407 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5408 /* unmute amp left and right */
5409 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5410 /* set connection select to line in (default select for this ADC) */
5411 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5412 /* unmute Line-Out mixer amp left and right (volume = 0) */
5413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5414 /* mute pin widget amp left and right (no gain on this amp) */
5415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5416 /* unmute HP mixer amp left and right (volume = 0) */
5417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5418 /* mute pin widget amp left and right (no gain on this amp) */
5419 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5420 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5423 /* mute analog inputs */
5424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5426 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5429 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5430 /* Unmute Front out path */
5431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5433 /* Unmute Headphone out path */
5434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5436 /* Unmute Mono out path */
5437 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5438 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5443 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5444 /* Line out and output */
5445 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5447 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5448 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5449 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5450 /* Mic2 (front panel) pin widget for input and vref at 80% */
5451 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5452 /* Line In pin widget for input */
5453 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5454 /* Headphone pin widget for output */
5455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5456 /* CD pin widget for input */
5457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5458 /* unmute amp left and right */
5459 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5460 /* set connection select to line in (default select for this ADC) */
5461 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5462 /* unmute Line-Out mixer amp left and right (volume = 0) */
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5464 /* mute pin widget amp left and right (no gain on this amp) */
5465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5466 /* unmute HP mixer amp left and right (volume = 0) */
5467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5468 /* mute pin widget amp left and right (no gain on this amp) */
5469 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5470 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5473 /* mute analog inputs */
5474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5478 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5479 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5480 /* Unmute Front out path */
5481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5483 /* Unmute Headphone out path */
5484 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5486 /* Unmute Mono out path */
5487 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5492 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5493 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5494 * audio = 0x16, internal speaker = 0x10.
5496 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5497 /* Disable all GPIOs */
5498 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5499 /* Internal speaker is connected to headphone pin */
5500 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5501 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5502 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5503 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5504 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5505 /* Ensure all other unused pins are disabled and muted. */
5506 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5509 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5510 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5511 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5515 /* Disable digital (SPDIF) pins */
5516 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5517 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5519 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5520 * when acting as an output.
5522 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5524 /* Start with output sum widgets muted and their output gains at min */
5525 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5526 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5527 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5528 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5529 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5530 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5531 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5532 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5533 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5535 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5536 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5537 /* Unmute Line1 pin widget output buffer since it starts as an output.
5538 * If the pin mode is changed by the user the pin mode control will
5539 * take care of enabling the pin's input/output buffers as needed.
5540 * Therefore there's no need to enable the input buffer at this
5543 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5544 /* Unmute input buffer of pin widget used for Line-in (no equiv
5547 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5549 /* Mute capture amp left and right */
5550 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5551 /* Set ADC connection select to match default mixer setting - line
5554 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5556 /* Do the same for the second ADC: mute capture input amp and
5557 * set ADC connection to line in (on mic1 pin)
5559 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5560 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5562 /* Mute all inputs to mixer widget (even unconnected ones) */
5563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5569 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5575 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5576 * similar laptops (adapted from Fujitsu init verbs).
5578 static struct hda_verb alc260_acer_init_verbs[] = {
5579 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5580 * the headphone jack. Turn this on and rely on the standard mute
5581 * methods whenever the user wants to turn these outputs off.
5583 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5584 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5585 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5586 /* Internal speaker/Headphone jack is connected to Line-out pin */
5587 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5588 /* Internal microphone/Mic jack is connected to Mic1 pin */
5589 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5590 /* Line In jack is connected to Line1 pin */
5591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5592 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5593 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5594 /* Ensure all other unused pins are disabled and muted. */
5595 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5596 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5598 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5600 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5601 /* Disable digital (SPDIF) pins */
5602 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5603 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5605 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5606 * bus when acting as outputs.
5608 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5609 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5611 /* Start with output sum widgets muted and their output gains at min */
5612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5613 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5618 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5619 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5620 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5622 /* Unmute Line-out pin widget amp left and right
5623 * (no equiv mixer ctrl)
5625 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5626 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5627 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5628 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5629 * inputs. If the pin mode is changed by the user the pin mode control
5630 * will take care of enabling the pin's input/output buffers as needed.
5631 * Therefore there's no need to enable the input buffer at this
5634 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5637 /* Mute capture amp left and right */
5638 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5639 /* Set ADC connection select to match default mixer setting - mic
5642 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5644 /* Do similar with the second ADC: mute capture input amp and
5645 * set ADC connection to mic to match ALSA's default state.
5647 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5650 /* Mute all inputs to mixer widget (even unconnected ones) */
5651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5658 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5663 /* Initialisation sequence for Maxdata Favorit 100XS
5664 * (adapted from Acer init verbs).
5666 static struct hda_verb alc260_favorit100_init_verbs[] = {
5667 /* GPIO 0 enables the output jack.
5668 * Turn this on and rely on the standard mute
5669 * methods whenever the user wants to turn these outputs off.
5671 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5672 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5673 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5674 /* Line/Mic input jack is connected to Mic1 pin */
5675 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5676 /* Ensure all other unused pins are disabled and muted. */
5677 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5678 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5680 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5682 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5687 /* Disable digital (SPDIF) pins */
5688 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5689 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5691 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5692 * bus when acting as outputs.
5694 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5695 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5697 /* Start with output sum widgets muted and their output gains at min */
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5706 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5708 /* Unmute Line-out pin widget amp left and right
5709 * (no equiv mixer ctrl)
5711 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5712 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5713 * inputs. If the pin mode is changed by the user the pin mode control
5714 * will take care of enabling the pin's input/output buffers as needed.
5715 * Therefore there's no need to enable the input buffer at this
5718 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5720 /* Mute capture amp left and right */
5721 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5722 /* Set ADC connection select to match default mixer setting - mic
5725 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5727 /* Do similar with the second ADC: mute capture input amp and
5728 * set ADC connection to mic to match ALSA's default state.
5730 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5731 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5733 /* Mute all inputs to mixer widget (even unconnected ones) */
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5746 static struct hda_verb alc260_will_verbs[] = {
5747 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5748 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5749 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5750 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5751 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5752 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5756 static struct hda_verb alc260_replacer_672v_verbs[] = {
5757 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5758 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5759 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5761 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5762 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5763 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5765 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5769 /* toggle speaker-output according to the hp-jack state */
5770 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5772 unsigned int present;
5774 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5775 present = snd_hda_jack_detect(codec, 0x0f);
5777 snd_hda_codec_write_cache(codec, 0x01, 0,
5778 AC_VERB_SET_GPIO_DATA, 1);
5779 snd_hda_codec_write_cache(codec, 0x0f, 0,
5780 AC_VERB_SET_PIN_WIDGET_CONTROL,
5783 snd_hda_codec_write_cache(codec, 0x01, 0,
5784 AC_VERB_SET_GPIO_DATA, 0);
5785 snd_hda_codec_write_cache(codec, 0x0f, 0,
5786 AC_VERB_SET_PIN_WIDGET_CONTROL,
5791 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5794 if ((res >> 26) == ALC880_HP_EVENT)
5795 alc260_replacer_672v_automute(codec);
5798 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5799 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5801 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5802 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5803 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5805 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5806 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5807 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5812 /* Test configuration for debugging, modelled after the ALC880 test
5815 #ifdef CONFIG_SND_DEBUG
5816 static hda_nid_t alc260_test_dac_nids[1] = {
5819 static hda_nid_t alc260_test_adc_nids[2] = {
5822 /* For testing the ALC260, each input MUX needs its own definition since
5823 * the signal assignments are different. This assumes that the first ADC
5826 static struct hda_input_mux alc260_test_capture_sources[2] = {
5830 { "MIC1 pin", 0x0 },
5831 { "MIC2 pin", 0x1 },
5832 { "LINE1 pin", 0x2 },
5833 { "LINE2 pin", 0x3 },
5835 { "LINE-OUT pin", 0x5 },
5836 { "HP-OUT pin", 0x6 },
5842 { "MIC1 pin", 0x0 },
5843 { "MIC2 pin", 0x1 },
5844 { "LINE1 pin", 0x2 },
5845 { "LINE2 pin", 0x3 },
5848 { "LINE-OUT pin", 0x6 },
5849 { "HP-OUT pin", 0x7 },
5853 static struct snd_kcontrol_new alc260_test_mixer[] = {
5854 /* Output driver widgets */
5855 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5856 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5857 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5858 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5859 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5860 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5862 /* Modes for retasking pin widgets
5863 * Note: the ALC260 doesn't seem to act on requests to enable mic
5864 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5865 * mention this restriction. At this stage it's not clear whether
5866 * this behaviour is intentional or is a hardware bug in chip
5867 * revisions available at least up until early 2006. Therefore for
5868 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5869 * choices, but if it turns out that the lack of mic bias for these
5870 * NIDs is intentional we could change their modes from
5871 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5873 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5874 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5875 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5876 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5877 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5878 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5880 /* Loopback mixer controls */
5881 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5882 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5883 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5884 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5885 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5886 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5887 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5888 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5889 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5890 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5891 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5892 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5893 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5894 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5896 /* Controls for GPIO pins, assuming they are configured as outputs */
5897 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5898 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5899 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5900 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5902 /* Switches to allow the digital IO pins to be enabled. The datasheet
5903 * is ambigious as to which NID is which; testing on laptops which
5904 * make this output available should provide clarification.
5906 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5907 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5909 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5910 * this output to turn on an external amplifier.
5912 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5913 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5917 static struct hda_verb alc260_test_init_verbs[] = {
5918 /* Enable all GPIOs as outputs with an initial value of 0 */
5919 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5920 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5921 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5923 /* Enable retasking pins as output, initially without power amp */
5924 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5925 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5928 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5929 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5931 /* Disable digital (SPDIF) pins initially, but users can enable
5932 * them via a mixer switch. In the case of SPDIF-out, this initverb
5933 * payload also sets the generation to 0, output to be in "consumer"
5934 * PCM format, copyright asserted, no pre-emphasis and no validity
5937 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5938 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5940 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5941 * OUT1 sum bus when acting as an output.
5943 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5944 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5945 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5946 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5948 /* Start with output sum widgets muted and their output gains at min */
5949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5951 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5954 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5955 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5956 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5957 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5959 /* Unmute retasking pin widget output buffers since the default
5960 * state appears to be output. As the pin mode is changed by the
5961 * user the pin mode control will take care of enabling the pin's
5962 * input/output buffers as needed.
5964 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5965 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5968 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5969 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5970 /* Also unmute the mono-out pin widget */
5971 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5973 /* Mute capture amp left and right */
5974 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5975 /* Set ADC connection select to match default mixer setting (mic1
5978 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5980 /* Do the same for the second ADC: mute capture input amp and
5981 * set ADC connection to mic1 pin
5983 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5984 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5986 /* Mute all inputs to mixer widget (even unconnected ones) */
5987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5991 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5992 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5993 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6000 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6001 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6003 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6004 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6007 * for BIOS auto-configuration
6010 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6011 const char *pfx, int *vol_bits)
6014 unsigned long vol_val, sw_val;
6017 if (nid >= 0x0f && nid < 0x11) {
6018 nid_vol = nid - 0x7;
6019 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6020 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6021 } else if (nid == 0x11) {
6022 nid_vol = nid - 0x7;
6023 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6024 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6025 } else if (nid >= 0x12 && nid <= 0x15) {
6027 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6028 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6032 if (!(*vol_bits & (1 << nid_vol))) {
6033 /* first control for the volume widget */
6034 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6037 *vol_bits |= (1 << nid_vol);
6039 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6045 /* add playback controls from the parsed DAC table */
6046 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6047 const struct auto_pin_cfg *cfg)
6053 spec->multiout.num_dacs = 1;
6054 spec->multiout.dac_nids = spec->private_dac_nids;
6055 spec->multiout.dac_nids[0] = 0x02;
6057 nid = cfg->line_out_pins[0];
6060 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6062 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6066 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6071 nid = cfg->speaker_pins[0];
6073 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6078 nid = cfg->hp_pins[0];
6080 err = alc260_add_playback_controls(spec, nid, "Headphone",
6088 /* create playback/capture controls for input pins */
6089 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6090 const struct auto_pin_cfg *cfg)
6092 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6095 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6096 hda_nid_t nid, int pin_type,
6099 alc_set_pin_output(codec, nid, pin_type);
6100 /* need the manual connection? */
6102 int idx = nid - 0x12;
6103 snd_hda_codec_write(codec, idx + 0x0b, 0,
6104 AC_VERB_SET_CONNECT_SEL, sel_idx);
6108 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6110 struct alc_spec *spec = codec->spec;
6113 nid = spec->autocfg.line_out_pins[0];
6115 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6116 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6119 nid = spec->autocfg.speaker_pins[0];
6121 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6123 nid = spec->autocfg.hp_pins[0];
6125 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6128 #define ALC260_PIN_CD_NID 0x16
6129 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6131 struct alc_spec *spec = codec->spec;
6134 for (i = 0; i < AUTO_PIN_LAST; i++) {
6135 hda_nid_t nid = spec->autocfg.input_pins[i];
6137 alc_set_input_pin(codec, nid, i);
6138 if (nid != ALC260_PIN_CD_NID &&
6139 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6140 snd_hda_codec_write(codec, nid, 0,
6141 AC_VERB_SET_AMP_GAIN_MUTE,
6148 * generic initialization of ADC, input mixers and output mixers
6150 static struct hda_verb alc260_volume_init_verbs[] = {
6152 * Unmute ADC0-1 and set the default input to mic-in
6154 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6155 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6156 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6157 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6159 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6161 * Note: PASD motherboards uses the Line In 2 as the input for
6162 * front panel mic (mic 2)
6164 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6165 /* mute analog inputs */
6166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6173 * Set up output mixers (0x08 - 0x0a)
6175 /* set vol=0 to output mixers */
6176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6177 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6178 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6179 /* set up input amps for analog loopback */
6180 /* Amp Indices: DAC = 0, mixer = 1 */
6181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6183 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6185 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6186 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6191 static int alc260_parse_auto_config(struct hda_codec *codec)
6193 struct alc_spec *spec = codec->spec;
6195 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6197 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6201 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6204 if (!spec->kctls.list)
6205 return 0; /* can't find valid BIOS pin config */
6206 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6210 spec->multiout.max_channels = 2;
6212 if (spec->autocfg.dig_outs)
6213 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6214 if (spec->kctls.list)
6215 add_mixer(spec, spec->kctls.list);
6217 add_verb(spec, alc260_volume_init_verbs);
6219 spec->num_mux_defs = 1;
6220 spec->input_mux = &spec->private_imux[0];
6222 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6227 /* additional initialization for auto-configuration model */
6228 static void alc260_auto_init(struct hda_codec *codec)
6230 struct alc_spec *spec = codec->spec;
6231 alc260_auto_init_multi_out(codec);
6232 alc260_auto_init_analog_input(codec);
6233 if (spec->unsol_event)
6234 alc_inithook(codec);
6237 #ifdef CONFIG_SND_HDA_POWER_SAVE
6238 static struct hda_amp_list alc260_loopbacks[] = {
6239 { 0x07, HDA_INPUT, 0 },
6240 { 0x07, HDA_INPUT, 1 },
6241 { 0x07, HDA_INPUT, 2 },
6242 { 0x07, HDA_INPUT, 3 },
6243 { 0x07, HDA_INPUT, 4 },
6249 * ALC260 configurations
6251 static const char *alc260_models[ALC260_MODEL_LAST] = {
6252 [ALC260_BASIC] = "basic",
6254 [ALC260_HP_3013] = "hp-3013",
6255 [ALC260_HP_DC7600] = "hp-dc7600",
6256 [ALC260_FUJITSU_S702X] = "fujitsu",
6257 [ALC260_ACER] = "acer",
6258 [ALC260_WILL] = "will",
6259 [ALC260_REPLACER_672V] = "replacer",
6260 [ALC260_FAVORIT100] = "favorit100",
6261 #ifdef CONFIG_SND_DEBUG
6262 [ALC260_TEST] = "test",
6264 [ALC260_AUTO] = "auto",
6267 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6268 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6269 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6270 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6271 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6272 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6273 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6274 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6275 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6276 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6277 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6278 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6279 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6280 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6281 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6282 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6283 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6284 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6285 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6286 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6287 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6291 static struct alc_config_preset alc260_presets[] = {
6293 .mixers = { alc260_base_output_mixer,
6294 alc260_input_mixer },
6295 .init_verbs = { alc260_init_verbs },
6296 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6297 .dac_nids = alc260_dac_nids,
6298 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6299 .adc_nids = alc260_adc_nids,
6300 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6301 .channel_mode = alc260_modes,
6302 .input_mux = &alc260_capture_source,
6305 .mixers = { alc260_hp_output_mixer,
6306 alc260_input_mixer },
6307 .init_verbs = { alc260_init_verbs,
6308 alc260_hp_unsol_verbs },
6309 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6310 .dac_nids = alc260_dac_nids,
6311 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6312 .adc_nids = alc260_adc_nids_alt,
6313 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6314 .channel_mode = alc260_modes,
6315 .input_mux = &alc260_capture_source,
6316 .unsol_event = alc260_hp_unsol_event,
6317 .init_hook = alc260_hp_automute,
6319 [ALC260_HP_DC7600] = {
6320 .mixers = { alc260_hp_dc7600_mixer,
6321 alc260_input_mixer },
6322 .init_verbs = { alc260_init_verbs,
6323 alc260_hp_dc7600_verbs },
6324 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6325 .dac_nids = alc260_dac_nids,
6326 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6327 .adc_nids = alc260_adc_nids_alt,
6328 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6329 .channel_mode = alc260_modes,
6330 .input_mux = &alc260_capture_source,
6331 .unsol_event = alc260_hp_3012_unsol_event,
6332 .init_hook = alc260_hp_3012_automute,
6334 [ALC260_HP_3013] = {
6335 .mixers = { alc260_hp_3013_mixer,
6336 alc260_input_mixer },
6337 .init_verbs = { alc260_hp_3013_init_verbs,
6338 alc260_hp_3013_unsol_verbs },
6339 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6340 .dac_nids = alc260_dac_nids,
6341 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6342 .adc_nids = alc260_adc_nids_alt,
6343 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6344 .channel_mode = alc260_modes,
6345 .input_mux = &alc260_capture_source,
6346 .unsol_event = alc260_hp_3013_unsol_event,
6347 .init_hook = alc260_hp_3013_automute,
6349 [ALC260_FUJITSU_S702X] = {
6350 .mixers = { alc260_fujitsu_mixer },
6351 .init_verbs = { alc260_fujitsu_init_verbs },
6352 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6353 .dac_nids = alc260_dac_nids,
6354 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6355 .adc_nids = alc260_dual_adc_nids,
6356 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6357 .channel_mode = alc260_modes,
6358 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6359 .input_mux = alc260_fujitsu_capture_sources,
6362 .mixers = { alc260_acer_mixer },
6363 .init_verbs = { alc260_acer_init_verbs },
6364 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6365 .dac_nids = alc260_dac_nids,
6366 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6367 .adc_nids = alc260_dual_adc_nids,
6368 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6369 .channel_mode = alc260_modes,
6370 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6371 .input_mux = alc260_acer_capture_sources,
6373 [ALC260_FAVORIT100] = {
6374 .mixers = { alc260_favorit100_mixer },
6375 .init_verbs = { alc260_favorit100_init_verbs },
6376 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6377 .dac_nids = alc260_dac_nids,
6378 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6379 .adc_nids = alc260_dual_adc_nids,
6380 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6381 .channel_mode = alc260_modes,
6382 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6383 .input_mux = alc260_favorit100_capture_sources,
6386 .mixers = { alc260_will_mixer },
6387 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6388 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6389 .dac_nids = alc260_dac_nids,
6390 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6391 .adc_nids = alc260_adc_nids,
6392 .dig_out_nid = ALC260_DIGOUT_NID,
6393 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6394 .channel_mode = alc260_modes,
6395 .input_mux = &alc260_capture_source,
6397 [ALC260_REPLACER_672V] = {
6398 .mixers = { alc260_replacer_672v_mixer },
6399 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6400 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6401 .dac_nids = alc260_dac_nids,
6402 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6403 .adc_nids = alc260_adc_nids,
6404 .dig_out_nid = ALC260_DIGOUT_NID,
6405 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6406 .channel_mode = alc260_modes,
6407 .input_mux = &alc260_capture_source,
6408 .unsol_event = alc260_replacer_672v_unsol_event,
6409 .init_hook = alc260_replacer_672v_automute,
6411 #ifdef CONFIG_SND_DEBUG
6413 .mixers = { alc260_test_mixer },
6414 .init_verbs = { alc260_test_init_verbs },
6415 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6416 .dac_nids = alc260_test_dac_nids,
6417 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6418 .adc_nids = alc260_test_adc_nids,
6419 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6420 .channel_mode = alc260_modes,
6421 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6422 .input_mux = alc260_test_capture_sources,
6427 static int patch_alc260(struct hda_codec *codec)
6429 struct alc_spec *spec;
6430 int err, board_config;
6432 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6438 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6441 if (board_config < 0) {
6442 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6444 board_config = ALC260_AUTO;
6447 if (board_config == ALC260_AUTO) {
6448 /* automatic parse from the BIOS config */
6449 err = alc260_parse_auto_config(codec);
6455 "hda_codec: Cannot set up configuration "
6456 "from BIOS. Using base mode...\n");
6457 board_config = ALC260_BASIC;
6461 err = snd_hda_attach_beep_device(codec, 0x1);
6467 if (board_config != ALC260_AUTO)
6468 setup_preset(codec, &alc260_presets[board_config]);
6470 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6471 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6473 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6474 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6476 if (!spec->adc_nids && spec->input_mux) {
6477 /* check whether NID 0x04 is valid */
6478 unsigned int wcap = get_wcaps(codec, 0x04);
6479 wcap = get_wcaps_type(wcap);
6481 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6482 spec->adc_nids = alc260_adc_nids_alt;
6483 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6485 spec->adc_nids = alc260_adc_nids;
6486 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6489 set_capture_mixer(codec);
6490 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6492 spec->vmaster_nid = 0x08;
6494 codec->patch_ops = alc_patch_ops;
6495 if (board_config == ALC260_AUTO)
6496 spec->init_hook = alc260_auto_init;
6497 #ifdef CONFIG_SND_HDA_POWER_SAVE
6498 if (!spec->loopback.amplist)
6499 spec->loopback.amplist = alc260_loopbacks;
6501 codec->proc_widget_hook = print_realtek_coef;
6508 * ALC882/883/885/888/889 support
6510 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6511 * configuration. Each pin widget can choose any input DACs and a mixer.
6512 * Each ADC is connected from a mixer of all inputs. This makes possible
6513 * 6-channel independent captures.
6515 * In addition, an independent DAC for the multi-playback (not used in this
6518 #define ALC882_DIGOUT_NID 0x06
6519 #define ALC882_DIGIN_NID 0x0a
6520 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6521 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6522 #define ALC1200_DIGOUT_NID 0x10
6525 static struct hda_channel_mode alc882_ch_modes[1] = {
6530 static hda_nid_t alc882_dac_nids[4] = {
6531 /* front, rear, clfe, rear_surr */
6532 0x02, 0x03, 0x04, 0x05
6534 #define alc883_dac_nids alc882_dac_nids
6537 #define alc882_adc_nids alc880_adc_nids
6538 #define alc882_adc_nids_alt alc880_adc_nids_alt
6539 #define alc883_adc_nids alc882_adc_nids_alt
6540 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6541 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6542 #define alc889_adc_nids alc880_adc_nids
6544 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6545 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6546 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6547 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6548 #define alc889_capsrc_nids alc882_capsrc_nids
6551 /* FIXME: should be a matrix-type input source selection */
6553 static struct hda_input_mux alc882_capture_source = {
6557 { "Front Mic", 0x1 },
6563 #define alc883_capture_source alc882_capture_source
6565 static struct hda_input_mux alc889_capture_source = {
6568 { "Front Mic", 0x0 },
6574 static struct hda_input_mux mb5_capture_source = {
6583 static struct hda_input_mux alc883_3stack_6ch_intel = {
6587 { "Front Mic", 0x0 },
6593 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6601 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6611 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6619 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6623 { "Front Mic", 0x1 },
6628 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6636 static struct hda_input_mux alc889A_mb31_capture_source = {
6640 /* Front Mic (0x01) unused */
6642 /* Line 2 (0x03) unused */
6643 /* CD (0x04) unsused? */
6650 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6657 static struct hda_verb alc882_3ST_ch2_init[] = {
6658 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6659 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6660 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6661 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6668 static struct hda_verb alc882_3ST_ch4_init[] = {
6669 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6670 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6671 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6672 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6673 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6680 static struct hda_verb alc882_3ST_ch6_init[] = {
6681 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6682 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6683 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6684 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6685 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6686 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6690 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6691 { 2, alc882_3ST_ch2_init },
6692 { 4, alc882_3ST_ch4_init },
6693 { 6, alc882_3ST_ch6_init },
6696 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6701 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6702 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6703 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6704 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6705 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6706 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6713 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6714 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6715 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6716 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6719 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6726 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6727 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6728 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6729 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6730 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6731 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6732 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6733 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6737 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6738 { 2, alc883_3ST_ch2_clevo_init },
6739 { 4, alc883_3ST_ch4_clevo_init },
6740 { 6, alc883_3ST_ch6_clevo_init },
6747 static struct hda_verb alc882_sixstack_ch6_init[] = {
6748 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6749 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6750 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6751 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6758 static struct hda_verb alc882_sixstack_ch8_init[] = {
6759 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6760 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6761 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6762 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6766 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6767 { 6, alc882_sixstack_ch6_init },
6768 { 8, alc882_sixstack_ch8_init },
6772 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6778 static struct hda_verb alc885_mbp_ch2_init[] = {
6779 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6780 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6781 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6788 static struct hda_verb alc885_mbp_ch4_init[] = {
6789 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6790 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6791 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6792 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6793 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6797 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6798 { 2, alc885_mbp_ch2_init },
6799 { 4, alc885_mbp_ch4_init },
6804 * Speakers/Woofer/HP = Front
6807 static struct hda_verb alc885_mb5_ch2_init[] = {
6808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6815 * Speakers/HP = Front
6819 static struct hda_verb alc885_mb5_ch6_init[] = {
6820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6821 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6822 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6826 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6827 { 2, alc885_mb5_ch2_init },
6828 { 6, alc885_mb5_ch6_init },
6835 static struct hda_verb alc883_4ST_ch2_init[] = {
6836 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6837 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6838 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6839 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6848 static struct hda_verb alc883_4ST_ch4_init[] = {
6849 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6855 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6862 static struct hda_verb alc883_4ST_ch6_init[] = {
6863 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6864 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6865 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6866 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6867 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6870 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6877 static struct hda_verb alc883_4ST_ch8_init[] = {
6878 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6879 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6880 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6881 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6882 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6883 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6884 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6885 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6886 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6890 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6891 { 2, alc883_4ST_ch2_init },
6892 { 4, alc883_4ST_ch4_init },
6893 { 6, alc883_4ST_ch6_init },
6894 { 8, alc883_4ST_ch8_init },
6901 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6902 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6903 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6904 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6905 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6912 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6913 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6914 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6917 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6924 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6925 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6926 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6927 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6928 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6929 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6930 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6934 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6935 { 2, alc883_3ST_ch2_intel_init },
6936 { 4, alc883_3ST_ch4_intel_init },
6937 { 6, alc883_3ST_ch6_intel_init },
6943 static struct hda_verb alc889_ch2_intel_init[] = {
6944 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6945 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6946 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6947 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6949 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6956 static struct hda_verb alc889_ch6_intel_init[] = {
6957 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6958 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6959 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6960 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6969 static struct hda_verb alc889_ch8_intel_init[] = {
6970 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6971 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6972 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6973 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6974 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6975 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6976 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6980 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6981 { 2, alc889_ch2_intel_init },
6982 { 6, alc889_ch6_intel_init },
6983 { 8, alc889_ch8_intel_init },
6989 static struct hda_verb alc883_sixstack_ch6_init[] = {
6990 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6991 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6992 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6993 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7000 static struct hda_verb alc883_sixstack_ch8_init[] = {
7001 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7002 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7003 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7008 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7009 { 6, alc883_sixstack_ch6_init },
7010 { 8, alc883_sixstack_ch8_init },
7014 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7015 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7017 static struct snd_kcontrol_new alc882_base_mixer[] = {
7018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7019 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7021 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7022 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7023 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7024 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7025 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7027 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7028 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7029 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7030 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7032 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7036 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7037 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7038 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7042 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7043 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7044 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7046 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7049 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7051 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7057 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7058 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7059 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7060 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7061 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7062 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7063 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7064 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7065 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7067 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7069 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7071 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7075 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7076 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7077 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7078 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7079 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7081 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7083 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7089 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7090 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7091 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7102 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7103 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7104 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7119 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7120 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7122 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7124 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7125 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7126 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7131 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7132 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7139 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7140 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7141 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7143 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7144 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7153 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7156 .name = "Channel Mode",
7157 .info = alc_ch_mode_info,
7158 .get = alc_ch_mode_get,
7159 .put = alc_ch_mode_put,
7164 static struct hda_verb alc882_base_init_verbs[] = {
7165 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7166 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7176 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7178 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7179 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7180 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7182 /* mute analog input loopbacks */
7183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7189 /* Front Pin: output 0 (0x0c) */
7190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7191 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7192 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7193 /* Rear Pin: output 1 (0x0d) */
7194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7196 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7197 /* CLFE Pin: output 2 (0x0e) */
7198 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7199 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7200 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7201 /* Side Pin: output 3 (0x0f) */
7202 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7203 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7204 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7205 /* Mic (rear) pin: input vref at 80% */
7206 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7207 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7208 /* Front Mic pin: input vref at 80% */
7209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7210 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7211 /* Line In pin: input */
7212 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7213 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7214 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7216 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7217 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7218 /* CD pin widget for input */
7219 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7221 /* FIXME: use matrix-type input source selection */
7222 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7224 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7225 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7226 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7231 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7232 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7233 /* ADC2: mute amp left and right */
7234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7235 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7236 /* ADC3: mute amp left and right */
7237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7238 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7243 static struct hda_verb alc882_adc1_init_verbs[] = {
7244 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7249 /* ADC1: mute amp left and right */
7250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7251 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7255 static struct hda_verb alc882_eapd_verbs[] = {
7256 /* change to EAPD mode */
7257 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7258 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7262 static struct hda_verb alc889_eapd_verbs[] = {
7263 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7264 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7268 static struct hda_verb alc_hp15_unsol_verbs[] = {
7269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7274 static struct hda_verb alc885_init_verbs[] = {
7275 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7288 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7289 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7292 /* mute analog input loopbacks */
7293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7297 /* Front HP Pin: output 0 (0x0c) */
7298 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7300 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7301 /* Front Pin: output 0 (0x0c) */
7302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7305 /* Rear Pin: output 1 (0x0d) */
7306 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7307 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7308 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7309 /* CLFE Pin: output 2 (0x0e) */
7310 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7312 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7313 /* Side Pin: output 3 (0x0f) */
7314 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7315 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7316 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7317 /* Mic (rear) pin: input vref at 80% */
7318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7320 /* Front Mic pin: input vref at 80% */
7321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7323 /* Line In pin: input */
7324 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7325 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7327 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7340 /* ADC2: mute amp left and right */
7341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7342 /* ADC3: mute amp left and right */
7343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7348 static struct hda_verb alc885_init_input_verbs[] = {
7349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7356 /* Unmute Selector 24h and set the default input to front mic */
7357 static struct hda_verb alc889_init_input_verbs[] = {
7358 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7364 #define alc883_init_verbs alc882_base_init_verbs
7367 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7369 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7373 /* FIXME: this looks suspicious...
7374 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7375 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7380 static struct hda_verb alc882_macpro_init_verbs[] = {
7381 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7385 /* Front Pin: output 0 (0x0c) */
7386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7388 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7389 /* Front Mic pin: input vref at 80% */
7390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7392 /* Speaker: output */
7393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7395 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7396 /* Headphone output (output 0 - 0x0c) */
7397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7399 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7401 /* FIXME: use matrix-type input source selection */
7402 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7403 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7418 /* ADC1: mute amp left and right */
7419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7420 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7421 /* ADC2: mute amp left and right */
7422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7423 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7424 /* ADC3: mute amp left and right */
7425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7432 static struct hda_verb alc885_mb5_init_verbs[] = {
7434 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7435 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7436 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7437 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7442 /* Surround mixer */
7443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7445 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7452 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7454 /* Front Pin (0x0c) */
7455 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7456 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7457 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7458 /* LFE Pin (0x0e) */
7459 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7461 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7465 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7466 /* Front Mic pin: input vref at 80% */
7467 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7480 /* Macbook Pro rev3 */
7481 static struct hda_verb alc885_mbp3_init_verbs[] = {
7482 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7487 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7488 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7489 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7491 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7492 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7493 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7494 /* Front Pin: output 0 (0x0c) */
7495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7497 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7498 /* HP Pin: output 0 (0x0e) */
7499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7502 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7503 /* Mic (rear) pin: input vref at 80% */
7504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7506 /* Front Mic pin: input vref at 80% */
7507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7509 /* Line In pin: use output 1 when in LineOut mode */
7510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7512 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7514 /* FIXME: use matrix-type input source selection */
7515 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7516 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7531 /* ADC1: mute amp left and right */
7532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7533 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7534 /* ADC2: mute amp left and right */
7535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7536 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7537 /* ADC3: mute amp left and right */
7538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7545 static struct hda_verb alc885_imac91_init_verbs[] = {
7546 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7554 /* HP Pin: output 0 (0x0c) */
7555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7557 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7558 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7559 /* Internal Speakers: output 0 (0x0d) */
7560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7562 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7563 /* Mic (rear) pin: input vref at 80% */
7564 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7565 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7566 /* Front Mic pin: input vref at 80% */
7567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7569 /* Line In pin: use output 1 when in LineOut mode */
7570 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7574 /* FIXME: use matrix-type input source selection */
7575 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7576 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7585 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7591 /* ADC1: mute amp left and right */
7592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7593 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7594 /* ADC2: mute amp left and right */
7595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7596 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 /* ADC3: mute amp left and right */
7598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 /* iMac 24 mixer. */
7605 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7606 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7607 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7611 /* iMac 24 init verbs. */
7612 static struct hda_verb alc885_imac24_init_verbs[] = {
7613 /* Internal speakers: output 0 (0x0c) */
7614 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7615 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7616 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7617 /* Internal speakers: output 0 (0x0c) */
7618 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7619 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7620 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7621 /* Headphone: output 0 (0x0c) */
7622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7624 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7625 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7626 /* Front Mic: input vref at 80% */
7627 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7628 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7632 /* Toggle speaker-output according to the hp-jack state */
7633 static void alc885_imac24_setup(struct hda_codec *codec)
7635 struct alc_spec *spec = codec->spec;
7637 spec->autocfg.hp_pins[0] = 0x14;
7638 spec->autocfg.speaker_pins[0] = 0x18;
7639 spec->autocfg.speaker_pins[1] = 0x1a;
7642 static void alc885_mbp3_setup(struct hda_codec *codec)
7644 struct alc_spec *spec = codec->spec;
7646 spec->autocfg.hp_pins[0] = 0x15;
7647 spec->autocfg.speaker_pins[0] = 0x14;
7650 static void alc885_imac91_automute(struct hda_codec *codec)
7652 unsigned int present;
7654 present = snd_hda_codec_read(codec, 0x14, 0,
7655 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7656 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7657 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7658 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7659 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7663 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7666 /* Headphone insertion or removal. */
7667 if ((res >> 26) == ALC880_HP_EVENT)
7668 alc885_imac91_automute(codec);
7671 static struct hda_verb alc882_targa_verbs[] = {
7672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7678 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7679 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7680 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7682 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7686 /* toggle speaker-output according to the hp-jack state */
7687 static void alc882_targa_automute(struct hda_codec *codec)
7689 struct alc_spec *spec = codec->spec;
7690 alc_automute_amp(codec);
7691 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7692 spec->jack_present ? 1 : 3);
7695 static void alc882_targa_setup(struct hda_codec *codec)
7697 struct alc_spec *spec = codec->spec;
7699 spec->autocfg.hp_pins[0] = 0x14;
7700 spec->autocfg.speaker_pins[0] = 0x1b;
7703 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7705 if ((res >> 26) == ALC880_HP_EVENT)
7706 alc882_targa_automute(codec);
7709 static struct hda_verb alc882_asus_a7j_verbs[] = {
7710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7714 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7717 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7718 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7719 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7721 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7722 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7723 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7727 static struct hda_verb alc882_asus_a7m_verbs[] = {
7728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7729 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7733 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7735 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7736 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7737 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7739 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7740 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7741 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7745 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7747 unsigned int gpiostate, gpiomask, gpiodir;
7749 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7750 AC_VERB_GET_GPIO_DATA, 0);
7753 gpiostate |= (1 << pin);
7755 gpiostate &= ~(1 << pin);
7757 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7758 AC_VERB_GET_GPIO_MASK, 0);
7759 gpiomask |= (1 << pin);
7761 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7762 AC_VERB_GET_GPIO_DIRECTION, 0);
7763 gpiodir |= (1 << pin);
7766 snd_hda_codec_write(codec, codec->afg, 0,
7767 AC_VERB_SET_GPIO_MASK, gpiomask);
7768 snd_hda_codec_write(codec, codec->afg, 0,
7769 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7773 snd_hda_codec_write(codec, codec->afg, 0,
7774 AC_VERB_SET_GPIO_DATA, gpiostate);
7777 /* set up GPIO at initialization */
7778 static void alc885_macpro_init_hook(struct hda_codec *codec)
7780 alc882_gpio_mute(codec, 0, 0);
7781 alc882_gpio_mute(codec, 1, 0);
7784 /* set up GPIO and update auto-muting at initialization */
7785 static void alc885_imac24_init_hook(struct hda_codec *codec)
7787 alc885_macpro_init_hook(codec);
7788 alc_automute_amp(codec);
7792 * generic initialization of ADC, input mixers and output mixers
7794 static struct hda_verb alc883_auto_init_verbs[] = {
7796 * Unmute ADC0-2 and set the default input to mic-in
7798 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7799 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7800 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7803 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7805 * Note: PASD motherboards uses the Line In 2 as the input for
7806 * front panel mic (mic 2)
7808 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7816 * Set up output mixers (0x0c - 0x0f)
7818 /* set vol=0 to output mixers */
7819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7822 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7823 /* set up input amps for analog loopback */
7824 /* Amp Indices: DAC = 0, mixer = 1 */
7825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7827 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7829 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7831 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7833 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7834 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7836 /* FIXME: use matrix-type input source selection */
7837 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7852 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7853 static struct hda_verb alc889A_mb31_ch2_init[] = {
7854 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7855 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7861 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7862 static struct hda_verb alc889A_mb31_ch4_init[] = {
7863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7864 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7865 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7870 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7871 static struct hda_verb alc889A_mb31_ch5_init[] = {
7872 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7879 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7880 static struct hda_verb alc889A_mb31_ch6_init[] = {
7881 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7882 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7883 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7888 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7889 { 2, alc889A_mb31_ch2_init },
7890 { 4, alc889A_mb31_ch4_init },
7891 { 5, alc889A_mb31_ch5_init },
7892 { 6, alc889A_mb31_ch6_init },
7895 static struct hda_verb alc883_medion_eapd_verbs[] = {
7896 /* eanable EAPD on medion laptop */
7897 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7898 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7902 #define alc883_base_mixer alc882_base_mixer
7904 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7905 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7906 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7907 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7908 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7909 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7910 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7911 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7914 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7916 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7917 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7921 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7922 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7923 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7925 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7927 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7929 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7931 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7935 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7936 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7939 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7945 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7949 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7950 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7951 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7952 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7953 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7954 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7956 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7962 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7966 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7970 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7971 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7972 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7973 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7974 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7975 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7976 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7977 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7981 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7985 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7989 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7990 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7991 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7993 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7994 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7996 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7997 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7998 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8000 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8001 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8003 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8009 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8013 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8015 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8017 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8018 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8020 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8021 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8022 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8024 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8030 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8033 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8037 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8039 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8041 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8042 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8043 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8045 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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),
8054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8060 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8064 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8065 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8066 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8067 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8068 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8069 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8070 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8071 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8072 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8077 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8081 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8084 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8085 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8086 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8087 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8089 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8092 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8093 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8097 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8098 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8099 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8102 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8106 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8108 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8118 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8119 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8120 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8126 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8127 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8131 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8134 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8135 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8136 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8144 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8145 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8146 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8156 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8158 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8159 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8160 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8163 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8164 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8171 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8173 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8175 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8176 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8177 0x0d, 1, 0x0, HDA_OUTPUT),
8178 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8179 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8180 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8183 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8184 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8188 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8192 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8196 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8204 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8205 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8207 /* Output switches */
8208 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8209 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8210 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8212 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8222 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8223 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8224 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8226 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8227 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8232 static struct hda_bind_ctls alc883_bind_cap_vol = {
8233 .ops = &snd_hda_bind_vol,
8235 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8236 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8241 static struct hda_bind_ctls alc883_bind_cap_switch = {
8242 .ops = &snd_hda_bind_sw,
8244 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8245 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8250 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8258 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8262 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8263 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8264 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8267 /* .name = "Capture Source", */
8268 .name = "Input Source",
8270 .info = alc_mux_enum_info,
8271 .get = alc_mux_enum_get,
8272 .put = alc_mux_enum_put,
8277 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8280 .name = "Channel Mode",
8281 .info = alc_ch_mode_info,
8282 .get = alc_ch_mode_get,
8283 .put = alc_ch_mode_put,
8288 /* toggle speaker-output according to the hp-jack state */
8289 static void alc883_mitac_setup(struct hda_codec *codec)
8291 struct alc_spec *spec = codec->spec;
8293 spec->autocfg.hp_pins[0] = 0x15;
8294 spec->autocfg.speaker_pins[0] = 0x14;
8295 spec->autocfg.speaker_pins[1] = 0x17;
8298 /* auto-toggle front mic */
8300 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8302 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8304 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8308 static struct hda_verb alc883_mitac_verbs[] = {
8310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8313 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8314 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8316 /* enable unsolicited event */
8317 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8318 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8323 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8325 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8328 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8330 /* enable unsolicited event */
8332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8339 static struct hda_verb alc883_clevo_m720_verbs[] = {
8341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8344 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8345 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8347 /* enable unsolicited event */
8348 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8349 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8354 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8356 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8362 /* enable unsolicited event */
8363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8368 static struct hda_verb alc883_targa_verbs[] = {
8369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8373 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8375 /* Connect Line-Out side jack (SPDIF) to Side */
8376 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8377 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8378 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8379 /* Connect Mic jack to CLFE */
8380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8383 /* Connect Line-in jack to Surround */
8384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8387 /* Connect HP out jack to Front */
8388 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8389 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8390 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8392 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8397 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8399 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8400 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8404 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8405 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8407 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8408 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8412 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8415 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8416 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8417 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8421 static struct hda_verb alc883_haier_w66_verbs[] = {
8422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8427 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8428 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8429 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8430 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8434 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8440 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8441 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8442 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8446 static struct hda_verb alc888_6st_dell_verbs[] = {
8447 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8451 static struct hda_verb alc883_vaiott_verbs[] = {
8453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8456 /* enable unsolicited event */
8457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8462 static void alc888_3st_hp_setup(struct hda_codec *codec)
8464 struct alc_spec *spec = codec->spec;
8466 spec->autocfg.hp_pins[0] = 0x1b;
8467 spec->autocfg.speaker_pins[0] = 0x14;
8468 spec->autocfg.speaker_pins[1] = 0x16;
8469 spec->autocfg.speaker_pins[2] = 0x18;
8472 static struct hda_verb alc888_3st_hp_verbs[] = {
8473 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8474 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8475 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8476 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8483 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8484 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8485 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8486 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8487 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8494 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8495 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8496 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8497 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8498 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8499 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8506 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8507 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8508 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8509 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8510 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8511 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8512 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8516 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8517 { 2, alc888_3st_hp_2ch_init },
8518 { 4, alc888_3st_hp_4ch_init },
8519 { 6, alc888_3st_hp_6ch_init },
8522 /* toggle front-jack and RCA according to the hp-jack state */
8523 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8525 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8527 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8528 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8529 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8530 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8533 /* toggle RCA according to the front-jack state */
8534 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8536 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8538 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8539 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8542 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8545 if ((res >> 26) == ALC880_HP_EVENT)
8546 alc888_lenovo_ms7195_front_automute(codec);
8547 if ((res >> 26) == ALC880_FRONT_EVENT)
8548 alc888_lenovo_ms7195_rca_automute(codec);
8551 static struct hda_verb alc883_medion_md2_verbs[] = {
8552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8557 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8561 /* toggle speaker-output according to the hp-jack state */
8562 static void alc883_medion_md2_setup(struct hda_codec *codec)
8564 struct alc_spec *spec = codec->spec;
8566 spec->autocfg.hp_pins[0] = 0x14;
8567 spec->autocfg.speaker_pins[0] = 0x15;
8570 /* toggle speaker-output according to the hp-jack state */
8571 #define alc883_targa_init_hook alc882_targa_init_hook
8572 #define alc883_targa_unsol_event alc882_targa_unsol_event
8574 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8576 unsigned int present;
8578 present = snd_hda_jack_detect(codec, 0x18);
8579 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8580 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8583 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8585 struct alc_spec *spec = codec->spec;
8587 spec->autocfg.hp_pins[0] = 0x15;
8588 spec->autocfg.speaker_pins[0] = 0x14;
8591 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8593 alc_automute_amp(codec);
8594 alc883_clevo_m720_mic_automute(codec);
8597 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8600 switch (res >> 26) {
8601 case ALC880_MIC_EVENT:
8602 alc883_clevo_m720_mic_automute(codec);
8605 alc_automute_amp_unsol_event(codec, res);
8610 /* toggle speaker-output according to the hp-jack state */
8611 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8613 struct alc_spec *spec = codec->spec;
8615 spec->autocfg.hp_pins[0] = 0x14;
8616 spec->autocfg.speaker_pins[0] = 0x15;
8619 static void alc883_haier_w66_setup(struct hda_codec *codec)
8621 struct alc_spec *spec = codec->spec;
8623 spec->autocfg.hp_pins[0] = 0x1b;
8624 spec->autocfg.speaker_pins[0] = 0x14;
8627 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8629 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8631 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8632 HDA_AMP_MUTE, bits);
8635 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8637 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8639 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8640 HDA_AMP_MUTE, bits);
8641 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8642 HDA_AMP_MUTE, bits);
8645 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8648 if ((res >> 26) == ALC880_HP_EVENT)
8649 alc883_lenovo_101e_all_automute(codec);
8650 if ((res >> 26) == ALC880_FRONT_EVENT)
8651 alc883_lenovo_101e_ispeaker_automute(codec);
8654 /* toggle speaker-output according to the hp-jack state */
8655 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8657 struct alc_spec *spec = codec->spec;
8659 spec->autocfg.hp_pins[0] = 0x14;
8660 spec->autocfg.speaker_pins[0] = 0x15;
8661 spec->autocfg.speaker_pins[1] = 0x16;
8664 static struct hda_verb alc883_acer_eapd_verbs[] = {
8665 /* HP Pin: output 0 (0x0c) */
8666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8667 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8668 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8669 /* Front Pin: output 0 (0x0c) */
8670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8671 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8673 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8674 /* eanable EAPD on medion laptop */
8675 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8676 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8677 /* enable unsolicited event */
8678 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8682 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8684 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8685 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8689 static void alc888_6st_dell_setup(struct hda_codec *codec)
8691 struct alc_spec *spec = codec->spec;
8693 spec->autocfg.hp_pins[0] = 0x1b;
8694 spec->autocfg.speaker_pins[0] = 0x14;
8695 spec->autocfg.speaker_pins[1] = 0x15;
8696 spec->autocfg.speaker_pins[2] = 0x16;
8697 spec->autocfg.speaker_pins[3] = 0x17;
8700 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8702 struct alc_spec *spec = codec->spec;
8704 spec->autocfg.hp_pins[0] = 0x1b;
8705 spec->autocfg.speaker_pins[0] = 0x14;
8706 spec->autocfg.speaker_pins[1] = 0x15;
8707 spec->autocfg.speaker_pins[2] = 0x16;
8708 spec->autocfg.speaker_pins[3] = 0x17;
8709 spec->autocfg.speaker_pins[4] = 0x1a;
8712 static void alc883_vaiott_setup(struct hda_codec *codec)
8714 struct alc_spec *spec = codec->spec;
8716 spec->autocfg.hp_pins[0] = 0x15;
8717 spec->autocfg.speaker_pins[0] = 0x14;
8718 spec->autocfg.speaker_pins[1] = 0x17;
8721 static struct hda_verb alc888_asus_m90v_verbs[] = {
8722 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8725 /* enable unsolicited event */
8726 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8727 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8731 static void alc883_mode2_setup(struct hda_codec *codec)
8733 struct alc_spec *spec = codec->spec;
8735 spec->autocfg.hp_pins[0] = 0x1b;
8736 spec->autocfg.speaker_pins[0] = 0x14;
8737 spec->autocfg.speaker_pins[1] = 0x15;
8738 spec->autocfg.speaker_pins[2] = 0x16;
8739 spec->ext_mic.pin = 0x18;
8740 spec->int_mic.pin = 0x19;
8741 spec->ext_mic.mux_idx = 0;
8742 spec->int_mic.mux_idx = 1;
8746 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8748 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8752 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8753 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8754 /* enable unsolicited event */
8755 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8759 static void alc883_eee1601_inithook(struct hda_codec *codec)
8761 struct alc_spec *spec = codec->spec;
8763 spec->autocfg.hp_pins[0] = 0x14;
8764 spec->autocfg.speaker_pins[0] = 0x1b;
8765 alc_automute_pin(codec);
8768 static struct hda_verb alc889A_mb31_verbs[] = {
8769 /* Init rear pin (used as headphone output) */
8770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8771 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8772 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8773 /* Init line pin (used as output in 4ch and 6ch mode) */
8774 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8775 /* Init line 2 pin (used as headphone out by default) */
8776 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8777 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8781 /* Mute speakers according to the headphone jack state */
8782 static void alc889A_mb31_automute(struct hda_codec *codec)
8784 unsigned int present;
8786 /* Mute only in 2ch or 4ch mode */
8787 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8789 present = snd_hda_jack_detect(codec, 0x15);
8790 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8791 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8792 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8793 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8797 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8799 if ((res >> 26) == ALC880_HP_EVENT)
8800 alc889A_mb31_automute(codec);
8804 #ifdef CONFIG_SND_HDA_POWER_SAVE
8805 #define alc882_loopbacks alc880_loopbacks
8808 /* pcm configuration: identical with ALC880 */
8809 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8810 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8811 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8812 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8814 static hda_nid_t alc883_slave_dig_outs[] = {
8815 ALC1200_DIGOUT_NID, 0,
8818 static hda_nid_t alc1200_slave_dig_outs[] = {
8819 ALC883_DIGOUT_NID, 0,
8823 * configuration and preset
8825 static const char *alc882_models[ALC882_MODEL_LAST] = {
8826 [ALC882_3ST_DIG] = "3stack-dig",
8827 [ALC882_6ST_DIG] = "6stack-dig",
8828 [ALC882_ARIMA] = "arima",
8829 [ALC882_W2JC] = "w2jc",
8830 [ALC882_TARGA] = "targa",
8831 [ALC882_ASUS_A7J] = "asus-a7j",
8832 [ALC882_ASUS_A7M] = "asus-a7m",
8833 [ALC885_MACPRO] = "macpro",
8834 [ALC885_MB5] = "mb5",
8835 [ALC885_MBP3] = "mbp3",
8836 [ALC885_IMAC24] = "imac24",
8837 [ALC885_IMAC91] = "imac91",
8838 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8839 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8840 [ALC883_3ST_6ch] = "3stack-6ch",
8841 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8842 [ALC883_TARGA_DIG] = "targa-dig",
8843 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8844 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8845 [ALC883_ACER] = "acer",
8846 [ALC883_ACER_ASPIRE] = "acer-aspire",
8847 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8848 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8849 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8850 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8851 [ALC883_MEDION] = "medion",
8852 [ALC883_MEDION_MD2] = "medion-md2",
8853 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8854 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8855 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8856 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8857 [ALC888_LENOVO_SKY] = "lenovo-sky",
8858 [ALC883_HAIER_W66] = "haier-w66",
8859 [ALC888_3ST_HP] = "3stack-hp",
8860 [ALC888_6ST_DELL] = "6stack-dell",
8861 [ALC883_MITAC] = "mitac",
8862 [ALC883_CLEVO_M540R] = "clevo-m540r",
8863 [ALC883_CLEVO_M720] = "clevo-m720",
8864 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8865 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8866 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8867 [ALC889A_INTEL] = "intel-alc889a",
8868 [ALC889_INTEL] = "intel-x58",
8869 [ALC1200_ASUS_P5Q] = "asus-p5q",
8870 [ALC889A_MB31] = "mb31",
8871 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8872 [ALC882_AUTO] = "auto",
8875 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8876 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8878 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8879 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8880 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8881 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8882 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8883 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8884 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8885 ALC888_ACER_ASPIRE_4930G),
8886 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8887 ALC888_ACER_ASPIRE_4930G),
8888 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8889 ALC888_ACER_ASPIRE_8930G),
8890 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8891 ALC888_ACER_ASPIRE_8930G),
8892 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8893 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8894 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8895 ALC888_ACER_ASPIRE_6530G),
8896 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8897 ALC888_ACER_ASPIRE_6530G),
8898 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8899 ALC888_ACER_ASPIRE_7730G),
8900 /* default Acer -- disabled as it causes more problems.
8901 * model=auto should work fine now
8903 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8905 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8907 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8908 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8909 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8910 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8911 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8912 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8914 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8915 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8916 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8917 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8918 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8919 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8920 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8921 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8922 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8923 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8924 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8926 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8927 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8928 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8929 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8930 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8931 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8932 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8933 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8934 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8936 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8937 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8938 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8939 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8940 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8941 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8942 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8943 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8944 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8945 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8946 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8947 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8948 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8949 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8950 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8951 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8952 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8953 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8954 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8955 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8956 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8957 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8958 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8959 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8960 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8961 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8962 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8963 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8964 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8966 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8967 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8968 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8969 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8970 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8971 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8972 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8973 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8974 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8975 ALC883_FUJITSU_PI2515),
8976 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8977 ALC888_FUJITSU_XA3530),
8978 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8979 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8980 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8981 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8982 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8983 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8984 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8985 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8986 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8988 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8989 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8990 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8991 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8992 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8993 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8994 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8999 /* codec SSID table for Intel Mac */
9000 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9001 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9002 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9003 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9004 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9005 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9006 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9007 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9008 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9009 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9010 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9011 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9012 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9013 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9014 * so apparently no perfect solution yet
9016 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9017 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9021 static struct alc_config_preset alc882_presets[] = {
9022 [ALC882_3ST_DIG] = {
9023 .mixers = { alc882_base_mixer },
9024 .init_verbs = { alc882_base_init_verbs,
9025 alc882_adc1_init_verbs },
9026 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9027 .dac_nids = alc882_dac_nids,
9028 .dig_out_nid = ALC882_DIGOUT_NID,
9029 .dig_in_nid = ALC882_DIGIN_NID,
9030 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9031 .channel_mode = alc882_ch_modes,
9033 .input_mux = &alc882_capture_source,
9035 [ALC882_6ST_DIG] = {
9036 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9037 .init_verbs = { alc882_base_init_verbs,
9038 alc882_adc1_init_verbs },
9039 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9040 .dac_nids = alc882_dac_nids,
9041 .dig_out_nid = ALC882_DIGOUT_NID,
9042 .dig_in_nid = ALC882_DIGIN_NID,
9043 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9044 .channel_mode = alc882_sixstack_modes,
9045 .input_mux = &alc882_capture_source,
9048 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9049 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9050 alc882_eapd_verbs },
9051 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9052 .dac_nids = alc882_dac_nids,
9053 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9054 .channel_mode = alc882_sixstack_modes,
9055 .input_mux = &alc882_capture_source,
9058 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9059 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9060 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9061 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9062 .dac_nids = alc882_dac_nids,
9063 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9064 .channel_mode = alc880_threestack_modes,
9066 .input_mux = &alc882_capture_source,
9067 .dig_out_nid = ALC882_DIGOUT_NID,
9070 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9071 .init_verbs = { alc885_mbp3_init_verbs,
9072 alc880_gpio1_init_verbs },
9074 .dac_nids = alc882_dac_nids,
9076 .channel_mode = alc885_mbp_4ch_modes,
9077 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9078 .input_mux = &alc882_capture_source,
9079 .dig_out_nid = ALC882_DIGOUT_NID,
9080 .dig_in_nid = ALC882_DIGIN_NID,
9081 .unsol_event = alc_automute_amp_unsol_event,
9082 .setup = alc885_mbp3_setup,
9083 .init_hook = alc_automute_amp,
9086 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9087 .init_verbs = { alc885_mb5_init_verbs,
9088 alc880_gpio1_init_verbs },
9089 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9090 .dac_nids = alc882_dac_nids,
9091 .channel_mode = alc885_mb5_6ch_modes,
9092 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9093 .input_mux = &mb5_capture_source,
9094 .dig_out_nid = ALC882_DIGOUT_NID,
9095 .dig_in_nid = ALC882_DIGIN_NID,
9098 .mixers = { alc882_macpro_mixer },
9099 .init_verbs = { alc882_macpro_init_verbs },
9100 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9101 .dac_nids = alc882_dac_nids,
9102 .dig_out_nid = ALC882_DIGOUT_NID,
9103 .dig_in_nid = ALC882_DIGIN_NID,
9104 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9105 .channel_mode = alc882_ch_modes,
9106 .input_mux = &alc882_capture_source,
9107 .init_hook = alc885_macpro_init_hook,
9110 .mixers = { alc885_imac24_mixer },
9111 .init_verbs = { alc885_imac24_init_verbs },
9112 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9113 .dac_nids = alc882_dac_nids,
9114 .dig_out_nid = ALC882_DIGOUT_NID,
9115 .dig_in_nid = ALC882_DIGIN_NID,
9116 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9117 .channel_mode = alc882_ch_modes,
9118 .input_mux = &alc882_capture_source,
9119 .unsol_event = alc_automute_amp_unsol_event,
9120 .setup = alc885_imac24_setup,
9121 .init_hook = alc885_imac24_init_hook,
9124 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9125 .init_verbs = { alc885_imac91_init_verbs,
9126 alc880_gpio1_init_verbs },
9127 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9128 .dac_nids = alc882_dac_nids,
9129 .channel_mode = alc885_mbp_4ch_modes,
9130 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9131 .input_mux = &alc882_capture_source,
9132 .dig_out_nid = ALC882_DIGOUT_NID,
9133 .dig_in_nid = ALC882_DIGIN_NID,
9134 .unsol_event = alc885_imac91_unsol_event,
9135 .init_hook = alc885_imac91_automute,
9138 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9139 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9140 alc880_gpio3_init_verbs, alc882_targa_verbs},
9141 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9142 .dac_nids = alc882_dac_nids,
9143 .dig_out_nid = ALC882_DIGOUT_NID,
9144 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9145 .adc_nids = alc882_adc_nids,
9146 .capsrc_nids = alc882_capsrc_nids,
9147 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9148 .channel_mode = alc882_3ST_6ch_modes,
9150 .input_mux = &alc882_capture_source,
9151 .unsol_event = alc882_targa_unsol_event,
9152 .setup = alc882_targa_setup,
9153 .init_hook = alc882_targa_automute,
9155 [ALC882_ASUS_A7J] = {
9156 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9157 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9158 alc882_asus_a7j_verbs},
9159 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9160 .dac_nids = alc882_dac_nids,
9161 .dig_out_nid = ALC882_DIGOUT_NID,
9162 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9163 .adc_nids = alc882_adc_nids,
9164 .capsrc_nids = alc882_capsrc_nids,
9165 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9166 .channel_mode = alc882_3ST_6ch_modes,
9168 .input_mux = &alc882_capture_source,
9170 [ALC882_ASUS_A7M] = {
9171 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9172 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9173 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9174 alc882_asus_a7m_verbs },
9175 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9176 .dac_nids = alc882_dac_nids,
9177 .dig_out_nid = ALC882_DIGOUT_NID,
9178 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9179 .channel_mode = alc880_threestack_modes,
9181 .input_mux = &alc882_capture_source,
9183 [ALC883_3ST_2ch_DIG] = {
9184 .mixers = { alc883_3ST_2ch_mixer },
9185 .init_verbs = { alc883_init_verbs },
9186 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9187 .dac_nids = alc883_dac_nids,
9188 .dig_out_nid = ALC883_DIGOUT_NID,
9189 .dig_in_nid = ALC883_DIGIN_NID,
9190 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9191 .channel_mode = alc883_3ST_2ch_modes,
9192 .input_mux = &alc883_capture_source,
9194 [ALC883_3ST_6ch_DIG] = {
9195 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9196 .init_verbs = { alc883_init_verbs },
9197 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9198 .dac_nids = alc883_dac_nids,
9199 .dig_out_nid = ALC883_DIGOUT_NID,
9200 .dig_in_nid = ALC883_DIGIN_NID,
9201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9202 .channel_mode = alc883_3ST_6ch_modes,
9204 .input_mux = &alc883_capture_source,
9206 [ALC883_3ST_6ch] = {
9207 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9208 .init_verbs = { alc883_init_verbs },
9209 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9210 .dac_nids = alc883_dac_nids,
9211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9212 .channel_mode = alc883_3ST_6ch_modes,
9214 .input_mux = &alc883_capture_source,
9216 [ALC883_3ST_6ch_INTEL] = {
9217 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9218 .init_verbs = { alc883_init_verbs },
9219 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9220 .dac_nids = alc883_dac_nids,
9221 .dig_out_nid = ALC883_DIGOUT_NID,
9222 .dig_in_nid = ALC883_DIGIN_NID,
9223 .slave_dig_outs = alc883_slave_dig_outs,
9224 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9225 .channel_mode = alc883_3ST_6ch_intel_modes,
9227 .input_mux = &alc883_3stack_6ch_intel,
9230 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9231 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9232 alc_hp15_unsol_verbs },
9233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9234 .dac_nids = alc883_dac_nids,
9235 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9236 .adc_nids = alc889_adc_nids,
9237 .dig_out_nid = ALC883_DIGOUT_NID,
9238 .dig_in_nid = ALC883_DIGIN_NID,
9239 .slave_dig_outs = alc883_slave_dig_outs,
9240 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9241 .channel_mode = alc889_8ch_intel_modes,
9242 .capsrc_nids = alc889_capsrc_nids,
9243 .input_mux = &alc889_capture_source,
9244 .setup = alc889_automute_setup,
9245 .init_hook = alc_automute_amp,
9246 .unsol_event = alc_automute_amp_unsol_event,
9250 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9251 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9252 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9253 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9254 .dac_nids = alc883_dac_nids,
9255 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9256 .adc_nids = alc889_adc_nids,
9257 .capsrc_nids = alc889_capsrc_nids,
9258 .capsrc_nids = alc889_capsrc_nids,
9259 .dig_out_nid = ALC883_DIGOUT_NID,
9260 .dig_in_nid = ALC883_DIGIN_NID,
9261 .slave_dig_outs = alc883_slave_dig_outs,
9262 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9263 .channel_mode = alc889_8ch_intel_modes,
9264 .capsrc_nids = alc889_capsrc_nids,
9265 .input_mux = &alc889_capture_source,
9266 .setup = alc889_automute_setup,
9267 .init_hook = alc889_intel_init_hook,
9268 .unsol_event = alc_automute_amp_unsol_event,
9271 [ALC883_6ST_DIG] = {
9272 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9273 .init_verbs = { alc883_init_verbs },
9274 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9275 .dac_nids = alc883_dac_nids,
9276 .dig_out_nid = ALC883_DIGOUT_NID,
9277 .dig_in_nid = ALC883_DIGIN_NID,
9278 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9279 .channel_mode = alc883_sixstack_modes,
9280 .input_mux = &alc883_capture_source,
9282 [ALC883_TARGA_DIG] = {
9283 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9284 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9285 alc883_targa_verbs},
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .dig_out_nid = ALC883_DIGOUT_NID,
9289 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9290 .channel_mode = alc883_3ST_6ch_modes,
9292 .input_mux = &alc883_capture_source,
9293 .unsol_event = alc883_targa_unsol_event,
9294 .setup = alc882_targa_setup,
9295 .init_hook = alc882_targa_automute,
9297 [ALC883_TARGA_2ch_DIG] = {
9298 .mixers = { alc883_targa_2ch_mixer},
9299 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9300 alc883_targa_verbs},
9301 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9302 .dac_nids = alc883_dac_nids,
9303 .adc_nids = alc883_adc_nids_alt,
9304 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9305 .capsrc_nids = alc883_capsrc_nids,
9306 .dig_out_nid = ALC883_DIGOUT_NID,
9307 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9308 .channel_mode = alc883_3ST_2ch_modes,
9309 .input_mux = &alc883_capture_source,
9310 .unsol_event = alc883_targa_unsol_event,
9311 .setup = alc882_targa_setup,
9312 .init_hook = alc882_targa_automute,
9314 [ALC883_TARGA_8ch_DIG] = {
9315 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9316 alc883_chmode_mixer },
9317 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9318 alc883_targa_verbs },
9319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9320 .dac_nids = alc883_dac_nids,
9321 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9322 .adc_nids = alc883_adc_nids_rev,
9323 .capsrc_nids = alc883_capsrc_nids_rev,
9324 .dig_out_nid = ALC883_DIGOUT_NID,
9325 .dig_in_nid = ALC883_DIGIN_NID,
9326 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9327 .channel_mode = alc883_4ST_8ch_modes,
9329 .input_mux = &alc883_capture_source,
9330 .unsol_event = alc883_targa_unsol_event,
9331 .setup = alc882_targa_setup,
9332 .init_hook = alc882_targa_automute,
9335 .mixers = { alc883_base_mixer },
9336 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9337 * and the headphone jack. Turn this on and rely on the
9338 * standard mute methods whenever the user wants to turn
9339 * these outputs off.
9341 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9342 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9343 .dac_nids = alc883_dac_nids,
9344 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9345 .channel_mode = alc883_3ST_2ch_modes,
9346 .input_mux = &alc883_capture_source,
9348 [ALC883_ACER_ASPIRE] = {
9349 .mixers = { alc883_acer_aspire_mixer },
9350 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9352 .dac_nids = alc883_dac_nids,
9353 .dig_out_nid = ALC883_DIGOUT_NID,
9354 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9355 .channel_mode = alc883_3ST_2ch_modes,
9356 .input_mux = &alc883_capture_source,
9357 .unsol_event = alc_automute_amp_unsol_event,
9358 .setup = alc883_acer_aspire_setup,
9359 .init_hook = alc_automute_amp,
9361 [ALC888_ACER_ASPIRE_4930G] = {
9362 .mixers = { alc888_base_mixer,
9363 alc883_chmode_mixer },
9364 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9365 alc888_acer_aspire_4930g_verbs },
9366 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9367 .dac_nids = alc883_dac_nids,
9368 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9369 .adc_nids = alc883_adc_nids_rev,
9370 .capsrc_nids = alc883_capsrc_nids_rev,
9371 .dig_out_nid = ALC883_DIGOUT_NID,
9372 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9373 .channel_mode = alc883_3ST_6ch_modes,
9376 ARRAY_SIZE(alc888_2_capture_sources),
9377 .input_mux = alc888_2_capture_sources,
9378 .unsol_event = alc_automute_amp_unsol_event,
9379 .setup = alc888_acer_aspire_4930g_setup,
9380 .init_hook = alc_automute_amp,
9382 [ALC888_ACER_ASPIRE_6530G] = {
9383 .mixers = { alc888_acer_aspire_6530_mixer },
9384 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9385 alc888_acer_aspire_6530g_verbs },
9386 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9387 .dac_nids = alc883_dac_nids,
9388 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9389 .adc_nids = alc883_adc_nids_rev,
9390 .capsrc_nids = alc883_capsrc_nids_rev,
9391 .dig_out_nid = ALC883_DIGOUT_NID,
9392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9393 .channel_mode = alc883_3ST_2ch_modes,
9395 ARRAY_SIZE(alc888_2_capture_sources),
9396 .input_mux = alc888_acer_aspire_6530_sources,
9397 .unsol_event = alc_automute_amp_unsol_event,
9398 .setup = alc888_acer_aspire_6530g_setup,
9399 .init_hook = alc_automute_amp,
9401 [ALC888_ACER_ASPIRE_8930G] = {
9402 .mixers = { alc889_acer_aspire_8930g_mixer,
9403 alc883_chmode_mixer },
9404 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9405 alc889_acer_aspire_8930g_verbs,
9407 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9408 .dac_nids = alc883_dac_nids,
9409 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9410 .adc_nids = alc889_adc_nids,
9411 .capsrc_nids = alc889_capsrc_nids,
9412 .dig_out_nid = ALC883_DIGOUT_NID,
9413 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9414 .channel_mode = alc883_3ST_6ch_modes,
9416 .const_channel_count = 6,
9418 ARRAY_SIZE(alc889_capture_sources),
9419 .input_mux = alc889_capture_sources,
9420 .unsol_event = alc_automute_amp_unsol_event,
9421 .setup = alc889_acer_aspire_8930g_setup,
9422 .init_hook = alc_automute_amp,
9424 [ALC888_ACER_ASPIRE_7730G] = {
9425 .mixers = { alc883_3ST_6ch_mixer,
9426 alc883_chmode_mixer },
9427 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9428 alc888_acer_aspire_7730G_verbs },
9429 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9430 .dac_nids = alc883_dac_nids,
9431 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9432 .adc_nids = alc883_adc_nids_rev,
9433 .capsrc_nids = alc883_capsrc_nids_rev,
9434 .dig_out_nid = ALC883_DIGOUT_NID,
9435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9436 .channel_mode = alc883_3ST_6ch_modes,
9438 .const_channel_count = 6,
9439 .input_mux = &alc883_capture_source,
9440 .unsol_event = alc_automute_amp_unsol_event,
9441 .setup = alc888_acer_aspire_6530g_setup,
9442 .init_hook = alc_automute_amp,
9445 .mixers = { alc883_fivestack_mixer,
9446 alc883_chmode_mixer },
9447 .init_verbs = { alc883_init_verbs,
9448 alc883_medion_eapd_verbs },
9449 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9450 .dac_nids = alc883_dac_nids,
9451 .adc_nids = alc883_adc_nids_alt,
9452 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9453 .capsrc_nids = alc883_capsrc_nids,
9454 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9455 .channel_mode = alc883_sixstack_modes,
9456 .input_mux = &alc883_capture_source,
9458 [ALC883_MEDION_MD2] = {
9459 .mixers = { alc883_medion_md2_mixer},
9460 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9462 .dac_nids = alc883_dac_nids,
9463 .dig_out_nid = ALC883_DIGOUT_NID,
9464 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9465 .channel_mode = alc883_3ST_2ch_modes,
9466 .input_mux = &alc883_capture_source,
9467 .unsol_event = alc_automute_amp_unsol_event,
9468 .setup = alc883_medion_md2_setup,
9469 .init_hook = alc_automute_amp,
9471 [ALC883_LAPTOP_EAPD] = {
9472 .mixers = { alc883_base_mixer },
9473 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9474 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9475 .dac_nids = alc883_dac_nids,
9476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9477 .channel_mode = alc883_3ST_2ch_modes,
9478 .input_mux = &alc883_capture_source,
9480 [ALC883_CLEVO_M540R] = {
9481 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9482 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9484 .dac_nids = alc883_dac_nids,
9485 .dig_out_nid = ALC883_DIGOUT_NID,
9486 .dig_in_nid = ALC883_DIGIN_NID,
9487 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9488 .channel_mode = alc883_3ST_6ch_clevo_modes,
9490 .input_mux = &alc883_capture_source,
9491 /* This machine has the hardware HP auto-muting, thus
9492 * we need no software mute via unsol event
9495 [ALC883_CLEVO_M720] = {
9496 .mixers = { alc883_clevo_m720_mixer },
9497 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9499 .dac_nids = alc883_dac_nids,
9500 .dig_out_nid = ALC883_DIGOUT_NID,
9501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9502 .channel_mode = alc883_3ST_2ch_modes,
9503 .input_mux = &alc883_capture_source,
9504 .unsol_event = alc883_clevo_m720_unsol_event,
9505 .setup = alc883_clevo_m720_setup,
9506 .init_hook = alc883_clevo_m720_init_hook,
9508 [ALC883_LENOVO_101E_2ch] = {
9509 .mixers = { alc883_lenovo_101e_2ch_mixer},
9510 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9511 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9512 .dac_nids = alc883_dac_nids,
9513 .adc_nids = alc883_adc_nids_alt,
9514 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9515 .capsrc_nids = alc883_capsrc_nids,
9516 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9517 .channel_mode = alc883_3ST_2ch_modes,
9518 .input_mux = &alc883_lenovo_101e_capture_source,
9519 .unsol_event = alc883_lenovo_101e_unsol_event,
9520 .init_hook = alc883_lenovo_101e_all_automute,
9522 [ALC883_LENOVO_NB0763] = {
9523 .mixers = { alc883_lenovo_nb0763_mixer },
9524 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9525 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9526 .dac_nids = alc883_dac_nids,
9527 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9528 .channel_mode = alc883_3ST_2ch_modes,
9530 .input_mux = &alc883_lenovo_nb0763_capture_source,
9531 .unsol_event = alc_automute_amp_unsol_event,
9532 .setup = alc883_medion_md2_setup,
9533 .init_hook = alc_automute_amp,
9535 [ALC888_LENOVO_MS7195_DIG] = {
9536 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9537 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9538 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9539 .dac_nids = alc883_dac_nids,
9540 .dig_out_nid = ALC883_DIGOUT_NID,
9541 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9542 .channel_mode = alc883_3ST_6ch_modes,
9544 .input_mux = &alc883_capture_source,
9545 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9546 .init_hook = alc888_lenovo_ms7195_front_automute,
9548 [ALC883_HAIER_W66] = {
9549 .mixers = { alc883_targa_2ch_mixer},
9550 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9552 .dac_nids = alc883_dac_nids,
9553 .dig_out_nid = ALC883_DIGOUT_NID,
9554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9555 .channel_mode = alc883_3ST_2ch_modes,
9556 .input_mux = &alc883_capture_source,
9557 .unsol_event = alc_automute_amp_unsol_event,
9558 .setup = alc883_haier_w66_setup,
9559 .init_hook = alc_automute_amp,
9562 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9563 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9564 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9565 .dac_nids = alc883_dac_nids,
9566 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9567 .channel_mode = alc888_3st_hp_modes,
9569 .input_mux = &alc883_capture_source,
9570 .unsol_event = alc_automute_amp_unsol_event,
9571 .setup = alc888_3st_hp_setup,
9572 .init_hook = alc_automute_amp,
9574 [ALC888_6ST_DELL] = {
9575 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9576 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9577 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9578 .dac_nids = alc883_dac_nids,
9579 .dig_out_nid = ALC883_DIGOUT_NID,
9580 .dig_in_nid = ALC883_DIGIN_NID,
9581 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9582 .channel_mode = alc883_sixstack_modes,
9583 .input_mux = &alc883_capture_source,
9584 .unsol_event = alc_automute_amp_unsol_event,
9585 .setup = alc888_6st_dell_setup,
9586 .init_hook = alc_automute_amp,
9589 .mixers = { alc883_mitac_mixer },
9590 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9592 .dac_nids = alc883_dac_nids,
9593 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9594 .channel_mode = alc883_3ST_2ch_modes,
9595 .input_mux = &alc883_capture_source,
9596 .unsol_event = alc_automute_amp_unsol_event,
9597 .setup = alc883_mitac_setup,
9598 .init_hook = alc_automute_amp,
9600 [ALC883_FUJITSU_PI2515] = {
9601 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9602 .init_verbs = { alc883_init_verbs,
9603 alc883_2ch_fujitsu_pi2515_verbs},
9604 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9605 .dac_nids = alc883_dac_nids,
9606 .dig_out_nid = ALC883_DIGOUT_NID,
9607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9608 .channel_mode = alc883_3ST_2ch_modes,
9609 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9610 .unsol_event = alc_automute_amp_unsol_event,
9611 .setup = alc883_2ch_fujitsu_pi2515_setup,
9612 .init_hook = alc_automute_amp,
9614 [ALC888_FUJITSU_XA3530] = {
9615 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9616 .init_verbs = { alc883_init_verbs,
9617 alc888_fujitsu_xa3530_verbs },
9618 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9619 .dac_nids = alc883_dac_nids,
9620 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9621 .adc_nids = alc883_adc_nids_rev,
9622 .capsrc_nids = alc883_capsrc_nids_rev,
9623 .dig_out_nid = ALC883_DIGOUT_NID,
9624 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9625 .channel_mode = alc888_4ST_8ch_intel_modes,
9627 ARRAY_SIZE(alc888_2_capture_sources),
9628 .input_mux = alc888_2_capture_sources,
9629 .unsol_event = alc_automute_amp_unsol_event,
9630 .setup = alc888_fujitsu_xa3530_setup,
9631 .init_hook = alc_automute_amp,
9633 [ALC888_LENOVO_SKY] = {
9634 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9635 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9636 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9637 .dac_nids = alc883_dac_nids,
9638 .dig_out_nid = ALC883_DIGOUT_NID,
9639 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9640 .channel_mode = alc883_sixstack_modes,
9642 .input_mux = &alc883_lenovo_sky_capture_source,
9643 .unsol_event = alc_automute_amp_unsol_event,
9644 .setup = alc888_lenovo_sky_setup,
9645 .init_hook = alc_automute_amp,
9647 [ALC888_ASUS_M90V] = {
9648 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9649 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9650 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9651 .dac_nids = alc883_dac_nids,
9652 .dig_out_nid = ALC883_DIGOUT_NID,
9653 .dig_in_nid = ALC883_DIGIN_NID,
9654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9655 .channel_mode = alc883_3ST_6ch_modes,
9657 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9658 .unsol_event = alc_sku_unsol_event,
9659 .setup = alc883_mode2_setup,
9660 .init_hook = alc_inithook,
9662 [ALC888_ASUS_EEE1601] = {
9663 .mixers = { alc883_asus_eee1601_mixer },
9664 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9665 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9666 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9667 .dac_nids = alc883_dac_nids,
9668 .dig_out_nid = ALC883_DIGOUT_NID,
9669 .dig_in_nid = ALC883_DIGIN_NID,
9670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9671 .channel_mode = alc883_3ST_2ch_modes,
9673 .input_mux = &alc883_asus_eee1601_capture_source,
9674 .unsol_event = alc_sku_unsol_event,
9675 .init_hook = alc883_eee1601_inithook,
9677 [ALC1200_ASUS_P5Q] = {
9678 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9679 .init_verbs = { alc883_init_verbs },
9680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9681 .dac_nids = alc883_dac_nids,
9682 .dig_out_nid = ALC1200_DIGOUT_NID,
9683 .dig_in_nid = ALC883_DIGIN_NID,
9684 .slave_dig_outs = alc1200_slave_dig_outs,
9685 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9686 .channel_mode = alc883_sixstack_modes,
9687 .input_mux = &alc883_capture_source,
9690 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9691 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9692 alc880_gpio1_init_verbs },
9693 .adc_nids = alc883_adc_nids,
9694 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9695 .capsrc_nids = alc883_capsrc_nids,
9696 .dac_nids = alc883_dac_nids,
9697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9698 .channel_mode = alc889A_mb31_6ch_modes,
9699 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9700 .input_mux = &alc889A_mb31_capture_source,
9701 .dig_out_nid = ALC883_DIGOUT_NID,
9702 .unsol_event = alc889A_mb31_unsol_event,
9703 .init_hook = alc889A_mb31_automute,
9705 [ALC883_SONY_VAIO_TT] = {
9706 .mixers = { alc883_vaiott_mixer },
9707 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9708 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9709 .dac_nids = alc883_dac_nids,
9710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9711 .channel_mode = alc883_3ST_2ch_modes,
9712 .input_mux = &alc883_capture_source,
9713 .unsol_event = alc_automute_amp_unsol_event,
9714 .setup = alc883_vaiott_setup,
9715 .init_hook = alc_automute_amp,
9724 PINFIX_ABIT_AW9D_MAX
9727 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9728 { 0x15, 0x01080104 }, /* side */
9729 { 0x16, 0x01011012 }, /* rear */
9730 { 0x17, 0x01016011 }, /* clfe */
9734 static const struct alc_fixup alc882_fixups[] = {
9735 [PINFIX_ABIT_AW9D_MAX] = {
9736 .pins = alc882_abit_aw9d_pinfix
9740 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9741 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9746 * BIOS auto configuration
9748 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9749 const struct auto_pin_cfg *cfg)
9751 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9754 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9755 hda_nid_t nid, int pin_type,
9759 struct alc_spec *spec = codec->spec;
9762 alc_set_pin_output(codec, nid, pin_type);
9763 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9766 idx = spec->multiout.dac_nids[dac_idx] - 2;
9767 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9771 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9773 struct alc_spec *spec = codec->spec;
9776 for (i = 0; i <= HDA_SIDE; i++) {
9777 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9778 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9780 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9785 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9787 struct alc_spec *spec = codec->spec;
9790 pin = spec->autocfg.hp_pins[0];
9791 if (pin) /* connect to front */
9793 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9794 pin = spec->autocfg.speaker_pins[0];
9796 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9799 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9801 struct alc_spec *spec = codec->spec;
9804 for (i = 0; i < AUTO_PIN_LAST; i++) {
9805 hda_nid_t nid = spec->autocfg.input_pins[i];
9808 alc_set_input_pin(codec, nid, i);
9809 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9810 snd_hda_codec_write(codec, nid, 0,
9811 AC_VERB_SET_AMP_GAIN_MUTE,
9816 static void alc882_auto_init_input_src(struct hda_codec *codec)
9818 struct alc_spec *spec = codec->spec;
9821 for (c = 0; c < spec->num_adc_nids; c++) {
9822 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9823 hda_nid_t nid = spec->capsrc_nids[c];
9824 unsigned int mux_idx;
9825 const struct hda_input_mux *imux;
9826 int conns, mute, idx, item;
9828 conns = snd_hda_get_connections(codec, nid, conn_list,
9829 ARRAY_SIZE(conn_list));
9832 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9833 imux = &spec->input_mux[mux_idx];
9834 for (idx = 0; idx < conns; idx++) {
9835 /* if the current connection is the selected one,
9836 * unmute it as default - otherwise mute it
9838 mute = AMP_IN_MUTE(idx);
9839 for (item = 0; item < imux->num_items; item++) {
9840 if (imux->items[item].index == idx) {
9841 if (spec->cur_mux[c] == item)
9842 mute = AMP_IN_UNMUTE(idx);
9846 /* check if we have a selector or mixer
9847 * we could check for the widget type instead, but
9848 * just check for Amp-In presence (in case of mixer
9849 * without amp-in there is something wrong, this
9850 * function shouldn't be used or capsrc nid is wrong)
9852 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9853 snd_hda_codec_write(codec, nid, 0,
9854 AC_VERB_SET_AMP_GAIN_MUTE,
9856 else if (mute != AMP_IN_MUTE(idx))
9857 snd_hda_codec_write(codec, nid, 0,
9858 AC_VERB_SET_CONNECT_SEL,
9864 /* add mic boosts if needed */
9865 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9867 struct alc_spec *spec = codec->spec;
9871 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9872 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9873 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9875 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9879 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9880 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9881 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9883 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9890 /* almost identical with ALC880 parser... */
9891 static int alc882_parse_auto_config(struct hda_codec *codec)
9893 struct alc_spec *spec = codec->spec;
9894 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9897 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9901 if (!spec->autocfg.line_outs)
9902 return 0; /* can't find valid BIOS pin config */
9904 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9907 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9910 err = alc880_auto_create_extra_out(spec,
9911 spec->autocfg.speaker_pins[0],
9915 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9919 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9923 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9925 /* check multiple SPDIF-out (for recent codecs) */
9926 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9928 err = snd_hda_get_connections(codec,
9929 spec->autocfg.dig_out_pins[i],
9934 spec->multiout.dig_out_nid = dig_nid;
9936 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9937 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9939 spec->slave_dig_outs[i - 1] = dig_nid;
9942 if (spec->autocfg.dig_in_pin)
9943 spec->dig_in_nid = ALC880_DIGIN_NID;
9945 if (spec->kctls.list)
9946 add_mixer(spec, spec->kctls.list);
9948 add_verb(spec, alc883_auto_init_verbs);
9949 /* if ADC 0x07 is available, initialize it, too */
9950 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9951 add_verb(spec, alc882_adc1_init_verbs);
9953 spec->num_mux_defs = 1;
9954 spec->input_mux = &spec->private_imux[0];
9956 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9958 err = alc_auto_add_mic_boost(codec);
9962 return 1; /* config found */
9965 /* additional initialization for auto-configuration model */
9966 static void alc882_auto_init(struct hda_codec *codec)
9968 struct alc_spec *spec = codec->spec;
9969 alc882_auto_init_multi_out(codec);
9970 alc882_auto_init_hp_out(codec);
9971 alc882_auto_init_analog_input(codec);
9972 alc882_auto_init_input_src(codec);
9973 if (spec->unsol_event)
9974 alc_inithook(codec);
9977 static int patch_alc882(struct hda_codec *codec)
9979 struct alc_spec *spec;
9980 int err, board_config;
9982 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9988 switch (codec->vendor_id) {
9993 /* ALC883 and variants */
9994 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9998 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10002 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10003 board_config = snd_hda_check_board_codec_sid_config(codec,
10004 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10006 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10007 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10009 board_config = ALC882_AUTO;
10012 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10014 if (board_config == ALC882_AUTO) {
10015 /* automatic parse from the BIOS config */
10016 err = alc882_parse_auto_config(codec);
10022 "hda_codec: Cannot set up configuration "
10023 "from BIOS. Using base mode...\n");
10024 board_config = ALC882_3ST_DIG;
10028 err = snd_hda_attach_beep_device(codec, 0x1);
10034 if (board_config != ALC882_AUTO)
10035 setup_preset(codec, &alc882_presets[board_config]);
10037 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10038 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10039 /* FIXME: setup DAC5 */
10040 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10041 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10043 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10044 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10046 if (codec->vendor_id == 0x10ec0888)
10047 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10049 if (!spec->adc_nids && spec->input_mux) {
10051 spec->num_adc_nids = 0;
10052 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10053 const struct hda_input_mux *imux = spec->input_mux;
10055 hda_nid_t items[16];
10056 hda_nid_t nid = alc882_adc_nids[i];
10057 unsigned int wcap = get_wcaps(codec, nid);
10059 wcap = get_wcaps_type(wcap);
10060 if (wcap != AC_WID_AUD_IN)
10062 spec->private_adc_nids[spec->num_adc_nids] = nid;
10063 err = snd_hda_get_connections(codec, nid, &cap, 1);
10066 err = snd_hda_get_connections(codec, cap, items,
10067 ARRAY_SIZE(items));
10070 for (j = 0; j < imux->num_items; j++)
10071 if (imux->items[j].index >= err)
10073 if (j < imux->num_items)
10075 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10076 spec->num_adc_nids++;
10078 spec->adc_nids = spec->private_adc_nids;
10079 spec->capsrc_nids = spec->private_capsrc_nids;
10082 set_capture_mixer(codec);
10083 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10085 spec->vmaster_nid = 0x0c;
10087 codec->patch_ops = alc_patch_ops;
10088 if (board_config == ALC882_AUTO)
10089 spec->init_hook = alc882_auto_init;
10090 #ifdef CONFIG_SND_HDA_POWER_SAVE
10091 if (!spec->loopback.amplist)
10092 spec->loopback.amplist = alc882_loopbacks;
10094 codec->proc_widget_hook = print_realtek_coef;
10104 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10105 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10107 #define alc262_dac_nids alc260_dac_nids
10108 #define alc262_adc_nids alc882_adc_nids
10109 #define alc262_adc_nids_alt alc882_adc_nids_alt
10110 #define alc262_capsrc_nids alc882_capsrc_nids
10111 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10113 #define alc262_modes alc260_modes
10114 #define alc262_capture_source alc882_capture_source
10116 static hda_nid_t alc262_dmic_adc_nids[1] = {
10121 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10123 static struct snd_kcontrol_new alc262_base_mixer[] = {
10124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10125 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10126 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10127 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10135 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10136 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10138 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10139 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10143 /* update HP, line and mono-out pins according to the master switch */
10144 static void alc262_hp_master_update(struct hda_codec *codec)
10146 struct alc_spec *spec = codec->spec;
10147 int val = spec->master_sw;
10149 /* HP & line-out */
10150 snd_hda_codec_write_cache(codec, 0x1b, 0,
10151 AC_VERB_SET_PIN_WIDGET_CONTROL,
10153 snd_hda_codec_write_cache(codec, 0x15, 0,
10154 AC_VERB_SET_PIN_WIDGET_CONTROL,
10156 /* mono (speaker) depending on the HP jack sense */
10157 val = val && !spec->jack_present;
10158 snd_hda_codec_write_cache(codec, 0x16, 0,
10159 AC_VERB_SET_PIN_WIDGET_CONTROL,
10160 val ? PIN_OUT : 0);
10163 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10165 struct alc_spec *spec = codec->spec;
10167 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10168 alc262_hp_master_update(codec);
10171 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10173 if ((res >> 26) != ALC880_HP_EVENT)
10175 alc262_hp_bpc_automute(codec);
10178 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10180 struct alc_spec *spec = codec->spec;
10182 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10183 alc262_hp_master_update(codec);
10186 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10189 if ((res >> 26) != ALC880_HP_EVENT)
10191 alc262_hp_wildwest_automute(codec);
10194 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10196 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10197 struct snd_ctl_elem_value *ucontrol)
10199 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10200 struct alc_spec *spec = codec->spec;
10201 int val = !!*ucontrol->value.integer.value;
10203 if (val == spec->master_sw)
10205 spec->master_sw = val;
10206 alc262_hp_master_update(codec);
10210 #define ALC262_HP_MASTER_SWITCH \
10212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10213 .name = "Master Playback Switch", \
10214 .info = snd_ctl_boolean_mono_info, \
10215 .get = alc262_hp_master_sw_get, \
10216 .put = alc262_hp_master_sw_put, \
10219 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10220 ALC262_HP_MASTER_SWITCH,
10221 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10222 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10223 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10224 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10226 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10229 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10230 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10231 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10232 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10233 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10235 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10236 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10237 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10238 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10239 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10243 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10244 ALC262_HP_MASTER_SWITCH,
10245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10246 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10247 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10248 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10249 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10251 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10263 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10264 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10265 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10266 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10270 /* mute/unmute internal speaker according to the hp jack and mute state */
10271 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10273 struct alc_spec *spec = codec->spec;
10275 spec->autocfg.hp_pins[0] = 0x15;
10276 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10279 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10280 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10281 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10286 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10290 static struct hda_verb alc262_hp_t5735_verbs[] = {
10291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10294 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10298 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10299 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10301 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10302 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10308 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10314 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10322 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10329 /* bind hp and internal speaker mute (with plug check) as master switch */
10330 static void alc262_hippo_master_update(struct hda_codec *codec)
10332 struct alc_spec *spec = codec->spec;
10333 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10334 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10335 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10339 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10340 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10341 HDA_AMP_MUTE, mute);
10342 /* mute internal speaker per jack sense */
10343 if (spec->jack_present)
10344 mute = HDA_AMP_MUTE;
10346 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10347 HDA_AMP_MUTE, mute);
10348 if (speaker_nid && speaker_nid != line_nid)
10349 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10350 HDA_AMP_MUTE, mute);
10353 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10355 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10356 struct snd_ctl_elem_value *ucontrol)
10358 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10359 struct alc_spec *spec = codec->spec;
10360 int val = !!*ucontrol->value.integer.value;
10362 if (val == spec->master_sw)
10364 spec->master_sw = val;
10365 alc262_hippo_master_update(codec);
10369 #define ALC262_HIPPO_MASTER_SWITCH \
10371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10372 .name = "Master Playback Switch", \
10373 .info = snd_ctl_boolean_mono_info, \
10374 .get = alc262_hippo_master_sw_get, \
10375 .put = alc262_hippo_master_sw_put, \
10378 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10379 ALC262_HIPPO_MASTER_SWITCH,
10380 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10388 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10389 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10390 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10395 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10396 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10397 ALC262_HIPPO_MASTER_SWITCH,
10398 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10399 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10400 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10401 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10404 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10405 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10407 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10411 /* mute/unmute internal speaker according to the hp jack and mute state */
10412 static void alc262_hippo_automute(struct hda_codec *codec)
10414 struct alc_spec *spec = codec->spec;
10415 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10417 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10418 alc262_hippo_master_update(codec);
10421 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10423 if ((res >> 26) != ALC880_HP_EVENT)
10425 alc262_hippo_automute(codec);
10428 static void alc262_hippo_setup(struct hda_codec *codec)
10430 struct alc_spec *spec = codec->spec;
10432 spec->autocfg.hp_pins[0] = 0x15;
10433 spec->autocfg.speaker_pins[0] = 0x14;
10436 static void alc262_hippo1_setup(struct hda_codec *codec)
10438 struct alc_spec *spec = codec->spec;
10440 spec->autocfg.hp_pins[0] = 0x1b;
10441 spec->autocfg.speaker_pins[0] = 0x14;
10445 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10446 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10447 ALC262_HIPPO_MASTER_SWITCH,
10448 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10450 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10451 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10455 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10456 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10457 ALC262_HIPPO_MASTER_SWITCH,
10458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10461 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10462 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10466 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10467 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10468 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10469 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10470 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10471 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10472 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10475 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10476 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10477 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10478 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10482 static struct hda_verb alc262_tyan_verbs[] = {
10483 /* Headphone automute */
10484 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10486 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10488 /* P11 AUX_IN, white 4-pin connector */
10489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10490 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10491 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10492 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10497 /* unsolicited event for HP jack sensing */
10498 static void alc262_tyan_setup(struct hda_codec *codec)
10500 struct alc_spec *spec = codec->spec;
10502 spec->autocfg.hp_pins[0] = 0x1b;
10503 spec->autocfg.speaker_pins[0] = 0x15;
10507 #define alc262_capture_mixer alc882_capture_mixer
10508 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10511 * generic initialization of ADC, input mixers and output mixers
10513 static struct hda_verb alc262_init_verbs[] = {
10515 * Unmute ADC0-2 and set the default input to mic-in
10517 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10519 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10520 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10521 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10526 * Note: PASD motherboards uses the Line In 2 as the input for
10527 * front panel mic (mic 2)
10529 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10537 * Set up output mixers (0x0c - 0x0e)
10539 /* set vol=0 to output mixers */
10540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10543 /* set up input amps for analog loopback */
10544 /* Amp Indices: DAC = 0, mixer = 1 */
10545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10552 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10554 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10561 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10562 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10563 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10568 /* FIXME: use matrix-type input source selection */
10569 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10570 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10589 static struct hda_verb alc262_eapd_verbs[] = {
10590 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10591 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10595 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10597 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10598 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10600 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10601 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10605 static struct hda_verb alc262_sony_unsol_verbs[] = {
10606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10608 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10610 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10615 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10616 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10617 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10624 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10625 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10626 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10627 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10628 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10629 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10631 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10632 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10636 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10638 struct alc_spec *spec = codec->spec;
10640 spec->autocfg.hp_pins[0] = 0x15;
10641 spec->autocfg.speaker_pins[0] = 0x14;
10642 spec->ext_mic.pin = 0x18;
10643 spec->ext_mic.mux_idx = 0;
10644 spec->int_mic.pin = 0x12;
10645 spec->int_mic.mux_idx = 9;
10646 spec->auto_mic = 1;
10652 * 0x16 = internal speaker
10653 * 0x18 = external mic
10656 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10657 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10658 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10662 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10664 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10669 static struct hda_verb alc262_nec_verbs[] = {
10670 /* Unmute Speaker */
10671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10674 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10677 /* External mic to headphone */
10678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10679 /* External mic to speaker */
10680 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10686 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10687 * 0x1b = port replicator headphone out
10690 #define ALC_HP_EVENT 0x37
10692 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10693 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10695 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10700 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10701 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10702 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10706 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10707 /* Front Mic pin: input vref at 50% */
10708 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10709 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10713 static struct hda_input_mux alc262_fujitsu_capture_source = {
10717 { "Int Mic", 0x1 },
10722 static struct hda_input_mux alc262_HP_capture_source = {
10726 { "Front Mic", 0x1 },
10733 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10737 { "Front Mic", 0x2 },
10743 /* mute/unmute internal speaker according to the hp jacks and mute state */
10744 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10746 struct alc_spec *spec = codec->spec;
10749 if (force || !spec->sense_updated) {
10750 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10751 snd_hda_jack_detect(codec, 0x1b);
10752 spec->sense_updated = 1;
10754 /* unmute internal speaker only if both HPs are unplugged and
10755 * master switch is on
10757 if (spec->jack_present)
10758 mute = HDA_AMP_MUTE;
10760 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10761 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10762 HDA_AMP_MUTE, mute);
10765 /* unsolicited event for HP jack sensing */
10766 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10769 if ((res >> 26) != ALC_HP_EVENT)
10771 alc262_fujitsu_automute(codec, 1);
10774 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10776 alc262_fujitsu_automute(codec, 1);
10779 /* bind volumes of both NID 0x0c and 0x0d */
10780 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10781 .ops = &snd_hda_bind_vol,
10783 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10784 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10789 /* mute/unmute internal speaker according to the hp jack and mute state */
10790 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10792 struct alc_spec *spec = codec->spec;
10795 if (force || !spec->sense_updated) {
10796 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10797 spec->sense_updated = 1;
10799 if (spec->jack_present) {
10800 /* mute internal speaker */
10801 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10802 HDA_AMP_MUTE, HDA_AMP_MUTE);
10803 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10804 HDA_AMP_MUTE, HDA_AMP_MUTE);
10806 /* unmute internal speaker if necessary */
10807 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10808 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10809 HDA_AMP_MUTE, mute);
10810 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10811 HDA_AMP_MUTE, mute);
10815 /* unsolicited event for HP jack sensing */
10816 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10819 if ((res >> 26) != ALC_HP_EVENT)
10821 alc262_lenovo_3000_automute(codec, 1);
10824 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10825 int dir, int idx, long *valp)
10829 for (i = 0; i < 2; i++, valp++)
10830 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10832 *valp ? 0 : HDA_AMP_MUTE);
10836 /* bind hp and internal speaker mute (with plug check) */
10837 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10838 struct snd_ctl_elem_value *ucontrol)
10840 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10841 long *valp = ucontrol->value.integer.value;
10844 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10845 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10847 alc262_fujitsu_automute(codec, 0);
10851 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10852 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10854 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10855 .name = "Master Playback Switch",
10856 .info = snd_hda_mixer_amp_switch_info,
10857 .get = snd_hda_mixer_amp_switch_get,
10858 .put = alc262_fujitsu_master_sw_put,
10859 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10861 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10862 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10865 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10866 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10867 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10868 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10872 /* bind hp and internal speaker mute (with plug check) */
10873 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10874 struct snd_ctl_elem_value *ucontrol)
10876 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10877 long *valp = ucontrol->value.integer.value;
10880 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10882 alc262_lenovo_3000_automute(codec, 0);
10886 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10887 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10889 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10890 .name = "Master Playback Switch",
10891 .info = snd_hda_mixer_amp_switch_info,
10892 .get = snd_hda_mixer_amp_switch_get,
10893 .put = alc262_lenovo_3000_master_sw_put,
10894 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10898 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10901 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10902 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10903 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10907 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10908 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10909 ALC262_HIPPO_MASTER_SWITCH,
10910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10911 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10912 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10914 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10915 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10919 /* additional init verbs for Benq laptops */
10920 static struct hda_verb alc262_EAPD_verbs[] = {
10921 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10922 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10926 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10930 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10931 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10935 /* Samsung Q1 Ultra Vista model setup */
10936 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10937 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10938 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10941 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10942 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10946 static struct hda_verb alc262_ultra_verbs[] = {
10948 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10953 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10955 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10961 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10963 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10965 /* ADC, choose mic */
10966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10975 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10979 /* mute/unmute internal speaker according to the hp jack and mute state */
10980 static void alc262_ultra_automute(struct hda_codec *codec)
10982 struct alc_spec *spec = codec->spec;
10986 /* auto-mute only when HP is used as HP */
10987 if (!spec->cur_mux[0]) {
10988 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10989 if (spec->jack_present)
10990 mute = HDA_AMP_MUTE;
10992 /* mute/unmute internal speaker */
10993 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10994 HDA_AMP_MUTE, mute);
10995 /* mute/unmute HP */
10996 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10997 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11000 /* unsolicited event for HP jack sensing */
11001 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11004 if ((res >> 26) != ALC880_HP_EVENT)
11006 alc262_ultra_automute(codec);
11009 static struct hda_input_mux alc262_ultra_capture_source = {
11013 { "Headphone", 0x7 },
11017 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11018 struct snd_ctl_elem_value *ucontrol)
11020 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11021 struct alc_spec *spec = codec->spec;
11024 ret = alc_mux_enum_put(kcontrol, ucontrol);
11027 /* reprogram the HP pin as mic or HP according to the input source */
11028 snd_hda_codec_write_cache(codec, 0x15, 0,
11029 AC_VERB_SET_PIN_WIDGET_CONTROL,
11030 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11031 alc262_ultra_automute(codec); /* mute/unmute HP */
11035 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11036 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11037 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11039 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11040 .name = "Capture Source",
11041 .info = alc_mux_enum_info,
11042 .get = alc_mux_enum_get,
11043 .put = alc262_ultra_mux_enum_put,
11048 /* We use two mixers depending on the output pin; 0x16 is a mono output
11049 * and thus it's bound with a different mixer.
11050 * This function returns which mixer amp should be used.
11052 static int alc262_check_volbit(hda_nid_t nid)
11056 else if (nid == 0x16)
11062 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11063 const char *pfx, int *vbits)
11068 vbit = alc262_check_volbit(nid);
11071 if (*vbits & vbit) /* a volume control for this mixer already there */
11075 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11077 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11078 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11081 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11089 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11091 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11092 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11095 /* add playback controls from the parsed DAC table */
11096 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11097 const struct auto_pin_cfg *cfg)
11103 spec->multiout.num_dacs = 1; /* only use one dac */
11104 spec->multiout.dac_nids = spec->private_dac_nids;
11105 spec->multiout.dac_nids[0] = 2;
11107 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11109 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11113 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11116 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11119 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11123 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11124 alc262_check_volbit(cfg->speaker_pins[0]) |
11125 alc262_check_volbit(cfg->hp_pins[0]);
11126 if (vbits == 1 || vbits == 2)
11127 pfx = "Master"; /* only one mixer is used */
11128 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11133 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11136 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11140 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11147 #define alc262_auto_create_input_ctls \
11148 alc880_auto_create_input_ctls
11151 * generic initialization of ADC, input mixers and output mixers
11153 static struct hda_verb alc262_volume_init_verbs[] = {
11155 * Unmute ADC0-2 and set the default input to mic-in
11157 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11159 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11161 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11164 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11166 * Note: PASD motherboards uses the Line In 2 as the input for
11167 * front panel mic (mic 2)
11169 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11177 * Set up output mixers (0x0c - 0x0f)
11179 /* set vol=0 to output mixers */
11180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11181 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11182 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11184 /* set up input amps for analog loopback */
11185 /* Amp Indices: DAC = 0, mixer = 1 */
11186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11193 /* FIXME: use matrix-type input source selection */
11194 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11195 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11204 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11214 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11216 * Unmute ADC0-2 and set the default input to mic-in
11218 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11219 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11220 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11222 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11223 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11225 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11227 * Note: PASD motherboards uses the Line In 2 as the input for
11228 * front panel mic (mic 2)
11230 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11240 * Set up output mixers (0x0c - 0x0e)
11242 /* set vol=0 to output mixers */
11243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11244 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11247 /* set up input amps for analog loopback */
11248 /* Amp Indices: DAC = 0, mixer = 1 */
11249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11258 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11260 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11263 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11270 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11273 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11274 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11275 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11276 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11277 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11280 /* FIXME: use matrix-type input source selection */
11281 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11282 /* Input mixer1: only unmute Mic */
11283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11301 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11313 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11318 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11320 * Unmute ADC0-2 and set the default input to mic-in
11322 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11324 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11326 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11329 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11331 * Note: PASD motherboards uses the Line In 2 as the input for front
11332 * panel mic (mic 2)
11334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11344 * Set up output mixers (0x0c - 0x0e)
11346 /* set vol=0 to output mixers */
11347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11351 /* set up input amps for analog loopback */
11352 /* Amp Indices: DAC = 0, mixer = 1 */
11353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11364 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11366 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11367 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11369 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11372 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11373 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11375 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11379 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11380 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11382 /* FIXME: use matrix-type input source selection */
11383 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11384 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11389 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11390 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11398 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11406 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11407 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11409 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11414 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11417 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11418 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11421 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11423 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11426 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11427 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11432 #ifdef CONFIG_SND_HDA_POWER_SAVE
11433 #define alc262_loopbacks alc880_loopbacks
11436 /* pcm configuration: identical with ALC880 */
11437 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11438 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11439 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11440 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11443 * BIOS auto configuration
11445 static int alc262_parse_auto_config(struct hda_codec *codec)
11447 struct alc_spec *spec = codec->spec;
11449 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11451 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11455 if (!spec->autocfg.line_outs) {
11456 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11457 spec->multiout.max_channels = 2;
11458 spec->no_analog = 1;
11461 return 0; /* can't find valid BIOS pin config */
11463 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11466 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11470 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11473 if (spec->autocfg.dig_outs) {
11474 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11475 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11477 if (spec->autocfg.dig_in_pin)
11478 spec->dig_in_nid = ALC262_DIGIN_NID;
11480 if (spec->kctls.list)
11481 add_mixer(spec, spec->kctls.list);
11483 add_verb(spec, alc262_volume_init_verbs);
11484 spec->num_mux_defs = 1;
11485 spec->input_mux = &spec->private_imux[0];
11487 err = alc_auto_add_mic_boost(codec);
11491 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11496 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11497 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11498 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11499 #define alc262_auto_init_input_src alc882_auto_init_input_src
11502 /* init callback for auto-configuration model -- overriding the default init */
11503 static void alc262_auto_init(struct hda_codec *codec)
11505 struct alc_spec *spec = codec->spec;
11506 alc262_auto_init_multi_out(codec);
11507 alc262_auto_init_hp_out(codec);
11508 alc262_auto_init_analog_input(codec);
11509 alc262_auto_init_input_src(codec);
11510 if (spec->unsol_event)
11511 alc_inithook(codec);
11515 * configuration and preset
11517 static const char *alc262_models[ALC262_MODEL_LAST] = {
11518 [ALC262_BASIC] = "basic",
11519 [ALC262_HIPPO] = "hippo",
11520 [ALC262_HIPPO_1] = "hippo_1",
11521 [ALC262_FUJITSU] = "fujitsu",
11522 [ALC262_HP_BPC] = "hp-bpc",
11523 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11524 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11525 [ALC262_HP_RP5700] = "hp-rp5700",
11526 [ALC262_BENQ_ED8] = "benq",
11527 [ALC262_BENQ_T31] = "benq-t31",
11528 [ALC262_SONY_ASSAMD] = "sony-assamd",
11529 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11530 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11531 [ALC262_ULTRA] = "ultra",
11532 [ALC262_LENOVO_3000] = "lenovo-3000",
11533 [ALC262_NEC] = "nec",
11534 [ALC262_TYAN] = "tyan",
11535 [ALC262_AUTO] = "auto",
11538 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11539 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11540 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11541 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11543 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11545 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11547 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11548 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11549 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11550 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11551 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11552 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11553 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11554 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11555 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11556 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11557 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11558 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11559 ALC262_HP_TC_T5735),
11560 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11561 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11562 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11563 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11564 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11565 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11566 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11567 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11568 #if 0 /* disable the quirk since model=auto works better in recent versions */
11569 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11570 ALC262_SONY_ASSAMD),
11572 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11573 ALC262_TOSHIBA_RX1),
11574 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11575 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11576 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11577 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11578 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11580 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11581 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11582 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11583 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11584 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11588 static struct alc_config_preset alc262_presets[] = {
11590 .mixers = { alc262_base_mixer },
11591 .init_verbs = { alc262_init_verbs },
11592 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11593 .dac_nids = alc262_dac_nids,
11595 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11596 .channel_mode = alc262_modes,
11597 .input_mux = &alc262_capture_source,
11600 .mixers = { alc262_hippo_mixer },
11601 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11602 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11603 .dac_nids = alc262_dac_nids,
11605 .dig_out_nid = ALC262_DIGOUT_NID,
11606 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11607 .channel_mode = alc262_modes,
11608 .input_mux = &alc262_capture_source,
11609 .unsol_event = alc262_hippo_unsol_event,
11610 .setup = alc262_hippo_setup,
11611 .init_hook = alc262_hippo_automute,
11613 [ALC262_HIPPO_1] = {
11614 .mixers = { alc262_hippo1_mixer },
11615 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11616 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11617 .dac_nids = alc262_dac_nids,
11619 .dig_out_nid = ALC262_DIGOUT_NID,
11620 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11621 .channel_mode = alc262_modes,
11622 .input_mux = &alc262_capture_source,
11623 .unsol_event = alc262_hippo_unsol_event,
11624 .setup = alc262_hippo1_setup,
11625 .init_hook = alc262_hippo_automute,
11627 [ALC262_FUJITSU] = {
11628 .mixers = { alc262_fujitsu_mixer },
11629 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11630 alc262_fujitsu_unsol_verbs },
11631 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11632 .dac_nids = alc262_dac_nids,
11634 .dig_out_nid = ALC262_DIGOUT_NID,
11635 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11636 .channel_mode = alc262_modes,
11637 .input_mux = &alc262_fujitsu_capture_source,
11638 .unsol_event = alc262_fujitsu_unsol_event,
11639 .init_hook = alc262_fujitsu_init_hook,
11641 [ALC262_HP_BPC] = {
11642 .mixers = { alc262_HP_BPC_mixer },
11643 .init_verbs = { alc262_HP_BPC_init_verbs },
11644 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11645 .dac_nids = alc262_dac_nids,
11647 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11648 .channel_mode = alc262_modes,
11649 .input_mux = &alc262_HP_capture_source,
11650 .unsol_event = alc262_hp_bpc_unsol_event,
11651 .init_hook = alc262_hp_bpc_automute,
11653 [ALC262_HP_BPC_D7000_WF] = {
11654 .mixers = { alc262_HP_BPC_WildWest_mixer },
11655 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11656 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11657 .dac_nids = alc262_dac_nids,
11659 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11660 .channel_mode = alc262_modes,
11661 .input_mux = &alc262_HP_D7000_capture_source,
11662 .unsol_event = alc262_hp_wildwest_unsol_event,
11663 .init_hook = alc262_hp_wildwest_automute,
11665 [ALC262_HP_BPC_D7000_WL] = {
11666 .mixers = { alc262_HP_BPC_WildWest_mixer,
11667 alc262_HP_BPC_WildWest_option_mixer },
11668 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11669 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11670 .dac_nids = alc262_dac_nids,
11672 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11673 .channel_mode = alc262_modes,
11674 .input_mux = &alc262_HP_D7000_capture_source,
11675 .unsol_event = alc262_hp_wildwest_unsol_event,
11676 .init_hook = alc262_hp_wildwest_automute,
11678 [ALC262_HP_TC_T5735] = {
11679 .mixers = { alc262_hp_t5735_mixer },
11680 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11681 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11682 .dac_nids = alc262_dac_nids,
11684 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11685 .channel_mode = alc262_modes,
11686 .input_mux = &alc262_capture_source,
11687 .unsol_event = alc_automute_amp_unsol_event,
11688 .setup = alc262_hp_t5735_setup,
11689 .init_hook = alc_automute_amp,
11691 [ALC262_HP_RP5700] = {
11692 .mixers = { alc262_hp_rp5700_mixer },
11693 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11694 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11695 .dac_nids = alc262_dac_nids,
11696 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11697 .channel_mode = alc262_modes,
11698 .input_mux = &alc262_hp_rp5700_capture_source,
11700 [ALC262_BENQ_ED8] = {
11701 .mixers = { alc262_base_mixer },
11702 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11703 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11704 .dac_nids = alc262_dac_nids,
11706 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11707 .channel_mode = alc262_modes,
11708 .input_mux = &alc262_capture_source,
11710 [ALC262_SONY_ASSAMD] = {
11711 .mixers = { alc262_sony_mixer },
11712 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11713 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11714 .dac_nids = alc262_dac_nids,
11716 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11717 .channel_mode = alc262_modes,
11718 .input_mux = &alc262_capture_source,
11719 .unsol_event = alc262_hippo_unsol_event,
11720 .setup = alc262_hippo_setup,
11721 .init_hook = alc262_hippo_automute,
11723 [ALC262_BENQ_T31] = {
11724 .mixers = { alc262_benq_t31_mixer },
11725 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11726 alc_hp15_unsol_verbs },
11727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11728 .dac_nids = alc262_dac_nids,
11730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11731 .channel_mode = alc262_modes,
11732 .input_mux = &alc262_capture_source,
11733 .unsol_event = alc262_hippo_unsol_event,
11734 .setup = alc262_hippo_setup,
11735 .init_hook = alc262_hippo_automute,
11738 .mixers = { alc262_ultra_mixer },
11739 .cap_mixer = alc262_ultra_capture_mixer,
11740 .init_verbs = { alc262_ultra_verbs },
11741 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11742 .dac_nids = alc262_dac_nids,
11743 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11744 .channel_mode = alc262_modes,
11745 .input_mux = &alc262_ultra_capture_source,
11746 .adc_nids = alc262_adc_nids, /* ADC0 */
11747 .capsrc_nids = alc262_capsrc_nids,
11748 .num_adc_nids = 1, /* single ADC */
11749 .unsol_event = alc262_ultra_unsol_event,
11750 .init_hook = alc262_ultra_automute,
11752 [ALC262_LENOVO_3000] = {
11753 .mixers = { alc262_lenovo_3000_mixer },
11754 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11755 alc262_lenovo_3000_unsol_verbs,
11756 alc262_lenovo_3000_init_verbs },
11757 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11758 .dac_nids = alc262_dac_nids,
11760 .dig_out_nid = ALC262_DIGOUT_NID,
11761 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11762 .channel_mode = alc262_modes,
11763 .input_mux = &alc262_fujitsu_capture_source,
11764 .unsol_event = alc262_lenovo_3000_unsol_event,
11767 .mixers = { alc262_nec_mixer },
11768 .init_verbs = { alc262_nec_verbs },
11769 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11770 .dac_nids = alc262_dac_nids,
11772 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11773 .channel_mode = alc262_modes,
11774 .input_mux = &alc262_capture_source,
11776 [ALC262_TOSHIBA_S06] = {
11777 .mixers = { alc262_toshiba_s06_mixer },
11778 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11779 alc262_eapd_verbs },
11780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11781 .capsrc_nids = alc262_dmic_capsrc_nids,
11782 .dac_nids = alc262_dac_nids,
11783 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11784 .num_adc_nids = 1, /* single ADC */
11785 .dig_out_nid = ALC262_DIGOUT_NID,
11786 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11787 .channel_mode = alc262_modes,
11788 .unsol_event = alc_sku_unsol_event,
11789 .setup = alc262_toshiba_s06_setup,
11790 .init_hook = alc_inithook,
11792 [ALC262_TOSHIBA_RX1] = {
11793 .mixers = { alc262_toshiba_rx1_mixer },
11794 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11795 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11796 .dac_nids = alc262_dac_nids,
11798 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11799 .channel_mode = alc262_modes,
11800 .input_mux = &alc262_capture_source,
11801 .unsol_event = alc262_hippo_unsol_event,
11802 .setup = alc262_hippo_setup,
11803 .init_hook = alc262_hippo_automute,
11806 .mixers = { alc262_tyan_mixer },
11807 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11808 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11809 .dac_nids = alc262_dac_nids,
11811 .dig_out_nid = ALC262_DIGOUT_NID,
11812 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11813 .channel_mode = alc262_modes,
11814 .input_mux = &alc262_capture_source,
11815 .unsol_event = alc_automute_amp_unsol_event,
11816 .setup = alc262_tyan_setup,
11817 .init_hook = alc_automute_amp,
11821 static int patch_alc262(struct hda_codec *codec)
11823 struct alc_spec *spec;
11827 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11831 codec->spec = spec;
11833 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11838 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11839 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11840 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11841 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11845 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11847 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11851 if (board_config < 0) {
11852 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11854 board_config = ALC262_AUTO;
11857 if (board_config == ALC262_AUTO) {
11858 /* automatic parse from the BIOS config */
11859 err = alc262_parse_auto_config(codec);
11865 "hda_codec: Cannot set up configuration "
11866 "from BIOS. Using base mode...\n");
11867 board_config = ALC262_BASIC;
11871 if (!spec->no_analog) {
11872 err = snd_hda_attach_beep_device(codec, 0x1);
11879 if (board_config != ALC262_AUTO)
11880 setup_preset(codec, &alc262_presets[board_config]);
11882 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11883 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11885 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11886 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11888 if (!spec->adc_nids && spec->input_mux) {
11890 /* check whether the digital-mic has to be supported */
11891 for (i = 0; i < spec->input_mux->num_items; i++) {
11892 if (spec->input_mux->items[i].index >= 9)
11895 if (i < spec->input_mux->num_items) {
11896 /* use only ADC0 */
11897 spec->adc_nids = alc262_dmic_adc_nids;
11898 spec->num_adc_nids = 1;
11899 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11901 /* all analog inputs */
11902 /* check whether NID 0x07 is valid */
11903 unsigned int wcap = get_wcaps(codec, 0x07);
11906 wcap = get_wcaps_type(wcap);
11907 if (wcap != AC_WID_AUD_IN) {
11908 spec->adc_nids = alc262_adc_nids_alt;
11909 spec->num_adc_nids =
11910 ARRAY_SIZE(alc262_adc_nids_alt);
11911 spec->capsrc_nids = alc262_capsrc_nids_alt;
11913 spec->adc_nids = alc262_adc_nids;
11914 spec->num_adc_nids =
11915 ARRAY_SIZE(alc262_adc_nids);
11916 spec->capsrc_nids = alc262_capsrc_nids;
11920 if (!spec->cap_mixer && !spec->no_analog)
11921 set_capture_mixer(codec);
11922 if (!spec->no_analog)
11923 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11925 spec->vmaster_nid = 0x0c;
11927 codec->patch_ops = alc_patch_ops;
11928 if (board_config == ALC262_AUTO)
11929 spec->init_hook = alc262_auto_init;
11930 #ifdef CONFIG_SND_HDA_POWER_SAVE
11931 if (!spec->loopback.amplist)
11932 spec->loopback.amplist = alc262_loopbacks;
11934 codec->proc_widget_hook = print_realtek_coef;
11940 * ALC268 channel source setting (2 channel)
11942 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11943 #define alc268_modes alc260_modes
11945 static hda_nid_t alc268_dac_nids[2] = {
11950 static hda_nid_t alc268_adc_nids[2] = {
11955 static hda_nid_t alc268_adc_nids_alt[1] = {
11960 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11962 static struct snd_kcontrol_new alc268_base_mixer[] = {
11963 /* output mixer control */
11964 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11965 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11969 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11970 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11974 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11975 /* output mixer control */
11976 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11977 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11978 ALC262_HIPPO_MASTER_SWITCH,
11979 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11980 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11981 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11985 /* bind Beep switches of both NID 0x0f and 0x10 */
11986 static struct hda_bind_ctls alc268_bind_beep_sw = {
11987 .ops = &snd_hda_bind_sw,
11989 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11990 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11995 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11996 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11997 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12001 static struct hda_verb alc268_eapd_verbs[] = {
12002 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12003 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12007 /* Toshiba specific */
12008 static struct hda_verb alc268_toshiba_verbs[] = {
12009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12013 /* Acer specific */
12014 /* bind volumes of both NID 0x02 and 0x03 */
12015 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12016 .ops = &snd_hda_bind_vol,
12018 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12019 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12024 /* mute/unmute internal speaker according to the hp jack and mute state */
12025 static void alc268_acer_automute(struct hda_codec *codec, int force)
12027 struct alc_spec *spec = codec->spec;
12030 if (force || !spec->sense_updated) {
12031 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12032 spec->sense_updated = 1;
12034 if (spec->jack_present)
12035 mute = HDA_AMP_MUTE; /* mute internal speaker */
12036 else /* unmute internal speaker if necessary */
12037 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12038 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12039 HDA_AMP_MUTE, mute);
12043 /* bind hp and internal speaker mute (with plug check) */
12044 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12045 struct snd_ctl_elem_value *ucontrol)
12047 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12048 long *valp = ucontrol->value.integer.value;
12051 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12053 alc268_acer_automute(codec, 0);
12057 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12058 /* output mixer control */
12059 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12062 .name = "Master Playback Switch",
12063 .info = snd_hda_mixer_amp_switch_info,
12064 .get = snd_hda_mixer_amp_switch_get,
12065 .put = alc268_acer_master_sw_put,
12066 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12068 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12072 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12073 /* output mixer control */
12074 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12077 .name = "Master Playback Switch",
12078 .info = snd_hda_mixer_amp_switch_info,
12079 .get = snd_hda_mixer_amp_switch_get,
12080 .put = alc268_acer_master_sw_put,
12081 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12084 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12085 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12089 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12090 /* output mixer control */
12091 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12094 .name = "Master Playback Switch",
12095 .info = snd_hda_mixer_amp_switch_info,
12096 .get = snd_hda_mixer_amp_switch_get,
12097 .put = alc268_acer_master_sw_put,
12098 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12101 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12105 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12106 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12108 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12110 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12115 static struct hda_verb alc268_acer_verbs[] = {
12116 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12117 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12118 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12120 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12121 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12122 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12126 /* unsolicited event for HP jack sensing */
12127 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12128 #define alc268_toshiba_setup alc262_hippo_setup
12129 #define alc268_toshiba_automute alc262_hippo_automute
12131 static void alc268_acer_unsol_event(struct hda_codec *codec,
12134 if ((res >> 26) != ALC880_HP_EVENT)
12136 alc268_acer_automute(codec, 1);
12139 static void alc268_acer_init_hook(struct hda_codec *codec)
12141 alc268_acer_automute(codec, 1);
12144 /* toggle speaker-output according to the hp-jack state */
12145 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12147 unsigned int present;
12148 unsigned char bits;
12150 present = snd_hda_jack_detect(codec, 0x15);
12151 bits = present ? AMP_IN_MUTE(0) : 0;
12152 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12153 AMP_IN_MUTE(0), bits);
12154 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12155 AMP_IN_MUTE(0), bits);
12158 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12161 switch (res >> 26) {
12162 case ALC880_HP_EVENT:
12163 alc268_aspire_one_speaker_automute(codec);
12165 case ALC880_MIC_EVENT:
12166 alc_mic_automute(codec);
12171 static void alc268_acer_lc_setup(struct hda_codec *codec)
12173 struct alc_spec *spec = codec->spec;
12174 spec->ext_mic.pin = 0x18;
12175 spec->ext_mic.mux_idx = 0;
12176 spec->int_mic.pin = 0x12;
12177 spec->int_mic.mux_idx = 6;
12178 spec->auto_mic = 1;
12181 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12183 alc268_aspire_one_speaker_automute(codec);
12184 alc_mic_automute(codec);
12187 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12188 /* output mixer control */
12189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12190 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12191 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12194 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12198 static struct hda_verb alc268_dell_verbs[] = {
12199 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12201 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12202 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12206 /* mute/unmute internal speaker according to the hp jack and mute state */
12207 static void alc268_dell_setup(struct hda_codec *codec)
12209 struct alc_spec *spec = codec->spec;
12211 spec->autocfg.hp_pins[0] = 0x15;
12212 spec->autocfg.speaker_pins[0] = 0x14;
12213 spec->ext_mic.pin = 0x18;
12214 spec->ext_mic.mux_idx = 0;
12215 spec->int_mic.pin = 0x19;
12216 spec->int_mic.mux_idx = 1;
12217 spec->auto_mic = 1;
12220 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12221 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12222 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12223 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12225 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12226 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12227 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12228 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12232 static struct hda_verb alc267_quanta_il1_verbs[] = {
12233 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12234 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12238 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12240 struct alc_spec *spec = codec->spec;
12241 spec->autocfg.hp_pins[0] = 0x15;
12242 spec->autocfg.speaker_pins[0] = 0x14;
12243 spec->ext_mic.pin = 0x18;
12244 spec->ext_mic.mux_idx = 0;
12245 spec->int_mic.pin = 0x19;
12246 spec->int_mic.mux_idx = 1;
12247 spec->auto_mic = 1;
12251 * generic initialization of ADC, input mixers and output mixers
12253 static struct hda_verb alc268_base_init_verbs[] = {
12254 /* Unmute DAC0-1 and set vol = 0 */
12255 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12256 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12259 * Set up output mixers (0x0c - 0x0e)
12261 /* set vol=0 to output mixers */
12262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12263 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12266 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12270 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12271 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12272 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12274 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12275 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12279 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12280 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12283 /* set PCBEEP vol = 0, mute connections */
12284 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12286 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12288 /* Unmute Selector 23h,24h and set the default input to mic-in */
12290 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12292 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12293 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12299 * generic initialization of ADC, input mixers and output mixers
12301 static struct hda_verb alc268_volume_init_verbs[] = {
12302 /* set output DAC */
12303 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12304 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12308 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12310 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12314 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12319 /* set PCBEEP vol = 0, mute connections */
12320 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12322 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12327 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12328 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12329 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12333 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12334 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12335 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12340 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12341 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12342 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12343 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12344 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12349 static struct hda_input_mux alc268_capture_source = {
12353 { "Front Mic", 0x1 },
12359 static struct hda_input_mux alc268_acer_capture_source = {
12363 { "Internal Mic", 0x1 },
12368 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12372 { "Internal Mic", 0x6 },
12377 #ifdef CONFIG_SND_DEBUG
12378 static struct snd_kcontrol_new alc268_test_mixer[] = {
12379 /* Volume widgets */
12380 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12381 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12382 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12383 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12384 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12385 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12386 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12387 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12388 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12389 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12390 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12391 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12392 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12393 /* The below appears problematic on some hardwares */
12394 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12395 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12396 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12397 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12398 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12400 /* Modes for retasking pin widgets */
12401 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12402 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12403 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12404 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12406 /* Controls for GPIO pins, assuming they are configured as outputs */
12407 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12408 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12409 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12410 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12412 /* Switches to allow the digital SPDIF output pin to be enabled.
12413 * The ALC268 does not have an SPDIF input.
12415 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12417 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12418 * this output to turn on an external amplifier.
12420 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12421 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12427 /* create input playback/capture controls for the given pin */
12428 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12429 const char *ctlname, int idx)
12445 if (spec->multiout.dac_nids[0] != dac &&
12446 spec->multiout.dac_nids[1] != dac) {
12447 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12448 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12452 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12456 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12457 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12459 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12460 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12466 /* add playback controls from the parsed DAC table */
12467 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12468 const struct auto_pin_cfg *cfg)
12473 spec->multiout.dac_nids = spec->private_dac_nids;
12475 nid = cfg->line_out_pins[0];
12478 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12482 err = alc268_new_analog_output(spec, nid, name, 0);
12487 nid = cfg->speaker_pins[0];
12489 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12490 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12494 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12498 nid = cfg->hp_pins[0];
12500 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12505 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12507 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12508 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12515 /* create playback/capture controls for input pins */
12516 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12517 const struct auto_pin_cfg *cfg)
12519 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12522 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12523 hda_nid_t nid, int pin_type)
12527 alc_set_pin_output(codec, nid, pin_type);
12528 if (nid == 0x14 || nid == 0x16)
12532 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12535 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12537 struct alc_spec *spec = codec->spec;
12538 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12540 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12541 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12545 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12547 struct alc_spec *spec = codec->spec;
12550 pin = spec->autocfg.hp_pins[0];
12552 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12553 pin = spec->autocfg.speaker_pins[0];
12555 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12558 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12560 struct alc_spec *spec = codec->spec;
12561 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12562 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12563 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12564 unsigned int dac_vol1, dac_vol2;
12566 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12567 snd_hda_codec_write(codec, speaker_nid, 0,
12568 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12569 /* mute mixer inputs from 0x1d */
12570 snd_hda_codec_write(codec, 0x0f, 0,
12571 AC_VERB_SET_AMP_GAIN_MUTE,
12573 snd_hda_codec_write(codec, 0x10, 0,
12574 AC_VERB_SET_AMP_GAIN_MUTE,
12577 /* unmute mixer inputs from 0x1d */
12578 snd_hda_codec_write(codec, 0x0f, 0,
12579 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12580 snd_hda_codec_write(codec, 0x10, 0,
12581 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12584 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12585 if (line_nid == 0x14)
12586 dac_vol2 = AMP_OUT_ZERO;
12587 else if (line_nid == 0x15)
12588 dac_vol1 = AMP_OUT_ZERO;
12589 if (hp_nid == 0x14)
12590 dac_vol2 = AMP_OUT_ZERO;
12591 else if (hp_nid == 0x15)
12592 dac_vol1 = AMP_OUT_ZERO;
12593 if (line_nid != 0x16 || hp_nid != 0x16 ||
12594 spec->autocfg.line_out_pins[1] != 0x16 ||
12595 spec->autocfg.line_out_pins[2] != 0x16)
12596 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12598 snd_hda_codec_write(codec, 0x02, 0,
12599 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12600 snd_hda_codec_write(codec, 0x03, 0,
12601 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12604 /* pcm configuration: identical with ALC880 */
12605 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12606 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12607 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12608 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12611 * BIOS auto configuration
12613 static int alc268_parse_auto_config(struct hda_codec *codec)
12615 struct alc_spec *spec = codec->spec;
12617 static hda_nid_t alc268_ignore[] = { 0 };
12619 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12623 if (!spec->autocfg.line_outs) {
12624 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12625 spec->multiout.max_channels = 2;
12626 spec->no_analog = 1;
12629 return 0; /* can't find valid BIOS pin config */
12631 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12634 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12638 spec->multiout.max_channels = 2;
12641 /* digital only support output */
12642 if (spec->autocfg.dig_outs) {
12643 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12644 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12646 if (spec->kctls.list)
12647 add_mixer(spec, spec->kctls.list);
12649 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12650 add_mixer(spec, alc268_beep_mixer);
12652 add_verb(spec, alc268_volume_init_verbs);
12653 spec->num_mux_defs = 2;
12654 spec->input_mux = &spec->private_imux[0];
12656 err = alc_auto_add_mic_boost(codec);
12660 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12665 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12667 /* init callback for auto-configuration model -- overriding the default init */
12668 static void alc268_auto_init(struct hda_codec *codec)
12670 struct alc_spec *spec = codec->spec;
12671 alc268_auto_init_multi_out(codec);
12672 alc268_auto_init_hp_out(codec);
12673 alc268_auto_init_mono_speaker_out(codec);
12674 alc268_auto_init_analog_input(codec);
12675 if (spec->unsol_event)
12676 alc_inithook(codec);
12680 * configuration and preset
12682 static const char *alc268_models[ALC268_MODEL_LAST] = {
12683 [ALC267_QUANTA_IL1] = "quanta-il1",
12684 [ALC268_3ST] = "3stack",
12685 [ALC268_TOSHIBA] = "toshiba",
12686 [ALC268_ACER] = "acer",
12687 [ALC268_ACER_DMIC] = "acer-dmic",
12688 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12689 [ALC268_DELL] = "dell",
12690 [ALC268_ZEPTO] = "zepto",
12691 #ifdef CONFIG_SND_DEBUG
12692 [ALC268_TEST] = "test",
12694 [ALC268_AUTO] = "auto",
12697 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12698 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12699 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12700 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12701 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12702 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12703 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12704 ALC268_ACER_ASPIRE_ONE),
12705 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12706 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12707 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12708 /* almost compatible with toshiba but with optional digital outs;
12709 * auto-probing seems working fine
12711 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12713 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12714 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12715 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12716 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12717 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12718 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12722 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12723 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12724 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12725 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12726 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12731 static struct alc_config_preset alc268_presets[] = {
12732 [ALC267_QUANTA_IL1] = {
12733 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12734 alc268_capture_nosrc_mixer },
12735 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12736 alc267_quanta_il1_verbs },
12737 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12738 .dac_nids = alc268_dac_nids,
12739 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12740 .adc_nids = alc268_adc_nids_alt,
12742 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12743 .channel_mode = alc268_modes,
12744 .unsol_event = alc_sku_unsol_event,
12745 .setup = alc267_quanta_il1_setup,
12746 .init_hook = alc_inithook,
12749 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12750 alc268_beep_mixer },
12751 .init_verbs = { alc268_base_init_verbs },
12752 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12753 .dac_nids = alc268_dac_nids,
12754 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12755 .adc_nids = alc268_adc_nids_alt,
12756 .capsrc_nids = alc268_capsrc_nids,
12758 .dig_out_nid = ALC268_DIGOUT_NID,
12759 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12760 .channel_mode = alc268_modes,
12761 .input_mux = &alc268_capture_source,
12763 [ALC268_TOSHIBA] = {
12764 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12765 alc268_beep_mixer },
12766 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12767 alc268_toshiba_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 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12775 .channel_mode = alc268_modes,
12776 .input_mux = &alc268_capture_source,
12777 .unsol_event = alc268_toshiba_unsol_event,
12778 .setup = alc268_toshiba_setup,
12779 .init_hook = alc268_toshiba_automute,
12782 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12783 alc268_beep_mixer },
12784 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12785 alc268_acer_verbs },
12786 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12787 .dac_nids = alc268_dac_nids,
12788 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12789 .adc_nids = alc268_adc_nids_alt,
12790 .capsrc_nids = alc268_capsrc_nids,
12792 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12793 .channel_mode = alc268_modes,
12794 .input_mux = &alc268_acer_capture_source,
12795 .unsol_event = alc268_acer_unsol_event,
12796 .init_hook = alc268_acer_init_hook,
12798 [ALC268_ACER_DMIC] = {
12799 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12800 alc268_beep_mixer },
12801 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12802 alc268_acer_verbs },
12803 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12804 .dac_nids = alc268_dac_nids,
12805 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12806 .adc_nids = alc268_adc_nids_alt,
12807 .capsrc_nids = alc268_capsrc_nids,
12809 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12810 .channel_mode = alc268_modes,
12811 .input_mux = &alc268_acer_dmic_capture_source,
12812 .unsol_event = alc268_acer_unsol_event,
12813 .init_hook = alc268_acer_init_hook,
12815 [ALC268_ACER_ASPIRE_ONE] = {
12816 .mixers = { alc268_acer_aspire_one_mixer,
12818 alc268_capture_nosrc_mixer },
12819 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12820 alc268_acer_aspire_one_verbs },
12821 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12822 .dac_nids = alc268_dac_nids,
12823 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12824 .adc_nids = alc268_adc_nids_alt,
12825 .capsrc_nids = alc268_capsrc_nids,
12827 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12828 .channel_mode = alc268_modes,
12829 .unsol_event = alc268_acer_lc_unsol_event,
12830 .setup = alc268_acer_lc_setup,
12831 .init_hook = alc268_acer_lc_init_hook,
12834 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12835 alc268_capture_nosrc_mixer },
12836 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12837 alc268_dell_verbs },
12838 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12839 .dac_nids = alc268_dac_nids,
12840 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12841 .adc_nids = alc268_adc_nids_alt,
12842 .capsrc_nids = alc268_capsrc_nids,
12844 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12845 .channel_mode = alc268_modes,
12846 .unsol_event = alc_sku_unsol_event,
12847 .setup = alc268_dell_setup,
12848 .init_hook = alc_inithook,
12851 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12852 alc268_beep_mixer },
12853 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12854 alc268_toshiba_verbs },
12855 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12856 .dac_nids = alc268_dac_nids,
12857 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12858 .adc_nids = alc268_adc_nids_alt,
12859 .capsrc_nids = alc268_capsrc_nids,
12861 .dig_out_nid = ALC268_DIGOUT_NID,
12862 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12863 .channel_mode = alc268_modes,
12864 .input_mux = &alc268_capture_source,
12865 .setup = alc268_toshiba_setup,
12866 .init_hook = alc268_toshiba_automute,
12868 #ifdef CONFIG_SND_DEBUG
12870 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12871 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12872 alc268_volume_init_verbs },
12873 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12874 .dac_nids = alc268_dac_nids,
12875 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12876 .adc_nids = alc268_adc_nids_alt,
12877 .capsrc_nids = alc268_capsrc_nids,
12879 .dig_out_nid = ALC268_DIGOUT_NID,
12880 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12881 .channel_mode = alc268_modes,
12882 .input_mux = &alc268_capture_source,
12887 static int patch_alc268(struct hda_codec *codec)
12889 struct alc_spec *spec;
12891 int i, has_beep, err;
12893 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12897 codec->spec = spec;
12899 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12903 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12904 board_config = snd_hda_check_board_codec_sid_config(codec,
12905 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12907 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12908 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12910 board_config = ALC268_AUTO;
12913 if (board_config == ALC268_AUTO) {
12914 /* automatic parse from the BIOS config */
12915 err = alc268_parse_auto_config(codec);
12921 "hda_codec: Cannot set up configuration "
12922 "from BIOS. Using base mode...\n");
12923 board_config = ALC268_3ST;
12927 if (board_config != ALC268_AUTO)
12928 setup_preset(codec, &alc268_presets[board_config]);
12930 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12931 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12932 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12934 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12937 for (i = 0; i < spec->num_mixers; i++) {
12938 if (spec->mixers[i] == alc268_beep_mixer) {
12945 err = snd_hda_attach_beep_device(codec, 0x1);
12950 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12951 /* override the amp caps for beep generator */
12952 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12953 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12954 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12955 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12956 (0 << AC_AMPCAP_MUTE_SHIFT));
12959 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12960 /* check whether NID 0x07 is valid */
12961 unsigned int wcap = get_wcaps(codec, 0x07);
12964 spec->capsrc_nids = alc268_capsrc_nids;
12966 wcap = get_wcaps_type(wcap);
12967 if (spec->auto_mic ||
12968 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12969 spec->adc_nids = alc268_adc_nids_alt;
12970 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12971 if (spec->auto_mic)
12972 fixup_automic_adc(codec);
12973 if (spec->auto_mic || spec->input_mux->num_items == 1)
12974 add_mixer(spec, alc268_capture_nosrc_mixer);
12976 add_mixer(spec, alc268_capture_alt_mixer);
12978 spec->adc_nids = alc268_adc_nids;
12979 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12980 add_mixer(spec, alc268_capture_mixer);
12982 /* set default input source */
12983 for (i = 0; i < spec->num_adc_nids; i++)
12984 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12985 0, AC_VERB_SET_CONNECT_SEL,
12986 i < spec->num_mux_defs ?
12987 spec->input_mux[i].items[0].index :
12988 spec->input_mux->items[0].index);
12991 spec->vmaster_nid = 0x02;
12993 codec->patch_ops = alc_patch_ops;
12994 if (board_config == ALC268_AUTO)
12995 spec->init_hook = alc268_auto_init;
12997 codec->proc_widget_hook = print_realtek_coef;
13003 * ALC269 channel source setting (2 channel)
13005 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13007 #define alc269_dac_nids alc260_dac_nids
13009 static hda_nid_t alc269_adc_nids[1] = {
13014 static hda_nid_t alc269_capsrc_nids[1] = {
13018 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13022 #define alc269_modes alc260_modes
13023 #define alc269_capture_source alc880_lg_lw_capture_source
13025 static struct snd_kcontrol_new alc269_base_mixer[] = {
13026 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13027 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13033 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13034 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13037 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13041 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13042 /* output mixer control */
13043 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13045 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13046 .name = "Master Playback Switch",
13047 .info = snd_hda_mixer_amp_switch_info,
13048 .get = snd_hda_mixer_amp_switch_get,
13049 .put = alc268_acer_master_sw_put,
13050 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13054 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13055 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13056 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13057 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13061 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13062 /* output mixer control */
13063 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13065 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13066 .name = "Master Playback Switch",
13067 .info = snd_hda_mixer_amp_switch_info,
13068 .get = snd_hda_mixer_amp_switch_get,
13069 .put = alc268_acer_master_sw_put,
13070 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13075 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13076 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13077 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13078 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13079 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13080 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13084 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13085 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13086 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13088 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13092 /* capture mixer elements */
13093 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13094 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13095 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13101 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13103 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13104 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13105 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13107 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13109 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13113 static struct hda_verb alc269_lifebook_verbs[] = {
13114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13115 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13116 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13118 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13120 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13121 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13123 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13127 /* toggle speaker-output according to the hp-jack state */
13128 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13130 unsigned int present;
13131 unsigned char bits;
13133 present = snd_hda_jack_detect(codec, 0x15);
13134 bits = present ? AMP_IN_MUTE(0) : 0;
13135 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13136 AMP_IN_MUTE(0), bits);
13137 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13138 AMP_IN_MUTE(0), bits);
13140 snd_hda_codec_write(codec, 0x20, 0,
13141 AC_VERB_SET_COEF_INDEX, 0x0c);
13142 snd_hda_codec_write(codec, 0x20, 0,
13143 AC_VERB_SET_PROC_COEF, 0x680);
13145 snd_hda_codec_write(codec, 0x20, 0,
13146 AC_VERB_SET_COEF_INDEX, 0x0c);
13147 snd_hda_codec_write(codec, 0x20, 0,
13148 AC_VERB_SET_PROC_COEF, 0x480);
13151 /* toggle speaker-output according to the hp-jacks state */
13152 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13154 unsigned int present;
13155 unsigned char bits;
13157 /* Check laptop headphone socket */
13158 present = snd_hda_jack_detect(codec, 0x15);
13160 /* Check port replicator headphone socket */
13161 present |= snd_hda_jack_detect(codec, 0x1a);
13163 bits = present ? AMP_IN_MUTE(0) : 0;
13164 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13165 AMP_IN_MUTE(0), bits);
13166 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13167 AMP_IN_MUTE(0), bits);
13169 snd_hda_codec_write(codec, 0x20, 0,
13170 AC_VERB_SET_COEF_INDEX, 0x0c);
13171 snd_hda_codec_write(codec, 0x20, 0,
13172 AC_VERB_SET_PROC_COEF, 0x680);
13174 snd_hda_codec_write(codec, 0x20, 0,
13175 AC_VERB_SET_COEF_INDEX, 0x0c);
13176 snd_hda_codec_write(codec, 0x20, 0,
13177 AC_VERB_SET_PROC_COEF, 0x480);
13180 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13182 unsigned int present_laptop;
13183 unsigned int present_dock;
13185 present_laptop = snd_hda_jack_detect(codec, 0x18);
13186 present_dock = snd_hda_jack_detect(codec, 0x1b);
13188 /* Laptop mic port overrides dock mic port, design decision */
13190 snd_hda_codec_write(codec, 0x23, 0,
13191 AC_VERB_SET_CONNECT_SEL, 0x3);
13192 if (present_laptop)
13193 snd_hda_codec_write(codec, 0x23, 0,
13194 AC_VERB_SET_CONNECT_SEL, 0x0);
13195 if (!present_dock && !present_laptop)
13196 snd_hda_codec_write(codec, 0x23, 0,
13197 AC_VERB_SET_CONNECT_SEL, 0x1);
13200 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13203 switch (res >> 26) {
13204 case ALC880_HP_EVENT:
13205 alc269_quanta_fl1_speaker_automute(codec);
13207 case ALC880_MIC_EVENT:
13208 alc_mic_automute(codec);
13213 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13216 if ((res >> 26) == ALC880_HP_EVENT)
13217 alc269_lifebook_speaker_automute(codec);
13218 if ((res >> 26) == ALC880_MIC_EVENT)
13219 alc269_lifebook_mic_autoswitch(codec);
13222 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13224 struct alc_spec *spec = codec->spec;
13225 spec->ext_mic.pin = 0x18;
13226 spec->ext_mic.mux_idx = 0;
13227 spec->int_mic.pin = 0x19;
13228 spec->int_mic.mux_idx = 1;
13229 spec->auto_mic = 1;
13232 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13234 alc269_quanta_fl1_speaker_automute(codec);
13235 alc_mic_automute(codec);
13238 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13240 alc269_lifebook_speaker_automute(codec);
13241 alc269_lifebook_mic_autoswitch(codec);
13244 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13246 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13247 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13249 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13250 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13255 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13257 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13258 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13259 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13261 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13265 /* toggle speaker-output according to the hp-jack state */
13266 static void alc269_speaker_automute(struct hda_codec *codec)
13268 struct alc_spec *spec = codec->spec;
13269 unsigned int nid = spec->autocfg.hp_pins[0];
13270 unsigned int present;
13271 unsigned char bits;
13273 present = snd_hda_jack_detect(codec, nid);
13274 bits = present ? AMP_IN_MUTE(0) : 0;
13275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13276 AMP_IN_MUTE(0), bits);
13277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13278 AMP_IN_MUTE(0), bits);
13281 /* unsolicited event for HP jack sensing */
13282 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13285 switch (res >> 26) {
13286 case ALC880_HP_EVENT:
13287 alc269_speaker_automute(codec);
13289 case ALC880_MIC_EVENT:
13290 alc_mic_automute(codec);
13295 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13297 struct alc_spec *spec = codec->spec;
13298 spec->ext_mic.pin = 0x18;
13299 spec->ext_mic.mux_idx = 0;
13300 spec->int_mic.pin = 0x12;
13301 spec->int_mic.mux_idx = 5;
13302 spec->auto_mic = 1;
13305 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13307 struct alc_spec *spec = codec->spec;
13308 spec->ext_mic.pin = 0x18;
13309 spec->ext_mic.mux_idx = 0;
13310 spec->int_mic.pin = 0x19;
13311 spec->int_mic.mux_idx = 1;
13312 spec->auto_mic = 1;
13315 static void alc269_eeepc_inithook(struct hda_codec *codec)
13317 alc269_speaker_automute(codec);
13318 alc_mic_automute(codec);
13322 * generic initialization of ADC, input mixers and output mixers
13324 static struct hda_verb alc269_init_verbs[] = {
13326 * Unmute ADC0 and set the default input to mic-in
13328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13330 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13331 * analog-loopback mixer widget
13332 * Note: PASD motherboards uses the Line In 2 as the input for
13333 * front panel mic (mic 2)
13335 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13343 * Set up output mixers (0x0c - 0x0e)
13345 /* set vol=0 to output mixers */
13346 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13347 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13349 /* set up input amps for analog loopback */
13350 /* Amp Indices: DAC = 0, mixer = 1 */
13351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13360 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13364 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13366 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13370 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13372 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13374 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13377 /* FIXME: use matrix-type input source selection */
13378 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13379 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13380 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13386 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13387 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13391 #define alc269_auto_create_multi_out_ctls \
13392 alc268_auto_create_multi_out_ctls
13393 #define alc269_auto_create_input_ctls \
13394 alc268_auto_create_input_ctls
13396 #ifdef CONFIG_SND_HDA_POWER_SAVE
13397 #define alc269_loopbacks alc880_loopbacks
13400 /* pcm configuration: identical with ALC880 */
13401 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13402 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13403 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13404 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13406 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13410 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13411 /* NID is set in alc_build_pcms */
13413 .open = alc880_playback_pcm_open,
13414 .prepare = alc880_playback_pcm_prepare,
13415 .cleanup = alc880_playback_pcm_cleanup
13419 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13423 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13424 /* NID is set in alc_build_pcms */
13428 * BIOS auto configuration
13430 static int alc269_parse_auto_config(struct hda_codec *codec)
13432 struct alc_spec *spec = codec->spec;
13434 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13436 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13441 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13444 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13448 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13450 if (spec->autocfg.dig_outs)
13451 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13453 if (spec->kctls.list)
13454 add_mixer(spec, spec->kctls.list);
13456 add_verb(spec, alc269_init_verbs);
13457 spec->num_mux_defs = 1;
13458 spec->input_mux = &spec->private_imux[0];
13459 /* set default input source */
13460 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13461 0, AC_VERB_SET_CONNECT_SEL,
13462 spec->input_mux->items[0].index);
13464 err = alc_auto_add_mic_boost(codec);
13468 if (!spec->cap_mixer && !spec->no_analog)
13469 set_capture_mixer(codec);
13471 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13476 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13477 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13478 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13481 /* init callback for auto-configuration model -- overriding the default init */
13482 static void alc269_auto_init(struct hda_codec *codec)
13484 struct alc_spec *spec = codec->spec;
13485 alc269_auto_init_multi_out(codec);
13486 alc269_auto_init_hp_out(codec);
13487 alc269_auto_init_analog_input(codec);
13488 if (spec->unsol_event)
13489 alc_inithook(codec);
13493 * configuration and preset
13495 static const char *alc269_models[ALC269_MODEL_LAST] = {
13496 [ALC269_BASIC] = "basic",
13497 [ALC269_QUANTA_FL1] = "quanta",
13498 [ALC269_ASUS_AMIC] = "asus-amic",
13499 [ALC269_ASUS_DMIC] = "asus-dmic",
13500 [ALC269_FUJITSU] = "fujitsu",
13501 [ALC269_LIFEBOOK] = "lifebook",
13502 [ALC269_AUTO] = "auto",
13505 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13506 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13507 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13509 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13510 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13511 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13512 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13513 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13514 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13515 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13516 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13517 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13518 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13519 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13520 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13521 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13522 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13523 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13524 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13525 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13526 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13527 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13528 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13529 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13530 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13531 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13532 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13533 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13534 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13535 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13536 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13537 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13539 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13541 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13542 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13543 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13544 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13548 static struct alc_config_preset alc269_presets[] = {
13550 .mixers = { alc269_base_mixer },
13551 .init_verbs = { alc269_init_verbs },
13552 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13553 .dac_nids = alc269_dac_nids,
13555 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13556 .channel_mode = alc269_modes,
13557 .input_mux = &alc269_capture_source,
13559 [ALC269_QUANTA_FL1] = {
13560 .mixers = { alc269_quanta_fl1_mixer },
13561 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13562 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13563 .dac_nids = alc269_dac_nids,
13565 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13566 .channel_mode = alc269_modes,
13567 .input_mux = &alc269_capture_source,
13568 .unsol_event = alc269_quanta_fl1_unsol_event,
13569 .setup = alc269_quanta_fl1_setup,
13570 .init_hook = alc269_quanta_fl1_init_hook,
13572 [ALC269_ASUS_AMIC] = {
13573 .mixers = { alc269_eeepc_mixer },
13574 .cap_mixer = alc269_epc_capture_mixer,
13575 .init_verbs = { alc269_init_verbs,
13576 alc269_eeepc_amic_init_verbs },
13577 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13578 .dac_nids = alc269_dac_nids,
13580 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13581 .channel_mode = alc269_modes,
13582 .unsol_event = alc269_eeepc_unsol_event,
13583 .setup = alc269_eeepc_amic_setup,
13584 .init_hook = alc269_eeepc_inithook,
13586 [ALC269_ASUS_DMIC] = {
13587 .mixers = { alc269_eeepc_mixer },
13588 .cap_mixer = alc269_epc_capture_mixer,
13589 .init_verbs = { alc269_init_verbs,
13590 alc269_eeepc_dmic_init_verbs },
13591 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13592 .dac_nids = alc269_dac_nids,
13594 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13595 .channel_mode = alc269_modes,
13596 .unsol_event = alc269_eeepc_unsol_event,
13597 .setup = alc269_eeepc_dmic_setup,
13598 .init_hook = alc269_eeepc_inithook,
13600 [ALC269_FUJITSU] = {
13601 .mixers = { alc269_fujitsu_mixer },
13602 .cap_mixer = alc269_epc_capture_mixer,
13603 .init_verbs = { alc269_init_verbs,
13604 alc269_eeepc_dmic_init_verbs },
13605 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13606 .dac_nids = alc269_dac_nids,
13608 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13609 .channel_mode = alc269_modes,
13610 .unsol_event = alc269_eeepc_unsol_event,
13611 .setup = alc269_eeepc_dmic_setup,
13612 .init_hook = alc269_eeepc_inithook,
13614 [ALC269_LIFEBOOK] = {
13615 .mixers = { alc269_lifebook_mixer },
13616 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13617 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13618 .dac_nids = alc269_dac_nids,
13620 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13621 .channel_mode = alc269_modes,
13622 .input_mux = &alc269_capture_source,
13623 .unsol_event = alc269_lifebook_unsol_event,
13624 .init_hook = alc269_lifebook_init_hook,
13628 static int patch_alc269(struct hda_codec *codec)
13630 struct alc_spec *spec;
13634 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13638 codec->spec = spec;
13640 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13642 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13643 kfree(codec->chip_name);
13644 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13645 if (!codec->chip_name) {
13651 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13655 if (board_config < 0) {
13656 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13658 board_config = ALC269_AUTO;
13661 if (board_config == ALC269_AUTO) {
13662 /* automatic parse from the BIOS config */
13663 err = alc269_parse_auto_config(codec);
13669 "hda_codec: Cannot set up configuration "
13670 "from BIOS. Using base mode...\n");
13671 board_config = ALC269_BASIC;
13675 err = snd_hda_attach_beep_device(codec, 0x1);
13681 if (board_config != ALC269_AUTO)
13682 setup_preset(codec, &alc269_presets[board_config]);
13684 if (codec->subsystem_id == 0x17aa3bf8) {
13685 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13686 * fix the sample rate of analog I/O to 44.1kHz
13688 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13689 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13691 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13692 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13694 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13695 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13697 spec->adc_nids = alc269_adc_nids;
13698 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13699 spec->capsrc_nids = alc269_capsrc_nids;
13700 if (!spec->cap_mixer)
13701 set_capture_mixer(codec);
13702 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13704 spec->vmaster_nid = 0x02;
13706 codec->patch_ops = alc_patch_ops;
13707 if (board_config == ALC269_AUTO)
13708 spec->init_hook = alc269_auto_init;
13709 #ifdef CONFIG_SND_HDA_POWER_SAVE
13710 if (!spec->loopback.amplist)
13711 spec->loopback.amplist = alc269_loopbacks;
13713 codec->proc_widget_hook = print_realtek_coef;
13719 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13723 * set the path ways for 2 channel output
13724 * need to set the codec line out and mic 1 pin widgets to inputs
13726 static struct hda_verb alc861_threestack_ch2_init[] = {
13727 /* set pin widget 1Ah (line in) for input */
13728 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13729 /* set pin widget 18h (mic1/2) for input, for mic also enable
13732 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13734 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13736 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13737 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13743 * need to set the codec line out and mic 1 pin widgets to outputs
13745 static struct hda_verb alc861_threestack_ch6_init[] = {
13746 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13747 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13748 /* set pin widget 18h (mic1) for output (CLFE)*/
13749 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13751 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13752 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13754 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13756 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13757 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13762 static struct hda_channel_mode alc861_threestack_modes[2] = {
13763 { 2, alc861_threestack_ch2_init },
13764 { 6, alc861_threestack_ch6_init },
13766 /* Set mic1 as input and unmute the mixer */
13767 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13768 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13769 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13772 /* Set mic1 as output and mute mixer */
13773 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13774 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13775 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13779 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13780 { 2, alc861_uniwill_m31_ch2_init },
13781 { 4, alc861_uniwill_m31_ch4_init },
13784 /* Set mic1 and line-in as input and unmute the mixer */
13785 static struct hda_verb alc861_asus_ch2_init[] = {
13786 /* set pin widget 1Ah (line in) for input */
13787 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13788 /* set pin widget 18h (mic1/2) for input, for mic also enable
13791 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13795 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13796 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13800 /* Set mic1 nad line-in as output and mute mixer */
13801 static struct hda_verb alc861_asus_ch6_init[] = {
13802 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13803 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13804 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13805 /* set pin widget 18h (mic1) for output (CLFE)*/
13806 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13807 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13808 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13809 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13811 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13814 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13819 static struct hda_channel_mode alc861_asus_modes[2] = {
13820 { 2, alc861_asus_ch2_init },
13821 { 6, alc861_asus_ch6_init },
13826 static struct snd_kcontrol_new alc861_base_mixer[] = {
13827 /* output mixer control */
13828 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13829 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13830 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13831 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13832 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13834 /*Input mixer control */
13835 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13836 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13837 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13838 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13839 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13840 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13842 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13843 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13849 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13850 /* output mixer control */
13851 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13852 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13853 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13854 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13855 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13857 /* Input mixer control */
13858 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13859 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13860 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13861 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13862 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13863 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13865 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13866 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13871 .name = "Channel Mode",
13872 .info = alc_ch_mode_info,
13873 .get = alc_ch_mode_get,
13874 .put = alc_ch_mode_put,
13875 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13880 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13881 /* output mixer control */
13882 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13884 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13889 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13890 /* output mixer control */
13891 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13892 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13893 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13894 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13895 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13897 /* Input mixer control */
13898 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13899 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13900 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13901 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13902 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13903 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13905 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13906 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13911 .name = "Channel Mode",
13912 .info = alc_ch_mode_info,
13913 .get = alc_ch_mode_get,
13914 .put = alc_ch_mode_put,
13915 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13920 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13921 /* output mixer control */
13922 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13923 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13924 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13925 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13926 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13928 /* Input mixer control */
13929 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13930 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13931 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13932 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13933 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13934 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13936 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13941 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13942 .name = "Channel Mode",
13943 .info = alc_ch_mode_info,
13944 .get = alc_ch_mode_get,
13945 .put = alc_ch_mode_put,
13946 .private_value = ARRAY_SIZE(alc861_asus_modes),
13951 /* additional mixer */
13952 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13953 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13954 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13959 * generic initialization of ADC, input mixers and output mixers
13961 static struct hda_verb alc861_base_init_verbs[] = {
13963 * Unmute ADC0 and set the default input to mic-in
13965 /* port-A for surround (rear panel) */
13966 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13967 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13968 /* port-B for mic-in (rear panel) with vref */
13969 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13970 /* port-C for line-in (rear panel) */
13971 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13972 /* port-D for Front */
13973 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13974 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13975 /* port-E for HP out (front panel) */
13976 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13977 /* route front PCM to HP */
13978 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13979 /* port-F for mic-in (front panel) with vref */
13980 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13981 /* port-G for CLFE (rear panel) */
13982 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13983 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13984 /* port-H for side (rear panel) */
13985 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13986 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13988 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13989 /* route front mic to ADC1*/
13990 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13991 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13993 /* Unmute DAC0~3 & spdif out*/
13994 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13995 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13996 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13997 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14000 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14001 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14002 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14003 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14004 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14006 /* Unmute Stereo Mixer 15 */
14007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14012 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14013 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14014 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14015 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14019 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14020 /* hp used DAC 3 (Front) */
14021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14027 static struct hda_verb alc861_threestack_init_verbs[] = {
14029 * Unmute ADC0 and set the default input to mic-in
14031 /* port-A for surround (rear panel) */
14032 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14033 /* port-B for mic-in (rear panel) with vref */
14034 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14035 /* port-C for line-in (rear panel) */
14036 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14037 /* port-D for Front */
14038 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14039 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14040 /* port-E for HP out (front panel) */
14041 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14042 /* route front PCM to HP */
14043 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14044 /* port-F for mic-in (front panel) with vref */
14045 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14046 /* port-G for CLFE (rear panel) */
14047 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14048 /* port-H for side (rear panel) */
14049 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14051 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14052 /* route front mic to ADC1*/
14053 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14055 /* Unmute DAC0~3 & spdif out*/
14056 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14057 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14058 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14059 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14062 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14063 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14064 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14065 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14066 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14068 /* Unmute Stereo Mixer 15 */
14069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14074 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14075 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14076 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14077 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14079 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14082 /* hp used DAC 3 (Front) */
14083 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14084 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14088 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14090 * Unmute ADC0 and set the default input to mic-in
14092 /* port-A for surround (rear panel) */
14093 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14094 /* port-B for mic-in (rear panel) with vref */
14095 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14096 /* port-C for line-in (rear panel) */
14097 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14098 /* port-D for Front */
14099 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14100 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14101 /* port-E for HP out (front panel) */
14102 /* this has to be set to VREF80 */
14103 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14104 /* route front PCM to HP */
14105 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14106 /* port-F for mic-in (front panel) with vref */
14107 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14108 /* port-G for CLFE (rear panel) */
14109 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14110 /* port-H for side (rear panel) */
14111 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14113 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14114 /* route front mic to ADC1*/
14115 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14116 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14117 /* Unmute DAC0~3 & spdif out*/
14118 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14119 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14120 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14121 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14124 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14125 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14126 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14127 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14128 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14130 /* Unmute Stereo Mixer 15 */
14131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14136 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14137 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14138 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14141 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14142 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14143 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14144 /* hp used DAC 3 (Front) */
14145 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14146 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14150 static struct hda_verb alc861_asus_init_verbs[] = {
14152 * Unmute ADC0 and set the default input to mic-in
14154 /* port-A for surround (rear panel)
14155 * according to codec#0 this is the HP jack
14157 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14158 /* route front PCM to HP */
14159 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14160 /* port-B for mic-in (rear panel) with vref */
14161 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14162 /* port-C for line-in (rear panel) */
14163 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14164 /* port-D for Front */
14165 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14166 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14167 /* port-E for HP out (front panel) */
14168 /* this has to be set to VREF80 */
14169 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14170 /* route front PCM to HP */
14171 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14172 /* port-F for mic-in (front panel) with vref */
14173 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14174 /* port-G for CLFE (rear panel) */
14175 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14176 /* port-H for side (rear panel) */
14177 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14179 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14180 /* route front mic to ADC1*/
14181 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 /* Unmute DAC0~3 & spdif out*/
14184 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14185 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14186 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14187 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14189 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14190 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14191 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14192 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14193 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14195 /* Unmute Stereo Mixer 15 */
14196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14201 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14202 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14203 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14204 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14209 /* hp used DAC 3 (Front) */
14210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14215 /* additional init verbs for ASUS laptops */
14216 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14217 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14218 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14223 * generic initialization of ADC, input mixers and output mixers
14225 static struct hda_verb alc861_auto_init_verbs[] = {
14227 * Unmute ADC0 and set the default input to mic-in
14229 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14230 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14232 /* Unmute DAC0~3 & spdif out*/
14233 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14234 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14235 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14236 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14239 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14240 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14241 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14242 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14243 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14245 /* Unmute Stereo Mixer 15 */
14246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14252 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14253 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14254 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14255 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14258 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14260 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14263 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14265 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14266 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14267 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14269 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14274 static struct hda_verb alc861_toshiba_init_verbs[] = {
14275 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14280 /* toggle speaker-output according to the hp-jack state */
14281 static void alc861_toshiba_automute(struct hda_codec *codec)
14283 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14285 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14286 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14287 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14288 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14291 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14294 if ((res >> 26) == ALC880_HP_EVENT)
14295 alc861_toshiba_automute(codec);
14298 /* pcm configuration: identical with ALC880 */
14299 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14300 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14301 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14302 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14305 #define ALC861_DIGOUT_NID 0x07
14307 static struct hda_channel_mode alc861_8ch_modes[1] = {
14311 static hda_nid_t alc861_dac_nids[4] = {
14312 /* front, surround, clfe, side */
14313 0x03, 0x06, 0x05, 0x04
14316 static hda_nid_t alc660_dac_nids[3] = {
14317 /* front, clfe, surround */
14321 static hda_nid_t alc861_adc_nids[1] = {
14326 static struct hda_input_mux alc861_capture_source = {
14330 { "Front Mic", 0x3 },
14337 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14339 struct alc_spec *spec = codec->spec;
14340 hda_nid_t mix, srcs[5];
14343 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14345 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14348 for (i = 0; i < num; i++) {
14350 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14351 if (type != AC_WID_AUD_OUT)
14353 for (j = 0; j < spec->multiout.num_dacs; j++)
14354 if (spec->multiout.dac_nids[j] == srcs[i])
14356 if (j >= spec->multiout.num_dacs)
14362 /* fill in the dac_nids table from the parsed pin configuration */
14363 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14364 const struct auto_pin_cfg *cfg)
14366 struct alc_spec *spec = codec->spec;
14368 hda_nid_t nid, dac;
14370 spec->multiout.dac_nids = spec->private_dac_nids;
14371 for (i = 0; i < cfg->line_outs; i++) {
14372 nid = cfg->line_out_pins[i];
14373 dac = alc861_look_for_dac(codec, nid);
14376 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14381 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14382 hda_nid_t nid, unsigned int chs)
14384 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14385 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14388 /* add playback controls from the parsed DAC table */
14389 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14390 const struct auto_pin_cfg *cfg)
14392 struct alc_spec *spec = codec->spec;
14393 static const char *chname[4] = {
14394 "Front", "Surround", NULL /*CLFE*/, "Side"
14399 if (cfg->line_outs == 1) {
14400 const char *pfx = NULL;
14403 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14406 nid = spec->multiout.dac_nids[0];
14407 return alc861_create_out_sw(codec, pfx, nid, 3);
14411 for (i = 0; i < cfg->line_outs; i++) {
14412 nid = spec->multiout.dac_nids[i];
14417 err = alc861_create_out_sw(codec, "Center", nid, 1);
14420 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14424 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14432 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14434 struct alc_spec *spec = codec->spec;
14441 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14442 nid = alc861_look_for_dac(codec, pin);
14444 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14447 spec->multiout.hp_nid = nid;
14453 /* create playback/capture controls for input pins */
14454 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14455 const struct auto_pin_cfg *cfg)
14457 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14460 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14462 int pin_type, hda_nid_t dac)
14464 hda_nid_t mix, srcs[5];
14467 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14469 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14471 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14473 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14476 for (i = 0; i < num; i++) {
14478 if (srcs[i] == dac || srcs[i] == 0x15)
14479 mute = AMP_IN_UNMUTE(i);
14481 mute = AMP_IN_MUTE(i);
14482 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14487 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14489 struct alc_spec *spec = codec->spec;
14492 for (i = 0; i < spec->autocfg.line_outs; i++) {
14493 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14494 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14496 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14497 spec->multiout.dac_nids[i]);
14501 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14503 struct alc_spec *spec = codec->spec;
14505 if (spec->autocfg.hp_outs)
14506 alc861_auto_set_output_and_unmute(codec,
14507 spec->autocfg.hp_pins[0],
14509 spec->multiout.hp_nid);
14510 if (spec->autocfg.speaker_outs)
14511 alc861_auto_set_output_and_unmute(codec,
14512 spec->autocfg.speaker_pins[0],
14514 spec->multiout.dac_nids[0]);
14517 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14519 struct alc_spec *spec = codec->spec;
14522 for (i = 0; i < AUTO_PIN_LAST; i++) {
14523 hda_nid_t nid = spec->autocfg.input_pins[i];
14524 if (nid >= 0x0c && nid <= 0x11)
14525 alc_set_input_pin(codec, nid, i);
14529 /* parse the BIOS configuration and set up the alc_spec */
14530 /* return 1 if successful, 0 if the proper config is not found,
14531 * or a negative error code
14533 static int alc861_parse_auto_config(struct hda_codec *codec)
14535 struct alc_spec *spec = codec->spec;
14537 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14539 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14543 if (!spec->autocfg.line_outs)
14544 return 0; /* can't find valid BIOS pin config */
14546 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14549 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14552 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14555 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14559 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14561 if (spec->autocfg.dig_outs)
14562 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14564 if (spec->kctls.list)
14565 add_mixer(spec, spec->kctls.list);
14567 add_verb(spec, alc861_auto_init_verbs);
14569 spec->num_mux_defs = 1;
14570 spec->input_mux = &spec->private_imux[0];
14572 spec->adc_nids = alc861_adc_nids;
14573 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14574 set_capture_mixer(codec);
14576 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14581 /* additional initialization for auto-configuration model */
14582 static void alc861_auto_init(struct hda_codec *codec)
14584 struct alc_spec *spec = codec->spec;
14585 alc861_auto_init_multi_out(codec);
14586 alc861_auto_init_hp_out(codec);
14587 alc861_auto_init_analog_input(codec);
14588 if (spec->unsol_event)
14589 alc_inithook(codec);
14592 #ifdef CONFIG_SND_HDA_POWER_SAVE
14593 static struct hda_amp_list alc861_loopbacks[] = {
14594 { 0x15, HDA_INPUT, 0 },
14595 { 0x15, HDA_INPUT, 1 },
14596 { 0x15, HDA_INPUT, 2 },
14597 { 0x15, HDA_INPUT, 3 },
14604 * configuration and preset
14606 static const char *alc861_models[ALC861_MODEL_LAST] = {
14607 [ALC861_3ST] = "3stack",
14608 [ALC660_3ST] = "3stack-660",
14609 [ALC861_3ST_DIG] = "3stack-dig",
14610 [ALC861_6ST_DIG] = "6stack-dig",
14611 [ALC861_UNIWILL_M31] = "uniwill-m31",
14612 [ALC861_TOSHIBA] = "toshiba",
14613 [ALC861_ASUS] = "asus",
14614 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14615 [ALC861_AUTO] = "auto",
14618 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14619 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14620 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14621 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14622 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14623 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14624 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14625 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14626 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14627 * Any other models that need this preset?
14629 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14630 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14631 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14632 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14633 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14634 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14635 /* FIXME: the below seems conflict */
14636 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14637 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14638 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14642 static struct alc_config_preset alc861_presets[] = {
14644 .mixers = { alc861_3ST_mixer },
14645 .init_verbs = { alc861_threestack_init_verbs },
14646 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14647 .dac_nids = alc861_dac_nids,
14648 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14649 .channel_mode = alc861_threestack_modes,
14651 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14652 .adc_nids = alc861_adc_nids,
14653 .input_mux = &alc861_capture_source,
14655 [ALC861_3ST_DIG] = {
14656 .mixers = { alc861_base_mixer },
14657 .init_verbs = { alc861_threestack_init_verbs },
14658 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14659 .dac_nids = alc861_dac_nids,
14660 .dig_out_nid = ALC861_DIGOUT_NID,
14661 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14662 .channel_mode = alc861_threestack_modes,
14664 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14665 .adc_nids = alc861_adc_nids,
14666 .input_mux = &alc861_capture_source,
14668 [ALC861_6ST_DIG] = {
14669 .mixers = { alc861_base_mixer },
14670 .init_verbs = { alc861_base_init_verbs },
14671 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14672 .dac_nids = alc861_dac_nids,
14673 .dig_out_nid = ALC861_DIGOUT_NID,
14674 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14675 .channel_mode = alc861_8ch_modes,
14676 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14677 .adc_nids = alc861_adc_nids,
14678 .input_mux = &alc861_capture_source,
14681 .mixers = { alc861_3ST_mixer },
14682 .init_verbs = { alc861_threestack_init_verbs },
14683 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14684 .dac_nids = alc660_dac_nids,
14685 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14686 .channel_mode = alc861_threestack_modes,
14688 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14689 .adc_nids = alc861_adc_nids,
14690 .input_mux = &alc861_capture_source,
14692 [ALC861_UNIWILL_M31] = {
14693 .mixers = { alc861_uniwill_m31_mixer },
14694 .init_verbs = { alc861_uniwill_m31_init_verbs },
14695 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14696 .dac_nids = alc861_dac_nids,
14697 .dig_out_nid = ALC861_DIGOUT_NID,
14698 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14699 .channel_mode = alc861_uniwill_m31_modes,
14701 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14702 .adc_nids = alc861_adc_nids,
14703 .input_mux = &alc861_capture_source,
14705 [ALC861_TOSHIBA] = {
14706 .mixers = { alc861_toshiba_mixer },
14707 .init_verbs = { alc861_base_init_verbs,
14708 alc861_toshiba_init_verbs },
14709 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14710 .dac_nids = alc861_dac_nids,
14711 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14712 .channel_mode = alc883_3ST_2ch_modes,
14713 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14714 .adc_nids = alc861_adc_nids,
14715 .input_mux = &alc861_capture_source,
14716 .unsol_event = alc861_toshiba_unsol_event,
14717 .init_hook = alc861_toshiba_automute,
14720 .mixers = { alc861_asus_mixer },
14721 .init_verbs = { alc861_asus_init_verbs },
14722 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14723 .dac_nids = alc861_dac_nids,
14724 .dig_out_nid = ALC861_DIGOUT_NID,
14725 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14726 .channel_mode = alc861_asus_modes,
14729 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14730 .adc_nids = alc861_adc_nids,
14731 .input_mux = &alc861_capture_source,
14733 [ALC861_ASUS_LAPTOP] = {
14734 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14735 .init_verbs = { alc861_asus_init_verbs,
14736 alc861_asus_laptop_init_verbs },
14737 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14738 .dac_nids = alc861_dac_nids,
14739 .dig_out_nid = ALC861_DIGOUT_NID,
14740 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14741 .channel_mode = alc883_3ST_2ch_modes,
14743 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14744 .adc_nids = alc861_adc_nids,
14745 .input_mux = &alc861_capture_source,
14749 /* Pin config fixes */
14751 PINFIX_FSC_AMILO_PI1505,
14754 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14755 { 0x0b, 0x0221101f }, /* HP */
14756 { 0x0f, 0x90170310 }, /* speaker */
14760 static const struct alc_fixup alc861_fixups[] = {
14761 [PINFIX_FSC_AMILO_PI1505] = {
14762 .pins = alc861_fsc_amilo_pi1505_pinfix
14766 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14767 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14771 static int patch_alc861(struct hda_codec *codec)
14773 struct alc_spec *spec;
14777 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14781 codec->spec = spec;
14783 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14787 if (board_config < 0) {
14788 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14790 board_config = ALC861_AUTO;
14793 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14795 if (board_config == ALC861_AUTO) {
14796 /* automatic parse from the BIOS config */
14797 err = alc861_parse_auto_config(codec);
14803 "hda_codec: Cannot set up configuration "
14804 "from BIOS. Using base mode...\n");
14805 board_config = ALC861_3ST_DIG;
14809 err = snd_hda_attach_beep_device(codec, 0x23);
14815 if (board_config != ALC861_AUTO)
14816 setup_preset(codec, &alc861_presets[board_config]);
14818 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14819 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14821 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14822 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14824 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14826 spec->vmaster_nid = 0x03;
14828 codec->patch_ops = alc_patch_ops;
14829 if (board_config == ALC861_AUTO)
14830 spec->init_hook = alc861_auto_init;
14831 #ifdef CONFIG_SND_HDA_POWER_SAVE
14832 if (!spec->loopback.amplist)
14833 spec->loopback.amplist = alc861_loopbacks;
14835 codec->proc_widget_hook = print_realtek_coef;
14841 * ALC861-VD support
14845 * In addition, an independent DAC
14847 #define ALC861VD_DIGOUT_NID 0x06
14849 static hda_nid_t alc861vd_dac_nids[4] = {
14850 /* front, surr, clfe, side surr */
14851 0x02, 0x03, 0x04, 0x05
14854 /* dac_nids for ALC660vd are in a different order - according to
14855 * Realtek's driver.
14856 * This should probably result in a different mixer for 6stack models
14857 * of ALC660vd codecs, but for now there is only 3stack mixer
14858 * - and it is the same as in 861vd.
14859 * adc_nids in ALC660vd are (is) the same as in 861vd
14861 static hda_nid_t alc660vd_dac_nids[3] = {
14862 /* front, rear, clfe, rear_surr */
14866 static hda_nid_t alc861vd_adc_nids[1] = {
14871 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14874 /* FIXME: should be a matrix-type input source selection */
14875 static struct hda_input_mux alc861vd_capture_source = {
14879 { "Front Mic", 0x1 },
14885 static struct hda_input_mux alc861vd_dallas_capture_source = {
14888 { "Ext Mic", 0x0 },
14889 { "Int Mic", 0x1 },
14893 static struct hda_input_mux alc861vd_hp_capture_source = {
14896 { "Front Mic", 0x0 },
14897 { "ATAPI Mic", 0x1 },
14904 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14911 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14912 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14913 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14914 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14915 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14922 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14923 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14924 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14925 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14926 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14930 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14931 { 6, alc861vd_6stack_ch6_init },
14932 { 8, alc861vd_6stack_ch8_init },
14935 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14938 .name = "Channel Mode",
14939 .info = alc_ch_mode_info,
14940 .get = alc_ch_mode_get,
14941 .put = alc_ch_mode_put,
14946 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14947 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14949 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14950 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14951 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14953 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14954 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14956 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14958 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14963 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14964 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14972 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14973 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14974 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14976 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14977 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14985 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14986 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14991 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14995 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14999 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15000 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15008 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15009 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15010 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15011 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15013 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15019 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15023 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15024 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15029 /* Pin assignment: Speaker=0x14, HP = 0x15,
15030 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15032 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15033 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15034 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15036 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15037 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15038 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15039 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15040 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15041 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15042 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15046 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15047 * Front Mic=0x18, ATAPI Mic = 0x19,
15049 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15050 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15051 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15053 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15056 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15057 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15063 * generic initialization of ADC, input mixers and output mixers
15065 static struct hda_verb alc861vd_volume_init_verbs[] = {
15067 * Unmute ADC0 and set the default input to mic-in
15069 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15072 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15073 * the analog-loopback mixer widget
15075 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15077 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15082 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15089 * Set up output mixers (0x02 - 0x05)
15091 /* set vol=0 to output mixers */
15092 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15093 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15094 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15095 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15097 /* set up input amps for analog loopback */
15098 /* Amp Indices: DAC = 0, mixer = 1 */
15099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15106 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15112 * 3-stack pin configuration:
15113 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15115 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15117 * Set pin mode and muting
15119 /* set front pin widgets 0x14 for output */
15120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15122 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15124 /* Mic (rear) pin: input vref at 80% */
15125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15126 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15127 /* Front Mic pin: input vref at 80% */
15128 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15129 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15130 /* Line In pin: input */
15131 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15132 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15133 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15134 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15136 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15137 /* CD pin widget for input */
15138 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15144 * 6-stack pin configuration:
15146 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15148 * Set pin mode and muting
15150 /* set front pin widgets 0x14 for output */
15151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15152 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15153 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15155 /* Rear Pin: output 1 (0x0d) */
15156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15159 /* CLFE Pin: output 2 (0x0e) */
15160 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15161 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15162 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15163 /* Side Pin: output 3 (0x0f) */
15164 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15165 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15166 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15168 /* Mic (rear) pin: input vref at 80% */
15169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15170 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15171 /* Front Mic pin: input vref at 80% */
15172 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15174 /* Line In pin: input */
15175 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15176 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15177 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15178 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15179 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15180 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15181 /* CD pin widget for input */
15182 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15187 static struct hda_verb alc861vd_eapd_verbs[] = {
15188 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15192 static struct hda_verb alc660vd_eapd_verbs[] = {
15193 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15194 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15198 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15202 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15203 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15207 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15209 unsigned int present;
15210 unsigned char bits;
15212 present = snd_hda_jack_detect(codec, 0x18);
15213 bits = present ? HDA_AMP_MUTE : 0;
15215 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15216 HDA_AMP_MUTE, bits);
15219 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15221 struct alc_spec *spec = codec->spec;
15222 spec->autocfg.hp_pins[0] = 0x1b;
15223 spec->autocfg.speaker_pins[0] = 0x14;
15226 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15228 alc_automute_amp(codec);
15229 alc861vd_lenovo_mic_automute(codec);
15232 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15235 switch (res >> 26) {
15236 case ALC880_MIC_EVENT:
15237 alc861vd_lenovo_mic_automute(codec);
15240 alc_automute_amp_unsol_event(codec, res);
15245 static struct hda_verb alc861vd_dallas_verbs[] = {
15246 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15247 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15248 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15249 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15263 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15264 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15265 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15266 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15267 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15271 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15272 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15274 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15275 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15276 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15284 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15285 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15290 /* toggle speaker-output according to the hp-jack state */
15291 static void alc861vd_dallas_setup(struct hda_codec *codec)
15293 struct alc_spec *spec = codec->spec;
15295 spec->autocfg.hp_pins[0] = 0x15;
15296 spec->autocfg.speaker_pins[0] = 0x14;
15299 #ifdef CONFIG_SND_HDA_POWER_SAVE
15300 #define alc861vd_loopbacks alc880_loopbacks
15303 /* pcm configuration: identical with ALC880 */
15304 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15305 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15306 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15307 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15310 * configuration and preset
15312 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15313 [ALC660VD_3ST] = "3stack-660",
15314 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15315 [ALC660VD_ASUS_V1S] = "asus-v1s",
15316 [ALC861VD_3ST] = "3stack",
15317 [ALC861VD_3ST_DIG] = "3stack-digout",
15318 [ALC861VD_6ST_DIG] = "6stack-digout",
15319 [ALC861VD_LENOVO] = "lenovo",
15320 [ALC861VD_DALLAS] = "dallas",
15321 [ALC861VD_HP] = "hp",
15322 [ALC861VD_AUTO] = "auto",
15325 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15326 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15327 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15328 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15329 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15330 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15331 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15332 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15333 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15334 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15335 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15336 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15337 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15338 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15339 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15340 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15344 static struct alc_config_preset alc861vd_presets[] = {
15346 .mixers = { alc861vd_3st_mixer },
15347 .init_verbs = { alc861vd_volume_init_verbs,
15348 alc861vd_3stack_init_verbs },
15349 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15350 .dac_nids = alc660vd_dac_nids,
15351 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15352 .channel_mode = alc861vd_3stack_2ch_modes,
15353 .input_mux = &alc861vd_capture_source,
15355 [ALC660VD_3ST_DIG] = {
15356 .mixers = { alc861vd_3st_mixer },
15357 .init_verbs = { alc861vd_volume_init_verbs,
15358 alc861vd_3stack_init_verbs },
15359 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15360 .dac_nids = alc660vd_dac_nids,
15361 .dig_out_nid = ALC861VD_DIGOUT_NID,
15362 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15363 .channel_mode = alc861vd_3stack_2ch_modes,
15364 .input_mux = &alc861vd_capture_source,
15367 .mixers = { alc861vd_3st_mixer },
15368 .init_verbs = { alc861vd_volume_init_verbs,
15369 alc861vd_3stack_init_verbs },
15370 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15371 .dac_nids = alc861vd_dac_nids,
15372 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15373 .channel_mode = alc861vd_3stack_2ch_modes,
15374 .input_mux = &alc861vd_capture_source,
15376 [ALC861VD_3ST_DIG] = {
15377 .mixers = { alc861vd_3st_mixer },
15378 .init_verbs = { alc861vd_volume_init_verbs,
15379 alc861vd_3stack_init_verbs },
15380 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15381 .dac_nids = alc861vd_dac_nids,
15382 .dig_out_nid = ALC861VD_DIGOUT_NID,
15383 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15384 .channel_mode = alc861vd_3stack_2ch_modes,
15385 .input_mux = &alc861vd_capture_source,
15387 [ALC861VD_6ST_DIG] = {
15388 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15389 .init_verbs = { alc861vd_volume_init_verbs,
15390 alc861vd_6stack_init_verbs },
15391 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15392 .dac_nids = alc861vd_dac_nids,
15393 .dig_out_nid = ALC861VD_DIGOUT_NID,
15394 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15395 .channel_mode = alc861vd_6stack_modes,
15396 .input_mux = &alc861vd_capture_source,
15398 [ALC861VD_LENOVO] = {
15399 .mixers = { alc861vd_lenovo_mixer },
15400 .init_verbs = { alc861vd_volume_init_verbs,
15401 alc861vd_3stack_init_verbs,
15402 alc861vd_eapd_verbs,
15403 alc861vd_lenovo_unsol_verbs },
15404 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15405 .dac_nids = alc660vd_dac_nids,
15406 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15407 .channel_mode = alc861vd_3stack_2ch_modes,
15408 .input_mux = &alc861vd_capture_source,
15409 .unsol_event = alc861vd_lenovo_unsol_event,
15410 .setup = alc861vd_lenovo_setup,
15411 .init_hook = alc861vd_lenovo_init_hook,
15413 [ALC861VD_DALLAS] = {
15414 .mixers = { alc861vd_dallas_mixer },
15415 .init_verbs = { alc861vd_dallas_verbs },
15416 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15417 .dac_nids = alc861vd_dac_nids,
15418 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15419 .channel_mode = alc861vd_3stack_2ch_modes,
15420 .input_mux = &alc861vd_dallas_capture_source,
15421 .unsol_event = alc_automute_amp_unsol_event,
15422 .setup = alc861vd_dallas_setup,
15423 .init_hook = alc_automute_amp,
15426 .mixers = { alc861vd_hp_mixer },
15427 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15428 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15429 .dac_nids = alc861vd_dac_nids,
15430 .dig_out_nid = ALC861VD_DIGOUT_NID,
15431 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15432 .channel_mode = alc861vd_3stack_2ch_modes,
15433 .input_mux = &alc861vd_hp_capture_source,
15434 .unsol_event = alc_automute_amp_unsol_event,
15435 .setup = alc861vd_dallas_setup,
15436 .init_hook = alc_automute_amp,
15438 [ALC660VD_ASUS_V1S] = {
15439 .mixers = { alc861vd_lenovo_mixer },
15440 .init_verbs = { alc861vd_volume_init_verbs,
15441 alc861vd_3stack_init_verbs,
15442 alc861vd_eapd_verbs,
15443 alc861vd_lenovo_unsol_verbs },
15444 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15445 .dac_nids = alc660vd_dac_nids,
15446 .dig_out_nid = ALC861VD_DIGOUT_NID,
15447 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15448 .channel_mode = alc861vd_3stack_2ch_modes,
15449 .input_mux = &alc861vd_capture_source,
15450 .unsol_event = alc861vd_lenovo_unsol_event,
15451 .setup = alc861vd_lenovo_setup,
15452 .init_hook = alc861vd_lenovo_init_hook,
15457 * BIOS auto configuration
15459 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15460 const struct auto_pin_cfg *cfg)
15462 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15466 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15467 hda_nid_t nid, int pin_type, int dac_idx)
15469 alc_set_pin_output(codec, nid, pin_type);
15472 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15474 struct alc_spec *spec = codec->spec;
15477 for (i = 0; i <= HDA_SIDE; i++) {
15478 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15479 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15481 alc861vd_auto_set_output_and_unmute(codec, nid,
15487 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15489 struct alc_spec *spec = codec->spec;
15492 pin = spec->autocfg.hp_pins[0];
15493 if (pin) /* connect to front and use dac 0 */
15494 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15495 pin = spec->autocfg.speaker_pins[0];
15497 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15500 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15502 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15504 struct alc_spec *spec = codec->spec;
15507 for (i = 0; i < AUTO_PIN_LAST; i++) {
15508 hda_nid_t nid = spec->autocfg.input_pins[i];
15509 if (alc_is_input_pin(codec, nid)) {
15510 alc_set_input_pin(codec, nid, i);
15511 if (nid != ALC861VD_PIN_CD_NID &&
15512 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15513 snd_hda_codec_write(codec, nid, 0,
15514 AC_VERB_SET_AMP_GAIN_MUTE,
15520 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15522 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15523 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15525 /* add playback controls from the parsed DAC table */
15526 /* Based on ALC880 version. But ALC861VD has separate,
15527 * different NIDs for mute/unmute switch and volume control */
15528 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15529 const struct auto_pin_cfg *cfg)
15531 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15532 hda_nid_t nid_v, nid_s;
15535 for (i = 0; i < cfg->line_outs; i++) {
15536 if (!spec->multiout.dac_nids[i])
15538 nid_v = alc861vd_idx_to_mixer_vol(
15540 spec->multiout.dac_nids[i]));
15541 nid_s = alc861vd_idx_to_mixer_switch(
15543 spec->multiout.dac_nids[i]));
15547 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15549 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15553 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15555 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15559 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15561 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15565 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15567 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15573 if (cfg->line_outs == 1 &&
15574 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15581 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15582 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15586 if (cfg->line_outs == 1 &&
15587 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15589 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15590 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15599 /* add playback controls for speaker and HP outputs */
15600 /* Based on ALC880 version. But ALC861VD has separate,
15601 * different NIDs for mute/unmute switch and volume control */
15602 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15603 hda_nid_t pin, const char *pfx)
15605 hda_nid_t nid_v, nid_s;
15611 if (alc880_is_fixed_pin(pin)) {
15612 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15613 /* specify the DAC as the extra output */
15614 if (!spec->multiout.hp_nid)
15615 spec->multiout.hp_nid = nid_v;
15617 spec->multiout.extra_out_nid[0] = nid_v;
15618 /* control HP volume/switch on the output mixer amp */
15619 nid_v = alc861vd_idx_to_mixer_vol(
15620 alc880_fixed_pin_idx(pin));
15621 nid_s = alc861vd_idx_to_mixer_switch(
15622 alc880_fixed_pin_idx(pin));
15624 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15625 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15628 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15629 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15632 } else if (alc880_is_multi_pin(pin)) {
15633 /* set manual connection */
15634 /* we have only a switch on HP-out PIN */
15635 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15636 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15643 /* parse the BIOS configuration and set up the alc_spec
15644 * return 1 if successful, 0 if the proper config is not found,
15645 * or a negative error code
15646 * Based on ALC880 version - had to change it to override
15647 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15648 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15650 struct alc_spec *spec = codec->spec;
15652 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15654 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15658 if (!spec->autocfg.line_outs)
15659 return 0; /* can't find valid BIOS pin config */
15661 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15664 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15667 err = alc861vd_auto_create_extra_out(spec,
15668 spec->autocfg.speaker_pins[0],
15672 err = alc861vd_auto_create_extra_out(spec,
15673 spec->autocfg.hp_pins[0],
15677 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15681 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15683 if (spec->autocfg.dig_outs)
15684 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15686 if (spec->kctls.list)
15687 add_mixer(spec, spec->kctls.list);
15689 add_verb(spec, alc861vd_volume_init_verbs);
15691 spec->num_mux_defs = 1;
15692 spec->input_mux = &spec->private_imux[0];
15694 err = alc_auto_add_mic_boost(codec);
15698 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15703 /* additional initialization for auto-configuration model */
15704 static void alc861vd_auto_init(struct hda_codec *codec)
15706 struct alc_spec *spec = codec->spec;
15707 alc861vd_auto_init_multi_out(codec);
15708 alc861vd_auto_init_hp_out(codec);
15709 alc861vd_auto_init_analog_input(codec);
15710 alc861vd_auto_init_input_src(codec);
15711 if (spec->unsol_event)
15712 alc_inithook(codec);
15716 ALC660VD_FIX_ASUS_GPIO1
15720 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15721 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15722 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15723 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15727 static const struct alc_fixup alc861vd_fixups[] = {
15728 [ALC660VD_FIX_ASUS_GPIO1] = {
15729 .verbs = alc660vd_fix_asus_gpio1_verbs,
15733 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15734 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15738 static int patch_alc861vd(struct hda_codec *codec)
15740 struct alc_spec *spec;
15741 int err, board_config;
15743 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15747 codec->spec = spec;
15749 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15753 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15754 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15756 board_config = ALC861VD_AUTO;
15759 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15761 if (board_config == ALC861VD_AUTO) {
15762 /* automatic parse from the BIOS config */
15763 err = alc861vd_parse_auto_config(codec);
15769 "hda_codec: Cannot set up configuration "
15770 "from BIOS. Using base mode...\n");
15771 board_config = ALC861VD_3ST;
15775 err = snd_hda_attach_beep_device(codec, 0x23);
15781 if (board_config != ALC861VD_AUTO)
15782 setup_preset(codec, &alc861vd_presets[board_config]);
15784 if (codec->vendor_id == 0x10ec0660) {
15785 /* always turn on EAPD */
15786 add_verb(spec, alc660vd_eapd_verbs);
15789 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15790 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15792 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15793 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15795 if (!spec->adc_nids) {
15796 spec->adc_nids = alc861vd_adc_nids;
15797 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15799 if (!spec->capsrc_nids)
15800 spec->capsrc_nids = alc861vd_capsrc_nids;
15802 set_capture_mixer(codec);
15803 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15805 spec->vmaster_nid = 0x02;
15807 codec->patch_ops = alc_patch_ops;
15809 if (board_config == ALC861VD_AUTO)
15810 spec->init_hook = alc861vd_auto_init;
15811 #ifdef CONFIG_SND_HDA_POWER_SAVE
15812 if (!spec->loopback.amplist)
15813 spec->loopback.amplist = alc861vd_loopbacks;
15815 codec->proc_widget_hook = print_realtek_coef;
15823 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15824 * configuration. Each pin widget can choose any input DACs and a mixer.
15825 * Each ADC is connected from a mixer of all inputs. This makes possible
15826 * 6-channel independent captures.
15828 * In addition, an independent DAC for the multi-playback (not used in this
15831 #define ALC662_DIGOUT_NID 0x06
15832 #define ALC662_DIGIN_NID 0x0a
15834 static hda_nid_t alc662_dac_nids[4] = {
15835 /* front, rear, clfe, rear_surr */
15839 static hda_nid_t alc272_dac_nids[2] = {
15843 static hda_nid_t alc662_adc_nids[2] = {
15848 static hda_nid_t alc272_adc_nids[1] = {
15853 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15854 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15858 /* FIXME: should be a matrix-type input source selection */
15859 static struct hda_input_mux alc662_capture_source = {
15863 { "Front Mic", 0x1 },
15869 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15877 static struct hda_input_mux alc663_capture_source = {
15881 { "Front Mic", 0x1 },
15886 #if 0 /* set to 1 for testing other input sources below */
15887 static struct hda_input_mux alc272_nc10_capture_source = {
15890 { "Autoselect Mic", 0x0 },
15891 { "Internal Mic", 0x1 },
15892 { "In-0x02", 0x2 },
15893 { "In-0x03", 0x3 },
15894 { "In-0x04", 0x4 },
15895 { "In-0x05", 0x5 },
15896 { "In-0x06", 0x6 },
15897 { "In-0x07", 0x7 },
15898 { "In-0x08", 0x8 },
15899 { "In-0x09", 0x9 },
15900 { "In-0x0a", 0x0a },
15901 { "In-0x0b", 0x0b },
15902 { "In-0x0c", 0x0c },
15903 { "In-0x0d", 0x0d },
15904 { "In-0x0e", 0x0e },
15905 { "In-0x0f", 0x0f },
15913 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15920 static struct hda_verb alc662_3ST_ch2_init[] = {
15921 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15922 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15923 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15924 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15931 static struct hda_verb alc662_3ST_ch6_init[] = {
15932 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15933 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15934 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15935 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15936 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15937 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15941 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15942 { 2, alc662_3ST_ch2_init },
15943 { 6, alc662_3ST_ch6_init },
15949 static struct hda_verb alc662_sixstack_ch6_init[] = {
15950 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15951 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15952 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15959 static struct hda_verb alc662_sixstack_ch8_init[] = {
15960 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15961 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15962 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15966 static struct hda_channel_mode alc662_5stack_modes[2] = {
15967 { 2, alc662_sixstack_ch6_init },
15968 { 6, alc662_sixstack_ch8_init },
15971 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15972 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15975 static struct snd_kcontrol_new alc662_base_mixer[] = {
15976 /* output mixer control */
15977 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15978 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15979 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15980 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15981 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15983 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15984 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15987 /*Input mixer control */
15988 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15989 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15990 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15991 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15992 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15993 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15999 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16000 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16001 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16002 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16003 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16004 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16005 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16006 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16009 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16010 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16014 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16015 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16016 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16017 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16018 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16019 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16020 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16021 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16022 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16024 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16025 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16026 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16027 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16030 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16035 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16036 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16037 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16038 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16039 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16040 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16048 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16049 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16050 ALC262_HIPPO_MASTER_SWITCH,
16052 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16053 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16054 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16056 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16057 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16058 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16062 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16063 ALC262_HIPPO_MASTER_SWITCH,
16064 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16065 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16066 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16067 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16068 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16069 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16070 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16076 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16077 .ops = &snd_hda_bind_vol,
16079 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16080 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16085 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16086 .ops = &snd_hda_bind_sw,
16088 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16089 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16094 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16095 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16096 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16102 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16103 .ops = &snd_hda_bind_sw,
16105 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16106 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16107 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16112 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16113 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16114 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16117 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16118 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16123 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16124 .ops = &snd_hda_bind_sw,
16126 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16127 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16128 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16133 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16134 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16135 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16138 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16139 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16143 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16144 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16145 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16146 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16149 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16150 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16154 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16155 .ops = &snd_hda_bind_vol,
16157 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16158 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16163 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16164 .ops = &snd_hda_bind_sw,
16166 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16167 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16172 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16173 HDA_BIND_VOL("Master Playback Volume",
16174 &alc663_asus_two_bind_master_vol),
16175 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16183 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16184 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16185 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16186 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16193 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16195 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16196 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16197 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16202 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16203 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16207 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16208 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16209 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16214 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16215 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16221 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16222 .ops = &snd_hda_bind_sw,
16224 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16225 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16226 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16227 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16228 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16233 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16234 .ops = &snd_hda_bind_sw,
16236 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16237 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16242 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16243 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16244 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16245 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16246 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16247 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16248 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16249 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16255 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16256 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16257 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16258 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16259 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16260 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16267 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16270 .name = "Channel Mode",
16271 .info = alc_ch_mode_info,
16272 .get = alc_ch_mode_get,
16273 .put = alc_ch_mode_put,
16278 static struct hda_verb alc662_init_verbs[] = {
16279 /* ADC: mute amp left and right */
16280 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16281 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16282 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16297 /* Front Pin: output 0 (0x0c) */
16298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16299 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16301 /* Rear Pin: output 1 (0x0d) */
16302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16305 /* CLFE Pin: output 2 (0x0e) */
16306 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16309 /* Mic (rear) pin: input vref at 80% */
16310 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16312 /* Front Mic pin: input vref at 80% */
16313 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16314 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16315 /* Line In pin: input */
16316 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16318 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16321 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16322 /* CD pin widget for input */
16323 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16325 /* FIXME: use matrix-type input source selection */
16326 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16331 /* always trun on EAPD */
16332 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16333 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16338 static struct hda_verb alc662_sue_init_verbs[] = {
16339 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16340 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16344 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16346 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16350 /* Set Unsolicited Event*/
16351 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16352 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16353 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16358 * generic initialization of ADC, input mixers and output mixers
16360 static struct hda_verb alc662_auto_init_verbs[] = {
16362 * Unmute ADC and set the default input to mic-in
16364 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16365 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16367 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16369 * Note: PASD motherboards uses the Line In 2 as the input for front
16370 * panel mic (mic 2)
16372 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16380 * Set up output mixers (0x0c - 0x0f)
16382 /* set vol=0 to output mixers */
16383 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16384 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16385 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16387 /* set up input amps for analog loopback */
16388 /* Amp Indices: DAC = 0, mixer = 1 */
16389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16397 /* FIXME: use matrix-type input source selection */
16398 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16405 /* additional verbs for ALC663 */
16406 static struct hda_verb alc663_auto_init_verbs[] = {
16407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16412 static struct hda_verb alc663_m51va_init_verbs[] = {
16413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16415 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16416 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16417 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16421 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16425 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16426 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16427 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16428 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16431 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16432 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16436 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16438 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16439 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16440 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16441 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16442 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16443 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16444 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16448 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16449 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16451 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16459 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16460 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16461 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16462 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16463 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16466 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16469 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16470 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16471 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16475 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16479 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16485 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16486 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16487 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16491 static struct hda_verb alc663_g71v_init_verbs[] = {
16492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16493 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16494 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16496 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16497 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16498 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16500 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16501 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16502 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16506 static struct hda_verb alc663_g50v_init_verbs[] = {
16507 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16508 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16509 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16511 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16512 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16516 static struct hda_verb alc662_ecs_init_verbs[] = {
16517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16518 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16519 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16520 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16524 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16525 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16526 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16529 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16530 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16531 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16534 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16535 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16539 static struct hda_verb alc272_dell_init_verbs[] = {
16540 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16541 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16544 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16545 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16546 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16549 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16550 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16554 static struct hda_verb alc663_mode7_init_verbs[] = {
16555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16556 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16557 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16558 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16560 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16561 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16562 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16563 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16564 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16567 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16568 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16569 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16573 static struct hda_verb alc663_mode8_init_verbs[] = {
16574 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16577 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16578 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16579 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16580 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16581 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16582 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16583 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16584 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16587 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16588 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16589 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16593 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16594 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16595 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16599 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16600 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16601 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16605 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16607 unsigned int present;
16608 unsigned char bits;
16610 present = snd_hda_jack_detect(codec, 0x14);
16611 bits = present ? HDA_AMP_MUTE : 0;
16613 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16614 HDA_AMP_MUTE, bits);
16617 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16619 unsigned int present;
16620 unsigned char bits;
16622 present = snd_hda_jack_detect(codec, 0x1b);
16623 bits = present ? HDA_AMP_MUTE : 0;
16625 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16626 HDA_AMP_MUTE, bits);
16627 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16628 HDA_AMP_MUTE, bits);
16631 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16634 if ((res >> 26) == ALC880_HP_EVENT)
16635 alc662_lenovo_101e_all_automute(codec);
16636 if ((res >> 26) == ALC880_FRONT_EVENT)
16637 alc662_lenovo_101e_ispeaker_automute(codec);
16640 /* unsolicited event for HP jack sensing */
16641 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16644 if ((res >> 26) == ALC880_MIC_EVENT)
16645 alc_mic_automute(codec);
16647 alc262_hippo_unsol_event(codec, res);
16650 static void alc662_eeepc_setup(struct hda_codec *codec)
16652 struct alc_spec *spec = codec->spec;
16654 alc262_hippo1_setup(codec);
16655 spec->ext_mic.pin = 0x18;
16656 spec->ext_mic.mux_idx = 0;
16657 spec->int_mic.pin = 0x19;
16658 spec->int_mic.mux_idx = 1;
16659 spec->auto_mic = 1;
16662 static void alc662_eeepc_inithook(struct hda_codec *codec)
16664 alc262_hippo_automute(codec);
16665 alc_mic_automute(codec);
16668 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16670 struct alc_spec *spec = codec->spec;
16672 spec->autocfg.hp_pins[0] = 0x14;
16673 spec->autocfg.speaker_pins[0] = 0x1b;
16676 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16678 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16680 unsigned int present;
16681 unsigned char bits;
16683 present = snd_hda_jack_detect(codec, 0x21);
16684 bits = present ? HDA_AMP_MUTE : 0;
16685 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16686 AMP_IN_MUTE(0), bits);
16687 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16688 AMP_IN_MUTE(0), bits);
16691 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16693 unsigned int present;
16694 unsigned char bits;
16696 present = snd_hda_jack_detect(codec, 0x21);
16697 bits = present ? HDA_AMP_MUTE : 0;
16698 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16699 AMP_IN_MUTE(0), bits);
16700 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16701 AMP_IN_MUTE(0), bits);
16702 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16703 AMP_IN_MUTE(0), bits);
16704 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16705 AMP_IN_MUTE(0), bits);
16708 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16710 unsigned int present;
16711 unsigned char bits;
16713 present = snd_hda_jack_detect(codec, 0x15);
16714 bits = present ? HDA_AMP_MUTE : 0;
16715 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16716 AMP_IN_MUTE(0), bits);
16717 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16718 AMP_IN_MUTE(0), bits);
16719 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16720 AMP_IN_MUTE(0), bits);
16721 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16722 AMP_IN_MUTE(0), bits);
16725 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16727 unsigned int present;
16728 unsigned char bits;
16730 present = snd_hda_jack_detect(codec, 0x1b);
16731 bits = present ? 0 : PIN_OUT;
16732 snd_hda_codec_write(codec, 0x14, 0,
16733 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16736 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16738 unsigned int present1, present2;
16740 present1 = snd_hda_jack_detect(codec, 0x21);
16741 present2 = snd_hda_jack_detect(codec, 0x15);
16743 if (present1 || present2) {
16744 snd_hda_codec_write_cache(codec, 0x14, 0,
16745 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16747 snd_hda_codec_write_cache(codec, 0x14, 0,
16748 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16752 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16754 unsigned int present1, present2;
16756 present1 = snd_hda_jack_detect(codec, 0x1b);
16757 present2 = snd_hda_jack_detect(codec, 0x15);
16759 if (present1 || present2) {
16760 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16761 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16762 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16763 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16765 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16766 AMP_IN_MUTE(0), 0);
16767 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16768 AMP_IN_MUTE(0), 0);
16772 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16774 unsigned int present1, present2;
16776 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16777 AC_VERB_GET_PIN_SENSE, 0)
16778 & AC_PINSENSE_PRESENCE;
16779 present2 = snd_hda_codec_read(codec, 0x21, 0,
16780 AC_VERB_GET_PIN_SENSE, 0)
16781 & AC_PINSENSE_PRESENCE;
16783 if (present1 || present2) {
16784 snd_hda_codec_write_cache(codec, 0x14, 0,
16785 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16786 snd_hda_codec_write_cache(codec, 0x17, 0,
16787 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16789 snd_hda_codec_write_cache(codec, 0x14, 0,
16790 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16791 snd_hda_codec_write_cache(codec, 0x17, 0,
16792 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16796 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16798 unsigned int present1, present2;
16800 present1 = snd_hda_codec_read(codec, 0x21, 0,
16801 AC_VERB_GET_PIN_SENSE, 0)
16802 & AC_PINSENSE_PRESENCE;
16803 present2 = snd_hda_codec_read(codec, 0x15, 0,
16804 AC_VERB_GET_PIN_SENSE, 0)
16805 & AC_PINSENSE_PRESENCE;
16807 if (present1 || present2) {
16808 snd_hda_codec_write_cache(codec, 0x14, 0,
16809 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16810 snd_hda_codec_write_cache(codec, 0x17, 0,
16811 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16813 snd_hda_codec_write_cache(codec, 0x14, 0,
16814 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16815 snd_hda_codec_write_cache(codec, 0x17, 0,
16816 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16820 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16823 switch (res >> 26) {
16824 case ALC880_HP_EVENT:
16825 alc663_m51va_speaker_automute(codec);
16827 case ALC880_MIC_EVENT:
16828 alc_mic_automute(codec);
16833 static void alc663_m51va_setup(struct hda_codec *codec)
16835 struct alc_spec *spec = codec->spec;
16836 spec->ext_mic.pin = 0x18;
16837 spec->ext_mic.mux_idx = 0;
16838 spec->int_mic.pin = 0x12;
16839 spec->int_mic.mux_idx = 9;
16840 spec->auto_mic = 1;
16843 static void alc663_m51va_inithook(struct hda_codec *codec)
16845 alc663_m51va_speaker_automute(codec);
16846 alc_mic_automute(codec);
16849 /* ***************** Mode1 ******************************/
16850 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16852 static void alc663_mode1_setup(struct hda_codec *codec)
16854 struct alc_spec *spec = codec->spec;
16855 spec->ext_mic.pin = 0x18;
16856 spec->ext_mic.mux_idx = 0;
16857 spec->int_mic.pin = 0x19;
16858 spec->int_mic.mux_idx = 1;
16859 spec->auto_mic = 1;
16862 #define alc663_mode1_inithook alc663_m51va_inithook
16864 /* ***************** Mode2 ******************************/
16865 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16868 switch (res >> 26) {
16869 case ALC880_HP_EVENT:
16870 alc662_f5z_speaker_automute(codec);
16872 case ALC880_MIC_EVENT:
16873 alc_mic_automute(codec);
16878 #define alc662_mode2_setup alc663_mode1_setup
16880 static void alc662_mode2_inithook(struct hda_codec *codec)
16882 alc662_f5z_speaker_automute(codec);
16883 alc_mic_automute(codec);
16885 /* ***************** Mode3 ******************************/
16886 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16889 switch (res >> 26) {
16890 case ALC880_HP_EVENT:
16891 alc663_two_hp_m1_speaker_automute(codec);
16893 case ALC880_MIC_EVENT:
16894 alc_mic_automute(codec);
16899 #define alc663_mode3_setup alc663_mode1_setup
16901 static void alc663_mode3_inithook(struct hda_codec *codec)
16903 alc663_two_hp_m1_speaker_automute(codec);
16904 alc_mic_automute(codec);
16906 /* ***************** Mode4 ******************************/
16907 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16910 switch (res >> 26) {
16911 case ALC880_HP_EVENT:
16912 alc663_21jd_two_speaker_automute(codec);
16914 case ALC880_MIC_EVENT:
16915 alc_mic_automute(codec);
16920 #define alc663_mode4_setup alc663_mode1_setup
16922 static void alc663_mode4_inithook(struct hda_codec *codec)
16924 alc663_21jd_two_speaker_automute(codec);
16925 alc_mic_automute(codec);
16927 /* ***************** Mode5 ******************************/
16928 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16931 switch (res >> 26) {
16932 case ALC880_HP_EVENT:
16933 alc663_15jd_two_speaker_automute(codec);
16935 case ALC880_MIC_EVENT:
16936 alc_mic_automute(codec);
16941 #define alc663_mode5_setup alc663_mode1_setup
16943 static void alc663_mode5_inithook(struct hda_codec *codec)
16945 alc663_15jd_two_speaker_automute(codec);
16946 alc_mic_automute(codec);
16948 /* ***************** Mode6 ******************************/
16949 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16952 switch (res >> 26) {
16953 case ALC880_HP_EVENT:
16954 alc663_two_hp_m2_speaker_automute(codec);
16956 case ALC880_MIC_EVENT:
16957 alc_mic_automute(codec);
16962 #define alc663_mode6_setup alc663_mode1_setup
16964 static void alc663_mode6_inithook(struct hda_codec *codec)
16966 alc663_two_hp_m2_speaker_automute(codec);
16967 alc_mic_automute(codec);
16970 /* ***************** Mode7 ******************************/
16971 static void alc663_mode7_unsol_event(struct hda_codec *codec,
16974 switch (res >> 26) {
16975 case ALC880_HP_EVENT:
16976 alc663_two_hp_m7_speaker_automute(codec);
16978 case ALC880_MIC_EVENT:
16979 alc_mic_automute(codec);
16984 #define alc663_mode7_setup alc663_mode1_setup
16986 static void alc663_mode7_inithook(struct hda_codec *codec)
16988 alc663_two_hp_m7_speaker_automute(codec);
16989 alc_mic_automute(codec);
16992 /* ***************** Mode8 ******************************/
16993 static void alc663_mode8_unsol_event(struct hda_codec *codec,
16996 switch (res >> 26) {
16997 case ALC880_HP_EVENT:
16998 alc663_two_hp_m8_speaker_automute(codec);
17000 case ALC880_MIC_EVENT:
17001 alc_mic_automute(codec);
17006 #define alc663_mode8_setup alc663_m51va_setup
17008 static void alc663_mode8_inithook(struct hda_codec *codec)
17010 alc663_two_hp_m8_speaker_automute(codec);
17011 alc_mic_automute(codec);
17014 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17016 unsigned int present;
17017 unsigned char bits;
17019 present = snd_hda_jack_detect(codec, 0x21);
17020 bits = present ? HDA_AMP_MUTE : 0;
17021 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17022 HDA_AMP_MUTE, bits);
17023 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17024 HDA_AMP_MUTE, bits);
17027 static void alc663_g71v_front_automute(struct hda_codec *codec)
17029 unsigned int present;
17030 unsigned char bits;
17032 present = snd_hda_jack_detect(codec, 0x15);
17033 bits = present ? HDA_AMP_MUTE : 0;
17034 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17035 HDA_AMP_MUTE, bits);
17038 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17041 switch (res >> 26) {
17042 case ALC880_HP_EVENT:
17043 alc663_g71v_hp_automute(codec);
17045 case ALC880_FRONT_EVENT:
17046 alc663_g71v_front_automute(codec);
17048 case ALC880_MIC_EVENT:
17049 alc_mic_automute(codec);
17054 #define alc663_g71v_setup alc663_m51va_setup
17056 static void alc663_g71v_inithook(struct hda_codec *codec)
17058 alc663_g71v_front_automute(codec);
17059 alc663_g71v_hp_automute(codec);
17060 alc_mic_automute(codec);
17063 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17066 switch (res >> 26) {
17067 case ALC880_HP_EVENT:
17068 alc663_m51va_speaker_automute(codec);
17070 case ALC880_MIC_EVENT:
17071 alc_mic_automute(codec);
17076 #define alc663_g50v_setup alc663_m51va_setup
17078 static void alc663_g50v_inithook(struct hda_codec *codec)
17080 alc663_m51va_speaker_automute(codec);
17081 alc_mic_automute(codec);
17084 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17085 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17086 ALC262_HIPPO_MASTER_SWITCH,
17088 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17089 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17090 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17092 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17093 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17094 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17098 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17099 /* Master Playback automatically created from Speaker and Headphone */
17100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17101 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17105 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17106 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17107 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17109 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17110 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17111 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17115 #ifdef CONFIG_SND_HDA_POWER_SAVE
17116 #define alc662_loopbacks alc880_loopbacks
17120 /* pcm configuration: identical with ALC880 */
17121 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17122 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17123 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17124 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17127 * configuration and preset
17129 static const char *alc662_models[ALC662_MODEL_LAST] = {
17130 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17131 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17132 [ALC662_3ST_6ch] = "3stack-6ch",
17133 [ALC662_5ST_DIG] = "6stack-dig",
17134 [ALC662_LENOVO_101E] = "lenovo-101e",
17135 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17136 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17137 [ALC662_ECS] = "ecs",
17138 [ALC663_ASUS_M51VA] = "m51va",
17139 [ALC663_ASUS_G71V] = "g71v",
17140 [ALC663_ASUS_H13] = "h13",
17141 [ALC663_ASUS_G50V] = "g50v",
17142 [ALC663_ASUS_MODE1] = "asus-mode1",
17143 [ALC662_ASUS_MODE2] = "asus-mode2",
17144 [ALC663_ASUS_MODE3] = "asus-mode3",
17145 [ALC663_ASUS_MODE4] = "asus-mode4",
17146 [ALC663_ASUS_MODE5] = "asus-mode5",
17147 [ALC663_ASUS_MODE6] = "asus-mode6",
17148 [ALC663_ASUS_MODE7] = "asus-mode7",
17149 [ALC663_ASUS_MODE8] = "asus-mode8",
17150 [ALC272_DELL] = "dell",
17151 [ALC272_DELL_ZM1] = "dell-zm1",
17152 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17153 [ALC662_AUTO] = "auto",
17156 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17157 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17158 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17159 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17160 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17161 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17162 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17163 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17164 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17165 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17166 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17167 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17168 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17169 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17170 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17171 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17172 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17173 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17174 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17175 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17176 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17177 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17178 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17179 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17180 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17181 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17182 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17183 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17184 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17185 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17186 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17187 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17188 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17189 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17190 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17191 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17192 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17193 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17194 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17195 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17196 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17197 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17198 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17199 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17200 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17201 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17202 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17203 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17204 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17205 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17206 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17207 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17208 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17209 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17210 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17211 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17212 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17213 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17214 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17215 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17216 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17217 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17218 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17219 ALC662_3ST_6ch_DIG),
17220 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17221 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17222 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17223 ALC662_3ST_6ch_DIG),
17224 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17225 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17226 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17227 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17228 ALC662_3ST_6ch_DIG),
17229 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17231 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17235 static struct alc_config_preset alc662_presets[] = {
17236 [ALC662_3ST_2ch_DIG] = {
17237 .mixers = { alc662_3ST_2ch_mixer },
17238 .init_verbs = { alc662_init_verbs },
17239 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17240 .dac_nids = alc662_dac_nids,
17241 .dig_out_nid = ALC662_DIGOUT_NID,
17242 .dig_in_nid = ALC662_DIGIN_NID,
17243 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17244 .channel_mode = alc662_3ST_2ch_modes,
17245 .input_mux = &alc662_capture_source,
17247 [ALC662_3ST_6ch_DIG] = {
17248 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17249 .init_verbs = { alc662_init_verbs },
17250 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17251 .dac_nids = alc662_dac_nids,
17252 .dig_out_nid = ALC662_DIGOUT_NID,
17253 .dig_in_nid = ALC662_DIGIN_NID,
17254 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17255 .channel_mode = alc662_3ST_6ch_modes,
17257 .input_mux = &alc662_capture_source,
17259 [ALC662_3ST_6ch] = {
17260 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17261 .init_verbs = { alc662_init_verbs },
17262 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17263 .dac_nids = alc662_dac_nids,
17264 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17265 .channel_mode = alc662_3ST_6ch_modes,
17267 .input_mux = &alc662_capture_source,
17269 [ALC662_5ST_DIG] = {
17270 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17271 .init_verbs = { alc662_init_verbs },
17272 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17273 .dac_nids = alc662_dac_nids,
17274 .dig_out_nid = ALC662_DIGOUT_NID,
17275 .dig_in_nid = ALC662_DIGIN_NID,
17276 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17277 .channel_mode = alc662_5stack_modes,
17278 .input_mux = &alc662_capture_source,
17280 [ALC662_LENOVO_101E] = {
17281 .mixers = { alc662_lenovo_101e_mixer },
17282 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17283 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17284 .dac_nids = alc662_dac_nids,
17285 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17286 .channel_mode = alc662_3ST_2ch_modes,
17287 .input_mux = &alc662_lenovo_101e_capture_source,
17288 .unsol_event = alc662_lenovo_101e_unsol_event,
17289 .init_hook = alc662_lenovo_101e_all_automute,
17291 [ALC662_ASUS_EEEPC_P701] = {
17292 .mixers = { alc662_eeepc_p701_mixer },
17293 .init_verbs = { alc662_init_verbs,
17294 alc662_eeepc_sue_init_verbs },
17295 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17296 .dac_nids = alc662_dac_nids,
17297 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17298 .channel_mode = alc662_3ST_2ch_modes,
17299 .unsol_event = alc662_eeepc_unsol_event,
17300 .setup = alc662_eeepc_setup,
17301 .init_hook = alc662_eeepc_inithook,
17303 [ALC662_ASUS_EEEPC_EP20] = {
17304 .mixers = { alc662_eeepc_ep20_mixer,
17305 alc662_chmode_mixer },
17306 .init_verbs = { alc662_init_verbs,
17307 alc662_eeepc_ep20_sue_init_verbs },
17308 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17309 .dac_nids = alc662_dac_nids,
17310 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17311 .channel_mode = alc662_3ST_6ch_modes,
17312 .input_mux = &alc662_lenovo_101e_capture_source,
17313 .unsol_event = alc662_eeepc_unsol_event,
17314 .setup = alc662_eeepc_ep20_setup,
17315 .init_hook = alc662_eeepc_ep20_inithook,
17318 .mixers = { alc662_ecs_mixer },
17319 .init_verbs = { alc662_init_verbs,
17320 alc662_ecs_init_verbs },
17321 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17322 .dac_nids = alc662_dac_nids,
17323 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17324 .channel_mode = alc662_3ST_2ch_modes,
17325 .unsol_event = alc662_eeepc_unsol_event,
17326 .setup = alc662_eeepc_setup,
17327 .init_hook = alc662_eeepc_inithook,
17329 [ALC663_ASUS_M51VA] = {
17330 .mixers = { alc663_m51va_mixer },
17331 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17332 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17333 .dac_nids = alc662_dac_nids,
17334 .dig_out_nid = ALC662_DIGOUT_NID,
17335 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17336 .channel_mode = alc662_3ST_2ch_modes,
17337 .unsol_event = alc663_m51va_unsol_event,
17338 .setup = alc663_m51va_setup,
17339 .init_hook = alc663_m51va_inithook,
17341 [ALC663_ASUS_G71V] = {
17342 .mixers = { alc663_g71v_mixer },
17343 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17344 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17345 .dac_nids = alc662_dac_nids,
17346 .dig_out_nid = ALC662_DIGOUT_NID,
17347 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17348 .channel_mode = alc662_3ST_2ch_modes,
17349 .unsol_event = alc663_g71v_unsol_event,
17350 .setup = alc663_g71v_setup,
17351 .init_hook = alc663_g71v_inithook,
17353 [ALC663_ASUS_H13] = {
17354 .mixers = { alc663_m51va_mixer },
17355 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17356 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17357 .dac_nids = alc662_dac_nids,
17358 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17359 .channel_mode = alc662_3ST_2ch_modes,
17360 .unsol_event = alc663_m51va_unsol_event,
17361 .init_hook = alc663_m51va_inithook,
17363 [ALC663_ASUS_G50V] = {
17364 .mixers = { alc663_g50v_mixer },
17365 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17366 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17367 .dac_nids = alc662_dac_nids,
17368 .dig_out_nid = ALC662_DIGOUT_NID,
17369 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17370 .channel_mode = alc662_3ST_6ch_modes,
17371 .input_mux = &alc663_capture_source,
17372 .unsol_event = alc663_g50v_unsol_event,
17373 .setup = alc663_g50v_setup,
17374 .init_hook = alc663_g50v_inithook,
17376 [ALC663_ASUS_MODE1] = {
17377 .mixers = { alc663_m51va_mixer },
17378 .cap_mixer = alc662_auto_capture_mixer,
17379 .init_verbs = { alc662_init_verbs,
17380 alc663_21jd_amic_init_verbs },
17381 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17383 .dac_nids = alc662_dac_nids,
17384 .dig_out_nid = ALC662_DIGOUT_NID,
17385 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17386 .channel_mode = alc662_3ST_2ch_modes,
17387 .unsol_event = alc663_mode1_unsol_event,
17388 .setup = alc663_mode1_setup,
17389 .init_hook = alc663_mode1_inithook,
17391 [ALC662_ASUS_MODE2] = {
17392 .mixers = { alc662_1bjd_mixer },
17393 .cap_mixer = alc662_auto_capture_mixer,
17394 .init_verbs = { alc662_init_verbs,
17395 alc662_1bjd_amic_init_verbs },
17396 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17397 .dac_nids = alc662_dac_nids,
17398 .dig_out_nid = ALC662_DIGOUT_NID,
17399 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17400 .channel_mode = alc662_3ST_2ch_modes,
17401 .unsol_event = alc662_mode2_unsol_event,
17402 .setup = alc662_mode2_setup,
17403 .init_hook = alc662_mode2_inithook,
17405 [ALC663_ASUS_MODE3] = {
17406 .mixers = { alc663_two_hp_m1_mixer },
17407 .cap_mixer = alc662_auto_capture_mixer,
17408 .init_verbs = { alc662_init_verbs,
17409 alc663_two_hp_amic_m1_init_verbs },
17410 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17412 .dac_nids = alc662_dac_nids,
17413 .dig_out_nid = ALC662_DIGOUT_NID,
17414 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17415 .channel_mode = alc662_3ST_2ch_modes,
17416 .unsol_event = alc663_mode3_unsol_event,
17417 .setup = alc663_mode3_setup,
17418 .init_hook = alc663_mode3_inithook,
17420 [ALC663_ASUS_MODE4] = {
17421 .mixers = { alc663_asus_21jd_clfe_mixer },
17422 .cap_mixer = alc662_auto_capture_mixer,
17423 .init_verbs = { alc662_init_verbs,
17424 alc663_21jd_amic_init_verbs},
17425 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17427 .dac_nids = alc662_dac_nids,
17428 .dig_out_nid = ALC662_DIGOUT_NID,
17429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17430 .channel_mode = alc662_3ST_2ch_modes,
17431 .unsol_event = alc663_mode4_unsol_event,
17432 .setup = alc663_mode4_setup,
17433 .init_hook = alc663_mode4_inithook,
17435 [ALC663_ASUS_MODE5] = {
17436 .mixers = { alc663_asus_15jd_clfe_mixer },
17437 .cap_mixer = alc662_auto_capture_mixer,
17438 .init_verbs = { alc662_init_verbs,
17439 alc663_15jd_amic_init_verbs },
17440 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17442 .dac_nids = alc662_dac_nids,
17443 .dig_out_nid = ALC662_DIGOUT_NID,
17444 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17445 .channel_mode = alc662_3ST_2ch_modes,
17446 .unsol_event = alc663_mode5_unsol_event,
17447 .setup = alc663_mode5_setup,
17448 .init_hook = alc663_mode5_inithook,
17450 [ALC663_ASUS_MODE6] = {
17451 .mixers = { alc663_two_hp_m2_mixer },
17452 .cap_mixer = alc662_auto_capture_mixer,
17453 .init_verbs = { alc662_init_verbs,
17454 alc663_two_hp_amic_m2_init_verbs },
17455 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17457 .dac_nids = alc662_dac_nids,
17458 .dig_out_nid = ALC662_DIGOUT_NID,
17459 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17460 .channel_mode = alc662_3ST_2ch_modes,
17461 .unsol_event = alc663_mode6_unsol_event,
17462 .setup = alc663_mode6_setup,
17463 .init_hook = alc663_mode6_inithook,
17465 [ALC663_ASUS_MODE7] = {
17466 .mixers = { alc663_mode7_mixer },
17467 .cap_mixer = alc662_auto_capture_mixer,
17468 .init_verbs = { alc662_init_verbs,
17469 alc663_mode7_init_verbs },
17470 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17472 .dac_nids = alc662_dac_nids,
17473 .dig_out_nid = ALC662_DIGOUT_NID,
17474 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17475 .channel_mode = alc662_3ST_2ch_modes,
17476 .unsol_event = alc663_mode7_unsol_event,
17477 .setup = alc663_mode7_setup,
17478 .init_hook = alc663_mode7_inithook,
17480 [ALC663_ASUS_MODE8] = {
17481 .mixers = { alc663_mode8_mixer },
17482 .cap_mixer = alc662_auto_capture_mixer,
17483 .init_verbs = { alc662_init_verbs,
17484 alc663_mode8_init_verbs },
17485 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17487 .dac_nids = alc662_dac_nids,
17488 .dig_out_nid = ALC662_DIGOUT_NID,
17489 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17490 .channel_mode = alc662_3ST_2ch_modes,
17491 .unsol_event = alc663_mode8_unsol_event,
17492 .setup = alc663_mode8_setup,
17493 .init_hook = alc663_mode8_inithook,
17496 .mixers = { alc663_m51va_mixer },
17497 .cap_mixer = alc272_auto_capture_mixer,
17498 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17499 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17500 .dac_nids = alc662_dac_nids,
17501 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17502 .adc_nids = alc272_adc_nids,
17503 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17504 .capsrc_nids = alc272_capsrc_nids,
17505 .channel_mode = alc662_3ST_2ch_modes,
17506 .unsol_event = alc663_m51va_unsol_event,
17507 .setup = alc663_m51va_setup,
17508 .init_hook = alc663_m51va_inithook,
17510 [ALC272_DELL_ZM1] = {
17511 .mixers = { alc663_m51va_mixer },
17512 .cap_mixer = alc662_auto_capture_mixer,
17513 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17514 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17515 .dac_nids = alc662_dac_nids,
17516 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17517 .adc_nids = alc662_adc_nids,
17519 .capsrc_nids = alc662_capsrc_nids,
17520 .channel_mode = alc662_3ST_2ch_modes,
17521 .unsol_event = alc663_m51va_unsol_event,
17522 .setup = alc663_m51va_setup,
17523 .init_hook = alc663_m51va_inithook,
17525 [ALC272_SAMSUNG_NC10] = {
17526 .mixers = { alc272_nc10_mixer },
17527 .init_verbs = { alc662_init_verbs,
17528 alc663_21jd_amic_init_verbs },
17529 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17530 .dac_nids = alc272_dac_nids,
17531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17532 .channel_mode = alc662_3ST_2ch_modes,
17533 /*.input_mux = &alc272_nc10_capture_source,*/
17534 .unsol_event = alc663_mode4_unsol_event,
17535 .setup = alc663_mode4_setup,
17536 .init_hook = alc663_mode4_inithook,
17542 * BIOS auto configuration
17545 /* convert from MIX nid to DAC */
17546 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17550 else if (nid >= 0x0c && nid <= 0x0e)
17551 return nid - 0x0c + 0x02;
17556 /* get MIX nid connected to the given pin targeted to DAC */
17557 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17563 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17564 for (i = 0; i < num; i++) {
17565 if (alc662_mix_to_dac(mix[i]) == dac)
17571 /* look for an empty DAC slot */
17572 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17574 struct alc_spec *spec = codec->spec;
17578 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17581 for (i = 0; i < num; i++) {
17582 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17585 for (j = 0; j < spec->multiout.num_dacs; j++)
17586 if (spec->multiout.dac_nids[j] == nid)
17588 if (j >= spec->multiout.num_dacs)
17594 /* fill in the dac_nids table from the parsed pin configuration */
17595 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17596 const struct auto_pin_cfg *cfg)
17598 struct alc_spec *spec = codec->spec;
17602 spec->multiout.dac_nids = spec->private_dac_nids;
17603 for (i = 0; i < cfg->line_outs; i++) {
17604 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17607 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17612 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17613 hda_nid_t nid, unsigned int chs)
17615 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17616 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17619 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17620 hda_nid_t nid, unsigned int chs)
17622 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17623 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17626 #define alc662_add_stereo_vol(spec, pfx, nid) \
17627 alc662_add_vol_ctl(spec, pfx, nid, 3)
17628 #define alc662_add_stereo_sw(spec, pfx, nid) \
17629 alc662_add_sw_ctl(spec, pfx, nid, 3)
17631 /* add playback controls from the parsed DAC table */
17632 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17633 const struct auto_pin_cfg *cfg)
17635 struct alc_spec *spec = codec->spec;
17636 static const char *chname[4] = {
17637 "Front", "Surround", NULL /*CLFE*/, "Side"
17639 hda_nid_t nid, mix;
17642 for (i = 0; i < cfg->line_outs; i++) {
17643 nid = spec->multiout.dac_nids[i];
17646 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17651 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17654 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17657 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17660 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17665 if (cfg->line_outs == 1 &&
17666 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17673 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17676 if (cfg->line_outs == 1 &&
17677 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17679 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17687 /* add playback controls for speaker and HP outputs */
17688 /* return DAC nid if any new DAC is assigned */
17689 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17692 struct alc_spec *spec = codec->spec;
17693 hda_nid_t nid, mix;
17698 nid = alc662_look_for_dac(codec, pin);
17700 /* the corresponding DAC is already occupied */
17701 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17702 return 0; /* no way */
17703 /* create a switch only */
17704 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17705 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17708 mix = alc662_dac_to_mix(codec, pin, nid);
17711 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17714 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17720 /* create playback/capture controls for input pins */
17721 #define alc662_auto_create_input_ctls \
17722 alc882_auto_create_input_ctls
17724 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17725 hda_nid_t nid, int pin_type,
17731 alc_set_pin_output(codec, nid, pin_type);
17732 /* need the manual connection? */
17733 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17736 for (i = 0; i < num; i++) {
17737 if (alc662_mix_to_dac(srcs[i]) != dac)
17739 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17744 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17746 struct alc_spec *spec = codec->spec;
17747 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17750 for (i = 0; i <= HDA_SIDE; i++) {
17751 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17753 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17754 spec->multiout.dac_nids[i]);
17758 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17760 struct alc_spec *spec = codec->spec;
17763 pin = spec->autocfg.hp_pins[0];
17765 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17766 spec->multiout.hp_nid);
17767 pin = spec->autocfg.speaker_pins[0];
17769 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17770 spec->multiout.extra_out_nid[0]);
17773 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17775 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17777 struct alc_spec *spec = codec->spec;
17780 for (i = 0; i < AUTO_PIN_LAST; i++) {
17781 hda_nid_t nid = spec->autocfg.input_pins[i];
17782 if (alc_is_input_pin(codec, nid)) {
17783 alc_set_input_pin(codec, nid, i);
17784 if (nid != ALC662_PIN_CD_NID &&
17785 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17786 snd_hda_codec_write(codec, nid, 0,
17787 AC_VERB_SET_AMP_GAIN_MUTE,
17793 #define alc662_auto_init_input_src alc882_auto_init_input_src
17795 static int alc662_parse_auto_config(struct hda_codec *codec)
17797 struct alc_spec *spec = codec->spec;
17799 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17801 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17805 if (!spec->autocfg.line_outs)
17806 return 0; /* can't find valid BIOS pin config */
17808 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17811 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17814 err = alc662_auto_create_extra_out(codec,
17815 spec->autocfg.speaker_pins[0],
17820 spec->multiout.extra_out_nid[0] = err;
17821 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17826 spec->multiout.hp_nid = err;
17827 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17831 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17833 if (spec->autocfg.dig_outs)
17834 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17836 if (spec->kctls.list)
17837 add_mixer(spec, spec->kctls.list);
17839 spec->num_mux_defs = 1;
17840 spec->input_mux = &spec->private_imux[0];
17842 add_verb(spec, alc662_auto_init_verbs);
17843 if (codec->vendor_id == 0x10ec0663)
17844 add_verb(spec, alc663_auto_init_verbs);
17846 err = alc_auto_add_mic_boost(codec);
17850 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17855 /* additional initialization for auto-configuration model */
17856 static void alc662_auto_init(struct hda_codec *codec)
17858 struct alc_spec *spec = codec->spec;
17859 alc662_auto_init_multi_out(codec);
17860 alc662_auto_init_hp_out(codec);
17861 alc662_auto_init_analog_input(codec);
17862 alc662_auto_init_input_src(codec);
17863 if (spec->unsol_event)
17864 alc_inithook(codec);
17867 static int patch_alc662(struct hda_codec *codec)
17869 struct alc_spec *spec;
17870 int err, board_config;
17872 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17876 codec->spec = spec;
17878 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17880 if (alc_read_coef_idx(codec, 0)==0x8020){
17881 kfree(codec->chip_name);
17882 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17883 if (!codec->chip_name) {
17889 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17892 if (board_config < 0) {
17893 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17895 board_config = ALC662_AUTO;
17898 if (board_config == ALC662_AUTO) {
17899 /* automatic parse from the BIOS config */
17900 err = alc662_parse_auto_config(codec);
17906 "hda_codec: Cannot set up configuration "
17907 "from BIOS. Using base mode...\n");
17908 board_config = ALC662_3ST_2ch_DIG;
17912 err = snd_hda_attach_beep_device(codec, 0x1);
17918 if (board_config != ALC662_AUTO)
17919 setup_preset(codec, &alc662_presets[board_config]);
17921 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17922 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17924 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17925 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17927 if (!spec->adc_nids) {
17928 spec->adc_nids = alc662_adc_nids;
17929 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17931 if (!spec->capsrc_nids)
17932 spec->capsrc_nids = alc662_capsrc_nids;
17934 if (!spec->cap_mixer)
17935 set_capture_mixer(codec);
17936 if (codec->vendor_id == 0x10ec0662)
17937 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17939 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17941 spec->vmaster_nid = 0x02;
17943 codec->patch_ops = alc_patch_ops;
17944 if (board_config == ALC662_AUTO)
17945 spec->init_hook = alc662_auto_init;
17946 #ifdef CONFIG_SND_HDA_POWER_SAVE
17947 if (!spec->loopback.amplist)
17948 spec->loopback.amplist = alc662_loopbacks;
17950 codec->proc_widget_hook = print_realtek_coef;
17955 static int patch_alc888(struct hda_codec *codec)
17957 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17958 kfree(codec->chip_name);
17959 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17960 if (!codec->chip_name) {
17964 return patch_alc662(codec);
17966 return patch_alc882(codec);
17972 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17973 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17974 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17975 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17976 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17977 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17978 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17979 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17980 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17981 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17982 .patch = patch_alc861 },
17983 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17984 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17985 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17986 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17987 .patch = patch_alc882 },
17988 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17989 .patch = patch_alc662 },
17990 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17991 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17992 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17993 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17994 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17995 .patch = patch_alc882 },
17996 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17997 .patch = patch_alc882 },
17998 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17999 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18000 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18001 .patch = patch_alc882 },
18002 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18003 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18004 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18005 {} /* terminator */
18008 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18010 MODULE_LICENSE("GPL");
18011 MODULE_DESCRIPTION("Realtek HD-audio codec");
18013 static struct hda_codec_preset_list realtek_list = {
18014 .preset = snd_hda_preset_realtek,
18015 .owner = THIS_MODULE,
18018 static int __init patch_realtek_init(void)
18020 return snd_hda_add_codec_preset(&realtek_list);
18023 static void __exit patch_realtek_exit(void)
18025 snd_hda_delete_codec_preset(&realtek_list);
18028 module_init(patch_realtek_init)
18029 module_exit(patch_realtek_exit)