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 void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1782 struct alc_spec *spec = codec->spec;
1784 spec->autocfg.hp_pins[0] = 0x15;
1785 spec->autocfg.speaker_pins[0] = 0x14;
1786 spec->autocfg.speaker_pins[1] = 0x16;
1787 spec->autocfg.speaker_pins[2] = 0x17;
1790 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1792 struct alc_spec *spec = codec->spec;
1794 spec->autocfg.hp_pins[0] = 0x15;
1795 spec->autocfg.speaker_pins[0] = 0x14;
1796 spec->autocfg.speaker_pins[1] = 0x16;
1797 spec->autocfg.speaker_pins[2] = 0x17;
1800 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1802 struct alc_spec *spec = codec->spec;
1804 spec->autocfg.hp_pins[0] = 0x15;
1805 spec->autocfg.speaker_pins[0] = 0x14;
1806 spec->autocfg.speaker_pins[1] = 0x16;
1807 spec->autocfg.speaker_pins[2] = 0x1b;
1811 * ALC880 3-stack model
1813 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1814 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1815 * F-Mic = 0x1b, HP = 0x19
1818 static hda_nid_t alc880_dac_nids[4] = {
1819 /* front, rear, clfe, rear_surr */
1820 0x02, 0x05, 0x04, 0x03
1823 static hda_nid_t alc880_adc_nids[3] = {
1828 /* The datasheet says the node 0x07 is connected from inputs,
1829 * but it shows zero connection in the real implementation on some devices.
1830 * Note: this is a 915GAV bug, fixed on 915GLV
1832 static hda_nid_t alc880_adc_nids_alt[2] = {
1837 #define ALC880_DIGOUT_NID 0x06
1838 #define ALC880_DIGIN_NID 0x0a
1840 static struct hda_input_mux alc880_capture_source = {
1844 { "Front Mic", 0x3 },
1850 /* channel source setting (2/6 channel selection for 3-stack) */
1852 static struct hda_verb alc880_threestack_ch2_init[] = {
1853 /* set line-in to input, mute it */
1854 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1855 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1856 /* set mic-in to input vref 80%, mute it */
1857 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1858 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1863 static struct hda_verb alc880_threestack_ch6_init[] = {
1864 /* set line-in to output, unmute it */
1865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1867 /* set mic-in to output, unmute it */
1868 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1869 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1873 static struct hda_channel_mode alc880_threestack_modes[2] = {
1874 { 2, alc880_threestack_ch2_init },
1875 { 6, alc880_threestack_ch6_init },
1878 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1881 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1882 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1883 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1884 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1886 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1887 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1888 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1889 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1890 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1893 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1894 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1898 .name = "Channel Mode",
1899 .info = alc_ch_mode_info,
1900 .get = alc_ch_mode_get,
1901 .put = alc_ch_mode_put,
1906 /* capture mixer elements */
1907 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1908 struct snd_ctl_elem_info *uinfo)
1910 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1911 struct alc_spec *spec = codec->spec;
1914 mutex_lock(&codec->control_mutex);
1915 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1917 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1918 mutex_unlock(&codec->control_mutex);
1922 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1923 unsigned int size, unsigned int __user *tlv)
1925 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1926 struct alc_spec *spec = codec->spec;
1929 mutex_lock(&codec->control_mutex);
1930 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1932 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1933 mutex_unlock(&codec->control_mutex);
1937 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1938 struct snd_ctl_elem_value *ucontrol);
1940 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1941 struct snd_ctl_elem_value *ucontrol,
1944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1945 struct alc_spec *spec = codec->spec;
1946 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1949 mutex_lock(&codec->control_mutex);
1950 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1952 err = func(kcontrol, ucontrol);
1953 mutex_unlock(&codec->control_mutex);
1957 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1958 struct snd_ctl_elem_value *ucontrol)
1960 return alc_cap_getput_caller(kcontrol, ucontrol,
1961 snd_hda_mixer_amp_volume_get);
1964 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1965 struct snd_ctl_elem_value *ucontrol)
1967 return alc_cap_getput_caller(kcontrol, ucontrol,
1968 snd_hda_mixer_amp_volume_put);
1971 /* capture mixer elements */
1972 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1974 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1975 struct snd_ctl_elem_value *ucontrol)
1977 return alc_cap_getput_caller(kcontrol, ucontrol,
1978 snd_hda_mixer_amp_switch_get);
1981 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1982 struct snd_ctl_elem_value *ucontrol)
1984 return alc_cap_getput_caller(kcontrol, ucontrol,
1985 snd_hda_mixer_amp_switch_put);
1988 #define _DEFINE_CAPMIX(num) \
1990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1991 .name = "Capture Switch", \
1992 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1994 .info = alc_cap_sw_info, \
1995 .get = alc_cap_sw_get, \
1996 .put = alc_cap_sw_put, \
1999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2000 .name = "Capture Volume", \
2001 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2002 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2003 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2005 .info = alc_cap_vol_info, \
2006 .get = alc_cap_vol_get, \
2007 .put = alc_cap_vol_put, \
2008 .tlv = { .c = alc_cap_vol_tlv }, \
2011 #define _DEFINE_CAPSRC(num) \
2013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2014 /* .name = "Capture Source", */ \
2015 .name = "Input Source", \
2017 .info = alc_mux_enum_info, \
2018 .get = alc_mux_enum_get, \
2019 .put = alc_mux_enum_put, \
2022 #define DEFINE_CAPMIX(num) \
2023 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2024 _DEFINE_CAPMIX(num), \
2025 _DEFINE_CAPSRC(num), \
2029 #define DEFINE_CAPMIX_NOSRC(num) \
2030 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2031 _DEFINE_CAPMIX(num), \
2035 /* up to three ADCs */
2039 DEFINE_CAPMIX_NOSRC(1);
2040 DEFINE_CAPMIX_NOSRC(2);
2041 DEFINE_CAPMIX_NOSRC(3);
2044 * ALC880 5-stack model
2046 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2048 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2049 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2052 /* additional mixers to alc880_three_stack_mixer */
2053 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2054 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2055 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2059 /* channel source setting (6/8 channel selection for 5-stack) */
2061 static struct hda_verb alc880_fivestack_ch6_init[] = {
2062 /* set line-in to input, mute it */
2063 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2064 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2069 static struct hda_verb alc880_fivestack_ch8_init[] = {
2070 /* set line-in to output, unmute it */
2071 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2072 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2076 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2077 { 6, alc880_fivestack_ch6_init },
2078 { 8, alc880_fivestack_ch8_init },
2083 * ALC880 6-stack model
2085 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2086 * Side = 0x05 (0x0f)
2087 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2088 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2091 static hda_nid_t alc880_6st_dac_nids[4] = {
2092 /* front, rear, clfe, rear_surr */
2093 0x02, 0x03, 0x04, 0x05
2096 static struct hda_input_mux alc880_6stack_capture_source = {
2100 { "Front Mic", 0x1 },
2106 /* fixed 8-channels */
2107 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2111 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2113 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2115 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2116 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2117 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2119 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2120 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2121 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2131 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2132 .name = "Channel Mode",
2133 .info = alc_ch_mode_info,
2134 .get = alc_ch_mode_get,
2135 .put = alc_ch_mode_put,
2144 * W810 has rear IO for:
2147 * Center/LFE (DAC 04)
2150 * The system also has a pair of internal speakers, and a headphone jack.
2151 * These are both connected to Line2 on the codec, hence to DAC 02.
2153 * There is a variable resistor to control the speaker or headphone
2154 * volume. This is a hardware-only device without a software API.
2156 * Plugging headphones in will disable the internal speakers. This is
2157 * implemented in hardware, not via the driver using jack sense. In
2158 * a similar fashion, plugging into the rear socket marked "front" will
2159 * disable both the speakers and headphones.
2161 * For input, there's a microphone jack, and an "audio in" jack.
2162 * These may not do anything useful with this driver yet, because I
2163 * haven't setup any initialization verbs for these yet...
2166 static hda_nid_t alc880_w810_dac_nids[3] = {
2167 /* front, rear/surround, clfe */
2171 /* fixed 6 channels */
2172 static struct hda_channel_mode alc880_w810_modes[1] = {
2176 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2177 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2179 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2181 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2182 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2183 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2194 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2195 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2199 static hda_nid_t alc880_z71v_dac_nids[1] = {
2202 #define ALC880_Z71V_HP_DAC 0x03
2204 /* fixed 2 channels */
2205 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2209 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2210 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2223 * ALC880 F1734 model
2225 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2226 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2229 static hda_nid_t alc880_f1734_dac_nids[1] = {
2232 #define ALC880_F1734_HP_DAC 0x02
2234 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2236 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2238 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2239 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2240 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2246 static struct hda_input_mux alc880_f1734_capture_source = {
2258 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2259 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2260 * Mic = 0x18, Line = 0x1a
2263 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2264 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2266 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2269 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2271 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2272 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2274 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2282 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2283 .name = "Channel Mode",
2284 .info = alc_ch_mode_info,
2285 .get = alc_ch_mode_get,
2286 .put = alc_ch_mode_put,
2292 * ALC880 ASUS W1V model
2294 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2295 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2296 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2299 /* additional mixers to alc880_asus_mixer */
2300 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2301 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2302 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2307 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2308 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2312 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2313 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2314 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2316 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2321 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2322 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2323 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2324 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2325 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2326 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2327 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2329 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2336 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2337 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2340 .name = "Channel Mode",
2341 .info = alc_ch_mode_info,
2342 .get = alc_ch_mode_get,
2343 .put = alc_ch_mode_put,
2348 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2350 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2352 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2353 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2354 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2355 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2356 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2357 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2358 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2362 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2363 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2364 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2365 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2366 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2373 * virtual master controls
2377 * slave controls for virtual master
2379 static const char *alc_slave_vols[] = {
2380 "Front Playback Volume",
2381 "Surround Playback Volume",
2382 "Center Playback Volume",
2383 "LFE Playback Volume",
2384 "Side Playback Volume",
2385 "Headphone Playback Volume",
2386 "Speaker Playback Volume",
2387 "Mono Playback Volume",
2388 "Line-Out Playback Volume",
2389 "PCM Playback Volume",
2393 static const char *alc_slave_sws[] = {
2394 "Front Playback Switch",
2395 "Surround Playback Switch",
2396 "Center Playback Switch",
2397 "LFE Playback Switch",
2398 "Side Playback Switch",
2399 "Headphone Playback Switch",
2400 "Speaker Playback Switch",
2401 "Mono Playback Switch",
2402 "IEC958 Playback Switch",
2403 "Line-Out Playback Switch",
2404 "PCM Playback Switch",
2409 * build control elements
2412 static void alc_free_kctls(struct hda_codec *codec);
2414 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2415 /* additional beep mixers; the actual parameters are overwritten at build */
2416 static struct snd_kcontrol_new alc_beep_mixer[] = {
2417 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2418 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2423 static int alc_build_controls(struct hda_codec *codec)
2425 struct alc_spec *spec = codec->spec;
2429 for (i = 0; i < spec->num_mixers; i++) {
2430 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2434 if (spec->cap_mixer) {
2435 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2439 if (spec->multiout.dig_out_nid) {
2440 err = snd_hda_create_spdif_out_ctls(codec,
2441 spec->multiout.dig_out_nid);
2444 if (!spec->no_analog) {
2445 err = snd_hda_create_spdif_share_sw(codec,
2449 spec->multiout.share_spdif = 1;
2452 if (spec->dig_in_nid) {
2453 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2458 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2459 /* create beep controls if needed */
2460 if (spec->beep_amp) {
2461 struct snd_kcontrol_new *knew;
2462 for (knew = alc_beep_mixer; knew->name; knew++) {
2463 struct snd_kcontrol *kctl;
2464 kctl = snd_ctl_new1(knew, codec);
2467 kctl->private_value = spec->beep_amp;
2468 err = snd_hda_ctl_add(codec,
2469 get_amp_nid_(spec->beep_amp), kctl);
2476 /* if we have no master control, let's create it */
2477 if (!spec->no_analog &&
2478 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2479 unsigned int vmaster_tlv[4];
2480 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2481 HDA_OUTPUT, vmaster_tlv);
2482 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2483 vmaster_tlv, alc_slave_vols);
2487 if (!spec->no_analog &&
2488 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2489 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2490 NULL, alc_slave_sws);
2495 alc_free_kctls(codec); /* no longer needed */
2501 * initialize the codec volumes, etc
2505 * generic initialization of ADC, input mixers and output mixers
2507 static struct hda_verb alc880_volume_init_verbs[] = {
2509 * Unmute ADC0-2 and set the default input to mic-in
2511 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2513 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2515 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2518 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2520 * Note: PASD motherboards uses the Line In 2 as the input for front
2523 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2533 * Set up output mixers (0x0c - 0x0f)
2535 /* set vol=0 to output mixers */
2536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2539 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2540 /* set up input amps for analog loopback */
2541 /* Amp Indices: DAC = 0, mixer = 1 */
2542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2547 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2548 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2549 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2555 * 3-stack pin configuration:
2556 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2558 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2560 * preset connection lists of input pins
2561 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2563 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2564 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2565 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2568 * Set pin mode and muting
2570 /* set front pin widgets 0x14 for output */
2571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2576 /* Mic2 (as headphone out) for HP output */
2577 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2578 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2579 /* Line In pin widget for input */
2580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2582 /* Line2 (as front mic) pin widget for input and vref at 80% */
2583 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2584 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2585 /* CD pin widget for input */
2586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2592 * 5-stack pin configuration:
2593 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2594 * line-in/side = 0x1a, f-mic = 0x1b
2596 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2598 * preset connection lists of input pins
2599 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2601 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2602 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2605 * Set pin mode and muting
2607 /* set pin widgets 0x14-0x17 for output */
2608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2611 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2612 /* unmute pins for output (no gain on this amp) */
2613 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2618 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2621 /* Mic2 (as headphone out) for HP output */
2622 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2624 /* Line In pin widget for input */
2625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2627 /* Line2 (as front mic) pin widget for input and vref at 80% */
2628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2630 /* CD pin widget for input */
2631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2637 * W810 pin configuration:
2638 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2640 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2641 /* hphone/speaker input selector: front DAC */
2642 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2646 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2648 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2658 * Z71V pin configuration:
2659 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2661 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2663 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2669 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2670 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2676 * 6-stack pin configuration:
2677 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2678 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2680 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2681 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2683 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2684 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2687 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2688 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2689 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2690 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2696 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2706 * Uniwill pin configuration:
2707 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2710 static struct hda_verb alc880_uniwill_init_verbs[] = {
2711 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2714 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2717 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2722 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2724 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2726 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2728 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2730 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2732 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2733 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2734 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2735 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2736 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2738 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2739 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2746 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2748 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2749 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2759 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2760 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2761 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2762 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2769 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2771 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2772 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2777 static struct hda_verb alc880_beep_init_verbs[] = {
2778 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2782 /* auto-toggle front mic */
2783 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2785 unsigned int present;
2788 present = snd_hda_jack_detect(codec, 0x18);
2789 bits = present ? HDA_AMP_MUTE : 0;
2790 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2793 static void alc880_uniwill_setup(struct hda_codec *codec)
2795 struct alc_spec *spec = codec->spec;
2797 spec->autocfg.hp_pins[0] = 0x14;
2798 spec->autocfg.speaker_pins[0] = 0x15;
2799 spec->autocfg.speaker_pins[0] = 0x16;
2802 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2804 alc_automute_amp(codec);
2805 alc880_uniwill_mic_automute(codec);
2808 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2811 /* Looks like the unsol event is incompatible with the standard
2812 * definition. 4bit tag is placed at 28 bit!
2814 switch (res >> 28) {
2815 case ALC880_MIC_EVENT:
2816 alc880_uniwill_mic_automute(codec);
2819 alc_automute_amp_unsol_event(codec, res);
2824 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2826 struct alc_spec *spec = codec->spec;
2828 spec->autocfg.hp_pins[0] = 0x14;
2829 spec->autocfg.speaker_pins[0] = 0x15;
2832 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2834 unsigned int present;
2836 present = snd_hda_codec_read(codec, 0x21, 0,
2837 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2838 present &= HDA_AMP_VOLMASK;
2839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2840 HDA_AMP_VOLMASK, present);
2841 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2842 HDA_AMP_VOLMASK, present);
2845 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2848 /* Looks like the unsol event is incompatible with the standard
2849 * definition. 4bit tag is placed at 28 bit!
2851 if ((res >> 28) == ALC880_DCVOL_EVENT)
2852 alc880_uniwill_p53_dcvol_automute(codec);
2854 alc_automute_amp_unsol_event(codec, res);
2858 * F1734 pin configuration:
2859 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2861 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2862 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2863 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2864 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2865 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2866 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2875 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2876 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2877 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2879 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2880 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2881 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2883 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2884 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2890 * ASUS pin configuration:
2891 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2893 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2894 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2895 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2896 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2897 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2900 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2903 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2905 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2906 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2908 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2910 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2911 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2913 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2914 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2915 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2916 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2921 /* Enable GPIO mask and set output */
2922 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2923 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2924 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2926 /* Clevo m520g init */
2927 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2928 /* headphone output */
2929 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2938 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2939 /* Mic1 (rear panel) */
2940 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 /* Mic2 (front panel) */
2943 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2944 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2948 /* change to EAPD mode */
2949 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2950 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2955 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2956 /* change to EAPD mode */
2957 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2958 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2960 /* Headphone output */
2961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2963 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2964 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2966 /* Line In pin widget for input */
2967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2968 /* CD pin widget for input */
2969 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2970 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2973 /* change to EAPD mode */
2974 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2975 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2981 * LG m1 express dual
2984 * Rear Line-In/Out (blue): 0x14
2985 * Build-in Mic-In: 0x15
2987 * HP-Out (green): 0x1b
2988 * Mic-In/Out (red): 0x19
2992 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2993 static hda_nid_t alc880_lg_dac_nids[3] = {
2997 /* seems analog CD is not working */
2998 static struct hda_input_mux alc880_lg_capture_source = {
3003 { "Internal Mic", 0x6 },
3007 /* 2,4,6 channel modes */
3008 static struct hda_verb alc880_lg_ch2_init[] = {
3009 /* set line-in and mic-in to input */
3010 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3011 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3015 static struct hda_verb alc880_lg_ch4_init[] = {
3016 /* set line-in to out and mic-in to input */
3017 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3018 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3022 static struct hda_verb alc880_lg_ch6_init[] = {
3023 /* set line-in and mic-in to output */
3024 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3025 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3029 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3030 { 2, alc880_lg_ch2_init },
3031 { 4, alc880_lg_ch4_init },
3032 { 6, alc880_lg_ch6_init },
3035 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3037 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3039 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3048 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3049 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3052 .name = "Channel Mode",
3053 .info = alc_ch_mode_info,
3054 .get = alc_ch_mode_get,
3055 .put = alc_ch_mode_put,
3060 static struct hda_verb alc880_lg_init_verbs[] = {
3061 /* set capture source to mic-in */
3062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3064 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3065 /* mute all amp mixer inputs */
3066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3069 /* line-in to input */
3070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3076 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3077 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3078 /* mic-in to input */
3079 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3083 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3084 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3085 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3087 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3091 /* toggle speaker-output according to the hp-jack state */
3092 static void alc880_lg_setup(struct hda_codec *codec)
3094 struct alc_spec *spec = codec->spec;
3096 spec->autocfg.hp_pins[0] = 0x1b;
3097 spec->autocfg.speaker_pins[0] = 0x17;
3106 * Built-in Mic-In: 0x19
3112 static struct hda_input_mux alc880_lg_lw_capture_source = {
3116 { "Internal Mic", 0x1 },
3121 #define alc880_lg_lw_modes alc880_threestack_modes
3123 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3126 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3127 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3128 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3129 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3130 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3131 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3136 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3137 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3140 .name = "Channel Mode",
3141 .info = alc_ch_mode_info,
3142 .get = alc_ch_mode_get,
3143 .put = alc_ch_mode_put,
3148 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3149 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3150 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3151 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3153 /* set capture source to mic-in */
3154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3155 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3160 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3164 /* mic-in to input */
3165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3168 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3169 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3175 /* toggle speaker-output according to the hp-jack state */
3176 static void alc880_lg_lw_setup(struct hda_codec *codec)
3178 struct alc_spec *spec = codec->spec;
3180 spec->autocfg.hp_pins[0] = 0x1b;
3181 spec->autocfg.speaker_pins[0] = 0x14;
3184 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3185 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3186 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3189 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3190 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3194 static struct hda_input_mux alc880_medion_rim_capture_source = {
3198 { "Internal Mic", 0x1 },
3202 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3203 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3208 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3209 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3211 /* Mic2 (as headphone out) for HP output */
3212 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3213 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3214 /* Internal Speaker */
3215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3216 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3218 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3219 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3221 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3225 /* toggle speaker-output according to the hp-jack state */
3226 static void alc880_medion_rim_automute(struct hda_codec *codec)
3228 struct alc_spec *spec = codec->spec;
3229 alc_automute_amp(codec);
3231 if (spec->jack_present)
3232 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3234 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3237 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3240 /* Looks like the unsol event is incompatible with the standard
3241 * definition. 4bit tag is placed at 28 bit!
3243 if ((res >> 28) == ALC880_HP_EVENT)
3244 alc880_medion_rim_automute(codec);
3247 static void alc880_medion_rim_setup(struct hda_codec *codec)
3249 struct alc_spec *spec = codec->spec;
3251 spec->autocfg.hp_pins[0] = 0x14;
3252 spec->autocfg.speaker_pins[0] = 0x1b;
3255 #ifdef CONFIG_SND_HDA_POWER_SAVE
3256 static struct hda_amp_list alc880_loopbacks[] = {
3257 { 0x0b, HDA_INPUT, 0 },
3258 { 0x0b, HDA_INPUT, 1 },
3259 { 0x0b, HDA_INPUT, 2 },
3260 { 0x0b, HDA_INPUT, 3 },
3261 { 0x0b, HDA_INPUT, 4 },
3265 static struct hda_amp_list alc880_lg_loopbacks[] = {
3266 { 0x0b, HDA_INPUT, 1 },
3267 { 0x0b, HDA_INPUT, 6 },
3268 { 0x0b, HDA_INPUT, 7 },
3277 static int alc_init(struct hda_codec *codec)
3279 struct alc_spec *spec = codec->spec;
3283 alc_auto_init_amp(codec, spec->init_amp);
3285 for (i = 0; i < spec->num_init_verbs; i++)
3286 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3288 if (spec->init_hook)
3289 spec->init_hook(codec);
3294 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3296 struct alc_spec *spec = codec->spec;
3298 if (spec->unsol_event)
3299 spec->unsol_event(codec, res);
3302 #ifdef CONFIG_SND_HDA_POWER_SAVE
3303 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3305 struct alc_spec *spec = codec->spec;
3306 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3311 * Analog playback callbacks
3313 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3314 struct hda_codec *codec,
3315 struct snd_pcm_substream *substream)
3317 struct alc_spec *spec = codec->spec;
3318 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3322 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3323 struct hda_codec *codec,
3324 unsigned int stream_tag,
3325 unsigned int format,
3326 struct snd_pcm_substream *substream)
3328 struct alc_spec *spec = codec->spec;
3329 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3330 stream_tag, format, substream);
3333 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3334 struct hda_codec *codec,
3335 struct snd_pcm_substream *substream)
3337 struct alc_spec *spec = codec->spec;
3338 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3344 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3345 struct hda_codec *codec,
3346 struct snd_pcm_substream *substream)
3348 struct alc_spec *spec = codec->spec;
3349 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3352 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3353 struct hda_codec *codec,
3354 unsigned int stream_tag,
3355 unsigned int format,
3356 struct snd_pcm_substream *substream)
3358 struct alc_spec *spec = codec->spec;
3359 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3360 stream_tag, format, substream);
3363 static int alc880_dig_playback_pcm_cleanup(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_cleanup(codec, &spec->multiout);
3371 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3372 struct hda_codec *codec,
3373 struct snd_pcm_substream *substream)
3375 struct alc_spec *spec = codec->spec;
3376 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3382 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3383 struct hda_codec *codec,
3384 unsigned int stream_tag,
3385 unsigned int format,
3386 struct snd_pcm_substream *substream)
3388 struct alc_spec *spec = codec->spec;
3390 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3391 stream_tag, 0, format);
3395 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3396 struct hda_codec *codec,
3397 struct snd_pcm_substream *substream)
3399 struct alc_spec *spec = codec->spec;
3401 snd_hda_codec_cleanup_stream(codec,
3402 spec->adc_nids[substream->number + 1]);
3409 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3413 /* NID is set in alc_build_pcms */
3415 .open = alc880_playback_pcm_open,
3416 .prepare = alc880_playback_pcm_prepare,
3417 .cleanup = alc880_playback_pcm_cleanup
3421 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3425 /* NID is set in alc_build_pcms */
3428 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3432 /* NID is set in alc_build_pcms */
3435 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3436 .substreams = 2, /* can be overridden */
3439 /* NID is set in alc_build_pcms */
3441 .prepare = alc880_alt_capture_pcm_prepare,
3442 .cleanup = alc880_alt_capture_pcm_cleanup
3446 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3450 /* NID is set in alc_build_pcms */
3452 .open = alc880_dig_playback_pcm_open,
3453 .close = alc880_dig_playback_pcm_close,
3454 .prepare = alc880_dig_playback_pcm_prepare,
3455 .cleanup = alc880_dig_playback_pcm_cleanup
3459 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3463 /* NID is set in alc_build_pcms */
3466 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3467 static struct hda_pcm_stream alc_pcm_null_stream = {
3473 static int alc_build_pcms(struct hda_codec *codec)
3475 struct alc_spec *spec = codec->spec;
3476 struct hda_pcm *info = spec->pcm_rec;
3479 codec->num_pcms = 1;
3480 codec->pcm_info = info;
3482 if (spec->no_analog)
3485 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3486 "%s Analog", codec->chip_name);
3487 info->name = spec->stream_name_analog;
3489 if (spec->stream_analog_playback) {
3490 if (snd_BUG_ON(!spec->multiout.dac_nids))
3492 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3493 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3495 if (spec->stream_analog_capture) {
3496 if (snd_BUG_ON(!spec->adc_nids))
3498 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3499 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3502 if (spec->channel_mode) {
3503 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3504 for (i = 0; i < spec->num_channel_mode; i++) {
3505 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3506 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3512 /* SPDIF for stream index #1 */
3513 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3514 snprintf(spec->stream_name_digital,
3515 sizeof(spec->stream_name_digital),
3516 "%s Digital", codec->chip_name);
3517 codec->num_pcms = 2;
3518 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3519 info = spec->pcm_rec + 1;
3520 info->name = spec->stream_name_digital;
3521 if (spec->dig_out_type)
3522 info->pcm_type = spec->dig_out_type;
3524 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3525 if (spec->multiout.dig_out_nid &&
3526 spec->stream_digital_playback) {
3527 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3528 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3530 if (spec->dig_in_nid &&
3531 spec->stream_digital_capture) {
3532 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3533 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3535 /* FIXME: do we need this for all Realtek codec models? */
3536 codec->spdif_status_reset = 1;
3539 if (spec->no_analog)
3542 /* If the use of more than one ADC is requested for the current
3543 * model, configure a second analog capture-only PCM.
3545 /* Additional Analaog capture for index #2 */
3546 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3547 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3548 codec->num_pcms = 3;
3549 info = spec->pcm_rec + 2;
3550 info->name = spec->stream_name_analog;
3551 if (spec->alt_dac_nid) {
3552 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3553 *spec->stream_analog_alt_playback;
3554 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3557 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3558 alc_pcm_null_stream;
3559 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3561 if (spec->num_adc_nids > 1) {
3562 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3563 *spec->stream_analog_alt_capture;
3564 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3566 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3567 spec->num_adc_nids - 1;
3569 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3570 alc_pcm_null_stream;
3571 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3578 static void alc_free_kctls(struct hda_codec *codec)
3580 struct alc_spec *spec = codec->spec;
3582 if (spec->kctls.list) {
3583 struct snd_kcontrol_new *kctl = spec->kctls.list;
3585 for (i = 0; i < spec->kctls.used; i++)
3586 kfree(kctl[i].name);
3588 snd_array_free(&spec->kctls);
3591 static void alc_free(struct hda_codec *codec)
3593 struct alc_spec *spec = codec->spec;
3598 alc_free_kctls(codec);
3600 snd_hda_detach_beep_device(codec);
3603 #ifdef SND_HDA_NEEDS_RESUME
3604 static int alc_resume(struct hda_codec *codec)
3606 codec->patch_ops.init(codec);
3607 snd_hda_codec_resume_amp(codec);
3608 snd_hda_codec_resume_cache(codec);
3615 static struct hda_codec_ops alc_patch_ops = {
3616 .build_controls = alc_build_controls,
3617 .build_pcms = alc_build_pcms,
3620 .unsol_event = alc_unsol_event,
3621 #ifdef SND_HDA_NEEDS_RESUME
3622 .resume = alc_resume,
3624 #ifdef CONFIG_SND_HDA_POWER_SAVE
3625 .check_power_status = alc_check_power_status,
3631 * Test configuration for debugging
3633 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3636 #ifdef CONFIG_SND_DEBUG
3637 static hda_nid_t alc880_test_dac_nids[4] = {
3638 0x02, 0x03, 0x04, 0x05
3641 static struct hda_input_mux alc880_test_capture_source = {
3650 { "Surround", 0x6 },
3654 static struct hda_channel_mode alc880_test_modes[4] = {
3661 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3662 struct snd_ctl_elem_info *uinfo)
3664 static char *texts[] = {
3665 "N/A", "Line Out", "HP Out",
3666 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3668 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3670 uinfo->value.enumerated.items = 8;
3671 if (uinfo->value.enumerated.item >= 8)
3672 uinfo->value.enumerated.item = 7;
3673 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3677 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3678 struct snd_ctl_elem_value *ucontrol)
3680 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3681 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3682 unsigned int pin_ctl, item = 0;
3684 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3685 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3686 if (pin_ctl & AC_PINCTL_OUT_EN) {
3687 if (pin_ctl & AC_PINCTL_HP_EN)
3691 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3692 switch (pin_ctl & AC_PINCTL_VREFEN) {
3693 case AC_PINCTL_VREF_HIZ: item = 3; break;
3694 case AC_PINCTL_VREF_50: item = 4; break;
3695 case AC_PINCTL_VREF_GRD: item = 5; break;
3696 case AC_PINCTL_VREF_80: item = 6; break;
3697 case AC_PINCTL_VREF_100: item = 7; break;
3700 ucontrol->value.enumerated.item[0] = item;
3704 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3705 struct snd_ctl_elem_value *ucontrol)
3707 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3708 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3709 static unsigned int ctls[] = {
3710 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3711 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3712 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3713 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3714 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3715 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3717 unsigned int old_ctl, new_ctl;
3719 old_ctl = snd_hda_codec_read(codec, nid, 0,
3720 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3721 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3722 if (old_ctl != new_ctl) {
3724 snd_hda_codec_write_cache(codec, nid, 0,
3725 AC_VERB_SET_PIN_WIDGET_CONTROL,
3727 val = ucontrol->value.enumerated.item[0] >= 3 ?
3729 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3736 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3737 struct snd_ctl_elem_info *uinfo)
3739 static char *texts[] = {
3740 "Front", "Surround", "CLFE", "Side"
3742 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3744 uinfo->value.enumerated.items = 4;
3745 if (uinfo->value.enumerated.item >= 4)
3746 uinfo->value.enumerated.item = 3;
3747 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3751 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3752 struct snd_ctl_elem_value *ucontrol)
3754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3755 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3758 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3759 ucontrol->value.enumerated.item[0] = sel & 3;
3763 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3764 struct snd_ctl_elem_value *ucontrol)
3766 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3767 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3770 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3771 if (ucontrol->value.enumerated.item[0] != sel) {
3772 sel = ucontrol->value.enumerated.item[0] & 3;
3773 snd_hda_codec_write_cache(codec, nid, 0,
3774 AC_VERB_SET_CONNECT_SEL, sel);
3780 #define PIN_CTL_TEST(xname,nid) { \
3781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3783 .info = alc_test_pin_ctl_info, \
3784 .get = alc_test_pin_ctl_get, \
3785 .put = alc_test_pin_ctl_put, \
3786 .private_value = nid \
3789 #define PIN_SRC_TEST(xname,nid) { \
3790 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3792 .info = alc_test_pin_src_info, \
3793 .get = alc_test_pin_src_get, \
3794 .put = alc_test_pin_src_put, \
3795 .private_value = nid \
3798 static struct snd_kcontrol_new alc880_test_mixer[] = {
3799 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3800 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3801 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3802 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3803 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3804 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3805 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3806 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3807 PIN_CTL_TEST("Front Pin Mode", 0x14),
3808 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3809 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3810 PIN_CTL_TEST("Side Pin Mode", 0x17),
3811 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3812 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3813 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3814 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3815 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3816 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3817 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3818 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3819 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3820 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3821 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3822 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3823 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3824 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3825 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3826 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3827 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3828 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3831 .name = "Channel Mode",
3832 .info = alc_ch_mode_info,
3833 .get = alc_ch_mode_get,
3834 .put = alc_ch_mode_put,
3839 static struct hda_verb alc880_test_init_verbs[] = {
3840 /* Unmute inputs of 0x0c - 0x0f */
3841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3847 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3849 /* Vol output for 0x0c-0x0f */
3850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3854 /* Set output pins 0x14-0x17 */
3855 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3857 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3858 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3859 /* Unmute output pins 0x14-0x17 */
3860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3862 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3863 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3864 /* Set input pins 0x18-0x1c */
3865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3866 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3867 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3868 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3869 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3870 /* Mute input pins 0x18-0x1b */
3871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3872 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3874 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3876 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3877 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3878 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3879 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3880 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3881 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3882 /* Analog input/passthru */
3883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3895 static const char *alc880_models[ALC880_MODEL_LAST] = {
3896 [ALC880_3ST] = "3stack",
3897 [ALC880_TCL_S700] = "tcl",
3898 [ALC880_3ST_DIG] = "3stack-digout",
3899 [ALC880_CLEVO] = "clevo",
3900 [ALC880_5ST] = "5stack",
3901 [ALC880_5ST_DIG] = "5stack-digout",
3902 [ALC880_W810] = "w810",
3903 [ALC880_Z71V] = "z71v",
3904 [ALC880_6ST] = "6stack",
3905 [ALC880_6ST_DIG] = "6stack-digout",
3906 [ALC880_ASUS] = "asus",
3907 [ALC880_ASUS_W1V] = "asus-w1v",
3908 [ALC880_ASUS_DIG] = "asus-dig",
3909 [ALC880_ASUS_DIG2] = "asus-dig2",
3910 [ALC880_UNIWILL_DIG] = "uniwill",
3911 [ALC880_UNIWILL_P53] = "uniwill-p53",
3912 [ALC880_FUJITSU] = "fujitsu",
3913 [ALC880_F1734] = "F1734",
3915 [ALC880_LG_LW] = "lg-lw",
3916 [ALC880_MEDION_RIM] = "medion",
3917 #ifdef CONFIG_SND_DEBUG
3918 [ALC880_TEST] = "test",
3920 [ALC880_AUTO] = "auto",
3923 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3924 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3925 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3926 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3927 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3928 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3929 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3930 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3931 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3932 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3933 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3935 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3936 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3937 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3938 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3939 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3940 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3941 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3942 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3943 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3944 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3945 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3946 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3947 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3948 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3949 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3950 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3951 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3952 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3953 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3954 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3955 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3956 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3957 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3958 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3959 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3960 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3961 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3962 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3963 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3964 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3965 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3966 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3967 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3968 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3969 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3970 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3971 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3972 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3973 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3974 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3975 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3976 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3977 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3978 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3979 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3980 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3981 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3982 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3983 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3984 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3987 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3988 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3989 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3990 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3991 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3993 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3994 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3995 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4000 * ALC880 codec presets
4002 static struct alc_config_preset alc880_presets[] = {
4004 .mixers = { alc880_three_stack_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_pin_3stack_init_verbs },
4007 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4008 .dac_nids = alc880_dac_nids,
4009 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4010 .channel_mode = alc880_threestack_modes,
4012 .input_mux = &alc880_capture_source,
4014 [ALC880_3ST_DIG] = {
4015 .mixers = { alc880_three_stack_mixer },
4016 .init_verbs = { alc880_volume_init_verbs,
4017 alc880_pin_3stack_init_verbs },
4018 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4019 .dac_nids = alc880_dac_nids,
4020 .dig_out_nid = ALC880_DIGOUT_NID,
4021 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4022 .channel_mode = alc880_threestack_modes,
4024 .input_mux = &alc880_capture_source,
4026 [ALC880_TCL_S700] = {
4027 .mixers = { alc880_tcl_s700_mixer },
4028 .init_verbs = { alc880_volume_init_verbs,
4029 alc880_pin_tcl_S700_init_verbs,
4030 alc880_gpio2_init_verbs },
4031 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4032 .dac_nids = alc880_dac_nids,
4033 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4034 .num_adc_nids = 1, /* single ADC */
4036 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4037 .channel_mode = alc880_2_jack_modes,
4038 .input_mux = &alc880_capture_source,
4041 .mixers = { alc880_three_stack_mixer,
4042 alc880_five_stack_mixer},
4043 .init_verbs = { alc880_volume_init_verbs,
4044 alc880_pin_5stack_init_verbs },
4045 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4046 .dac_nids = alc880_dac_nids,
4047 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4048 .channel_mode = alc880_fivestack_modes,
4049 .input_mux = &alc880_capture_source,
4051 [ALC880_5ST_DIG] = {
4052 .mixers = { alc880_three_stack_mixer,
4053 alc880_five_stack_mixer },
4054 .init_verbs = { alc880_volume_init_verbs,
4055 alc880_pin_5stack_init_verbs },
4056 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4057 .dac_nids = alc880_dac_nids,
4058 .dig_out_nid = ALC880_DIGOUT_NID,
4059 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4060 .channel_mode = alc880_fivestack_modes,
4061 .input_mux = &alc880_capture_source,
4064 .mixers = { alc880_six_stack_mixer },
4065 .init_verbs = { alc880_volume_init_verbs,
4066 alc880_pin_6stack_init_verbs },
4067 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4068 .dac_nids = alc880_6st_dac_nids,
4069 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4070 .channel_mode = alc880_sixstack_modes,
4071 .input_mux = &alc880_6stack_capture_source,
4073 [ALC880_6ST_DIG] = {
4074 .mixers = { alc880_six_stack_mixer },
4075 .init_verbs = { alc880_volume_init_verbs,
4076 alc880_pin_6stack_init_verbs },
4077 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4078 .dac_nids = alc880_6st_dac_nids,
4079 .dig_out_nid = ALC880_DIGOUT_NID,
4080 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4081 .channel_mode = alc880_sixstack_modes,
4082 .input_mux = &alc880_6stack_capture_source,
4085 .mixers = { alc880_w810_base_mixer },
4086 .init_verbs = { alc880_volume_init_verbs,
4087 alc880_pin_w810_init_verbs,
4088 alc880_gpio2_init_verbs },
4089 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4090 .dac_nids = alc880_w810_dac_nids,
4091 .dig_out_nid = ALC880_DIGOUT_NID,
4092 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4093 .channel_mode = alc880_w810_modes,
4094 .input_mux = &alc880_capture_source,
4097 .mixers = { alc880_z71v_mixer },
4098 .init_verbs = { alc880_volume_init_verbs,
4099 alc880_pin_z71v_init_verbs },
4100 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4101 .dac_nids = alc880_z71v_dac_nids,
4102 .dig_out_nid = ALC880_DIGOUT_NID,
4104 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4105 .channel_mode = alc880_2_jack_modes,
4106 .input_mux = &alc880_capture_source,
4109 .mixers = { alc880_f1734_mixer },
4110 .init_verbs = { alc880_volume_init_verbs,
4111 alc880_pin_f1734_init_verbs },
4112 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4113 .dac_nids = alc880_f1734_dac_nids,
4115 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4116 .channel_mode = alc880_2_jack_modes,
4117 .input_mux = &alc880_f1734_capture_source,
4118 .unsol_event = alc880_uniwill_p53_unsol_event,
4119 .setup = alc880_uniwill_p53_setup,
4120 .init_hook = alc_automute_amp,
4123 .mixers = { alc880_asus_mixer },
4124 .init_verbs = { alc880_volume_init_verbs,
4125 alc880_pin_asus_init_verbs,
4126 alc880_gpio1_init_verbs },
4127 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4128 .dac_nids = alc880_asus_dac_nids,
4129 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4130 .channel_mode = alc880_asus_modes,
4132 .input_mux = &alc880_capture_source,
4134 [ALC880_ASUS_DIG] = {
4135 .mixers = { alc880_asus_mixer },
4136 .init_verbs = { alc880_volume_init_verbs,
4137 alc880_pin_asus_init_verbs,
4138 alc880_gpio1_init_verbs },
4139 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4140 .dac_nids = alc880_asus_dac_nids,
4141 .dig_out_nid = ALC880_DIGOUT_NID,
4142 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4143 .channel_mode = alc880_asus_modes,
4145 .input_mux = &alc880_capture_source,
4147 [ALC880_ASUS_DIG2] = {
4148 .mixers = { alc880_asus_mixer },
4149 .init_verbs = { alc880_volume_init_verbs,
4150 alc880_pin_asus_init_verbs,
4151 alc880_gpio2_init_verbs }, /* use GPIO2 */
4152 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4153 .dac_nids = alc880_asus_dac_nids,
4154 .dig_out_nid = ALC880_DIGOUT_NID,
4155 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4156 .channel_mode = alc880_asus_modes,
4158 .input_mux = &alc880_capture_source,
4160 [ALC880_ASUS_W1V] = {
4161 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_asus_init_verbs,
4164 alc880_gpio1_init_verbs },
4165 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4166 .dac_nids = alc880_asus_dac_nids,
4167 .dig_out_nid = ALC880_DIGOUT_NID,
4168 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4169 .channel_mode = alc880_asus_modes,
4171 .input_mux = &alc880_capture_source,
4173 [ALC880_UNIWILL_DIG] = {
4174 .mixers = { alc880_asus_mixer },
4175 .init_verbs = { alc880_volume_init_verbs,
4176 alc880_pin_asus_init_verbs },
4177 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4178 .dac_nids = alc880_asus_dac_nids,
4179 .dig_out_nid = ALC880_DIGOUT_NID,
4180 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4181 .channel_mode = alc880_asus_modes,
4183 .input_mux = &alc880_capture_source,
4185 [ALC880_UNIWILL] = {
4186 .mixers = { alc880_uniwill_mixer },
4187 .init_verbs = { alc880_volume_init_verbs,
4188 alc880_uniwill_init_verbs },
4189 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4190 .dac_nids = alc880_asus_dac_nids,
4191 .dig_out_nid = ALC880_DIGOUT_NID,
4192 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4193 .channel_mode = alc880_threestack_modes,
4195 .input_mux = &alc880_capture_source,
4196 .unsol_event = alc880_uniwill_unsol_event,
4197 .setup = alc880_uniwill_setup,
4198 .init_hook = alc880_uniwill_init_hook,
4200 [ALC880_UNIWILL_P53] = {
4201 .mixers = { alc880_uniwill_p53_mixer },
4202 .init_verbs = { alc880_volume_init_verbs,
4203 alc880_uniwill_p53_init_verbs },
4204 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4205 .dac_nids = alc880_asus_dac_nids,
4206 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4207 .channel_mode = alc880_threestack_modes,
4208 .input_mux = &alc880_capture_source,
4209 .unsol_event = alc880_uniwill_p53_unsol_event,
4210 .setup = alc880_uniwill_p53_setup,
4211 .init_hook = alc_automute_amp,
4213 [ALC880_FUJITSU] = {
4214 .mixers = { alc880_fujitsu_mixer },
4215 .init_verbs = { alc880_volume_init_verbs,
4216 alc880_uniwill_p53_init_verbs,
4217 alc880_beep_init_verbs },
4218 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4219 .dac_nids = alc880_dac_nids,
4220 .dig_out_nid = ALC880_DIGOUT_NID,
4221 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4222 .channel_mode = alc880_2_jack_modes,
4223 .input_mux = &alc880_capture_source,
4224 .unsol_event = alc880_uniwill_p53_unsol_event,
4225 .setup = alc880_uniwill_p53_setup,
4226 .init_hook = alc_automute_amp,
4229 .mixers = { alc880_three_stack_mixer },
4230 .init_verbs = { alc880_volume_init_verbs,
4231 alc880_pin_clevo_init_verbs },
4232 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4233 .dac_nids = alc880_dac_nids,
4235 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4236 .channel_mode = alc880_threestack_modes,
4238 .input_mux = &alc880_capture_source,
4241 .mixers = { alc880_lg_mixer },
4242 .init_verbs = { alc880_volume_init_verbs,
4243 alc880_lg_init_verbs },
4244 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4245 .dac_nids = alc880_lg_dac_nids,
4246 .dig_out_nid = ALC880_DIGOUT_NID,
4247 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4248 .channel_mode = alc880_lg_ch_modes,
4250 .input_mux = &alc880_lg_capture_source,
4251 .unsol_event = alc_automute_amp_unsol_event,
4252 .setup = alc880_lg_setup,
4253 .init_hook = alc_automute_amp,
4254 #ifdef CONFIG_SND_HDA_POWER_SAVE
4255 .loopbacks = alc880_lg_loopbacks,
4259 .mixers = { alc880_lg_lw_mixer },
4260 .init_verbs = { alc880_volume_init_verbs,
4261 alc880_lg_lw_init_verbs },
4262 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4263 .dac_nids = alc880_dac_nids,
4264 .dig_out_nid = ALC880_DIGOUT_NID,
4265 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4266 .channel_mode = alc880_lg_lw_modes,
4267 .input_mux = &alc880_lg_lw_capture_source,
4268 .unsol_event = alc_automute_amp_unsol_event,
4269 .setup = alc880_lg_lw_setup,
4270 .init_hook = alc_automute_amp,
4272 [ALC880_MEDION_RIM] = {
4273 .mixers = { alc880_medion_rim_mixer },
4274 .init_verbs = { alc880_volume_init_verbs,
4275 alc880_medion_rim_init_verbs,
4276 alc_gpio2_init_verbs },
4277 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4278 .dac_nids = alc880_dac_nids,
4279 .dig_out_nid = ALC880_DIGOUT_NID,
4280 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4281 .channel_mode = alc880_2_jack_modes,
4282 .input_mux = &alc880_medion_rim_capture_source,
4283 .unsol_event = alc880_medion_rim_unsol_event,
4284 .setup = alc880_medion_rim_setup,
4285 .init_hook = alc880_medion_rim_automute,
4287 #ifdef CONFIG_SND_DEBUG
4289 .mixers = { alc880_test_mixer },
4290 .init_verbs = { alc880_test_init_verbs },
4291 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4292 .dac_nids = alc880_test_dac_nids,
4293 .dig_out_nid = ALC880_DIGOUT_NID,
4294 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4295 .channel_mode = alc880_test_modes,
4296 .input_mux = &alc880_test_capture_source,
4302 * Automatic parse of I/O pins from the BIOS configuration
4307 ALC_CTL_WIDGET_MUTE,
4310 static struct snd_kcontrol_new alc880_control_templates[] = {
4311 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4312 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4313 HDA_BIND_MUTE(NULL, 0, 0, 0),
4316 /* add dynamic controls */
4317 static int add_control(struct alc_spec *spec, int type, const char *name,
4320 struct snd_kcontrol_new *knew;
4322 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4323 knew = snd_array_new(&spec->kctls);
4326 *knew = alc880_control_templates[type];
4327 knew->name = kstrdup(name, GFP_KERNEL);
4330 if (get_amp_nid_(val))
4331 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4332 knew->private_value = val;
4336 static int add_control_with_pfx(struct alc_spec *spec, int type,
4337 const char *pfx, const char *dir,
4338 const char *sfx, unsigned long val)
4341 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4342 return add_control(spec, type, name, val);
4345 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4346 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4347 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4348 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4350 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4351 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4352 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4353 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4354 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4355 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4356 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4357 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4358 #define ALC880_PIN_CD_NID 0x1c
4360 /* fill in the dac_nids table from the parsed pin configuration */
4361 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4362 const struct auto_pin_cfg *cfg)
4368 memset(assigned, 0, sizeof(assigned));
4369 spec->multiout.dac_nids = spec->private_dac_nids;
4371 /* check the pins hardwired to audio widget */
4372 for (i = 0; i < cfg->line_outs; i++) {
4373 nid = cfg->line_out_pins[i];
4374 if (alc880_is_fixed_pin(nid)) {
4375 int idx = alc880_fixed_pin_idx(nid);
4376 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4380 /* left pins can be connect to any audio widget */
4381 for (i = 0; i < cfg->line_outs; i++) {
4382 nid = cfg->line_out_pins[i];
4383 if (alc880_is_fixed_pin(nid))
4385 /* search for an empty channel */
4386 for (j = 0; j < cfg->line_outs; j++) {
4388 spec->multiout.dac_nids[i] =
4389 alc880_idx_to_dac(j);
4395 spec->multiout.num_dacs = cfg->line_outs;
4399 /* add playback controls from the parsed DAC table */
4400 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4401 const struct auto_pin_cfg *cfg)
4403 static const char *chname[4] = {
4404 "Front", "Surround", NULL /*CLFE*/, "Side"
4409 for (i = 0; i < cfg->line_outs; i++) {
4410 if (!spec->multiout.dac_nids[i])
4412 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4415 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4417 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4421 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4423 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4427 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4429 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4433 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4435 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4441 if (cfg->line_outs == 1 &&
4442 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4446 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4447 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4451 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4452 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4461 /* add playback controls for speaker and HP outputs */
4462 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4471 if (alc880_is_fixed_pin(pin)) {
4472 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4473 /* specify the DAC as the extra output */
4474 if (!spec->multiout.hp_nid)
4475 spec->multiout.hp_nid = nid;
4477 spec->multiout.extra_out_nid[0] = nid;
4478 /* control HP volume/switch on the output mixer amp */
4479 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4480 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4481 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4484 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4485 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4488 } else if (alc880_is_multi_pin(pin)) {
4489 /* set manual connection */
4490 /* we have only a switch on HP-out PIN */
4491 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4492 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4499 /* create input playback/capture controls for the given pin */
4500 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4501 const char *ctlname,
4502 int idx, hda_nid_t mix_nid)
4506 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4507 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4510 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4511 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4517 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4519 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4520 return (pincap & AC_PINCAP_IN) != 0;
4523 /* create playback/capture controls for input pins */
4524 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4525 const struct auto_pin_cfg *cfg,
4527 hda_nid_t cap1, hda_nid_t cap2)
4529 struct alc_spec *spec = codec->spec;
4530 struct hda_input_mux *imux = &spec->private_imux[0];
4533 for (i = 0; i < AUTO_PIN_LAST; i++) {
4536 pin = cfg->input_pins[i];
4537 if (!alc_is_input_pin(codec, pin))
4541 idx = get_connection_index(codec, mixer, pin);
4543 err = new_analog_input(spec, pin,
4544 auto_pin_cfg_labels[i],
4553 idx = get_connection_index(codec, cap1, pin);
4554 if (idx < 0 && cap2)
4555 idx = get_connection_index(codec, cap2, pin);
4557 imux->items[imux->num_items].label =
4558 auto_pin_cfg_labels[i];
4559 imux->items[imux->num_items].index = idx;
4566 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4567 const struct auto_pin_cfg *cfg)
4569 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4572 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4573 unsigned int pin_type)
4575 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4578 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4582 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4583 hda_nid_t nid, int pin_type,
4586 alc_set_pin_output(codec, nid, pin_type);
4587 /* need the manual connection? */
4588 if (alc880_is_multi_pin(nid)) {
4589 struct alc_spec *spec = codec->spec;
4590 int idx = alc880_multi_pin_idx(nid);
4591 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4592 AC_VERB_SET_CONNECT_SEL,
4593 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4597 static int get_pin_type(int line_out_type)
4599 if (line_out_type == AUTO_PIN_HP_OUT)
4605 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4607 struct alc_spec *spec = codec->spec;
4610 for (i = 0; i < spec->autocfg.line_outs; i++) {
4611 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4612 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4613 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4617 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4619 struct alc_spec *spec = codec->spec;
4622 pin = spec->autocfg.speaker_pins[0];
4623 if (pin) /* connect to front */
4624 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4625 pin = spec->autocfg.hp_pins[0];
4626 if (pin) /* connect to front */
4627 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4630 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4632 struct alc_spec *spec = codec->spec;
4635 for (i = 0; i < AUTO_PIN_LAST; i++) {
4636 hda_nid_t nid = spec->autocfg.input_pins[i];
4637 if (alc_is_input_pin(codec, nid)) {
4638 alc_set_input_pin(codec, nid, i);
4639 if (nid != ALC880_PIN_CD_NID &&
4640 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4641 snd_hda_codec_write(codec, nid, 0,
4642 AC_VERB_SET_AMP_GAIN_MUTE,
4648 /* parse the BIOS configuration and set up the alc_spec */
4649 /* return 1 if successful, 0 if the proper config is not found,
4650 * or a negative error code
4652 static int alc880_parse_auto_config(struct hda_codec *codec)
4654 struct alc_spec *spec = codec->spec;
4656 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4658 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4662 if (!spec->autocfg.line_outs)
4663 return 0; /* can't find valid BIOS pin config */
4665 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4668 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4671 err = alc880_auto_create_extra_out(spec,
4672 spec->autocfg.speaker_pins[0],
4676 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4680 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4684 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4686 /* check multiple SPDIF-out (for recent codecs) */
4687 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4689 err = snd_hda_get_connections(codec,
4690 spec->autocfg.dig_out_pins[i],
4695 spec->multiout.dig_out_nid = dig_nid;
4697 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4698 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4700 spec->slave_dig_outs[i - 1] = dig_nid;
4703 if (spec->autocfg.dig_in_pin)
4704 spec->dig_in_nid = ALC880_DIGIN_NID;
4706 if (spec->kctls.list)
4707 add_mixer(spec, spec->kctls.list);
4709 add_verb(spec, alc880_volume_init_verbs);
4711 spec->num_mux_defs = 1;
4712 spec->input_mux = &spec->private_imux[0];
4714 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4719 /* additional initialization for auto-configuration model */
4720 static void alc880_auto_init(struct hda_codec *codec)
4722 struct alc_spec *spec = codec->spec;
4723 alc880_auto_init_multi_out(codec);
4724 alc880_auto_init_extra_out(codec);
4725 alc880_auto_init_analog_input(codec);
4726 if (spec->unsol_event)
4727 alc_inithook(codec);
4730 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4731 * one of two digital mic pins, e.g. on ALC272
4733 static void fixup_automic_adc(struct hda_codec *codec)
4735 struct alc_spec *spec = codec->spec;
4738 for (i = 0; i < spec->num_adc_nids; i++) {
4739 hda_nid_t cap = spec->capsrc_nids ?
4740 spec->capsrc_nids[i] : spec->adc_nids[i];
4743 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4746 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4749 spec->int_mic.mux_idx = iidx;
4750 spec->ext_mic.mux_idx = eidx;
4751 if (spec->capsrc_nids)
4752 spec->capsrc_nids += i;
4753 spec->adc_nids += i;
4754 spec->num_adc_nids = 1;
4757 snd_printd(KERN_INFO "hda_codec: %s: "
4758 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4759 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4760 spec->auto_mic = 0; /* disable auto-mic to be sure */
4763 static void set_capture_mixer(struct hda_codec *codec)
4765 struct alc_spec *spec = codec->spec;
4766 static struct snd_kcontrol_new *caps[2][3] = {
4767 { alc_capture_mixer_nosrc1,
4768 alc_capture_mixer_nosrc2,
4769 alc_capture_mixer_nosrc3 },
4770 { alc_capture_mixer1,
4772 alc_capture_mixer3 },
4774 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4776 if (spec->auto_mic) {
4778 fixup_automic_adc(codec);
4779 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4783 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4787 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4788 #define set_beep_amp(spec, nid, idx, dir) \
4789 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4791 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4795 * OK, here we have finally the patch for ALC880
4798 static int patch_alc880(struct hda_codec *codec)
4800 struct alc_spec *spec;
4804 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4810 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4813 if (board_config < 0) {
4814 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4816 board_config = ALC880_AUTO;
4819 if (board_config == ALC880_AUTO) {
4820 /* automatic parse from the BIOS config */
4821 err = alc880_parse_auto_config(codec);
4827 "hda_codec: Cannot set up configuration "
4828 "from BIOS. Using 3-stack mode...\n");
4829 board_config = ALC880_3ST;
4833 err = snd_hda_attach_beep_device(codec, 0x1);
4839 if (board_config != ALC880_AUTO)
4840 setup_preset(codec, &alc880_presets[board_config]);
4842 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4843 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4844 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4846 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4847 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4849 if (!spec->adc_nids && spec->input_mux) {
4850 /* check whether NID 0x07 is valid */
4851 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4853 wcap = get_wcaps_type(wcap);
4854 if (wcap != AC_WID_AUD_IN) {
4855 spec->adc_nids = alc880_adc_nids_alt;
4856 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4858 spec->adc_nids = alc880_adc_nids;
4859 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4862 set_capture_mixer(codec);
4863 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4865 spec->vmaster_nid = 0x0c;
4867 codec->patch_ops = alc_patch_ops;
4868 if (board_config == ALC880_AUTO)
4869 spec->init_hook = alc880_auto_init;
4870 #ifdef CONFIG_SND_HDA_POWER_SAVE
4871 if (!spec->loopback.amplist)
4872 spec->loopback.amplist = alc880_loopbacks;
4874 codec->proc_widget_hook = print_realtek_coef;
4884 static hda_nid_t alc260_dac_nids[1] = {
4889 static hda_nid_t alc260_adc_nids[1] = {
4894 static hda_nid_t alc260_adc_nids_alt[1] = {
4899 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4900 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4902 static hda_nid_t alc260_dual_adc_nids[2] = {
4907 #define ALC260_DIGOUT_NID 0x03
4908 #define ALC260_DIGIN_NID 0x06
4910 static struct hda_input_mux alc260_capture_source = {
4914 { "Front Mic", 0x1 },
4920 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4921 * headphone jack and the internal CD lines since these are the only pins at
4922 * which audio can appear. For flexibility, also allow the option of
4923 * recording the mixer output on the second ADC (ADC0 doesn't have a
4924 * connection to the mixer output).
4926 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4930 { "Mic/Line", 0x0 },
4932 { "Headphone", 0x2 },
4938 { "Mic/Line", 0x0 },
4940 { "Headphone", 0x2 },
4947 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4948 * the Fujitsu S702x, but jacks are marked differently.
4950 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4957 { "Headphone", 0x5 },
4966 { "Headphone", 0x6 },
4972 /* Maxdata Favorit 100XS */
4973 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4977 { "Line/Mic", 0x0 },
4984 { "Line/Mic", 0x0 },
4992 * This is just place-holder, so there's something for alc_build_pcms to look
4993 * at when it calculates the maximum number of channels. ALC260 has no mixer
4994 * element which allows changing the channel mode, so the verb list is
4997 static struct hda_channel_mode alc260_modes[1] = {
5002 /* Mixer combinations
5004 * basic: base_output + input + pc_beep + capture
5005 * HP: base_output + input + capture_alt
5006 * HP_3013: hp_3013 + input + capture
5007 * fujitsu: fujitsu + capture
5008 * acer: acer + capture
5011 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5012 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5013 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5014 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5015 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5016 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5017 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5021 static struct snd_kcontrol_new alc260_input_mixer[] = {
5022 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5023 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5024 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5025 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5027 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5029 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5033 /* update HP, line and mono out pins according to the master switch */
5034 static void alc260_hp_master_update(struct hda_codec *codec,
5035 hda_nid_t hp, hda_nid_t line,
5038 struct alc_spec *spec = codec->spec;
5039 unsigned int val = spec->master_sw ? PIN_HP : 0;
5040 /* change HP and line-out pins */
5041 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5043 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5045 /* mono (speaker) depending on the HP jack sense */
5046 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5047 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5051 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5052 struct snd_ctl_elem_value *ucontrol)
5054 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5055 struct alc_spec *spec = codec->spec;
5056 *ucontrol->value.integer.value = spec->master_sw;
5060 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5061 struct snd_ctl_elem_value *ucontrol)
5063 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5064 struct alc_spec *spec = codec->spec;
5065 int val = !!*ucontrol->value.integer.value;
5066 hda_nid_t hp, line, mono;
5068 if (val == spec->master_sw)
5070 spec->master_sw = val;
5071 hp = (kcontrol->private_value >> 16) & 0xff;
5072 line = (kcontrol->private_value >> 8) & 0xff;
5073 mono = kcontrol->private_value & 0xff;
5074 alc260_hp_master_update(codec, hp, line, mono);
5078 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5081 .name = "Master Playback Switch",
5082 .info = snd_ctl_boolean_mono_info,
5083 .get = alc260_hp_master_sw_get,
5084 .put = alc260_hp_master_sw_put,
5085 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5087 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5088 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5089 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5090 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5091 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5093 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5097 static struct hda_verb alc260_hp_unsol_verbs[] = {
5098 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5102 static void alc260_hp_automute(struct hda_codec *codec)
5104 struct alc_spec *spec = codec->spec;
5106 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5107 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5110 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5112 if ((res >> 26) == ALC880_HP_EVENT)
5113 alc260_hp_automute(codec);
5116 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5119 .name = "Master Playback Switch",
5120 .info = snd_ctl_boolean_mono_info,
5121 .get = alc260_hp_master_sw_get,
5122 .put = alc260_hp_master_sw_put,
5123 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5125 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5126 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5127 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5128 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5131 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5132 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5136 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5137 .ops = &snd_hda_bind_vol,
5139 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5140 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5141 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5146 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5147 .ops = &snd_hda_bind_sw,
5149 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5150 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5155 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5156 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5157 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5158 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5163 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5164 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5168 static void alc260_hp_3013_automute(struct hda_codec *codec)
5170 struct alc_spec *spec = codec->spec;
5172 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5173 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5176 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5179 if ((res >> 26) == ALC880_HP_EVENT)
5180 alc260_hp_3013_automute(codec);
5183 static void alc260_hp_3012_automute(struct hda_codec *codec)
5185 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5187 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5189 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5191 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5195 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5198 if ((res >> 26) == ALC880_HP_EVENT)
5199 alc260_hp_3012_automute(codec);
5202 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5203 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5205 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5206 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5207 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5208 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5209 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5210 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5211 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5212 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5213 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5215 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5219 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5220 * versions of the ALC260 don't act on requests to enable mic bias from NID
5221 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5222 * datasheet doesn't mention this restriction. At this stage it's not clear
5223 * whether this behaviour is intentional or is a hardware bug in chip
5224 * revisions available in early 2006. Therefore for now allow the
5225 * "Headphone Jack Mode" control to span all choices, but if it turns out
5226 * that the lack of mic bias for this NID is intentional we could change the
5227 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5229 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5230 * don't appear to make the mic bias available from the "line" jack, even
5231 * though the NID used for this jack (0x14) can supply it. The theory is
5232 * that perhaps Acer have included blocking capacitors between the ALC260
5233 * and the output jack. If this turns out to be the case for all such
5234 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5235 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5237 * The C20x Tablet series have a mono internal speaker which is controlled
5238 * via the chip's Mono sum widget and pin complex, so include the necessary
5239 * controls for such models. On models without a "mono speaker" the control
5240 * won't do anything.
5242 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5243 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5244 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5245 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5246 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5248 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5250 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5251 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5253 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5254 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5255 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5256 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5257 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5261 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5263 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5264 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5265 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5266 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5267 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5268 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5269 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5273 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5274 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5276 static struct snd_kcontrol_new alc260_will_mixer[] = {
5277 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5280 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5281 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5282 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5283 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5284 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5285 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5286 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5290 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5291 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5293 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5294 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5295 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5297 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5298 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5299 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5300 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
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),
5308 * initialization verbs
5310 static struct hda_verb alc260_init_verbs[] = {
5311 /* Line In pin widget for input */
5312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5313 /* CD pin widget for input */
5314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5315 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5316 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5317 /* Mic2 (front panel) pin widget for input and vref at 80% */
5318 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5319 /* LINE-2 is used for line-out in rear */
5320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5321 /* select line-out */
5322 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5324 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5326 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5328 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5329 /* mute capture amp left and right */
5330 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5331 /* set connection select to line in (default select for this ADC) */
5332 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5333 /* mute capture amp left and right */
5334 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5335 /* set connection select to line in (default select for this ADC) */
5336 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5337 /* set vol=0 Line-Out mixer amp left and right */
5338 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5339 /* unmute pin widget amp left and right (no gain on this amp) */
5340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5341 /* set vol=0 HP mixer amp left and right */
5342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5343 /* unmute pin widget amp left and right (no gain on this amp) */
5344 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5345 /* set vol=0 Mono mixer amp left and right */
5346 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5347 /* unmute pin widget amp left and right (no gain on this amp) */
5348 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5349 /* unmute LINE-2 out pin */
5350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5351 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5354 /* mute analog inputs */
5355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5360 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5361 /* mute Front out path */
5362 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5363 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5364 /* mute Headphone out path */
5365 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5366 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5367 /* mute Mono out path */
5368 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5369 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5373 #if 0 /* should be identical with alc260_init_verbs? */
5374 static struct hda_verb alc260_hp_init_verbs[] = {
5375 /* Headphone and output */
5376 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5378 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5379 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5380 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5381 /* Mic2 (front panel) pin widget for input and vref at 80% */
5382 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5383 /* Line In pin widget for input */
5384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5385 /* Line-2 pin widget for output */
5386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5387 /* CD pin widget for input */
5388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5389 /* unmute amp left and right */
5390 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5391 /* set connection select to line in (default select for this ADC) */
5392 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5393 /* unmute Line-Out mixer amp left and right (volume = 0) */
5394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5395 /* mute pin widget amp left and right (no gain on this amp) */
5396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5397 /* unmute HP mixer amp left and right (volume = 0) */
5398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5399 /* mute pin widget amp left and right (no gain on this amp) */
5400 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5401 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5404 /* mute analog inputs */
5405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5410 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5411 /* Unmute Front out path */
5412 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5414 /* Unmute Headphone out path */
5415 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5416 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5417 /* Unmute Mono out path */
5418 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5419 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5424 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5425 /* Line out and output */
5426 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5428 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5429 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5430 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5431 /* Mic2 (front panel) pin widget for input and vref at 80% */
5432 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5433 /* Line In pin widget for input */
5434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5435 /* Headphone pin widget for output */
5436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5437 /* CD pin widget for input */
5438 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5439 /* unmute amp left and right */
5440 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5441 /* set connection select to line in (default select for this ADC) */
5442 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5443 /* unmute Line-Out mixer amp left and right (volume = 0) */
5444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5445 /* mute pin widget amp left and right (no gain on this amp) */
5446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5447 /* unmute HP mixer amp left and right (volume = 0) */
5448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5449 /* mute pin widget amp left and right (no gain on this amp) */
5450 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5451 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5454 /* mute analog inputs */
5455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5460 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5461 /* Unmute Front out path */
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5464 /* Unmute Headphone out path */
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5467 /* Unmute Mono out path */
5468 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5469 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5473 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5474 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5475 * audio = 0x16, internal speaker = 0x10.
5477 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5478 /* Disable all GPIOs */
5479 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5480 /* Internal speaker is connected to headphone pin */
5481 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5482 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5484 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5485 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5486 /* Ensure all other unused pins are disabled and muted. */
5487 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5488 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5489 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5490 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5492 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 /* Disable digital (SPDIF) pins */
5497 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5498 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5500 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5501 * when acting as an output.
5503 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5505 /* Start with output sum widgets muted and their output gains at min */
5506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5509 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5512 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5516 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5517 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5518 /* Unmute Line1 pin widget output buffer since it starts as an output.
5519 * If the pin mode is changed by the user the pin mode control will
5520 * take care of enabling the pin's input/output buffers as needed.
5521 * Therefore there's no need to enable the input buffer at this
5524 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5525 /* Unmute input buffer of pin widget used for Line-in (no equiv
5528 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5530 /* Mute capture amp left and right */
5531 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5532 /* Set ADC connection select to match default mixer setting - line
5535 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5537 /* Do the same for the second ADC: mute capture input amp and
5538 * set ADC connection to line in (on mic1 pin)
5540 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5541 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5543 /* Mute all inputs to mixer widget (even unconnected ones) */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5556 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5557 * similar laptops (adapted from Fujitsu init verbs).
5559 static struct hda_verb alc260_acer_init_verbs[] = {
5560 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5561 * the headphone jack. Turn this on and rely on the standard mute
5562 * methods whenever the user wants to turn these outputs off.
5564 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5565 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5566 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5567 /* Internal speaker/Headphone jack is connected to Line-out pin */
5568 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5569 /* Internal microphone/Mic jack is connected to Mic1 pin */
5570 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5571 /* Line In jack is connected to Line1 pin */
5572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5573 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5574 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5575 /* Ensure all other unused pins are disabled and muted. */
5576 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5577 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5578 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5579 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 /* Disable digital (SPDIF) pins */
5583 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5584 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5586 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5587 * bus when acting as outputs.
5589 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5590 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5592 /* Start with output sum widgets muted and their output gains at min */
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5603 /* Unmute Line-out pin widget amp left and right
5604 * (no equiv mixer ctrl)
5606 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5607 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5608 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5609 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5610 * inputs. If the pin mode is changed by the user the pin mode control
5611 * will take care of enabling the pin's input/output buffers as needed.
5612 * Therefore there's no need to enable the input buffer at this
5615 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5618 /* Mute capture amp left and right */
5619 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5620 /* Set ADC connection select to match default mixer setting - mic
5623 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5625 /* Do similar with the second ADC: mute capture input amp and
5626 * set ADC connection to mic to match ALSA's default state.
5628 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5631 /* Mute all inputs to mixer widget (even unconnected ones) */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5644 /* Initialisation sequence for Maxdata Favorit 100XS
5645 * (adapted from Acer init verbs).
5647 static struct hda_verb alc260_favorit100_init_verbs[] = {
5648 /* GPIO 0 enables the output jack.
5649 * Turn this on and rely on the standard mute
5650 * methods whenever the user wants to turn these outputs off.
5652 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5653 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5654 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5655 /* Line/Mic input jack is connected to Mic1 pin */
5656 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5657 /* Ensure all other unused pins are disabled and muted. */
5658 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5659 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5660 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5661 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5663 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5668 /* Disable digital (SPDIF) pins */
5669 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5670 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5672 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5673 * bus when acting as outputs.
5675 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5676 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5678 /* Start with output sum widgets muted and their output gains at min */
5679 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5682 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5685 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5689 /* Unmute Line-out pin widget amp left and right
5690 * (no equiv mixer ctrl)
5692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5693 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5694 * inputs. If the pin mode is changed by the user the pin mode control
5695 * will take care of enabling the pin's input/output buffers as needed.
5696 * Therefore there's no need to enable the input buffer at this
5699 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5701 /* Mute capture amp left and right */
5702 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5703 /* Set ADC connection select to match default mixer setting - mic
5706 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5708 /* Do similar with the second ADC: mute capture input amp and
5709 * set ADC connection to mic to match ALSA's default state.
5711 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5712 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 /* Mute all inputs to mixer widget (even unconnected ones) */
5715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5727 static struct hda_verb alc260_will_verbs[] = {
5728 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5729 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5730 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5731 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5732 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5733 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5737 static struct hda_verb alc260_replacer_672v_verbs[] = {
5738 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5739 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5740 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5742 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5743 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5744 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5746 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5750 /* toggle speaker-output according to the hp-jack state */
5751 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5753 unsigned int present;
5755 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5756 present = snd_hda_jack_detect(codec, 0x0f);
5758 snd_hda_codec_write_cache(codec, 0x01, 0,
5759 AC_VERB_SET_GPIO_DATA, 1);
5760 snd_hda_codec_write_cache(codec, 0x0f, 0,
5761 AC_VERB_SET_PIN_WIDGET_CONTROL,
5764 snd_hda_codec_write_cache(codec, 0x01, 0,
5765 AC_VERB_SET_GPIO_DATA, 0);
5766 snd_hda_codec_write_cache(codec, 0x0f, 0,
5767 AC_VERB_SET_PIN_WIDGET_CONTROL,
5772 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5775 if ((res >> 26) == ALC880_HP_EVENT)
5776 alc260_replacer_672v_automute(codec);
5779 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5780 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5781 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5782 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5783 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5784 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5787 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5788 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5789 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5793 /* Test configuration for debugging, modelled after the ALC880 test
5796 #ifdef CONFIG_SND_DEBUG
5797 static hda_nid_t alc260_test_dac_nids[1] = {
5800 static hda_nid_t alc260_test_adc_nids[2] = {
5803 /* For testing the ALC260, each input MUX needs its own definition since
5804 * the signal assignments are different. This assumes that the first ADC
5807 static struct hda_input_mux alc260_test_capture_sources[2] = {
5811 { "MIC1 pin", 0x0 },
5812 { "MIC2 pin", 0x1 },
5813 { "LINE1 pin", 0x2 },
5814 { "LINE2 pin", 0x3 },
5816 { "LINE-OUT pin", 0x5 },
5817 { "HP-OUT pin", 0x6 },
5823 { "MIC1 pin", 0x0 },
5824 { "MIC2 pin", 0x1 },
5825 { "LINE1 pin", 0x2 },
5826 { "LINE2 pin", 0x3 },
5829 { "LINE-OUT pin", 0x6 },
5830 { "HP-OUT pin", 0x7 },
5834 static struct snd_kcontrol_new alc260_test_mixer[] = {
5835 /* Output driver widgets */
5836 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5837 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5838 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5839 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5840 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5843 /* Modes for retasking pin widgets
5844 * Note: the ALC260 doesn't seem to act on requests to enable mic
5845 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5846 * mention this restriction. At this stage it's not clear whether
5847 * this behaviour is intentional or is a hardware bug in chip
5848 * revisions available at least up until early 2006. Therefore for
5849 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5850 * choices, but if it turns out that the lack of mic bias for these
5851 * NIDs is intentional we could change their modes from
5852 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5854 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5855 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5856 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5857 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5859 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5861 /* Loopback mixer controls */
5862 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5863 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5864 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5865 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5866 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5867 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5868 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5869 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5870 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5871 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5872 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5873 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5874 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5875 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5877 /* Controls for GPIO pins, assuming they are configured as outputs */
5878 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5879 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5880 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5881 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5883 /* Switches to allow the digital IO pins to be enabled. The datasheet
5884 * is ambigious as to which NID is which; testing on laptops which
5885 * make this output available should provide clarification.
5887 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5888 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5890 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5891 * this output to turn on an external amplifier.
5893 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5894 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5898 static struct hda_verb alc260_test_init_verbs[] = {
5899 /* Enable all GPIOs as outputs with an initial value of 0 */
5900 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5901 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5902 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5904 /* Enable retasking pins as output, initially without power amp */
5905 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5906 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5908 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5912 /* Disable digital (SPDIF) pins initially, but users can enable
5913 * them via a mixer switch. In the case of SPDIF-out, this initverb
5914 * payload also sets the generation to 0, output to be in "consumer"
5915 * PCM format, copyright asserted, no pre-emphasis and no validity
5918 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5919 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5921 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5922 * OUT1 sum bus when acting as an output.
5924 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5925 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5926 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5927 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5929 /* Start with output sum widgets muted and their output gains at min */
5930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5933 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5936 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5938 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5940 /* Unmute retasking pin widget output buffers since the default
5941 * state appears to be output. As the pin mode is changed by the
5942 * user the pin mode control will take care of enabling the pin's
5943 * input/output buffers as needed.
5945 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5946 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 /* Also unmute the mono-out pin widget */
5952 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5954 /* Mute capture amp left and right */
5955 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5956 /* Set ADC connection select to match default mixer setting (mic1
5959 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5961 /* Do the same for the second ADC: mute capture input amp and
5962 * set ADC connection to mic1 pin
5964 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5965 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5967 /* Mute all inputs to mixer widget (even unconnected ones) */
5968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5981 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5982 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5984 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5985 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5988 * for BIOS auto-configuration
5991 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5992 const char *pfx, int *vol_bits)
5995 unsigned long vol_val, sw_val;
5998 if (nid >= 0x0f && nid < 0x11) {
5999 nid_vol = nid - 0x7;
6000 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6001 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6002 } else if (nid == 0x11) {
6003 nid_vol = nid - 0x7;
6004 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6005 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6006 } else if (nid >= 0x12 && nid <= 0x15) {
6008 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6009 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6013 if (!(*vol_bits & (1 << nid_vol))) {
6014 /* first control for the volume widget */
6015 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6018 *vol_bits |= (1 << nid_vol);
6020 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6026 /* add playback controls from the parsed DAC table */
6027 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6028 const struct auto_pin_cfg *cfg)
6034 spec->multiout.num_dacs = 1;
6035 spec->multiout.dac_nids = spec->private_dac_nids;
6036 spec->multiout.dac_nids[0] = 0x02;
6038 nid = cfg->line_out_pins[0];
6041 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6043 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6047 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6052 nid = cfg->speaker_pins[0];
6054 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6059 nid = cfg->hp_pins[0];
6061 err = alc260_add_playback_controls(spec, nid, "Headphone",
6069 /* create playback/capture controls for input pins */
6070 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6071 const struct auto_pin_cfg *cfg)
6073 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6076 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6077 hda_nid_t nid, int pin_type,
6080 alc_set_pin_output(codec, nid, pin_type);
6081 /* need the manual connection? */
6083 int idx = nid - 0x12;
6084 snd_hda_codec_write(codec, idx + 0x0b, 0,
6085 AC_VERB_SET_CONNECT_SEL, sel_idx);
6089 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6091 struct alc_spec *spec = codec->spec;
6094 nid = spec->autocfg.line_out_pins[0];
6096 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6097 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6100 nid = spec->autocfg.speaker_pins[0];
6102 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6104 nid = spec->autocfg.hp_pins[0];
6106 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6109 #define ALC260_PIN_CD_NID 0x16
6110 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6112 struct alc_spec *spec = codec->spec;
6115 for (i = 0; i < AUTO_PIN_LAST; i++) {
6116 hda_nid_t nid = spec->autocfg.input_pins[i];
6118 alc_set_input_pin(codec, nid, i);
6119 if (nid != ALC260_PIN_CD_NID &&
6120 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6121 snd_hda_codec_write(codec, nid, 0,
6122 AC_VERB_SET_AMP_GAIN_MUTE,
6129 * generic initialization of ADC, input mixers and output mixers
6131 static struct hda_verb alc260_volume_init_verbs[] = {
6133 * Unmute ADC0-1 and set the default input to mic-in
6135 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6136 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6137 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6138 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6140 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6142 * Note: PASD motherboards uses the Line In 2 as the input for
6143 * front panel mic (mic 2)
6145 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6146 /* mute analog inputs */
6147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6151 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6154 * Set up output mixers (0x08 - 0x0a)
6156 /* set vol=0 to output mixers */
6157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6159 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6160 /* set up input amps for analog loopback */
6161 /* Amp Indices: DAC = 0, mixer = 1 */
6162 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6165 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6166 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6167 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6172 static int alc260_parse_auto_config(struct hda_codec *codec)
6174 struct alc_spec *spec = codec->spec;
6176 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6178 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6182 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6185 if (!spec->kctls.list)
6186 return 0; /* can't find valid BIOS pin config */
6187 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6191 spec->multiout.max_channels = 2;
6193 if (spec->autocfg.dig_outs)
6194 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6195 if (spec->kctls.list)
6196 add_mixer(spec, spec->kctls.list);
6198 add_verb(spec, alc260_volume_init_verbs);
6200 spec->num_mux_defs = 1;
6201 spec->input_mux = &spec->private_imux[0];
6203 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6208 /* additional initialization for auto-configuration model */
6209 static void alc260_auto_init(struct hda_codec *codec)
6211 struct alc_spec *spec = codec->spec;
6212 alc260_auto_init_multi_out(codec);
6213 alc260_auto_init_analog_input(codec);
6214 if (spec->unsol_event)
6215 alc_inithook(codec);
6218 #ifdef CONFIG_SND_HDA_POWER_SAVE
6219 static struct hda_amp_list alc260_loopbacks[] = {
6220 { 0x07, HDA_INPUT, 0 },
6221 { 0x07, HDA_INPUT, 1 },
6222 { 0x07, HDA_INPUT, 2 },
6223 { 0x07, HDA_INPUT, 3 },
6224 { 0x07, HDA_INPUT, 4 },
6230 * ALC260 configurations
6232 static const char *alc260_models[ALC260_MODEL_LAST] = {
6233 [ALC260_BASIC] = "basic",
6235 [ALC260_HP_3013] = "hp-3013",
6236 [ALC260_HP_DC7600] = "hp-dc7600",
6237 [ALC260_FUJITSU_S702X] = "fujitsu",
6238 [ALC260_ACER] = "acer",
6239 [ALC260_WILL] = "will",
6240 [ALC260_REPLACER_672V] = "replacer",
6241 [ALC260_FAVORIT100] = "favorit100",
6242 #ifdef CONFIG_SND_DEBUG
6243 [ALC260_TEST] = "test",
6245 [ALC260_AUTO] = "auto",
6248 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6249 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6250 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6251 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6252 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6253 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6254 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6255 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6256 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6257 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6258 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6259 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6260 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6261 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6262 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6263 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6264 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6265 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6266 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6267 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6268 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6272 static struct alc_config_preset alc260_presets[] = {
6274 .mixers = { alc260_base_output_mixer,
6275 alc260_input_mixer },
6276 .init_verbs = { alc260_init_verbs },
6277 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6278 .dac_nids = alc260_dac_nids,
6279 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6280 .adc_nids = alc260_adc_nids,
6281 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6282 .channel_mode = alc260_modes,
6283 .input_mux = &alc260_capture_source,
6286 .mixers = { alc260_hp_output_mixer,
6287 alc260_input_mixer },
6288 .init_verbs = { alc260_init_verbs,
6289 alc260_hp_unsol_verbs },
6290 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6291 .dac_nids = alc260_dac_nids,
6292 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6293 .adc_nids = alc260_adc_nids_alt,
6294 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6295 .channel_mode = alc260_modes,
6296 .input_mux = &alc260_capture_source,
6297 .unsol_event = alc260_hp_unsol_event,
6298 .init_hook = alc260_hp_automute,
6300 [ALC260_HP_DC7600] = {
6301 .mixers = { alc260_hp_dc7600_mixer,
6302 alc260_input_mixer },
6303 .init_verbs = { alc260_init_verbs,
6304 alc260_hp_dc7600_verbs },
6305 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6306 .dac_nids = alc260_dac_nids,
6307 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6308 .adc_nids = alc260_adc_nids_alt,
6309 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6310 .channel_mode = alc260_modes,
6311 .input_mux = &alc260_capture_source,
6312 .unsol_event = alc260_hp_3012_unsol_event,
6313 .init_hook = alc260_hp_3012_automute,
6315 [ALC260_HP_3013] = {
6316 .mixers = { alc260_hp_3013_mixer,
6317 alc260_input_mixer },
6318 .init_verbs = { alc260_hp_3013_init_verbs,
6319 alc260_hp_3013_unsol_verbs },
6320 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6321 .dac_nids = alc260_dac_nids,
6322 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6323 .adc_nids = alc260_adc_nids_alt,
6324 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6325 .channel_mode = alc260_modes,
6326 .input_mux = &alc260_capture_source,
6327 .unsol_event = alc260_hp_3013_unsol_event,
6328 .init_hook = alc260_hp_3013_automute,
6330 [ALC260_FUJITSU_S702X] = {
6331 .mixers = { alc260_fujitsu_mixer },
6332 .init_verbs = { alc260_fujitsu_init_verbs },
6333 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6334 .dac_nids = alc260_dac_nids,
6335 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6336 .adc_nids = alc260_dual_adc_nids,
6337 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6338 .channel_mode = alc260_modes,
6339 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6340 .input_mux = alc260_fujitsu_capture_sources,
6343 .mixers = { alc260_acer_mixer },
6344 .init_verbs = { alc260_acer_init_verbs },
6345 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6346 .dac_nids = alc260_dac_nids,
6347 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6348 .adc_nids = alc260_dual_adc_nids,
6349 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6350 .channel_mode = alc260_modes,
6351 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6352 .input_mux = alc260_acer_capture_sources,
6354 [ALC260_FAVORIT100] = {
6355 .mixers = { alc260_favorit100_mixer },
6356 .init_verbs = { alc260_favorit100_init_verbs },
6357 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6358 .dac_nids = alc260_dac_nids,
6359 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6360 .adc_nids = alc260_dual_adc_nids,
6361 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6362 .channel_mode = alc260_modes,
6363 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6364 .input_mux = alc260_favorit100_capture_sources,
6367 .mixers = { alc260_will_mixer },
6368 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6369 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6370 .dac_nids = alc260_dac_nids,
6371 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6372 .adc_nids = alc260_adc_nids,
6373 .dig_out_nid = ALC260_DIGOUT_NID,
6374 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6375 .channel_mode = alc260_modes,
6376 .input_mux = &alc260_capture_source,
6378 [ALC260_REPLACER_672V] = {
6379 .mixers = { alc260_replacer_672v_mixer },
6380 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6381 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6382 .dac_nids = alc260_dac_nids,
6383 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6384 .adc_nids = alc260_adc_nids,
6385 .dig_out_nid = ALC260_DIGOUT_NID,
6386 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6387 .channel_mode = alc260_modes,
6388 .input_mux = &alc260_capture_source,
6389 .unsol_event = alc260_replacer_672v_unsol_event,
6390 .init_hook = alc260_replacer_672v_automute,
6392 #ifdef CONFIG_SND_DEBUG
6394 .mixers = { alc260_test_mixer },
6395 .init_verbs = { alc260_test_init_verbs },
6396 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6397 .dac_nids = alc260_test_dac_nids,
6398 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6399 .adc_nids = alc260_test_adc_nids,
6400 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6401 .channel_mode = alc260_modes,
6402 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6403 .input_mux = alc260_test_capture_sources,
6408 static int patch_alc260(struct hda_codec *codec)
6410 struct alc_spec *spec;
6411 int err, board_config;
6413 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6419 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6422 if (board_config < 0) {
6423 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6425 board_config = ALC260_AUTO;
6428 if (board_config == ALC260_AUTO) {
6429 /* automatic parse from the BIOS config */
6430 err = alc260_parse_auto_config(codec);
6436 "hda_codec: Cannot set up configuration "
6437 "from BIOS. Using base mode...\n");
6438 board_config = ALC260_BASIC;
6442 err = snd_hda_attach_beep_device(codec, 0x1);
6448 if (board_config != ALC260_AUTO)
6449 setup_preset(codec, &alc260_presets[board_config]);
6451 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6452 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6454 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6455 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6457 if (!spec->adc_nids && spec->input_mux) {
6458 /* check whether NID 0x04 is valid */
6459 unsigned int wcap = get_wcaps(codec, 0x04);
6460 wcap = get_wcaps_type(wcap);
6462 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6463 spec->adc_nids = alc260_adc_nids_alt;
6464 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6466 spec->adc_nids = alc260_adc_nids;
6467 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6470 set_capture_mixer(codec);
6471 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6473 spec->vmaster_nid = 0x08;
6475 codec->patch_ops = alc_patch_ops;
6476 if (board_config == ALC260_AUTO)
6477 spec->init_hook = alc260_auto_init;
6478 #ifdef CONFIG_SND_HDA_POWER_SAVE
6479 if (!spec->loopback.amplist)
6480 spec->loopback.amplist = alc260_loopbacks;
6482 codec->proc_widget_hook = print_realtek_coef;
6489 * ALC882/883/885/888/889 support
6491 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6492 * configuration. Each pin widget can choose any input DACs and a mixer.
6493 * Each ADC is connected from a mixer of all inputs. This makes possible
6494 * 6-channel independent captures.
6496 * In addition, an independent DAC for the multi-playback (not used in this
6499 #define ALC882_DIGOUT_NID 0x06
6500 #define ALC882_DIGIN_NID 0x0a
6501 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6502 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6503 #define ALC1200_DIGOUT_NID 0x10
6506 static struct hda_channel_mode alc882_ch_modes[1] = {
6511 static hda_nid_t alc882_dac_nids[4] = {
6512 /* front, rear, clfe, rear_surr */
6513 0x02, 0x03, 0x04, 0x05
6515 #define alc883_dac_nids alc882_dac_nids
6518 #define alc882_adc_nids alc880_adc_nids
6519 #define alc882_adc_nids_alt alc880_adc_nids_alt
6520 #define alc883_adc_nids alc882_adc_nids_alt
6521 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6522 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6523 #define alc889_adc_nids alc880_adc_nids
6525 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6526 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6527 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6528 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6529 #define alc889_capsrc_nids alc882_capsrc_nids
6532 /* FIXME: should be a matrix-type input source selection */
6534 static struct hda_input_mux alc882_capture_source = {
6538 { "Front Mic", 0x1 },
6544 #define alc883_capture_source alc882_capture_source
6546 static struct hda_input_mux alc889_capture_source = {
6549 { "Front Mic", 0x0 },
6555 static struct hda_input_mux mb5_capture_source = {
6564 static struct hda_input_mux alc883_3stack_6ch_intel = {
6568 { "Front Mic", 0x0 },
6574 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6582 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6592 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6600 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6604 { "Front Mic", 0x1 },
6609 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6617 static struct hda_input_mux alc889A_mb31_capture_source = {
6621 /* Front Mic (0x01) unused */
6623 /* Line 2 (0x03) unused */
6624 /* CD (0x04) unsused? */
6631 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6638 static struct hda_verb alc882_3ST_ch2_init[] = {
6639 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6640 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6649 static struct hda_verb alc882_3ST_ch4_init[] = {
6650 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6651 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6652 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6653 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6654 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6661 static struct hda_verb alc882_3ST_ch6_init[] = {
6662 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6663 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6664 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6666 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6667 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6671 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6672 { 2, alc882_3ST_ch2_init },
6673 { 4, alc882_3ST_ch4_init },
6674 { 6, alc882_3ST_ch6_init },
6677 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6682 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6683 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6684 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6685 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6686 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6687 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6694 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6695 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6696 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6697 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6698 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6699 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6700 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6707 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6708 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6709 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6710 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6711 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6712 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6713 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6714 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6718 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6719 { 2, alc883_3ST_ch2_clevo_init },
6720 { 4, alc883_3ST_ch4_clevo_init },
6721 { 6, alc883_3ST_ch6_clevo_init },
6728 static struct hda_verb alc882_sixstack_ch6_init[] = {
6729 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6730 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6731 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6732 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6739 static struct hda_verb alc882_sixstack_ch8_init[] = {
6740 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6741 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6742 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6743 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6747 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6748 { 6, alc882_sixstack_ch6_init },
6749 { 8, alc882_sixstack_ch8_init },
6753 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6759 static struct hda_verb alc885_mbp_ch2_init[] = {
6760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6761 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6762 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6769 static struct hda_verb alc885_mbp_ch4_init[] = {
6770 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6771 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6772 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6773 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6774 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6778 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6779 { 2, alc885_mbp_ch2_init },
6780 { 4, alc885_mbp_ch4_init },
6785 * Speakers/Woofer/HP = Front
6788 static struct hda_verb alc885_mb5_ch2_init[] = {
6789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6796 * Speakers/HP = Front
6800 static struct hda_verb alc885_mb5_ch6_init[] = {
6801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6807 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6808 { 2, alc885_mb5_ch2_init },
6809 { 6, alc885_mb5_ch6_init },
6816 static struct hda_verb alc883_4ST_ch2_init[] = {
6817 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6818 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6819 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6820 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6821 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6822 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6829 static struct hda_verb alc883_4ST_ch4_init[] = {
6830 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6831 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6832 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6833 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6834 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6835 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6836 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6843 static struct hda_verb alc883_4ST_ch6_init[] = {
6844 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6845 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6846 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6847 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6848 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6851 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6858 static struct hda_verb alc883_4ST_ch8_init[] = {
6859 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6860 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6861 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6864 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6867 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6871 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6872 { 2, alc883_4ST_ch2_init },
6873 { 4, alc883_4ST_ch4_init },
6874 { 6, alc883_4ST_ch6_init },
6875 { 8, alc883_4ST_ch8_init },
6882 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6883 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6884 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6893 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6894 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6895 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6896 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6898 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6905 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6906 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6907 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6908 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6909 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6910 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6911 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6915 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6916 { 2, alc883_3ST_ch2_intel_init },
6917 { 4, alc883_3ST_ch4_intel_init },
6918 { 6, alc883_3ST_ch6_intel_init },
6924 static struct hda_verb alc889_ch2_intel_init[] = {
6925 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6926 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6927 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6928 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6929 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6930 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6937 static struct hda_verb alc889_ch6_intel_init[] = {
6938 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6939 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6940 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6941 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6942 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6943 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6950 static struct hda_verb alc889_ch8_intel_init[] = {
6951 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6952 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6953 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6954 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6955 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6956 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6957 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6961 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6962 { 2, alc889_ch2_intel_init },
6963 { 6, alc889_ch6_intel_init },
6964 { 8, alc889_ch8_intel_init },
6970 static struct hda_verb alc883_sixstack_ch6_init[] = {
6971 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6972 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6973 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6974 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6981 static struct hda_verb alc883_sixstack_ch8_init[] = {
6982 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6985 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6989 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6990 { 6, alc883_sixstack_ch6_init },
6991 { 8, alc883_sixstack_ch8_init },
6995 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6996 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6998 static struct snd_kcontrol_new alc882_base_mixer[] = {
6999 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7000 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7002 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7003 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7004 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7005 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7006 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7008 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7013 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7018 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7019 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7023 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7024 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7025 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7027 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7028 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7030 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7032 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7033 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7038 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7040 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7041 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7042 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7043 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7044 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7045 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7046 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7048 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7050 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7051 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7056 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7057 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7058 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7059 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7060 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7062 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7064 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7070 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7073 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7074 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7075 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7076 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7077 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7083 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7085 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7093 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7096 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7100 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7101 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7103 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7104 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7105 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7107 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7113 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7114 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7116 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7120 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7122 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7134 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7137 .name = "Channel Mode",
7138 .info = alc_ch_mode_info,
7139 .get = alc_ch_mode_get,
7140 .put = alc_ch_mode_put,
7145 static struct hda_verb alc882_base_init_verbs[] = {
7146 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7153 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7156 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7160 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7161 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7163 /* mute analog input loopbacks */
7164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7170 /* Front Pin: output 0 (0x0c) */
7171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7173 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7174 /* Rear Pin: output 1 (0x0d) */
7175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7177 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7178 /* CLFE Pin: output 2 (0x0e) */
7179 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7181 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7182 /* Side Pin: output 3 (0x0f) */
7183 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7185 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7186 /* Mic (rear) pin: input vref at 80% */
7187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7189 /* Front Mic pin: input vref at 80% */
7190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7192 /* Line In pin: input */
7193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7195 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7199 /* CD pin widget for input */
7200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7202 /* FIXME: use matrix-type input source selection */
7203 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7206 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7207 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7212 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7214 /* ADC2: mute amp left and right */
7215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7216 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7217 /* ADC3: mute amp left and right */
7218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7219 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7224 static struct hda_verb alc882_adc1_init_verbs[] = {
7225 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7227 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7230 /* ADC1: mute amp left and right */
7231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7236 static struct hda_verb alc882_eapd_verbs[] = {
7237 /* change to EAPD mode */
7238 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7239 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7243 static struct hda_verb alc889_eapd_verbs[] = {
7244 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7245 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7249 static struct hda_verb alc_hp15_unsol_verbs[] = {
7250 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7255 static struct hda_verb alc885_init_verbs[] = {
7256 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7270 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7271 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7273 /* mute analog input loopbacks */
7274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7278 /* Front HP Pin: output 0 (0x0c) */
7279 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7282 /* Front Pin: output 0 (0x0c) */
7283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7284 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7285 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7286 /* Rear Pin: output 1 (0x0d) */
7287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7289 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7290 /* CLFE Pin: output 2 (0x0e) */
7291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7292 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7293 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7294 /* Side Pin: output 3 (0x0f) */
7295 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7296 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7297 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7298 /* Mic (rear) pin: input vref at 80% */
7299 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7301 /* Front Mic pin: input vref at 80% */
7302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7303 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7304 /* Line In pin: input */
7305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7308 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7314 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7315 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7319 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7320 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7321 /* ADC2: mute amp left and right */
7322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7323 /* ADC3: mute amp left and right */
7324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7329 static struct hda_verb alc885_init_input_verbs[] = {
7330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7337 /* Unmute Selector 24h and set the default input to front mic */
7338 static struct hda_verb alc889_init_input_verbs[] = {
7339 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7345 #define alc883_init_verbs alc882_base_init_verbs
7348 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7350 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7354 /* FIXME: this looks suspicious...
7355 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7356 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7361 static struct hda_verb alc882_macpro_init_verbs[] = {
7362 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7366 /* Front Pin: output 0 (0x0c) */
7367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7369 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7370 /* Front Mic pin: input vref at 80% */
7371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7373 /* Speaker: output */
7374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7376 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7377 /* Headphone output (output 0 - 0x0c) */
7378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7380 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7382 /* FIXME: use matrix-type input source selection */
7383 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7384 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7399 /* ADC1: mute amp left and right */
7400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7401 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7402 /* ADC2: mute amp left and right */
7403 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7404 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7405 /* ADC3: mute amp left and right */
7406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7413 static struct hda_verb alc885_mb5_init_verbs[] = {
7415 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7416 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7418 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7423 /* Surround mixer */
7424 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7425 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7432 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7433 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7435 /* Front Pin (0x0c) */
7436 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7437 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7438 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7439 /* LFE Pin (0x0e) */
7440 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7442 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7446 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7447 /* Front Mic pin: input vref at 80% */
7448 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7461 /* Macbook Pro rev3 */
7462 static struct hda_verb alc885_mbp3_init_verbs[] = {
7463 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7475 /* Front Pin: output 0 (0x0c) */
7476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7478 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7479 /* HP Pin: output 0 (0x0e) */
7480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7483 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7484 /* Mic (rear) pin: input vref at 80% */
7485 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7486 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7487 /* Front Mic pin: input vref at 80% */
7488 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7489 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7490 /* Line In pin: use output 1 when in LineOut mode */
7491 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7492 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7493 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7495 /* FIXME: use matrix-type input source selection */
7496 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7497 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7512 /* ADC1: mute amp left and right */
7513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7514 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7515 /* ADC2: mute amp left and right */
7516 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7517 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7518 /* ADC3: mute amp left and right */
7519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7520 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7526 static struct hda_verb alc885_imac91_init_verbs[] = {
7527 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7535 /* HP Pin: output 0 (0x0c) */
7536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7537 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7538 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7540 /* Internal Speakers: output 0 (0x0d) */
7541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7543 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7544 /* Mic (rear) pin: input vref at 80% */
7545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7547 /* Front Mic pin: input vref at 80% */
7548 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7550 /* Line In pin: use output 1 when in LineOut mode */
7551 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7553 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7555 /* FIXME: use matrix-type input source selection */
7556 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7557 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7572 /* ADC1: mute amp left and right */
7573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7574 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7575 /* ADC2: mute amp left and right */
7576 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7577 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7578 /* ADC3: mute amp left and right */
7579 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7580 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7585 /* iMac 24 mixer. */
7586 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7587 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7588 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7592 /* iMac 24 init verbs. */
7593 static struct hda_verb alc885_imac24_init_verbs[] = {
7594 /* Internal speakers: output 0 (0x0c) */
7595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7597 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7598 /* Internal speakers: output 0 (0x0c) */
7599 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7600 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7601 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7602 /* Headphone: output 0 (0x0c) */
7603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7606 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7607 /* Front Mic: input vref at 80% */
7608 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7609 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7613 /* Toggle speaker-output according to the hp-jack state */
7614 static void alc885_imac24_setup(struct hda_codec *codec)
7616 struct alc_spec *spec = codec->spec;
7618 spec->autocfg.hp_pins[0] = 0x14;
7619 spec->autocfg.speaker_pins[0] = 0x18;
7620 spec->autocfg.speaker_pins[1] = 0x1a;
7623 static void alc885_mbp3_setup(struct hda_codec *codec)
7625 struct alc_spec *spec = codec->spec;
7627 spec->autocfg.hp_pins[0] = 0x15;
7628 spec->autocfg.speaker_pins[0] = 0x14;
7631 static void alc885_imac91_automute(struct hda_codec *codec)
7633 unsigned int present;
7635 present = snd_hda_codec_read(codec, 0x14, 0,
7636 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7637 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7638 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7639 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7640 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7644 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7647 /* Headphone insertion or removal. */
7648 if ((res >> 26) == ALC880_HP_EVENT)
7649 alc885_imac91_automute(codec);
7652 static struct hda_verb alc882_targa_verbs[] = {
7653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7659 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7660 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7661 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7663 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7667 /* toggle speaker-output according to the hp-jack state */
7668 static void alc882_targa_automute(struct hda_codec *codec)
7670 struct alc_spec *spec = codec->spec;
7671 alc_automute_amp(codec);
7672 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7673 spec->jack_present ? 1 : 3);
7676 static void alc882_targa_setup(struct hda_codec *codec)
7678 struct alc_spec *spec = codec->spec;
7680 spec->autocfg.hp_pins[0] = 0x14;
7681 spec->autocfg.speaker_pins[0] = 0x1b;
7684 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7686 if ((res >> 26) == ALC880_HP_EVENT)
7687 alc882_targa_automute(codec);
7690 static struct hda_verb alc882_asus_a7j_verbs[] = {
7691 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7696 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7698 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7699 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7700 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7702 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7703 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7704 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7708 static struct hda_verb alc882_asus_a7m_verbs[] = {
7709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7714 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7716 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7718 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7720 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7721 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7722 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7726 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7728 unsigned int gpiostate, gpiomask, gpiodir;
7730 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7731 AC_VERB_GET_GPIO_DATA, 0);
7734 gpiostate |= (1 << pin);
7736 gpiostate &= ~(1 << pin);
7738 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7739 AC_VERB_GET_GPIO_MASK, 0);
7740 gpiomask |= (1 << pin);
7742 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7743 AC_VERB_GET_GPIO_DIRECTION, 0);
7744 gpiodir |= (1 << pin);
7747 snd_hda_codec_write(codec, codec->afg, 0,
7748 AC_VERB_SET_GPIO_MASK, gpiomask);
7749 snd_hda_codec_write(codec, codec->afg, 0,
7750 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7754 snd_hda_codec_write(codec, codec->afg, 0,
7755 AC_VERB_SET_GPIO_DATA, gpiostate);
7758 /* set up GPIO at initialization */
7759 static void alc885_macpro_init_hook(struct hda_codec *codec)
7761 alc882_gpio_mute(codec, 0, 0);
7762 alc882_gpio_mute(codec, 1, 0);
7765 /* set up GPIO and update auto-muting at initialization */
7766 static void alc885_imac24_init_hook(struct hda_codec *codec)
7768 alc885_macpro_init_hook(codec);
7769 alc_automute_amp(codec);
7773 * generic initialization of ADC, input mixers and output mixers
7775 static struct hda_verb alc883_auto_init_verbs[] = {
7777 * Unmute ADC0-2 and set the default input to mic-in
7779 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7780 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7781 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7782 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7784 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7786 * Note: PASD motherboards uses the Line In 2 as the input for
7787 * front panel mic (mic 2)
7789 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7790 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7791 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7792 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7797 * Set up output mixers (0x0c - 0x0f)
7799 /* set vol=0 to output mixers */
7800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7802 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7803 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7804 /* set up input amps for analog loopback */
7805 /* Amp Indices: DAC = 0, mixer = 1 */
7806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7812 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7813 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7814 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7815 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7817 /* FIXME: use matrix-type input source selection */
7818 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7833 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7834 static struct hda_verb alc889A_mb31_ch2_init[] = {
7835 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7837 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7838 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7842 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7843 static struct hda_verb alc889A_mb31_ch4_init[] = {
7844 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7846 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7847 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7851 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7852 static struct hda_verb alc889A_mb31_ch5_init[] = {
7853 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7854 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7856 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7860 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7861 static struct hda_verb alc889A_mb31_ch6_init[] = {
7862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7863 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7864 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7869 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7870 { 2, alc889A_mb31_ch2_init },
7871 { 4, alc889A_mb31_ch4_init },
7872 { 5, alc889A_mb31_ch5_init },
7873 { 6, alc889A_mb31_ch6_init },
7876 static struct hda_verb alc883_medion_eapd_verbs[] = {
7877 /* eanable EAPD on medion laptop */
7878 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7879 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7883 #define alc883_base_mixer alc882_base_mixer
7885 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7886 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7887 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7896 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7902 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7903 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7904 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7906 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7910 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7911 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7912 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7916 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7918 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7920 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7922 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7925 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7926 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7930 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7931 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7932 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7933 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7934 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7935 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7936 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7937 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7947 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7948 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7949 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7950 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7951 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7952 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7953 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7954 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7955 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7956 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7960 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7964 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7966 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7970 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7974 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7975 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7981 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7982 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7984 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7994 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7998 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7999 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8001 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8002 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8003 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8005 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8014 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8018 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8019 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8020 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8021 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8022 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8023 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8024 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8026 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8028 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8029 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8031 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8037 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8041 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8042 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8043 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8045 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8046 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8047 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8048 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8049 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8050 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8051 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8055 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8062 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8063 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8064 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8066 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8067 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8068 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8074 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8078 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8079 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8080 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8083 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8087 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8094 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8099 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8107 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8108 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8112 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8115 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8121 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8125 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8127 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8137 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8140 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8141 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8144 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8145 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8152 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8154 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8156 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8157 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8158 0x0d, 1, 0x0, HDA_OUTPUT),
8159 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8160 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8161 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8164 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8165 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8177 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8183 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8185 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8186 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8187 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8188 /* Output switches */
8189 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8190 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8191 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8199 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8203 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8208 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8213 static struct hda_bind_ctls alc883_bind_cap_vol = {
8214 .ops = &snd_hda_bind_vol,
8216 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8217 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8222 static struct hda_bind_ctls alc883_bind_cap_switch = {
8223 .ops = &snd_hda_bind_sw,
8225 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8226 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8231 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8233 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8243 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8244 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8245 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8248 /* .name = "Capture Source", */
8249 .name = "Input Source",
8251 .info = alc_mux_enum_info,
8252 .get = alc_mux_enum_get,
8253 .put = alc_mux_enum_put,
8258 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8261 .name = "Channel Mode",
8262 .info = alc_ch_mode_info,
8263 .get = alc_ch_mode_get,
8264 .put = alc_ch_mode_put,
8269 /* toggle speaker-output according to the hp-jack state */
8270 static void alc883_mitac_setup(struct hda_codec *codec)
8272 struct alc_spec *spec = codec->spec;
8274 spec->autocfg.hp_pins[0] = 0x15;
8275 spec->autocfg.speaker_pins[0] = 0x14;
8276 spec->autocfg.speaker_pins[1] = 0x17;
8279 /* auto-toggle front mic */
8281 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8283 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8285 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8289 static struct hda_verb alc883_mitac_verbs[] = {
8291 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8294 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8295 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8297 /* enable unsolicited event */
8298 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8299 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8304 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8309 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8311 /* enable unsolicited event */
8313 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8314 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8320 static struct hda_verb alc883_clevo_m720_verbs[] = {
8322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8325 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8328 /* enable unsolicited event */
8329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8330 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8335 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8337 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8343 /* enable unsolicited event */
8344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8349 static struct hda_verb alc883_targa_verbs[] = {
8350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8356 /* Connect Line-Out side jack (SPDIF) to Side */
8357 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8358 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8359 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8360 /* Connect Mic jack to CLFE */
8361 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8362 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8363 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8364 /* Connect Line-in jack to Surround */
8365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8366 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8367 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8368 /* Connect HP out jack to Front */
8369 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8370 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8371 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8373 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8378 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8379 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8381 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8385 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8388 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8393 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8397 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8398 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8402 static struct hda_verb alc883_haier_w66_verbs[] = {
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8406 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8408 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8410 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8411 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8415 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8420 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8421 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8422 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8423 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8427 static struct hda_verb alc888_6st_dell_verbs[] = {
8428 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8432 static struct hda_verb alc883_vaiott_verbs[] = {
8434 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8437 /* enable unsolicited event */
8438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8443 static void alc888_3st_hp_setup(struct hda_codec *codec)
8445 struct alc_spec *spec = codec->spec;
8447 spec->autocfg.hp_pins[0] = 0x1b;
8448 spec->autocfg.speaker_pins[0] = 0x14;
8449 spec->autocfg.speaker_pins[1] = 0x16;
8450 spec->autocfg.speaker_pins[2] = 0x18;
8453 static struct hda_verb alc888_3st_hp_verbs[] = {
8454 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8455 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8456 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8457 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8464 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8465 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8466 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8467 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8468 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8475 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8476 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8477 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8478 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8479 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8480 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8487 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8488 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8489 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8490 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8491 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8492 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8493 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8497 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8498 { 2, alc888_3st_hp_2ch_init },
8499 { 4, alc888_3st_hp_4ch_init },
8500 { 6, alc888_3st_hp_6ch_init },
8503 /* toggle front-jack and RCA according to the hp-jack state */
8504 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8506 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8508 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8509 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8510 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8511 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8514 /* toggle RCA according to the front-jack state */
8515 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8517 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8519 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8520 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8523 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8526 if ((res >> 26) == ALC880_HP_EVENT)
8527 alc888_lenovo_ms7195_front_automute(codec);
8528 if ((res >> 26) == ALC880_FRONT_EVENT)
8529 alc888_lenovo_ms7195_rca_automute(codec);
8532 static struct hda_verb alc883_medion_md2_verbs[] = {
8533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8538 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8542 /* toggle speaker-output according to the hp-jack state */
8543 static void alc883_medion_md2_setup(struct hda_codec *codec)
8545 struct alc_spec *spec = codec->spec;
8547 spec->autocfg.hp_pins[0] = 0x14;
8548 spec->autocfg.speaker_pins[0] = 0x15;
8551 /* toggle speaker-output according to the hp-jack state */
8552 #define alc883_targa_init_hook alc882_targa_init_hook
8553 #define alc883_targa_unsol_event alc882_targa_unsol_event
8555 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8557 unsigned int present;
8559 present = snd_hda_jack_detect(codec, 0x18);
8560 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8561 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8564 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8566 struct alc_spec *spec = codec->spec;
8568 spec->autocfg.hp_pins[0] = 0x15;
8569 spec->autocfg.speaker_pins[0] = 0x14;
8572 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8574 alc_automute_amp(codec);
8575 alc883_clevo_m720_mic_automute(codec);
8578 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8581 switch (res >> 26) {
8582 case ALC880_MIC_EVENT:
8583 alc883_clevo_m720_mic_automute(codec);
8586 alc_automute_amp_unsol_event(codec, res);
8591 /* toggle speaker-output according to the hp-jack state */
8592 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8594 struct alc_spec *spec = codec->spec;
8596 spec->autocfg.hp_pins[0] = 0x14;
8597 spec->autocfg.speaker_pins[0] = 0x15;
8600 static void alc883_haier_w66_setup(struct hda_codec *codec)
8602 struct alc_spec *spec = codec->spec;
8604 spec->autocfg.hp_pins[0] = 0x1b;
8605 spec->autocfg.speaker_pins[0] = 0x14;
8608 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8610 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8612 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8613 HDA_AMP_MUTE, bits);
8616 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8618 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8620 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8621 HDA_AMP_MUTE, bits);
8622 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8623 HDA_AMP_MUTE, bits);
8626 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8629 if ((res >> 26) == ALC880_HP_EVENT)
8630 alc883_lenovo_101e_all_automute(codec);
8631 if ((res >> 26) == ALC880_FRONT_EVENT)
8632 alc883_lenovo_101e_ispeaker_automute(codec);
8635 /* toggle speaker-output according to the hp-jack state */
8636 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8638 struct alc_spec *spec = codec->spec;
8640 spec->autocfg.hp_pins[0] = 0x14;
8641 spec->autocfg.speaker_pins[0] = 0x15;
8642 spec->autocfg.speaker_pins[1] = 0x16;
8645 static struct hda_verb alc883_acer_eapd_verbs[] = {
8646 /* HP Pin: output 0 (0x0c) */
8647 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8648 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8649 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8650 /* Front Pin: output 0 (0x0c) */
8651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8654 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8655 /* eanable EAPD on medion laptop */
8656 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8657 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8658 /* enable unsolicited event */
8659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8663 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8664 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8665 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8666 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8670 static void alc888_6st_dell_setup(struct hda_codec *codec)
8672 struct alc_spec *spec = codec->spec;
8674 spec->autocfg.hp_pins[0] = 0x1b;
8675 spec->autocfg.speaker_pins[0] = 0x14;
8676 spec->autocfg.speaker_pins[1] = 0x15;
8677 spec->autocfg.speaker_pins[2] = 0x16;
8678 spec->autocfg.speaker_pins[3] = 0x17;
8681 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8683 struct alc_spec *spec = codec->spec;
8685 spec->autocfg.hp_pins[0] = 0x1b;
8686 spec->autocfg.speaker_pins[0] = 0x14;
8687 spec->autocfg.speaker_pins[1] = 0x15;
8688 spec->autocfg.speaker_pins[2] = 0x16;
8689 spec->autocfg.speaker_pins[3] = 0x17;
8690 spec->autocfg.speaker_pins[4] = 0x1a;
8693 static void alc883_vaiott_setup(struct hda_codec *codec)
8695 struct alc_spec *spec = codec->spec;
8697 spec->autocfg.hp_pins[0] = 0x15;
8698 spec->autocfg.speaker_pins[0] = 0x14;
8699 spec->autocfg.speaker_pins[1] = 0x17;
8702 static struct hda_verb alc888_asus_m90v_verbs[] = {
8703 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8706 /* enable unsolicited event */
8707 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8708 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8712 static void alc883_mode2_setup(struct hda_codec *codec)
8714 struct alc_spec *spec = codec->spec;
8716 spec->autocfg.hp_pins[0] = 0x1b;
8717 spec->autocfg.speaker_pins[0] = 0x14;
8718 spec->autocfg.speaker_pins[1] = 0x15;
8719 spec->autocfg.speaker_pins[2] = 0x16;
8720 spec->ext_mic.pin = 0x18;
8721 spec->int_mic.pin = 0x19;
8722 spec->ext_mic.mux_idx = 0;
8723 spec->int_mic.mux_idx = 1;
8727 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8733 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8734 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8735 /* enable unsolicited event */
8736 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8740 static void alc883_eee1601_inithook(struct hda_codec *codec)
8742 struct alc_spec *spec = codec->spec;
8744 spec->autocfg.hp_pins[0] = 0x14;
8745 spec->autocfg.speaker_pins[0] = 0x1b;
8746 alc_automute_pin(codec);
8749 static struct hda_verb alc889A_mb31_verbs[] = {
8750 /* Init rear pin (used as headphone output) */
8751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8752 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8753 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8754 /* Init line pin (used as output in 4ch and 6ch mode) */
8755 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8756 /* Init line 2 pin (used as headphone out by default) */
8757 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8758 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8762 /* Mute speakers according to the headphone jack state */
8763 static void alc889A_mb31_automute(struct hda_codec *codec)
8765 unsigned int present;
8767 /* Mute only in 2ch or 4ch mode */
8768 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8770 present = snd_hda_jack_detect(codec, 0x15);
8771 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8772 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8773 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8774 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8778 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8780 if ((res >> 26) == ALC880_HP_EVENT)
8781 alc889A_mb31_automute(codec);
8785 #ifdef CONFIG_SND_HDA_POWER_SAVE
8786 #define alc882_loopbacks alc880_loopbacks
8789 /* pcm configuration: identical with ALC880 */
8790 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8791 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8792 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8793 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8795 static hda_nid_t alc883_slave_dig_outs[] = {
8796 ALC1200_DIGOUT_NID, 0,
8799 static hda_nid_t alc1200_slave_dig_outs[] = {
8800 ALC883_DIGOUT_NID, 0,
8804 * configuration and preset
8806 static const char *alc882_models[ALC882_MODEL_LAST] = {
8807 [ALC882_3ST_DIG] = "3stack-dig",
8808 [ALC882_6ST_DIG] = "6stack-dig",
8809 [ALC882_ARIMA] = "arima",
8810 [ALC882_W2JC] = "w2jc",
8811 [ALC882_TARGA] = "targa",
8812 [ALC882_ASUS_A7J] = "asus-a7j",
8813 [ALC882_ASUS_A7M] = "asus-a7m",
8814 [ALC885_MACPRO] = "macpro",
8815 [ALC885_MB5] = "mb5",
8816 [ALC885_MBP3] = "mbp3",
8817 [ALC885_IMAC24] = "imac24",
8818 [ALC885_IMAC91] = "imac91",
8819 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8820 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8821 [ALC883_3ST_6ch] = "3stack-6ch",
8822 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8823 [ALC883_TARGA_DIG] = "targa-dig",
8824 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8825 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8826 [ALC883_ACER] = "acer",
8827 [ALC883_ACER_ASPIRE] = "acer-aspire",
8828 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8829 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8830 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8831 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8832 [ALC883_MEDION] = "medion",
8833 [ALC883_MEDION_MD2] = "medion-md2",
8834 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8835 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8836 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8837 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8838 [ALC888_LENOVO_SKY] = "lenovo-sky",
8839 [ALC883_HAIER_W66] = "haier-w66",
8840 [ALC888_3ST_HP] = "3stack-hp",
8841 [ALC888_6ST_DELL] = "6stack-dell",
8842 [ALC883_MITAC] = "mitac",
8843 [ALC883_CLEVO_M540R] = "clevo-m540r",
8844 [ALC883_CLEVO_M720] = "clevo-m720",
8845 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8846 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8847 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8848 [ALC889A_INTEL] = "intel-alc889a",
8849 [ALC889_INTEL] = "intel-x58",
8850 [ALC1200_ASUS_P5Q] = "asus-p5q",
8851 [ALC889A_MB31] = "mb31",
8852 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8853 [ALC882_AUTO] = "auto",
8856 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8857 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8859 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8860 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8861 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8862 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8863 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8864 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8865 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8866 ALC888_ACER_ASPIRE_4930G),
8867 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8868 ALC888_ACER_ASPIRE_4930G),
8869 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8870 ALC888_ACER_ASPIRE_8930G),
8871 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8872 ALC888_ACER_ASPIRE_8930G),
8873 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8874 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8875 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8876 ALC888_ACER_ASPIRE_6530G),
8877 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8878 ALC888_ACER_ASPIRE_6530G),
8879 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8880 ALC888_ACER_ASPIRE_7730G),
8881 /* default Acer -- disabled as it causes more problems.
8882 * model=auto should work fine now
8884 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8886 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8888 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8889 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8890 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8891 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8892 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8893 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8895 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8896 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8897 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8898 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8899 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8900 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8901 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8902 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8903 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8904 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8905 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8907 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8908 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8909 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8910 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8911 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8912 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8913 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8914 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8915 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8917 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8918 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8919 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8921 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8922 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8923 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8924 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8925 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8926 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8927 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8928 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8929 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8930 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8931 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8932 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8933 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8934 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8935 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8936 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8937 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8938 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8939 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8940 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8941 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8942 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8943 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8944 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8945 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8947 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8948 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8949 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8950 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8951 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8952 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8953 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8954 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8955 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8956 ALC883_FUJITSU_PI2515),
8957 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8958 ALC888_FUJITSU_XA3530),
8959 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8960 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8961 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8962 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8963 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8964 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8965 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8966 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8967 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8969 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8970 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8971 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8972 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8973 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8974 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8975 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8980 /* codec SSID table for Intel Mac */
8981 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8982 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8983 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8984 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8985 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8986 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8987 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8988 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8989 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8990 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8991 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8992 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
8993 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8994 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
8995 * so apparently no perfect solution yet
8997 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8998 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9002 static struct alc_config_preset alc882_presets[] = {
9003 [ALC882_3ST_DIG] = {
9004 .mixers = { alc882_base_mixer },
9005 .init_verbs = { alc882_base_init_verbs,
9006 alc882_adc1_init_verbs },
9007 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9008 .dac_nids = alc882_dac_nids,
9009 .dig_out_nid = ALC882_DIGOUT_NID,
9010 .dig_in_nid = ALC882_DIGIN_NID,
9011 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9012 .channel_mode = alc882_ch_modes,
9014 .input_mux = &alc882_capture_source,
9016 [ALC882_6ST_DIG] = {
9017 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9018 .init_verbs = { alc882_base_init_verbs,
9019 alc882_adc1_init_verbs },
9020 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9021 .dac_nids = alc882_dac_nids,
9022 .dig_out_nid = ALC882_DIGOUT_NID,
9023 .dig_in_nid = ALC882_DIGIN_NID,
9024 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9025 .channel_mode = alc882_sixstack_modes,
9026 .input_mux = &alc882_capture_source,
9029 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9030 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9031 alc882_eapd_verbs },
9032 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9033 .dac_nids = alc882_dac_nids,
9034 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9035 .channel_mode = alc882_sixstack_modes,
9036 .input_mux = &alc882_capture_source,
9039 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9040 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9041 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9042 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9043 .dac_nids = alc882_dac_nids,
9044 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9045 .channel_mode = alc880_threestack_modes,
9047 .input_mux = &alc882_capture_source,
9048 .dig_out_nid = ALC882_DIGOUT_NID,
9051 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9052 .init_verbs = { alc885_mbp3_init_verbs,
9053 alc880_gpio1_init_verbs },
9055 .dac_nids = alc882_dac_nids,
9057 .channel_mode = alc885_mbp_4ch_modes,
9058 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9059 .input_mux = &alc882_capture_source,
9060 .dig_out_nid = ALC882_DIGOUT_NID,
9061 .dig_in_nid = ALC882_DIGIN_NID,
9062 .unsol_event = alc_automute_amp_unsol_event,
9063 .setup = alc885_mbp3_setup,
9064 .init_hook = alc_automute_amp,
9067 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9068 .init_verbs = { alc885_mb5_init_verbs,
9069 alc880_gpio1_init_verbs },
9070 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9071 .dac_nids = alc882_dac_nids,
9072 .channel_mode = alc885_mb5_6ch_modes,
9073 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9074 .input_mux = &mb5_capture_source,
9075 .dig_out_nid = ALC882_DIGOUT_NID,
9076 .dig_in_nid = ALC882_DIGIN_NID,
9079 .mixers = { alc882_macpro_mixer },
9080 .init_verbs = { alc882_macpro_init_verbs },
9081 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9082 .dac_nids = alc882_dac_nids,
9083 .dig_out_nid = ALC882_DIGOUT_NID,
9084 .dig_in_nid = ALC882_DIGIN_NID,
9085 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9086 .channel_mode = alc882_ch_modes,
9087 .input_mux = &alc882_capture_source,
9088 .init_hook = alc885_macpro_init_hook,
9091 .mixers = { alc885_imac24_mixer },
9092 .init_verbs = { alc885_imac24_init_verbs },
9093 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9094 .dac_nids = alc882_dac_nids,
9095 .dig_out_nid = ALC882_DIGOUT_NID,
9096 .dig_in_nid = ALC882_DIGIN_NID,
9097 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9098 .channel_mode = alc882_ch_modes,
9099 .input_mux = &alc882_capture_source,
9100 .unsol_event = alc_automute_amp_unsol_event,
9101 .setup = alc885_imac24_setup,
9102 .init_hook = alc885_imac24_init_hook,
9105 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9106 .init_verbs = { alc885_imac91_init_verbs,
9107 alc880_gpio1_init_verbs },
9108 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9109 .dac_nids = alc882_dac_nids,
9110 .channel_mode = alc885_mbp_4ch_modes,
9111 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9112 .input_mux = &alc882_capture_source,
9113 .dig_out_nid = ALC882_DIGOUT_NID,
9114 .dig_in_nid = ALC882_DIGIN_NID,
9115 .unsol_event = alc885_imac91_unsol_event,
9116 .init_hook = alc885_imac91_automute,
9119 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9120 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9121 alc880_gpio3_init_verbs, alc882_targa_verbs},
9122 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9123 .dac_nids = alc882_dac_nids,
9124 .dig_out_nid = ALC882_DIGOUT_NID,
9125 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9126 .adc_nids = alc882_adc_nids,
9127 .capsrc_nids = alc882_capsrc_nids,
9128 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9129 .channel_mode = alc882_3ST_6ch_modes,
9131 .input_mux = &alc882_capture_source,
9132 .unsol_event = alc882_targa_unsol_event,
9133 .setup = alc882_targa_setup,
9134 .init_hook = alc882_targa_automute,
9136 [ALC882_ASUS_A7J] = {
9137 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9138 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9139 alc882_asus_a7j_verbs},
9140 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9141 .dac_nids = alc882_dac_nids,
9142 .dig_out_nid = ALC882_DIGOUT_NID,
9143 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9144 .adc_nids = alc882_adc_nids,
9145 .capsrc_nids = alc882_capsrc_nids,
9146 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9147 .channel_mode = alc882_3ST_6ch_modes,
9149 .input_mux = &alc882_capture_source,
9151 [ALC882_ASUS_A7M] = {
9152 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9153 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9154 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9155 alc882_asus_a7m_verbs },
9156 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9157 .dac_nids = alc882_dac_nids,
9158 .dig_out_nid = ALC882_DIGOUT_NID,
9159 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9160 .channel_mode = alc880_threestack_modes,
9162 .input_mux = &alc882_capture_source,
9164 [ALC883_3ST_2ch_DIG] = {
9165 .mixers = { alc883_3ST_2ch_mixer },
9166 .init_verbs = { alc883_init_verbs },
9167 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9168 .dac_nids = alc883_dac_nids,
9169 .dig_out_nid = ALC883_DIGOUT_NID,
9170 .dig_in_nid = ALC883_DIGIN_NID,
9171 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9172 .channel_mode = alc883_3ST_2ch_modes,
9173 .input_mux = &alc883_capture_source,
9175 [ALC883_3ST_6ch_DIG] = {
9176 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9177 .init_verbs = { alc883_init_verbs },
9178 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9179 .dac_nids = alc883_dac_nids,
9180 .dig_out_nid = ALC883_DIGOUT_NID,
9181 .dig_in_nid = ALC883_DIGIN_NID,
9182 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9183 .channel_mode = alc883_3ST_6ch_modes,
9185 .input_mux = &alc883_capture_source,
9187 [ALC883_3ST_6ch] = {
9188 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9189 .init_verbs = { alc883_init_verbs },
9190 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9191 .dac_nids = alc883_dac_nids,
9192 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9193 .channel_mode = alc883_3ST_6ch_modes,
9195 .input_mux = &alc883_capture_source,
9197 [ALC883_3ST_6ch_INTEL] = {
9198 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9199 .init_verbs = { alc883_init_verbs },
9200 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9201 .dac_nids = alc883_dac_nids,
9202 .dig_out_nid = ALC883_DIGOUT_NID,
9203 .dig_in_nid = ALC883_DIGIN_NID,
9204 .slave_dig_outs = alc883_slave_dig_outs,
9205 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9206 .channel_mode = alc883_3ST_6ch_intel_modes,
9208 .input_mux = &alc883_3stack_6ch_intel,
9211 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9212 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9213 alc_hp15_unsol_verbs },
9214 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9215 .dac_nids = alc883_dac_nids,
9216 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9217 .adc_nids = alc889_adc_nids,
9218 .dig_out_nid = ALC883_DIGOUT_NID,
9219 .dig_in_nid = ALC883_DIGIN_NID,
9220 .slave_dig_outs = alc883_slave_dig_outs,
9221 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9222 .channel_mode = alc889_8ch_intel_modes,
9223 .capsrc_nids = alc889_capsrc_nids,
9224 .input_mux = &alc889_capture_source,
9225 .setup = alc889_automute_setup,
9226 .init_hook = alc_automute_amp,
9227 .unsol_event = alc_automute_amp_unsol_event,
9231 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9232 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9233 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9235 .dac_nids = alc883_dac_nids,
9236 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9237 .adc_nids = alc889_adc_nids,
9238 .capsrc_nids = alc889_capsrc_nids,
9239 .capsrc_nids = alc889_capsrc_nids,
9240 .dig_out_nid = ALC883_DIGOUT_NID,
9241 .dig_in_nid = ALC883_DIGIN_NID,
9242 .slave_dig_outs = alc883_slave_dig_outs,
9243 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9244 .channel_mode = alc889_8ch_intel_modes,
9245 .capsrc_nids = alc889_capsrc_nids,
9246 .input_mux = &alc889_capture_source,
9247 .setup = alc889_automute_setup,
9248 .init_hook = alc889_intel_init_hook,
9249 .unsol_event = alc_automute_amp_unsol_event,
9252 [ALC883_6ST_DIG] = {
9253 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9254 .init_verbs = { alc883_init_verbs },
9255 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9256 .dac_nids = alc883_dac_nids,
9257 .dig_out_nid = ALC883_DIGOUT_NID,
9258 .dig_in_nid = ALC883_DIGIN_NID,
9259 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9260 .channel_mode = alc883_sixstack_modes,
9261 .input_mux = &alc883_capture_source,
9263 [ALC883_TARGA_DIG] = {
9264 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9265 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9266 alc883_targa_verbs},
9267 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9268 .dac_nids = alc883_dac_nids,
9269 .dig_out_nid = ALC883_DIGOUT_NID,
9270 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9271 .channel_mode = alc883_3ST_6ch_modes,
9273 .input_mux = &alc883_capture_source,
9274 .unsol_event = alc883_targa_unsol_event,
9275 .setup = alc882_targa_setup,
9276 .init_hook = alc882_targa_automute,
9278 [ALC883_TARGA_2ch_DIG] = {
9279 .mixers = { alc883_targa_2ch_mixer},
9280 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9281 alc883_targa_verbs},
9282 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9283 .dac_nids = alc883_dac_nids,
9284 .adc_nids = alc883_adc_nids_alt,
9285 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9286 .capsrc_nids = alc883_capsrc_nids,
9287 .dig_out_nid = ALC883_DIGOUT_NID,
9288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9289 .channel_mode = alc883_3ST_2ch_modes,
9290 .input_mux = &alc883_capture_source,
9291 .unsol_event = alc883_targa_unsol_event,
9292 .setup = alc882_targa_setup,
9293 .init_hook = alc882_targa_automute,
9295 [ALC883_TARGA_8ch_DIG] = {
9296 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9297 alc883_chmode_mixer },
9298 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9299 alc883_targa_verbs },
9300 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9301 .dac_nids = alc883_dac_nids,
9302 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9303 .adc_nids = alc883_adc_nids_rev,
9304 .capsrc_nids = alc883_capsrc_nids_rev,
9305 .dig_out_nid = ALC883_DIGOUT_NID,
9306 .dig_in_nid = ALC883_DIGIN_NID,
9307 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9308 .channel_mode = alc883_4ST_8ch_modes,
9310 .input_mux = &alc883_capture_source,
9311 .unsol_event = alc883_targa_unsol_event,
9312 .setup = alc882_targa_setup,
9313 .init_hook = alc882_targa_automute,
9316 .mixers = { alc883_base_mixer },
9317 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9318 * and the headphone jack. Turn this on and rely on the
9319 * standard mute methods whenever the user wants to turn
9320 * these outputs off.
9322 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9323 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9324 .dac_nids = alc883_dac_nids,
9325 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9326 .channel_mode = alc883_3ST_2ch_modes,
9327 .input_mux = &alc883_capture_source,
9329 [ALC883_ACER_ASPIRE] = {
9330 .mixers = { alc883_acer_aspire_mixer },
9331 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9332 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9333 .dac_nids = alc883_dac_nids,
9334 .dig_out_nid = ALC883_DIGOUT_NID,
9335 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9336 .channel_mode = alc883_3ST_2ch_modes,
9337 .input_mux = &alc883_capture_source,
9338 .unsol_event = alc_automute_amp_unsol_event,
9339 .setup = alc883_acer_aspire_setup,
9340 .init_hook = alc_automute_amp,
9342 [ALC888_ACER_ASPIRE_4930G] = {
9343 .mixers = { alc888_base_mixer,
9344 alc883_chmode_mixer },
9345 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9346 alc888_acer_aspire_4930g_verbs },
9347 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9348 .dac_nids = alc883_dac_nids,
9349 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9350 .adc_nids = alc883_adc_nids_rev,
9351 .capsrc_nids = alc883_capsrc_nids_rev,
9352 .dig_out_nid = ALC883_DIGOUT_NID,
9353 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9354 .channel_mode = alc883_3ST_6ch_modes,
9357 ARRAY_SIZE(alc888_2_capture_sources),
9358 .input_mux = alc888_2_capture_sources,
9359 .unsol_event = alc_automute_amp_unsol_event,
9360 .setup = alc888_acer_aspire_4930g_setup,
9361 .init_hook = alc_automute_amp,
9363 [ALC888_ACER_ASPIRE_6530G] = {
9364 .mixers = { alc888_acer_aspire_6530_mixer },
9365 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9366 alc888_acer_aspire_6530g_verbs },
9367 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9368 .dac_nids = alc883_dac_nids,
9369 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9370 .adc_nids = alc883_adc_nids_rev,
9371 .capsrc_nids = alc883_capsrc_nids_rev,
9372 .dig_out_nid = ALC883_DIGOUT_NID,
9373 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9374 .channel_mode = alc883_3ST_2ch_modes,
9376 ARRAY_SIZE(alc888_2_capture_sources),
9377 .input_mux = alc888_acer_aspire_6530_sources,
9378 .unsol_event = alc_automute_amp_unsol_event,
9379 .setup = alc888_acer_aspire_6530g_setup,
9380 .init_hook = alc_automute_amp,
9382 [ALC888_ACER_ASPIRE_8930G] = {
9383 .mixers = { alc888_base_mixer,
9384 alc883_chmode_mixer },
9385 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9386 alc889_acer_aspire_8930g_verbs,
9388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9389 .dac_nids = alc883_dac_nids,
9390 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9391 .adc_nids = alc889_adc_nids,
9392 .capsrc_nids = alc889_capsrc_nids,
9393 .dig_out_nid = ALC883_DIGOUT_NID,
9394 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9395 .channel_mode = alc883_3ST_6ch_modes,
9397 .const_channel_count = 6,
9399 ARRAY_SIZE(alc889_capture_sources),
9400 .input_mux = alc889_capture_sources,
9401 .unsol_event = alc_automute_amp_unsol_event,
9402 .setup = alc889_acer_aspire_8930g_setup,
9403 .init_hook = alc_automute_amp,
9405 [ALC888_ACER_ASPIRE_7730G] = {
9406 .mixers = { alc883_3ST_6ch_mixer,
9407 alc883_chmode_mixer },
9408 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9409 alc888_acer_aspire_7730G_verbs },
9410 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9411 .dac_nids = alc883_dac_nids,
9412 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9413 .adc_nids = alc883_adc_nids_rev,
9414 .capsrc_nids = alc883_capsrc_nids_rev,
9415 .dig_out_nid = ALC883_DIGOUT_NID,
9416 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9417 .channel_mode = alc883_3ST_6ch_modes,
9419 .const_channel_count = 6,
9420 .input_mux = &alc883_capture_source,
9421 .unsol_event = alc_automute_amp_unsol_event,
9422 .setup = alc888_acer_aspire_6530g_setup,
9423 .init_hook = alc_automute_amp,
9426 .mixers = { alc883_fivestack_mixer,
9427 alc883_chmode_mixer },
9428 .init_verbs = { alc883_init_verbs,
9429 alc883_medion_eapd_verbs },
9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9431 .dac_nids = alc883_dac_nids,
9432 .adc_nids = alc883_adc_nids_alt,
9433 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9434 .capsrc_nids = alc883_capsrc_nids,
9435 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9436 .channel_mode = alc883_sixstack_modes,
9437 .input_mux = &alc883_capture_source,
9439 [ALC883_MEDION_MD2] = {
9440 .mixers = { alc883_medion_md2_mixer},
9441 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9442 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9443 .dac_nids = alc883_dac_nids,
9444 .dig_out_nid = ALC883_DIGOUT_NID,
9445 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9446 .channel_mode = alc883_3ST_2ch_modes,
9447 .input_mux = &alc883_capture_source,
9448 .unsol_event = alc_automute_amp_unsol_event,
9449 .setup = alc883_medion_md2_setup,
9450 .init_hook = alc_automute_amp,
9452 [ALC883_LAPTOP_EAPD] = {
9453 .mixers = { alc883_base_mixer },
9454 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9455 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9456 .dac_nids = alc883_dac_nids,
9457 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9458 .channel_mode = alc883_3ST_2ch_modes,
9459 .input_mux = &alc883_capture_source,
9461 [ALC883_CLEVO_M540R] = {
9462 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9463 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9464 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9465 .dac_nids = alc883_dac_nids,
9466 .dig_out_nid = ALC883_DIGOUT_NID,
9467 .dig_in_nid = ALC883_DIGIN_NID,
9468 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9469 .channel_mode = alc883_3ST_6ch_clevo_modes,
9471 .input_mux = &alc883_capture_source,
9472 /* This machine has the hardware HP auto-muting, thus
9473 * we need no software mute via unsol event
9476 [ALC883_CLEVO_M720] = {
9477 .mixers = { alc883_clevo_m720_mixer },
9478 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9479 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9480 .dac_nids = alc883_dac_nids,
9481 .dig_out_nid = ALC883_DIGOUT_NID,
9482 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9483 .channel_mode = alc883_3ST_2ch_modes,
9484 .input_mux = &alc883_capture_source,
9485 .unsol_event = alc883_clevo_m720_unsol_event,
9486 .setup = alc883_clevo_m720_setup,
9487 .init_hook = alc883_clevo_m720_init_hook,
9489 [ALC883_LENOVO_101E_2ch] = {
9490 .mixers = { alc883_lenovo_101e_2ch_mixer},
9491 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9492 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9493 .dac_nids = alc883_dac_nids,
9494 .adc_nids = alc883_adc_nids_alt,
9495 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9496 .capsrc_nids = alc883_capsrc_nids,
9497 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9498 .channel_mode = alc883_3ST_2ch_modes,
9499 .input_mux = &alc883_lenovo_101e_capture_source,
9500 .unsol_event = alc883_lenovo_101e_unsol_event,
9501 .init_hook = alc883_lenovo_101e_all_automute,
9503 [ALC883_LENOVO_NB0763] = {
9504 .mixers = { alc883_lenovo_nb0763_mixer },
9505 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9506 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9507 .dac_nids = alc883_dac_nids,
9508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9509 .channel_mode = alc883_3ST_2ch_modes,
9511 .input_mux = &alc883_lenovo_nb0763_capture_source,
9512 .unsol_event = alc_automute_amp_unsol_event,
9513 .setup = alc883_medion_md2_setup,
9514 .init_hook = alc_automute_amp,
9516 [ALC888_LENOVO_MS7195_DIG] = {
9517 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9518 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9519 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9520 .dac_nids = alc883_dac_nids,
9521 .dig_out_nid = ALC883_DIGOUT_NID,
9522 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9523 .channel_mode = alc883_3ST_6ch_modes,
9525 .input_mux = &alc883_capture_source,
9526 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9527 .init_hook = alc888_lenovo_ms7195_front_automute,
9529 [ALC883_HAIER_W66] = {
9530 .mixers = { alc883_targa_2ch_mixer},
9531 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9532 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9533 .dac_nids = alc883_dac_nids,
9534 .dig_out_nid = ALC883_DIGOUT_NID,
9535 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9536 .channel_mode = alc883_3ST_2ch_modes,
9537 .input_mux = &alc883_capture_source,
9538 .unsol_event = alc_automute_amp_unsol_event,
9539 .setup = alc883_haier_w66_setup,
9540 .init_hook = alc_automute_amp,
9543 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9544 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9546 .dac_nids = alc883_dac_nids,
9547 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9548 .channel_mode = alc888_3st_hp_modes,
9550 .input_mux = &alc883_capture_source,
9551 .unsol_event = alc_automute_amp_unsol_event,
9552 .setup = alc888_3st_hp_setup,
9553 .init_hook = alc_automute_amp,
9555 [ALC888_6ST_DELL] = {
9556 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9557 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9559 .dac_nids = alc883_dac_nids,
9560 .dig_out_nid = ALC883_DIGOUT_NID,
9561 .dig_in_nid = ALC883_DIGIN_NID,
9562 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9563 .channel_mode = alc883_sixstack_modes,
9564 .input_mux = &alc883_capture_source,
9565 .unsol_event = alc_automute_amp_unsol_event,
9566 .setup = alc888_6st_dell_setup,
9567 .init_hook = alc_automute_amp,
9570 .mixers = { alc883_mitac_mixer },
9571 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9573 .dac_nids = alc883_dac_nids,
9574 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9575 .channel_mode = alc883_3ST_2ch_modes,
9576 .input_mux = &alc883_capture_source,
9577 .unsol_event = alc_automute_amp_unsol_event,
9578 .setup = alc883_mitac_setup,
9579 .init_hook = alc_automute_amp,
9581 [ALC883_FUJITSU_PI2515] = {
9582 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9583 .init_verbs = { alc883_init_verbs,
9584 alc883_2ch_fujitsu_pi2515_verbs},
9585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9586 .dac_nids = alc883_dac_nids,
9587 .dig_out_nid = ALC883_DIGOUT_NID,
9588 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9589 .channel_mode = alc883_3ST_2ch_modes,
9590 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9591 .unsol_event = alc_automute_amp_unsol_event,
9592 .setup = alc883_2ch_fujitsu_pi2515_setup,
9593 .init_hook = alc_automute_amp,
9595 [ALC888_FUJITSU_XA3530] = {
9596 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9597 .init_verbs = { alc883_init_verbs,
9598 alc888_fujitsu_xa3530_verbs },
9599 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9600 .dac_nids = alc883_dac_nids,
9601 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9602 .adc_nids = alc883_adc_nids_rev,
9603 .capsrc_nids = alc883_capsrc_nids_rev,
9604 .dig_out_nid = ALC883_DIGOUT_NID,
9605 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9606 .channel_mode = alc888_4ST_8ch_intel_modes,
9608 ARRAY_SIZE(alc888_2_capture_sources),
9609 .input_mux = alc888_2_capture_sources,
9610 .unsol_event = alc_automute_amp_unsol_event,
9611 .setup = alc888_fujitsu_xa3530_setup,
9612 .init_hook = alc_automute_amp,
9614 [ALC888_LENOVO_SKY] = {
9615 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9616 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9617 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9618 .dac_nids = alc883_dac_nids,
9619 .dig_out_nid = ALC883_DIGOUT_NID,
9620 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9621 .channel_mode = alc883_sixstack_modes,
9623 .input_mux = &alc883_lenovo_sky_capture_source,
9624 .unsol_event = alc_automute_amp_unsol_event,
9625 .setup = alc888_lenovo_sky_setup,
9626 .init_hook = alc_automute_amp,
9628 [ALC888_ASUS_M90V] = {
9629 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9630 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9631 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9632 .dac_nids = alc883_dac_nids,
9633 .dig_out_nid = ALC883_DIGOUT_NID,
9634 .dig_in_nid = ALC883_DIGIN_NID,
9635 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9636 .channel_mode = alc883_3ST_6ch_modes,
9638 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9639 .unsol_event = alc_sku_unsol_event,
9640 .setup = alc883_mode2_setup,
9641 .init_hook = alc_inithook,
9643 [ALC888_ASUS_EEE1601] = {
9644 .mixers = { alc883_asus_eee1601_mixer },
9645 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9646 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9648 .dac_nids = alc883_dac_nids,
9649 .dig_out_nid = ALC883_DIGOUT_NID,
9650 .dig_in_nid = ALC883_DIGIN_NID,
9651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9652 .channel_mode = alc883_3ST_2ch_modes,
9654 .input_mux = &alc883_asus_eee1601_capture_source,
9655 .unsol_event = alc_sku_unsol_event,
9656 .init_hook = alc883_eee1601_inithook,
9658 [ALC1200_ASUS_P5Q] = {
9659 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9660 .init_verbs = { alc883_init_verbs },
9661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9662 .dac_nids = alc883_dac_nids,
9663 .dig_out_nid = ALC1200_DIGOUT_NID,
9664 .dig_in_nid = ALC883_DIGIN_NID,
9665 .slave_dig_outs = alc1200_slave_dig_outs,
9666 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9667 .channel_mode = alc883_sixstack_modes,
9668 .input_mux = &alc883_capture_source,
9671 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9672 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9673 alc880_gpio1_init_verbs },
9674 .adc_nids = alc883_adc_nids,
9675 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9676 .capsrc_nids = alc883_capsrc_nids,
9677 .dac_nids = alc883_dac_nids,
9678 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9679 .channel_mode = alc889A_mb31_6ch_modes,
9680 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9681 .input_mux = &alc889A_mb31_capture_source,
9682 .dig_out_nid = ALC883_DIGOUT_NID,
9683 .unsol_event = alc889A_mb31_unsol_event,
9684 .init_hook = alc889A_mb31_automute,
9686 [ALC883_SONY_VAIO_TT] = {
9687 .mixers = { alc883_vaiott_mixer },
9688 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9690 .dac_nids = alc883_dac_nids,
9691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9692 .channel_mode = alc883_3ST_2ch_modes,
9693 .input_mux = &alc883_capture_source,
9694 .unsol_event = alc_automute_amp_unsol_event,
9695 .setup = alc883_vaiott_setup,
9696 .init_hook = alc_automute_amp,
9705 PINFIX_ABIT_AW9D_MAX
9708 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9709 { 0x15, 0x01080104 }, /* side */
9710 { 0x16, 0x01011012 }, /* rear */
9711 { 0x17, 0x01016011 }, /* clfe */
9715 static const struct alc_fixup alc882_fixups[] = {
9716 [PINFIX_ABIT_AW9D_MAX] = {
9717 .pins = alc882_abit_aw9d_pinfix
9721 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9722 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9727 * BIOS auto configuration
9729 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9730 const struct auto_pin_cfg *cfg)
9732 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9735 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9736 hda_nid_t nid, int pin_type,
9740 struct alc_spec *spec = codec->spec;
9743 alc_set_pin_output(codec, nid, pin_type);
9744 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9747 idx = spec->multiout.dac_nids[dac_idx] - 2;
9748 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9752 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9754 struct alc_spec *spec = codec->spec;
9757 for (i = 0; i <= HDA_SIDE; i++) {
9758 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9759 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9761 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9766 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9768 struct alc_spec *spec = codec->spec;
9771 pin = spec->autocfg.hp_pins[0];
9772 if (pin) /* connect to front */
9774 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9775 pin = spec->autocfg.speaker_pins[0];
9777 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9780 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9782 struct alc_spec *spec = codec->spec;
9785 for (i = 0; i < AUTO_PIN_LAST; i++) {
9786 hda_nid_t nid = spec->autocfg.input_pins[i];
9789 alc_set_input_pin(codec, nid, i);
9790 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9791 snd_hda_codec_write(codec, nid, 0,
9792 AC_VERB_SET_AMP_GAIN_MUTE,
9797 static void alc882_auto_init_input_src(struct hda_codec *codec)
9799 struct alc_spec *spec = codec->spec;
9802 for (c = 0; c < spec->num_adc_nids; c++) {
9803 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9804 hda_nid_t nid = spec->capsrc_nids[c];
9805 unsigned int mux_idx;
9806 const struct hda_input_mux *imux;
9807 int conns, mute, idx, item;
9809 conns = snd_hda_get_connections(codec, nid, conn_list,
9810 ARRAY_SIZE(conn_list));
9813 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9814 imux = &spec->input_mux[mux_idx];
9815 for (idx = 0; idx < conns; idx++) {
9816 /* if the current connection is the selected one,
9817 * unmute it as default - otherwise mute it
9819 mute = AMP_IN_MUTE(idx);
9820 for (item = 0; item < imux->num_items; item++) {
9821 if (imux->items[item].index == idx) {
9822 if (spec->cur_mux[c] == item)
9823 mute = AMP_IN_UNMUTE(idx);
9827 /* check if we have a selector or mixer
9828 * we could check for the widget type instead, but
9829 * just check for Amp-In presence (in case of mixer
9830 * without amp-in there is something wrong, this
9831 * function shouldn't be used or capsrc nid is wrong)
9833 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9834 snd_hda_codec_write(codec, nid, 0,
9835 AC_VERB_SET_AMP_GAIN_MUTE,
9837 else if (mute != AMP_IN_MUTE(idx))
9838 snd_hda_codec_write(codec, nid, 0,
9839 AC_VERB_SET_CONNECT_SEL,
9845 /* add mic boosts if needed */
9846 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9848 struct alc_spec *spec = codec->spec;
9852 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9853 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9854 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9856 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9860 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9861 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9862 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9864 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9871 /* almost identical with ALC880 parser... */
9872 static int alc882_parse_auto_config(struct hda_codec *codec)
9874 struct alc_spec *spec = codec->spec;
9875 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9878 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9882 if (!spec->autocfg.line_outs)
9883 return 0; /* can't find valid BIOS pin config */
9885 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9888 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9891 err = alc880_auto_create_extra_out(spec,
9892 spec->autocfg.speaker_pins[0],
9896 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9900 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9904 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9906 /* check multiple SPDIF-out (for recent codecs) */
9907 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9909 err = snd_hda_get_connections(codec,
9910 spec->autocfg.dig_out_pins[i],
9915 spec->multiout.dig_out_nid = dig_nid;
9917 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9918 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9920 spec->slave_dig_outs[i - 1] = dig_nid;
9923 if (spec->autocfg.dig_in_pin)
9924 spec->dig_in_nid = ALC880_DIGIN_NID;
9926 if (spec->kctls.list)
9927 add_mixer(spec, spec->kctls.list);
9929 add_verb(spec, alc883_auto_init_verbs);
9930 /* if ADC 0x07 is available, initialize it, too */
9931 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9932 add_verb(spec, alc882_adc1_init_verbs);
9934 spec->num_mux_defs = 1;
9935 spec->input_mux = &spec->private_imux[0];
9937 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9939 err = alc_auto_add_mic_boost(codec);
9943 return 1; /* config found */
9946 /* additional initialization for auto-configuration model */
9947 static void alc882_auto_init(struct hda_codec *codec)
9949 struct alc_spec *spec = codec->spec;
9950 alc882_auto_init_multi_out(codec);
9951 alc882_auto_init_hp_out(codec);
9952 alc882_auto_init_analog_input(codec);
9953 alc882_auto_init_input_src(codec);
9954 if (spec->unsol_event)
9955 alc_inithook(codec);
9958 static int patch_alc882(struct hda_codec *codec)
9960 struct alc_spec *spec;
9961 int err, board_config;
9963 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9969 switch (codec->vendor_id) {
9974 /* ALC883 and variants */
9975 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9979 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9983 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9984 board_config = snd_hda_check_board_codec_sid_config(codec,
9985 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9987 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9988 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9990 board_config = ALC882_AUTO;
9993 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9995 if (board_config == ALC882_AUTO) {
9996 /* automatic parse from the BIOS config */
9997 err = alc882_parse_auto_config(codec);
10003 "hda_codec: Cannot set up configuration "
10004 "from BIOS. Using base mode...\n");
10005 board_config = ALC882_3ST_DIG;
10009 err = snd_hda_attach_beep_device(codec, 0x1);
10015 if (board_config != ALC882_AUTO)
10016 setup_preset(codec, &alc882_presets[board_config]);
10018 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10019 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10020 /* FIXME: setup DAC5 */
10021 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10022 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10024 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10025 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10027 if (codec->vendor_id == 0x10ec0888)
10028 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10030 if (!spec->adc_nids && spec->input_mux) {
10032 spec->num_adc_nids = 0;
10033 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10034 const struct hda_input_mux *imux = spec->input_mux;
10036 hda_nid_t items[16];
10037 hda_nid_t nid = alc882_adc_nids[i];
10038 unsigned int wcap = get_wcaps(codec, nid);
10040 wcap = get_wcaps_type(wcap);
10041 if (wcap != AC_WID_AUD_IN)
10043 spec->private_adc_nids[spec->num_adc_nids] = nid;
10044 err = snd_hda_get_connections(codec, nid, &cap, 1);
10047 err = snd_hda_get_connections(codec, cap, items,
10048 ARRAY_SIZE(items));
10051 for (j = 0; j < imux->num_items; j++)
10052 if (imux->items[j].index >= err)
10054 if (j < imux->num_items)
10056 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10057 spec->num_adc_nids++;
10059 spec->adc_nids = spec->private_adc_nids;
10060 spec->capsrc_nids = spec->private_capsrc_nids;
10063 set_capture_mixer(codec);
10064 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10066 spec->vmaster_nid = 0x0c;
10068 codec->patch_ops = alc_patch_ops;
10069 if (board_config == ALC882_AUTO)
10070 spec->init_hook = alc882_auto_init;
10071 #ifdef CONFIG_SND_HDA_POWER_SAVE
10072 if (!spec->loopback.amplist)
10073 spec->loopback.amplist = alc882_loopbacks;
10075 codec->proc_widget_hook = print_realtek_coef;
10085 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10086 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10088 #define alc262_dac_nids alc260_dac_nids
10089 #define alc262_adc_nids alc882_adc_nids
10090 #define alc262_adc_nids_alt alc882_adc_nids_alt
10091 #define alc262_capsrc_nids alc882_capsrc_nids
10092 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10094 #define alc262_modes alc260_modes
10095 #define alc262_capture_source alc882_capture_source
10097 static hda_nid_t alc262_dmic_adc_nids[1] = {
10102 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10104 static struct snd_kcontrol_new alc262_base_mixer[] = {
10105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10106 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10107 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10108 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10109 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10110 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10116 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10117 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10119 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10120 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10124 /* update HP, line and mono-out pins according to the master switch */
10125 static void alc262_hp_master_update(struct hda_codec *codec)
10127 struct alc_spec *spec = codec->spec;
10128 int val = spec->master_sw;
10130 /* HP & line-out */
10131 snd_hda_codec_write_cache(codec, 0x1b, 0,
10132 AC_VERB_SET_PIN_WIDGET_CONTROL,
10134 snd_hda_codec_write_cache(codec, 0x15, 0,
10135 AC_VERB_SET_PIN_WIDGET_CONTROL,
10137 /* mono (speaker) depending on the HP jack sense */
10138 val = val && !spec->jack_present;
10139 snd_hda_codec_write_cache(codec, 0x16, 0,
10140 AC_VERB_SET_PIN_WIDGET_CONTROL,
10141 val ? PIN_OUT : 0);
10144 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10146 struct alc_spec *spec = codec->spec;
10148 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10149 alc262_hp_master_update(codec);
10152 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10154 if ((res >> 26) != ALC880_HP_EVENT)
10156 alc262_hp_bpc_automute(codec);
10159 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10161 struct alc_spec *spec = codec->spec;
10163 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10164 alc262_hp_master_update(codec);
10167 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10170 if ((res >> 26) != ALC880_HP_EVENT)
10172 alc262_hp_wildwest_automute(codec);
10175 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10177 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10178 struct snd_ctl_elem_value *ucontrol)
10180 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10181 struct alc_spec *spec = codec->spec;
10182 int val = !!*ucontrol->value.integer.value;
10184 if (val == spec->master_sw)
10186 spec->master_sw = val;
10187 alc262_hp_master_update(codec);
10191 #define ALC262_HP_MASTER_SWITCH \
10193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10194 .name = "Master Playback Switch", \
10195 .info = snd_ctl_boolean_mono_info, \
10196 .get = alc262_hp_master_sw_get, \
10197 .put = alc262_hp_master_sw_put, \
10200 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10201 ALC262_HP_MASTER_SWITCH,
10202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10203 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10205 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10207 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10210 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10213 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10219 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10220 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10224 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10225 ALC262_HP_MASTER_SWITCH,
10226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10227 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10229 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10230 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10232 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10236 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10237 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10238 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10239 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10240 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10244 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10245 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10246 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10247 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10251 /* mute/unmute internal speaker according to the hp jack and mute state */
10252 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10254 struct alc_spec *spec = codec->spec;
10256 spec->autocfg.hp_pins[0] = 0x15;
10257 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10260 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10261 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10262 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10263 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10271 static struct hda_verb alc262_hp_t5735_verbs[] = {
10272 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10275 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10279 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10280 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10281 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10282 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10283 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10289 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10290 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10292 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10293 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10294 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10295 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10297 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10303 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10310 /* bind hp and internal speaker mute (with plug check) as master switch */
10311 static void alc262_hippo_master_update(struct hda_codec *codec)
10313 struct alc_spec *spec = codec->spec;
10314 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10315 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10316 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10320 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10321 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10322 HDA_AMP_MUTE, mute);
10323 /* mute internal speaker per jack sense */
10324 if (spec->jack_present)
10325 mute = HDA_AMP_MUTE;
10327 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10328 HDA_AMP_MUTE, mute);
10329 if (speaker_nid && speaker_nid != line_nid)
10330 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10331 HDA_AMP_MUTE, mute);
10334 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10336 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10337 struct snd_ctl_elem_value *ucontrol)
10339 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10340 struct alc_spec *spec = codec->spec;
10341 int val = !!*ucontrol->value.integer.value;
10343 if (val == spec->master_sw)
10345 spec->master_sw = val;
10346 alc262_hippo_master_update(codec);
10350 #define ALC262_HIPPO_MASTER_SWITCH \
10352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10353 .name = "Master Playback Switch", \
10354 .info = snd_ctl_boolean_mono_info, \
10355 .get = alc262_hippo_master_sw_get, \
10356 .put = alc262_hippo_master_sw_put, \
10359 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10360 ALC262_HIPPO_MASTER_SWITCH,
10361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10368 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10369 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10370 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10371 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10376 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10377 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10378 ALC262_HIPPO_MASTER_SWITCH,
10379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10384 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10385 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10386 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10387 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10388 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10392 /* mute/unmute internal speaker according to the hp jack and mute state */
10393 static void alc262_hippo_automute(struct hda_codec *codec)
10395 struct alc_spec *spec = codec->spec;
10396 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10398 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10399 alc262_hippo_master_update(codec);
10402 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10404 if ((res >> 26) != ALC880_HP_EVENT)
10406 alc262_hippo_automute(codec);
10409 static void alc262_hippo_setup(struct hda_codec *codec)
10411 struct alc_spec *spec = codec->spec;
10413 spec->autocfg.hp_pins[0] = 0x15;
10414 spec->autocfg.speaker_pins[0] = 0x14;
10417 static void alc262_hippo1_setup(struct hda_codec *codec)
10419 struct alc_spec *spec = codec->spec;
10421 spec->autocfg.hp_pins[0] = 0x1b;
10422 spec->autocfg.speaker_pins[0] = 0x14;
10426 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10427 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10428 ALC262_HIPPO_MASTER_SWITCH,
10429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10431 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10432 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10436 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10437 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10438 ALC262_HIPPO_MASTER_SWITCH,
10439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10442 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10443 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10447 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10448 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10449 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10450 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10451 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10452 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10453 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10456 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10457 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10458 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10459 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10463 static struct hda_verb alc262_tyan_verbs[] = {
10464 /* Headphone automute */
10465 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10466 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10469 /* P11 AUX_IN, white 4-pin connector */
10470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10471 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10472 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10473 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10478 /* unsolicited event for HP jack sensing */
10479 static void alc262_tyan_setup(struct hda_codec *codec)
10481 struct alc_spec *spec = codec->spec;
10483 spec->autocfg.hp_pins[0] = 0x1b;
10484 spec->autocfg.speaker_pins[0] = 0x15;
10488 #define alc262_capture_mixer alc882_capture_mixer
10489 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10492 * generic initialization of ADC, input mixers and output mixers
10494 static struct hda_verb alc262_init_verbs[] = {
10496 * Unmute ADC0-2 and set the default input to mic-in
10498 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10500 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10502 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10505 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10507 * Note: PASD motherboards uses the Line In 2 as the input for
10508 * front panel mic (mic 2)
10510 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10518 * Set up output mixers (0x0c - 0x0e)
10520 /* set vol=0 to output mixers */
10521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10524 /* set up input amps for analog loopback */
10525 /* Amp Indices: DAC = 0, mixer = 1 */
10526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10535 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10536 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10537 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10538 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10540 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10542 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10546 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10547 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10549 /* FIXME: use matrix-type input source selection */
10550 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10551 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10563 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10564 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10570 static struct hda_verb alc262_eapd_verbs[] = {
10571 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10572 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10576 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10578 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10579 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10586 static struct hda_verb alc262_sony_unsol_verbs[] = {
10587 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10588 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10589 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10591 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10596 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10597 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10598 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10601 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10605 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10606 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10610 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10611 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10612 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10613 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10617 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10619 struct alc_spec *spec = codec->spec;
10621 spec->autocfg.hp_pins[0] = 0x15;
10622 spec->autocfg.speaker_pins[0] = 0x14;
10623 spec->ext_mic.pin = 0x18;
10624 spec->ext_mic.mux_idx = 0;
10625 spec->int_mic.pin = 0x12;
10626 spec->int_mic.mux_idx = 9;
10627 spec->auto_mic = 1;
10633 * 0x16 = internal speaker
10634 * 0x18 = external mic
10637 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10638 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10639 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10650 static struct hda_verb alc262_nec_verbs[] = {
10651 /* Unmute Speaker */
10652 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10655 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10658 /* External mic to headphone */
10659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10660 /* External mic to speaker */
10661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10667 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10668 * 0x1b = port replicator headphone out
10671 #define ALC_HP_EVENT 0x37
10673 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10674 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10676 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10677 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10681 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10682 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10683 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10687 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10688 /* Front Mic pin: input vref at 50% */
10689 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10694 static struct hda_input_mux alc262_fujitsu_capture_source = {
10698 { "Int Mic", 0x1 },
10703 static struct hda_input_mux alc262_HP_capture_source = {
10707 { "Front Mic", 0x1 },
10714 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10718 { "Front Mic", 0x2 },
10724 /* mute/unmute internal speaker according to the hp jacks and mute state */
10725 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10727 struct alc_spec *spec = codec->spec;
10730 if (force || !spec->sense_updated) {
10731 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10732 snd_hda_jack_detect(codec, 0x1b);
10733 spec->sense_updated = 1;
10735 /* unmute internal speaker only if both HPs are unplugged and
10736 * master switch is on
10738 if (spec->jack_present)
10739 mute = HDA_AMP_MUTE;
10741 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10742 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10743 HDA_AMP_MUTE, mute);
10746 /* unsolicited event for HP jack sensing */
10747 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10750 if ((res >> 26) != ALC_HP_EVENT)
10752 alc262_fujitsu_automute(codec, 1);
10755 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10757 alc262_fujitsu_automute(codec, 1);
10760 /* bind volumes of both NID 0x0c and 0x0d */
10761 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10762 .ops = &snd_hda_bind_vol,
10764 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10765 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10770 /* mute/unmute internal speaker according to the hp jack and mute state */
10771 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10773 struct alc_spec *spec = codec->spec;
10776 if (force || !spec->sense_updated) {
10777 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10778 spec->sense_updated = 1;
10780 if (spec->jack_present) {
10781 /* mute internal speaker */
10782 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10783 HDA_AMP_MUTE, HDA_AMP_MUTE);
10784 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10785 HDA_AMP_MUTE, HDA_AMP_MUTE);
10787 /* unmute internal speaker if necessary */
10788 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10789 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10790 HDA_AMP_MUTE, mute);
10791 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10792 HDA_AMP_MUTE, mute);
10796 /* unsolicited event for HP jack sensing */
10797 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10800 if ((res >> 26) != ALC_HP_EVENT)
10802 alc262_lenovo_3000_automute(codec, 1);
10805 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10806 int dir, int idx, long *valp)
10810 for (i = 0; i < 2; i++, valp++)
10811 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10813 *valp ? 0 : HDA_AMP_MUTE);
10817 /* bind hp and internal speaker mute (with plug check) */
10818 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10819 struct snd_ctl_elem_value *ucontrol)
10821 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10822 long *valp = ucontrol->value.integer.value;
10825 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10826 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10828 alc262_fujitsu_automute(codec, 0);
10832 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10833 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10835 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10836 .name = "Master Playback Switch",
10837 .info = snd_hda_mixer_amp_switch_info,
10838 .get = snd_hda_mixer_amp_switch_get,
10839 .put = alc262_fujitsu_master_sw_put,
10840 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10842 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10843 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10846 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10847 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10848 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10849 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10853 /* bind hp and internal speaker mute (with plug check) */
10854 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10855 struct snd_ctl_elem_value *ucontrol)
10857 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10858 long *valp = ucontrol->value.integer.value;
10861 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10863 alc262_lenovo_3000_automute(codec, 0);
10867 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10868 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10871 .name = "Master Playback Switch",
10872 .info = snd_hda_mixer_amp_switch_info,
10873 .get = snd_hda_mixer_amp_switch_get,
10874 .put = alc262_lenovo_3000_master_sw_put,
10875 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10882 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10883 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10884 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10888 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10889 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10890 ALC262_HIPPO_MASTER_SWITCH,
10891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10900 /* additional init verbs for Benq laptops */
10901 static struct hda_verb alc262_EAPD_verbs[] = {
10902 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10903 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10907 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10908 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10911 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10912 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10916 /* Samsung Q1 Ultra Vista model setup */
10917 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10918 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10919 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10922 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10923 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10927 static struct hda_verb alc262_ultra_verbs[] = {
10929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10936 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10946 /* ADC, choose mic */
10947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10955 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10960 /* mute/unmute internal speaker according to the hp jack and mute state */
10961 static void alc262_ultra_automute(struct hda_codec *codec)
10963 struct alc_spec *spec = codec->spec;
10967 /* auto-mute only when HP is used as HP */
10968 if (!spec->cur_mux[0]) {
10969 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10970 if (spec->jack_present)
10971 mute = HDA_AMP_MUTE;
10973 /* mute/unmute internal speaker */
10974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10975 HDA_AMP_MUTE, mute);
10976 /* mute/unmute HP */
10977 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10978 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10981 /* unsolicited event for HP jack sensing */
10982 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10985 if ((res >> 26) != ALC880_HP_EVENT)
10987 alc262_ultra_automute(codec);
10990 static struct hda_input_mux alc262_ultra_capture_source = {
10994 { "Headphone", 0x7 },
10998 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10999 struct snd_ctl_elem_value *ucontrol)
11001 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11002 struct alc_spec *spec = codec->spec;
11005 ret = alc_mux_enum_put(kcontrol, ucontrol);
11008 /* reprogram the HP pin as mic or HP according to the input source */
11009 snd_hda_codec_write_cache(codec, 0x15, 0,
11010 AC_VERB_SET_PIN_WIDGET_CONTROL,
11011 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11012 alc262_ultra_automute(codec); /* mute/unmute HP */
11016 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11017 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11018 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11021 .name = "Capture Source",
11022 .info = alc_mux_enum_info,
11023 .get = alc_mux_enum_get,
11024 .put = alc262_ultra_mux_enum_put,
11029 /* We use two mixers depending on the output pin; 0x16 is a mono output
11030 * and thus it's bound with a different mixer.
11031 * This function returns which mixer amp should be used.
11033 static int alc262_check_volbit(hda_nid_t nid)
11037 else if (nid == 0x16)
11043 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11044 const char *pfx, int *vbits)
11049 vbit = alc262_check_volbit(nid);
11052 if (*vbits & vbit) /* a volume control for this mixer already there */
11056 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11058 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11059 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11062 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11070 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11072 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11073 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11076 /* add playback controls from the parsed DAC table */
11077 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11078 const struct auto_pin_cfg *cfg)
11084 spec->multiout.num_dacs = 1; /* only use one dac */
11085 spec->multiout.dac_nids = spec->private_dac_nids;
11086 spec->multiout.dac_nids[0] = 2;
11088 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11090 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11094 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11097 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11100 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11104 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11105 alc262_check_volbit(cfg->speaker_pins[0]) |
11106 alc262_check_volbit(cfg->hp_pins[0]);
11107 if (vbits == 1 || vbits == 2)
11108 pfx = "Master"; /* only one mixer is used */
11109 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11114 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11117 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11121 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11128 #define alc262_auto_create_input_ctls \
11129 alc880_auto_create_input_ctls
11132 * generic initialization of ADC, input mixers and output mixers
11134 static struct hda_verb alc262_volume_init_verbs[] = {
11136 * Unmute ADC0-2 and set the default input to mic-in
11138 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11140 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11142 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11145 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11147 * Note: PASD motherboards uses the Line In 2 as the input for
11148 * front panel mic (mic 2)
11150 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11158 * Set up output mixers (0x0c - 0x0f)
11160 /* set vol=0 to output mixers */
11161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11165 /* set up input amps for analog loopback */
11166 /* Amp Indices: DAC = 0, mixer = 1 */
11167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11174 /* FIXME: use matrix-type input source selection */
11175 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11176 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11177 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11178 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11182 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11183 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11185 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11195 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11197 * Unmute ADC0-2 and set the default input to mic-in
11199 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11203 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11204 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11206 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11208 * Note: PASD motherboards uses the Line In 2 as the input for
11209 * front panel mic (mic 2)
11211 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11221 * Set up output mixers (0x0c - 0x0e)
11223 /* set vol=0 to output mixers */
11224 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11225 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11226 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11228 /* set up input amps for analog loopback */
11229 /* Amp Indices: DAC = 0, mixer = 1 */
11230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11231 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11232 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11233 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11234 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11235 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11237 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11239 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11241 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11244 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11248 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11250 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11251 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11253 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11254 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11255 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11257 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11258 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11261 /* FIXME: use matrix-type input source selection */
11262 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11263 /* Input mixer1: only unmute Mic */
11264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11294 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11299 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11301 * Unmute ADC0-2 and set the default input to mic-in
11303 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11305 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11306 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11307 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11310 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11312 * Note: PASD motherboards uses the Line In 2 as the input for front
11313 * panel mic (mic 2)
11315 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11325 * Set up output mixers (0x0c - 0x0e)
11327 /* set vol=0 to output mixers */
11328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11332 /* set up input amps for analog loopback */
11333 /* Amp Indices: DAC = 0, mixer = 1 */
11334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11348 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11353 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11356 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11360 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11361 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11363 /* FIXME: use matrix-type input source selection */
11364 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11365 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11371 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11379 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11387 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11395 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11398 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11399 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11401 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11403 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11407 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11413 #ifdef CONFIG_SND_HDA_POWER_SAVE
11414 #define alc262_loopbacks alc880_loopbacks
11417 /* pcm configuration: identical with ALC880 */
11418 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11419 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11420 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11421 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11424 * BIOS auto configuration
11426 static int alc262_parse_auto_config(struct hda_codec *codec)
11428 struct alc_spec *spec = codec->spec;
11430 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11432 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11436 if (!spec->autocfg.line_outs) {
11437 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11438 spec->multiout.max_channels = 2;
11439 spec->no_analog = 1;
11442 return 0; /* can't find valid BIOS pin config */
11444 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11447 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11451 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11454 if (spec->autocfg.dig_outs) {
11455 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11456 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11458 if (spec->autocfg.dig_in_pin)
11459 spec->dig_in_nid = ALC262_DIGIN_NID;
11461 if (spec->kctls.list)
11462 add_mixer(spec, spec->kctls.list);
11464 add_verb(spec, alc262_volume_init_verbs);
11465 spec->num_mux_defs = 1;
11466 spec->input_mux = &spec->private_imux[0];
11468 err = alc_auto_add_mic_boost(codec);
11472 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11477 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11478 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11479 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11480 #define alc262_auto_init_input_src alc882_auto_init_input_src
11483 /* init callback for auto-configuration model -- overriding the default init */
11484 static void alc262_auto_init(struct hda_codec *codec)
11486 struct alc_spec *spec = codec->spec;
11487 alc262_auto_init_multi_out(codec);
11488 alc262_auto_init_hp_out(codec);
11489 alc262_auto_init_analog_input(codec);
11490 alc262_auto_init_input_src(codec);
11491 if (spec->unsol_event)
11492 alc_inithook(codec);
11496 * configuration and preset
11498 static const char *alc262_models[ALC262_MODEL_LAST] = {
11499 [ALC262_BASIC] = "basic",
11500 [ALC262_HIPPO] = "hippo",
11501 [ALC262_HIPPO_1] = "hippo_1",
11502 [ALC262_FUJITSU] = "fujitsu",
11503 [ALC262_HP_BPC] = "hp-bpc",
11504 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11505 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11506 [ALC262_HP_RP5700] = "hp-rp5700",
11507 [ALC262_BENQ_ED8] = "benq",
11508 [ALC262_BENQ_T31] = "benq-t31",
11509 [ALC262_SONY_ASSAMD] = "sony-assamd",
11510 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11511 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11512 [ALC262_ULTRA] = "ultra",
11513 [ALC262_LENOVO_3000] = "lenovo-3000",
11514 [ALC262_NEC] = "nec",
11515 [ALC262_TYAN] = "tyan",
11516 [ALC262_AUTO] = "auto",
11519 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11520 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11521 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11522 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11524 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11526 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11528 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11529 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11530 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11531 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11532 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11533 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11534 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11535 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11536 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11537 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11538 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11539 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11540 ALC262_HP_TC_T5735),
11541 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11542 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11543 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11544 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11545 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11546 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11547 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11548 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11549 #if 0 /* disable the quirk since model=auto works better in recent versions */
11550 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11551 ALC262_SONY_ASSAMD),
11553 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11554 ALC262_TOSHIBA_RX1),
11555 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11556 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11557 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11558 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11559 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11561 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11562 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11563 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11564 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11565 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11569 static struct alc_config_preset alc262_presets[] = {
11571 .mixers = { alc262_base_mixer },
11572 .init_verbs = { alc262_init_verbs },
11573 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11574 .dac_nids = alc262_dac_nids,
11576 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11577 .channel_mode = alc262_modes,
11578 .input_mux = &alc262_capture_source,
11581 .mixers = { alc262_hippo_mixer },
11582 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11583 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11584 .dac_nids = alc262_dac_nids,
11586 .dig_out_nid = ALC262_DIGOUT_NID,
11587 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11588 .channel_mode = alc262_modes,
11589 .input_mux = &alc262_capture_source,
11590 .unsol_event = alc262_hippo_unsol_event,
11591 .setup = alc262_hippo_setup,
11592 .init_hook = alc262_hippo_automute,
11594 [ALC262_HIPPO_1] = {
11595 .mixers = { alc262_hippo1_mixer },
11596 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11597 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11598 .dac_nids = alc262_dac_nids,
11600 .dig_out_nid = ALC262_DIGOUT_NID,
11601 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11602 .channel_mode = alc262_modes,
11603 .input_mux = &alc262_capture_source,
11604 .unsol_event = alc262_hippo_unsol_event,
11605 .setup = alc262_hippo1_setup,
11606 .init_hook = alc262_hippo_automute,
11608 [ALC262_FUJITSU] = {
11609 .mixers = { alc262_fujitsu_mixer },
11610 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11611 alc262_fujitsu_unsol_verbs },
11612 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11613 .dac_nids = alc262_dac_nids,
11615 .dig_out_nid = ALC262_DIGOUT_NID,
11616 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11617 .channel_mode = alc262_modes,
11618 .input_mux = &alc262_fujitsu_capture_source,
11619 .unsol_event = alc262_fujitsu_unsol_event,
11620 .init_hook = alc262_fujitsu_init_hook,
11622 [ALC262_HP_BPC] = {
11623 .mixers = { alc262_HP_BPC_mixer },
11624 .init_verbs = { alc262_HP_BPC_init_verbs },
11625 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11626 .dac_nids = alc262_dac_nids,
11628 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11629 .channel_mode = alc262_modes,
11630 .input_mux = &alc262_HP_capture_source,
11631 .unsol_event = alc262_hp_bpc_unsol_event,
11632 .init_hook = alc262_hp_bpc_automute,
11634 [ALC262_HP_BPC_D7000_WF] = {
11635 .mixers = { alc262_HP_BPC_WildWest_mixer },
11636 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11637 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11638 .dac_nids = alc262_dac_nids,
11640 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11641 .channel_mode = alc262_modes,
11642 .input_mux = &alc262_HP_D7000_capture_source,
11643 .unsol_event = alc262_hp_wildwest_unsol_event,
11644 .init_hook = alc262_hp_wildwest_automute,
11646 [ALC262_HP_BPC_D7000_WL] = {
11647 .mixers = { alc262_HP_BPC_WildWest_mixer,
11648 alc262_HP_BPC_WildWest_option_mixer },
11649 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11650 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11651 .dac_nids = alc262_dac_nids,
11653 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11654 .channel_mode = alc262_modes,
11655 .input_mux = &alc262_HP_D7000_capture_source,
11656 .unsol_event = alc262_hp_wildwest_unsol_event,
11657 .init_hook = alc262_hp_wildwest_automute,
11659 [ALC262_HP_TC_T5735] = {
11660 .mixers = { alc262_hp_t5735_mixer },
11661 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11662 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11663 .dac_nids = alc262_dac_nids,
11665 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11666 .channel_mode = alc262_modes,
11667 .input_mux = &alc262_capture_source,
11668 .unsol_event = alc_automute_amp_unsol_event,
11669 .setup = alc262_hp_t5735_setup,
11670 .init_hook = alc_automute_amp,
11672 [ALC262_HP_RP5700] = {
11673 .mixers = { alc262_hp_rp5700_mixer },
11674 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11675 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11676 .dac_nids = alc262_dac_nids,
11677 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11678 .channel_mode = alc262_modes,
11679 .input_mux = &alc262_hp_rp5700_capture_source,
11681 [ALC262_BENQ_ED8] = {
11682 .mixers = { alc262_base_mixer },
11683 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11685 .dac_nids = alc262_dac_nids,
11687 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11688 .channel_mode = alc262_modes,
11689 .input_mux = &alc262_capture_source,
11691 [ALC262_SONY_ASSAMD] = {
11692 .mixers = { alc262_sony_mixer },
11693 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11694 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11695 .dac_nids = alc262_dac_nids,
11697 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11698 .channel_mode = alc262_modes,
11699 .input_mux = &alc262_capture_source,
11700 .unsol_event = alc262_hippo_unsol_event,
11701 .setup = alc262_hippo_setup,
11702 .init_hook = alc262_hippo_automute,
11704 [ALC262_BENQ_T31] = {
11705 .mixers = { alc262_benq_t31_mixer },
11706 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11707 alc_hp15_unsol_verbs },
11708 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11709 .dac_nids = alc262_dac_nids,
11711 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11712 .channel_mode = alc262_modes,
11713 .input_mux = &alc262_capture_source,
11714 .unsol_event = alc262_hippo_unsol_event,
11715 .setup = alc262_hippo_setup,
11716 .init_hook = alc262_hippo_automute,
11719 .mixers = { alc262_ultra_mixer },
11720 .cap_mixer = alc262_ultra_capture_mixer,
11721 .init_verbs = { alc262_ultra_verbs },
11722 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11723 .dac_nids = alc262_dac_nids,
11724 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11725 .channel_mode = alc262_modes,
11726 .input_mux = &alc262_ultra_capture_source,
11727 .adc_nids = alc262_adc_nids, /* ADC0 */
11728 .capsrc_nids = alc262_capsrc_nids,
11729 .num_adc_nids = 1, /* single ADC */
11730 .unsol_event = alc262_ultra_unsol_event,
11731 .init_hook = alc262_ultra_automute,
11733 [ALC262_LENOVO_3000] = {
11734 .mixers = { alc262_lenovo_3000_mixer },
11735 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11736 alc262_lenovo_3000_unsol_verbs,
11737 alc262_lenovo_3000_init_verbs },
11738 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11739 .dac_nids = alc262_dac_nids,
11741 .dig_out_nid = ALC262_DIGOUT_NID,
11742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11743 .channel_mode = alc262_modes,
11744 .input_mux = &alc262_fujitsu_capture_source,
11745 .unsol_event = alc262_lenovo_3000_unsol_event,
11748 .mixers = { alc262_nec_mixer },
11749 .init_verbs = { alc262_nec_verbs },
11750 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11751 .dac_nids = alc262_dac_nids,
11753 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11754 .channel_mode = alc262_modes,
11755 .input_mux = &alc262_capture_source,
11757 [ALC262_TOSHIBA_S06] = {
11758 .mixers = { alc262_toshiba_s06_mixer },
11759 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11760 alc262_eapd_verbs },
11761 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11762 .capsrc_nids = alc262_dmic_capsrc_nids,
11763 .dac_nids = alc262_dac_nids,
11764 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11765 .num_adc_nids = 1, /* single ADC */
11766 .dig_out_nid = ALC262_DIGOUT_NID,
11767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11768 .channel_mode = alc262_modes,
11769 .unsol_event = alc_sku_unsol_event,
11770 .setup = alc262_toshiba_s06_setup,
11771 .init_hook = alc_inithook,
11773 [ALC262_TOSHIBA_RX1] = {
11774 .mixers = { alc262_toshiba_rx1_mixer },
11775 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11776 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11777 .dac_nids = alc262_dac_nids,
11779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11780 .channel_mode = alc262_modes,
11781 .input_mux = &alc262_capture_source,
11782 .unsol_event = alc262_hippo_unsol_event,
11783 .setup = alc262_hippo_setup,
11784 .init_hook = alc262_hippo_automute,
11787 .mixers = { alc262_tyan_mixer },
11788 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11789 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11790 .dac_nids = alc262_dac_nids,
11792 .dig_out_nid = ALC262_DIGOUT_NID,
11793 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11794 .channel_mode = alc262_modes,
11795 .input_mux = &alc262_capture_source,
11796 .unsol_event = alc_automute_amp_unsol_event,
11797 .setup = alc262_tyan_setup,
11798 .init_hook = alc_automute_amp,
11802 static int patch_alc262(struct hda_codec *codec)
11804 struct alc_spec *spec;
11808 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11812 codec->spec = spec;
11814 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11819 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11820 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11821 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11822 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11826 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11828 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11832 if (board_config < 0) {
11833 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11835 board_config = ALC262_AUTO;
11838 if (board_config == ALC262_AUTO) {
11839 /* automatic parse from the BIOS config */
11840 err = alc262_parse_auto_config(codec);
11846 "hda_codec: Cannot set up configuration "
11847 "from BIOS. Using base mode...\n");
11848 board_config = ALC262_BASIC;
11852 if (!spec->no_analog) {
11853 err = snd_hda_attach_beep_device(codec, 0x1);
11860 if (board_config != ALC262_AUTO)
11861 setup_preset(codec, &alc262_presets[board_config]);
11863 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11864 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11866 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11867 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11869 if (!spec->adc_nids && spec->input_mux) {
11871 /* check whether the digital-mic has to be supported */
11872 for (i = 0; i < spec->input_mux->num_items; i++) {
11873 if (spec->input_mux->items[i].index >= 9)
11876 if (i < spec->input_mux->num_items) {
11877 /* use only ADC0 */
11878 spec->adc_nids = alc262_dmic_adc_nids;
11879 spec->num_adc_nids = 1;
11880 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11882 /* all analog inputs */
11883 /* check whether NID 0x07 is valid */
11884 unsigned int wcap = get_wcaps(codec, 0x07);
11887 wcap = get_wcaps_type(wcap);
11888 if (wcap != AC_WID_AUD_IN) {
11889 spec->adc_nids = alc262_adc_nids_alt;
11890 spec->num_adc_nids =
11891 ARRAY_SIZE(alc262_adc_nids_alt);
11892 spec->capsrc_nids = alc262_capsrc_nids_alt;
11894 spec->adc_nids = alc262_adc_nids;
11895 spec->num_adc_nids =
11896 ARRAY_SIZE(alc262_adc_nids);
11897 spec->capsrc_nids = alc262_capsrc_nids;
11901 if (!spec->cap_mixer && !spec->no_analog)
11902 set_capture_mixer(codec);
11903 if (!spec->no_analog)
11904 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11906 spec->vmaster_nid = 0x0c;
11908 codec->patch_ops = alc_patch_ops;
11909 if (board_config == ALC262_AUTO)
11910 spec->init_hook = alc262_auto_init;
11911 #ifdef CONFIG_SND_HDA_POWER_SAVE
11912 if (!spec->loopback.amplist)
11913 spec->loopback.amplist = alc262_loopbacks;
11915 codec->proc_widget_hook = print_realtek_coef;
11921 * ALC268 channel source setting (2 channel)
11923 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11924 #define alc268_modes alc260_modes
11926 static hda_nid_t alc268_dac_nids[2] = {
11931 static hda_nid_t alc268_adc_nids[2] = {
11936 static hda_nid_t alc268_adc_nids_alt[1] = {
11941 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11943 static struct snd_kcontrol_new alc268_base_mixer[] = {
11944 /* output mixer control */
11945 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11946 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11947 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11948 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11949 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11950 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11951 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11955 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11956 /* output mixer control */
11957 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11959 ALC262_HIPPO_MASTER_SWITCH,
11960 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11961 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11962 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11966 /* bind Beep switches of both NID 0x0f and 0x10 */
11967 static struct hda_bind_ctls alc268_bind_beep_sw = {
11968 .ops = &snd_hda_bind_sw,
11970 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11971 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11976 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11977 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11978 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11982 static struct hda_verb alc268_eapd_verbs[] = {
11983 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11984 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11988 /* Toshiba specific */
11989 static struct hda_verb alc268_toshiba_verbs[] = {
11990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11994 /* Acer specific */
11995 /* bind volumes of both NID 0x02 and 0x03 */
11996 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11997 .ops = &snd_hda_bind_vol,
11999 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12000 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12005 /* mute/unmute internal speaker according to the hp jack and mute state */
12006 static void alc268_acer_automute(struct hda_codec *codec, int force)
12008 struct alc_spec *spec = codec->spec;
12011 if (force || !spec->sense_updated) {
12012 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12013 spec->sense_updated = 1;
12015 if (spec->jack_present)
12016 mute = HDA_AMP_MUTE; /* mute internal speaker */
12017 else /* unmute internal speaker if necessary */
12018 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12020 HDA_AMP_MUTE, mute);
12024 /* bind hp and internal speaker mute (with plug check) */
12025 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12026 struct snd_ctl_elem_value *ucontrol)
12028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12029 long *valp = ucontrol->value.integer.value;
12032 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12034 alc268_acer_automute(codec, 0);
12038 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12039 /* output mixer control */
12040 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12043 .name = "Master Playback Switch",
12044 .info = snd_hda_mixer_amp_switch_info,
12045 .get = snd_hda_mixer_amp_switch_get,
12046 .put = alc268_acer_master_sw_put,
12047 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12049 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12053 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12054 /* output mixer control */
12055 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12057 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12058 .name = "Master Playback Switch",
12059 .info = snd_hda_mixer_amp_switch_info,
12060 .get = snd_hda_mixer_amp_switch_get,
12061 .put = alc268_acer_master_sw_put,
12062 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12064 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12065 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12066 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12070 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12071 /* output mixer control */
12072 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12074 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12075 .name = "Master Playback Switch",
12076 .info = snd_hda_mixer_amp_switch_info,
12077 .get = snd_hda_mixer_amp_switch_get,
12078 .put = alc268_acer_master_sw_put,
12079 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12082 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12086 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12087 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12089 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12090 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12091 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12096 static struct hda_verb alc268_acer_verbs[] = {
12097 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12098 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12099 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12100 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12101 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12102 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12103 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12107 /* unsolicited event for HP jack sensing */
12108 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12109 #define alc268_toshiba_setup alc262_hippo_setup
12110 #define alc268_toshiba_automute alc262_hippo_automute
12112 static void alc268_acer_unsol_event(struct hda_codec *codec,
12115 if ((res >> 26) != ALC880_HP_EVENT)
12117 alc268_acer_automute(codec, 1);
12120 static void alc268_acer_init_hook(struct hda_codec *codec)
12122 alc268_acer_automute(codec, 1);
12125 /* toggle speaker-output according to the hp-jack state */
12126 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12128 unsigned int present;
12129 unsigned char bits;
12131 present = snd_hda_jack_detect(codec, 0x15);
12132 bits = present ? AMP_IN_MUTE(0) : 0;
12133 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12134 AMP_IN_MUTE(0), bits);
12135 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12136 AMP_IN_MUTE(0), bits);
12139 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12142 switch (res >> 26) {
12143 case ALC880_HP_EVENT:
12144 alc268_aspire_one_speaker_automute(codec);
12146 case ALC880_MIC_EVENT:
12147 alc_mic_automute(codec);
12152 static void alc268_acer_lc_setup(struct hda_codec *codec)
12154 struct alc_spec *spec = codec->spec;
12155 spec->ext_mic.pin = 0x18;
12156 spec->ext_mic.mux_idx = 0;
12157 spec->int_mic.pin = 0x12;
12158 spec->int_mic.mux_idx = 6;
12159 spec->auto_mic = 1;
12162 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12164 alc268_aspire_one_speaker_automute(codec);
12165 alc_mic_automute(codec);
12168 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12169 /* output mixer control */
12170 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12171 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12175 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12179 static struct hda_verb alc268_dell_verbs[] = {
12180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12182 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12183 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12187 /* mute/unmute internal speaker according to the hp jack and mute state */
12188 static void alc268_dell_setup(struct hda_codec *codec)
12190 struct alc_spec *spec = codec->spec;
12192 spec->autocfg.hp_pins[0] = 0x15;
12193 spec->autocfg.speaker_pins[0] = 0x14;
12194 spec->ext_mic.pin = 0x18;
12195 spec->ext_mic.mux_idx = 0;
12196 spec->int_mic.pin = 0x19;
12197 spec->int_mic.mux_idx = 1;
12198 spec->auto_mic = 1;
12201 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12202 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12203 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12204 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12207 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12208 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12209 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12213 static struct hda_verb alc267_quanta_il1_verbs[] = {
12214 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12219 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12221 struct alc_spec *spec = codec->spec;
12222 spec->autocfg.hp_pins[0] = 0x15;
12223 spec->autocfg.speaker_pins[0] = 0x14;
12224 spec->ext_mic.pin = 0x18;
12225 spec->ext_mic.mux_idx = 0;
12226 spec->int_mic.pin = 0x19;
12227 spec->int_mic.mux_idx = 1;
12228 spec->auto_mic = 1;
12232 * generic initialization of ADC, input mixers and output mixers
12234 static struct hda_verb alc268_base_init_verbs[] = {
12235 /* Unmute DAC0-1 and set vol = 0 */
12236 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12237 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12240 * Set up output mixers (0x0c - 0x0e)
12242 /* set vol=0 to output mixers */
12243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12244 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12247 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12251 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12252 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12253 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12255 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12256 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12264 /* set PCBEEP vol = 0, mute connections */
12265 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12267 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12269 /* Unmute Selector 23h,24h and set the default input to mic-in */
12271 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12273 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12280 * generic initialization of ADC, input mixers and output mixers
12282 static struct hda_verb alc268_volume_init_verbs[] = {
12283 /* set output DAC */
12284 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12285 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12288 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12290 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12291 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12294 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12295 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12297 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12300 /* set PCBEEP vol = 0, mute connections */
12301 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12302 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12303 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12308 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12309 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12310 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12314 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12315 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12316 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12321 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12322 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12323 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12324 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12325 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12330 static struct hda_input_mux alc268_capture_source = {
12334 { "Front Mic", 0x1 },
12340 static struct hda_input_mux alc268_acer_capture_source = {
12344 { "Internal Mic", 0x1 },
12349 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12353 { "Internal Mic", 0x6 },
12358 #ifdef CONFIG_SND_DEBUG
12359 static struct snd_kcontrol_new alc268_test_mixer[] = {
12360 /* Volume widgets */
12361 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12362 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12363 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12364 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12365 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12366 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12367 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12368 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12369 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12370 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12371 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12372 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12373 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12374 /* The below appears problematic on some hardwares */
12375 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12376 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12377 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12378 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12379 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12381 /* Modes for retasking pin widgets */
12382 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12383 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12384 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12385 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12387 /* Controls for GPIO pins, assuming they are configured as outputs */
12388 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12389 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12390 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12391 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12393 /* Switches to allow the digital SPDIF output pin to be enabled.
12394 * The ALC268 does not have an SPDIF input.
12396 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12398 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12399 * this output to turn on an external amplifier.
12401 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12402 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12408 /* create input playback/capture controls for the given pin */
12409 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12410 const char *ctlname, int idx)
12426 if (spec->multiout.dac_nids[0] != dac &&
12427 spec->multiout.dac_nids[1] != dac) {
12428 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12429 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12433 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12437 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12438 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12440 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12441 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12447 /* add playback controls from the parsed DAC table */
12448 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12449 const struct auto_pin_cfg *cfg)
12454 spec->multiout.dac_nids = spec->private_dac_nids;
12456 nid = cfg->line_out_pins[0];
12459 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12463 err = alc268_new_analog_output(spec, nid, name, 0);
12468 nid = cfg->speaker_pins[0];
12470 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12471 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12475 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12479 nid = cfg->hp_pins[0];
12481 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12486 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12488 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12489 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12496 /* create playback/capture controls for input pins */
12497 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12498 const struct auto_pin_cfg *cfg)
12500 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12503 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12504 hda_nid_t nid, int pin_type)
12508 alc_set_pin_output(codec, nid, pin_type);
12509 if (nid == 0x14 || nid == 0x16)
12513 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12516 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12518 struct alc_spec *spec = codec->spec;
12519 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12521 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12522 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12526 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12528 struct alc_spec *spec = codec->spec;
12531 pin = spec->autocfg.hp_pins[0];
12533 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12534 pin = spec->autocfg.speaker_pins[0];
12536 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12539 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12541 struct alc_spec *spec = codec->spec;
12542 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12543 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12544 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12545 unsigned int dac_vol1, dac_vol2;
12547 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12548 snd_hda_codec_write(codec, speaker_nid, 0,
12549 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12550 /* mute mixer inputs from 0x1d */
12551 snd_hda_codec_write(codec, 0x0f, 0,
12552 AC_VERB_SET_AMP_GAIN_MUTE,
12554 snd_hda_codec_write(codec, 0x10, 0,
12555 AC_VERB_SET_AMP_GAIN_MUTE,
12558 /* unmute mixer inputs from 0x1d */
12559 snd_hda_codec_write(codec, 0x0f, 0,
12560 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12561 snd_hda_codec_write(codec, 0x10, 0,
12562 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12565 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12566 if (line_nid == 0x14)
12567 dac_vol2 = AMP_OUT_ZERO;
12568 else if (line_nid == 0x15)
12569 dac_vol1 = AMP_OUT_ZERO;
12570 if (hp_nid == 0x14)
12571 dac_vol2 = AMP_OUT_ZERO;
12572 else if (hp_nid == 0x15)
12573 dac_vol1 = AMP_OUT_ZERO;
12574 if (line_nid != 0x16 || hp_nid != 0x16 ||
12575 spec->autocfg.line_out_pins[1] != 0x16 ||
12576 spec->autocfg.line_out_pins[2] != 0x16)
12577 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12579 snd_hda_codec_write(codec, 0x02, 0,
12580 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12581 snd_hda_codec_write(codec, 0x03, 0,
12582 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12585 /* pcm configuration: identical with ALC880 */
12586 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12587 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12588 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12589 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12592 * BIOS auto configuration
12594 static int alc268_parse_auto_config(struct hda_codec *codec)
12596 struct alc_spec *spec = codec->spec;
12598 static hda_nid_t alc268_ignore[] = { 0 };
12600 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12604 if (!spec->autocfg.line_outs) {
12605 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12606 spec->multiout.max_channels = 2;
12607 spec->no_analog = 1;
12610 return 0; /* can't find valid BIOS pin config */
12612 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12615 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12619 spec->multiout.max_channels = 2;
12622 /* digital only support output */
12623 if (spec->autocfg.dig_outs) {
12624 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12625 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12627 if (spec->kctls.list)
12628 add_mixer(spec, spec->kctls.list);
12630 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12631 add_mixer(spec, alc268_beep_mixer);
12633 add_verb(spec, alc268_volume_init_verbs);
12634 spec->num_mux_defs = 2;
12635 spec->input_mux = &spec->private_imux[0];
12637 err = alc_auto_add_mic_boost(codec);
12641 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12646 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12648 /* init callback for auto-configuration model -- overriding the default init */
12649 static void alc268_auto_init(struct hda_codec *codec)
12651 struct alc_spec *spec = codec->spec;
12652 alc268_auto_init_multi_out(codec);
12653 alc268_auto_init_hp_out(codec);
12654 alc268_auto_init_mono_speaker_out(codec);
12655 alc268_auto_init_analog_input(codec);
12656 if (spec->unsol_event)
12657 alc_inithook(codec);
12661 * configuration and preset
12663 static const char *alc268_models[ALC268_MODEL_LAST] = {
12664 [ALC267_QUANTA_IL1] = "quanta-il1",
12665 [ALC268_3ST] = "3stack",
12666 [ALC268_TOSHIBA] = "toshiba",
12667 [ALC268_ACER] = "acer",
12668 [ALC268_ACER_DMIC] = "acer-dmic",
12669 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12670 [ALC268_DELL] = "dell",
12671 [ALC268_ZEPTO] = "zepto",
12672 #ifdef CONFIG_SND_DEBUG
12673 [ALC268_TEST] = "test",
12675 [ALC268_AUTO] = "auto",
12678 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12679 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12680 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12681 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12682 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12683 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12684 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12685 ALC268_ACER_ASPIRE_ONE),
12686 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12687 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12688 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12689 /* almost compatible with toshiba but with optional digital outs;
12690 * auto-probing seems working fine
12692 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12694 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12695 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12696 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12697 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12698 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12699 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12703 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12704 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12705 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12706 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12707 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12712 static struct alc_config_preset alc268_presets[] = {
12713 [ALC267_QUANTA_IL1] = {
12714 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12715 alc268_capture_nosrc_mixer },
12716 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12717 alc267_quanta_il1_verbs },
12718 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12719 .dac_nids = alc268_dac_nids,
12720 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12721 .adc_nids = alc268_adc_nids_alt,
12723 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12724 .channel_mode = alc268_modes,
12725 .unsol_event = alc_sku_unsol_event,
12726 .setup = alc267_quanta_il1_setup,
12727 .init_hook = alc_inithook,
12730 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12731 alc268_beep_mixer },
12732 .init_verbs = { alc268_base_init_verbs },
12733 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12734 .dac_nids = alc268_dac_nids,
12735 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12736 .adc_nids = alc268_adc_nids_alt,
12737 .capsrc_nids = alc268_capsrc_nids,
12739 .dig_out_nid = ALC268_DIGOUT_NID,
12740 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12741 .channel_mode = alc268_modes,
12742 .input_mux = &alc268_capture_source,
12744 [ALC268_TOSHIBA] = {
12745 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12746 alc268_beep_mixer },
12747 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12748 alc268_toshiba_verbs },
12749 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12750 .dac_nids = alc268_dac_nids,
12751 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12752 .adc_nids = alc268_adc_nids_alt,
12753 .capsrc_nids = alc268_capsrc_nids,
12755 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12756 .channel_mode = alc268_modes,
12757 .input_mux = &alc268_capture_source,
12758 .unsol_event = alc268_toshiba_unsol_event,
12759 .setup = alc268_toshiba_setup,
12760 .init_hook = alc268_toshiba_automute,
12763 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12764 alc268_beep_mixer },
12765 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12766 alc268_acer_verbs },
12767 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12768 .dac_nids = alc268_dac_nids,
12769 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12770 .adc_nids = alc268_adc_nids_alt,
12771 .capsrc_nids = alc268_capsrc_nids,
12773 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12774 .channel_mode = alc268_modes,
12775 .input_mux = &alc268_acer_capture_source,
12776 .unsol_event = alc268_acer_unsol_event,
12777 .init_hook = alc268_acer_init_hook,
12779 [ALC268_ACER_DMIC] = {
12780 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12781 alc268_beep_mixer },
12782 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12783 alc268_acer_verbs },
12784 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12785 .dac_nids = alc268_dac_nids,
12786 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12787 .adc_nids = alc268_adc_nids_alt,
12788 .capsrc_nids = alc268_capsrc_nids,
12790 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12791 .channel_mode = alc268_modes,
12792 .input_mux = &alc268_acer_dmic_capture_source,
12793 .unsol_event = alc268_acer_unsol_event,
12794 .init_hook = alc268_acer_init_hook,
12796 [ALC268_ACER_ASPIRE_ONE] = {
12797 .mixers = { alc268_acer_aspire_one_mixer,
12799 alc268_capture_nosrc_mixer },
12800 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12801 alc268_acer_aspire_one_verbs },
12802 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12803 .dac_nids = alc268_dac_nids,
12804 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12805 .adc_nids = alc268_adc_nids_alt,
12806 .capsrc_nids = alc268_capsrc_nids,
12808 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12809 .channel_mode = alc268_modes,
12810 .unsol_event = alc268_acer_lc_unsol_event,
12811 .setup = alc268_acer_lc_setup,
12812 .init_hook = alc268_acer_lc_init_hook,
12815 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12816 alc268_capture_nosrc_mixer },
12817 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12818 alc268_dell_verbs },
12819 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12820 .dac_nids = alc268_dac_nids,
12821 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12822 .adc_nids = alc268_adc_nids_alt,
12823 .capsrc_nids = alc268_capsrc_nids,
12825 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12826 .channel_mode = alc268_modes,
12827 .unsol_event = alc_sku_unsol_event,
12828 .setup = alc268_dell_setup,
12829 .init_hook = alc_inithook,
12832 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12833 alc268_beep_mixer },
12834 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12835 alc268_toshiba_verbs },
12836 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12837 .dac_nids = alc268_dac_nids,
12838 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12839 .adc_nids = alc268_adc_nids_alt,
12840 .capsrc_nids = alc268_capsrc_nids,
12842 .dig_out_nid = ALC268_DIGOUT_NID,
12843 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12844 .channel_mode = alc268_modes,
12845 .input_mux = &alc268_capture_source,
12846 .setup = alc268_toshiba_setup,
12847 .init_hook = alc268_toshiba_automute,
12849 #ifdef CONFIG_SND_DEBUG
12851 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12852 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12853 alc268_volume_init_verbs },
12854 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12855 .dac_nids = alc268_dac_nids,
12856 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12857 .adc_nids = alc268_adc_nids_alt,
12858 .capsrc_nids = alc268_capsrc_nids,
12860 .dig_out_nid = ALC268_DIGOUT_NID,
12861 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12862 .channel_mode = alc268_modes,
12863 .input_mux = &alc268_capture_source,
12868 static int patch_alc268(struct hda_codec *codec)
12870 struct alc_spec *spec;
12872 int i, has_beep, err;
12874 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12878 codec->spec = spec;
12880 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12884 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12885 board_config = snd_hda_check_board_codec_sid_config(codec,
12886 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12888 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12889 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12891 board_config = ALC268_AUTO;
12894 if (board_config == ALC268_AUTO) {
12895 /* automatic parse from the BIOS config */
12896 err = alc268_parse_auto_config(codec);
12902 "hda_codec: Cannot set up configuration "
12903 "from BIOS. Using base mode...\n");
12904 board_config = ALC268_3ST;
12908 if (board_config != ALC268_AUTO)
12909 setup_preset(codec, &alc268_presets[board_config]);
12911 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12912 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12913 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12915 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12918 for (i = 0; i < spec->num_mixers; i++) {
12919 if (spec->mixers[i] == alc268_beep_mixer) {
12926 err = snd_hda_attach_beep_device(codec, 0x1);
12931 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12932 /* override the amp caps for beep generator */
12933 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12934 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12935 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12936 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12937 (0 << AC_AMPCAP_MUTE_SHIFT));
12940 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12941 /* check whether NID 0x07 is valid */
12942 unsigned int wcap = get_wcaps(codec, 0x07);
12945 spec->capsrc_nids = alc268_capsrc_nids;
12947 wcap = get_wcaps_type(wcap);
12948 if (spec->auto_mic ||
12949 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12950 spec->adc_nids = alc268_adc_nids_alt;
12951 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12952 if (spec->auto_mic)
12953 fixup_automic_adc(codec);
12954 if (spec->auto_mic || spec->input_mux->num_items == 1)
12955 add_mixer(spec, alc268_capture_nosrc_mixer);
12957 add_mixer(spec, alc268_capture_alt_mixer);
12959 spec->adc_nids = alc268_adc_nids;
12960 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12961 add_mixer(spec, alc268_capture_mixer);
12963 /* set default input source */
12964 for (i = 0; i < spec->num_adc_nids; i++)
12965 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12966 0, AC_VERB_SET_CONNECT_SEL,
12967 i < spec->num_mux_defs ?
12968 spec->input_mux[i].items[0].index :
12969 spec->input_mux->items[0].index);
12972 spec->vmaster_nid = 0x02;
12974 codec->patch_ops = alc_patch_ops;
12975 if (board_config == ALC268_AUTO)
12976 spec->init_hook = alc268_auto_init;
12978 codec->proc_widget_hook = print_realtek_coef;
12984 * ALC269 channel source setting (2 channel)
12986 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12988 #define alc269_dac_nids alc260_dac_nids
12990 static hda_nid_t alc269_adc_nids[1] = {
12995 static hda_nid_t alc269_capsrc_nids[1] = {
12999 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13003 #define alc269_modes alc260_modes
13004 #define alc269_capture_source alc880_lg_lw_capture_source
13006 static struct snd_kcontrol_new alc269_base_mixer[] = {
13007 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13008 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13014 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13016 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13017 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13018 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13022 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13023 /* output mixer control */
13024 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13027 .name = "Master Playback Switch",
13028 .info = snd_hda_mixer_amp_switch_info,
13029 .get = snd_hda_mixer_amp_switch_get,
13030 .put = alc268_acer_master_sw_put,
13031 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13036 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13037 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13038 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13042 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13043 /* output mixer control */
13044 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13047 .name = "Master Playback Switch",
13048 .info = snd_hda_mixer_amp_switch_info,
13049 .get = snd_hda_mixer_amp_switch_get,
13050 .put = alc268_acer_master_sw_put,
13051 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13056 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13057 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13058 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13059 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13060 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13061 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13065 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13066 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13067 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13069 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13073 /* capture mixer elements */
13074 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13075 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13076 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13077 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13082 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13084 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13086 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13087 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13088 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13089 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13090 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13094 static struct hda_verb alc269_lifebook_verbs[] = {
13095 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13096 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13097 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13099 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13100 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13101 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13102 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13103 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13104 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13108 /* toggle speaker-output according to the hp-jack state */
13109 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13111 unsigned int present;
13112 unsigned char bits;
13114 present = snd_hda_jack_detect(codec, 0x15);
13115 bits = present ? AMP_IN_MUTE(0) : 0;
13116 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13117 AMP_IN_MUTE(0), bits);
13118 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13119 AMP_IN_MUTE(0), bits);
13121 snd_hda_codec_write(codec, 0x20, 0,
13122 AC_VERB_SET_COEF_INDEX, 0x0c);
13123 snd_hda_codec_write(codec, 0x20, 0,
13124 AC_VERB_SET_PROC_COEF, 0x680);
13126 snd_hda_codec_write(codec, 0x20, 0,
13127 AC_VERB_SET_COEF_INDEX, 0x0c);
13128 snd_hda_codec_write(codec, 0x20, 0,
13129 AC_VERB_SET_PROC_COEF, 0x480);
13132 /* toggle speaker-output according to the hp-jacks state */
13133 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13135 unsigned int present;
13136 unsigned char bits;
13138 /* Check laptop headphone socket */
13139 present = snd_hda_jack_detect(codec, 0x15);
13141 /* Check port replicator headphone socket */
13142 present |= snd_hda_jack_detect(codec, 0x1a);
13144 bits = present ? AMP_IN_MUTE(0) : 0;
13145 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13146 AMP_IN_MUTE(0), bits);
13147 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13148 AMP_IN_MUTE(0), bits);
13150 snd_hda_codec_write(codec, 0x20, 0,
13151 AC_VERB_SET_COEF_INDEX, 0x0c);
13152 snd_hda_codec_write(codec, 0x20, 0,
13153 AC_VERB_SET_PROC_COEF, 0x680);
13155 snd_hda_codec_write(codec, 0x20, 0,
13156 AC_VERB_SET_COEF_INDEX, 0x0c);
13157 snd_hda_codec_write(codec, 0x20, 0,
13158 AC_VERB_SET_PROC_COEF, 0x480);
13161 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13163 unsigned int present_laptop;
13164 unsigned int present_dock;
13166 present_laptop = snd_hda_jack_detect(codec, 0x18);
13167 present_dock = snd_hda_jack_detect(codec, 0x1b);
13169 /* Laptop mic port overrides dock mic port, design decision */
13171 snd_hda_codec_write(codec, 0x23, 0,
13172 AC_VERB_SET_CONNECT_SEL, 0x3);
13173 if (present_laptop)
13174 snd_hda_codec_write(codec, 0x23, 0,
13175 AC_VERB_SET_CONNECT_SEL, 0x0);
13176 if (!present_dock && !present_laptop)
13177 snd_hda_codec_write(codec, 0x23, 0,
13178 AC_VERB_SET_CONNECT_SEL, 0x1);
13181 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13184 switch (res >> 26) {
13185 case ALC880_HP_EVENT:
13186 alc269_quanta_fl1_speaker_automute(codec);
13188 case ALC880_MIC_EVENT:
13189 alc_mic_automute(codec);
13194 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13197 if ((res >> 26) == ALC880_HP_EVENT)
13198 alc269_lifebook_speaker_automute(codec);
13199 if ((res >> 26) == ALC880_MIC_EVENT)
13200 alc269_lifebook_mic_autoswitch(codec);
13203 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13205 struct alc_spec *spec = codec->spec;
13206 spec->ext_mic.pin = 0x18;
13207 spec->ext_mic.mux_idx = 0;
13208 spec->int_mic.pin = 0x19;
13209 spec->int_mic.mux_idx = 1;
13210 spec->auto_mic = 1;
13213 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13215 alc269_quanta_fl1_speaker_automute(codec);
13216 alc_mic_automute(codec);
13219 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13221 alc269_lifebook_speaker_automute(codec);
13222 alc269_lifebook_mic_autoswitch(codec);
13225 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13226 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13227 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13228 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13230 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13231 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13232 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13236 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13237 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13238 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13239 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13241 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13242 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13246 /* toggle speaker-output according to the hp-jack state */
13247 static void alc269_speaker_automute(struct hda_codec *codec)
13249 struct alc_spec *spec = codec->spec;
13250 unsigned int nid = spec->autocfg.hp_pins[0];
13251 unsigned int present;
13252 unsigned char bits;
13254 present = snd_hda_jack_detect(codec, nid);
13255 bits = present ? AMP_IN_MUTE(0) : 0;
13256 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13257 AMP_IN_MUTE(0), bits);
13258 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13259 AMP_IN_MUTE(0), bits);
13262 /* unsolicited event for HP jack sensing */
13263 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13266 switch (res >> 26) {
13267 case ALC880_HP_EVENT:
13268 alc269_speaker_automute(codec);
13270 case ALC880_MIC_EVENT:
13271 alc_mic_automute(codec);
13276 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13278 struct alc_spec *spec = codec->spec;
13279 spec->ext_mic.pin = 0x18;
13280 spec->ext_mic.mux_idx = 0;
13281 spec->int_mic.pin = 0x12;
13282 spec->int_mic.mux_idx = 5;
13283 spec->auto_mic = 1;
13286 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13288 struct alc_spec *spec = codec->spec;
13289 spec->ext_mic.pin = 0x18;
13290 spec->ext_mic.mux_idx = 0;
13291 spec->int_mic.pin = 0x19;
13292 spec->int_mic.mux_idx = 1;
13293 spec->auto_mic = 1;
13296 static void alc269_eeepc_inithook(struct hda_codec *codec)
13298 alc269_speaker_automute(codec);
13299 alc_mic_automute(codec);
13303 * generic initialization of ADC, input mixers and output mixers
13305 static struct hda_verb alc269_init_verbs[] = {
13307 * Unmute ADC0 and set the default input to mic-in
13309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13311 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13312 * analog-loopback mixer widget
13313 * Note: PASD motherboards uses the Line In 2 as the input for
13314 * front panel mic (mic 2)
13316 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13324 * Set up output mixers (0x0c - 0x0e)
13326 /* set vol=0 to output mixers */
13327 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13328 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13330 /* set up input amps for analog loopback */
13331 /* Amp Indices: DAC = 0, mixer = 1 */
13332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13341 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13342 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13344 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13345 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13347 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13348 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13349 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13353 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13355 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13358 /* FIXME: use matrix-type input source selection */
13359 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13360 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13367 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13368 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13372 #define alc269_auto_create_multi_out_ctls \
13373 alc268_auto_create_multi_out_ctls
13374 #define alc269_auto_create_input_ctls \
13375 alc268_auto_create_input_ctls
13377 #ifdef CONFIG_SND_HDA_POWER_SAVE
13378 #define alc269_loopbacks alc880_loopbacks
13381 /* pcm configuration: identical with ALC880 */
13382 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13383 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13384 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13385 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13387 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13391 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13392 /* NID is set in alc_build_pcms */
13394 .open = alc880_playback_pcm_open,
13395 .prepare = alc880_playback_pcm_prepare,
13396 .cleanup = alc880_playback_pcm_cleanup
13400 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13404 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13405 /* NID is set in alc_build_pcms */
13409 * BIOS auto configuration
13411 static int alc269_parse_auto_config(struct hda_codec *codec)
13413 struct alc_spec *spec = codec->spec;
13415 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13417 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13422 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13425 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13429 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13431 if (spec->autocfg.dig_outs)
13432 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13434 if (spec->kctls.list)
13435 add_mixer(spec, spec->kctls.list);
13437 add_verb(spec, alc269_init_verbs);
13438 spec->num_mux_defs = 1;
13439 spec->input_mux = &spec->private_imux[0];
13440 /* set default input source */
13441 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13442 0, AC_VERB_SET_CONNECT_SEL,
13443 spec->input_mux->items[0].index);
13445 err = alc_auto_add_mic_boost(codec);
13449 if (!spec->cap_mixer && !spec->no_analog)
13450 set_capture_mixer(codec);
13452 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13457 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13458 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13459 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13462 /* init callback for auto-configuration model -- overriding the default init */
13463 static void alc269_auto_init(struct hda_codec *codec)
13465 struct alc_spec *spec = codec->spec;
13466 alc269_auto_init_multi_out(codec);
13467 alc269_auto_init_hp_out(codec);
13468 alc269_auto_init_analog_input(codec);
13469 if (spec->unsol_event)
13470 alc_inithook(codec);
13474 * configuration and preset
13476 static const char *alc269_models[ALC269_MODEL_LAST] = {
13477 [ALC269_BASIC] = "basic",
13478 [ALC269_QUANTA_FL1] = "quanta",
13479 [ALC269_ASUS_AMIC] = "asus-amic",
13480 [ALC269_ASUS_DMIC] = "asus-dmic",
13481 [ALC269_FUJITSU] = "fujitsu",
13482 [ALC269_LIFEBOOK] = "lifebook",
13483 [ALC269_AUTO] = "auto",
13486 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13487 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13488 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13490 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13491 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13492 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13493 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13494 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13495 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13496 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13497 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13498 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13499 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13500 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13501 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13502 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13503 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13504 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13505 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13506 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13507 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13508 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13509 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13510 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13511 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13512 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13513 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13514 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13515 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13516 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13517 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13518 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13520 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13522 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13523 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13524 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13525 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13529 static struct alc_config_preset alc269_presets[] = {
13531 .mixers = { alc269_base_mixer },
13532 .init_verbs = { alc269_init_verbs },
13533 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13534 .dac_nids = alc269_dac_nids,
13536 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13537 .channel_mode = alc269_modes,
13538 .input_mux = &alc269_capture_source,
13540 [ALC269_QUANTA_FL1] = {
13541 .mixers = { alc269_quanta_fl1_mixer },
13542 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13543 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13544 .dac_nids = alc269_dac_nids,
13546 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13547 .channel_mode = alc269_modes,
13548 .input_mux = &alc269_capture_source,
13549 .unsol_event = alc269_quanta_fl1_unsol_event,
13550 .setup = alc269_quanta_fl1_setup,
13551 .init_hook = alc269_quanta_fl1_init_hook,
13553 [ALC269_ASUS_AMIC] = {
13554 .mixers = { alc269_eeepc_mixer },
13555 .cap_mixer = alc269_epc_capture_mixer,
13556 .init_verbs = { alc269_init_verbs,
13557 alc269_eeepc_amic_init_verbs },
13558 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13559 .dac_nids = alc269_dac_nids,
13561 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13562 .channel_mode = alc269_modes,
13563 .unsol_event = alc269_eeepc_unsol_event,
13564 .setup = alc269_eeepc_amic_setup,
13565 .init_hook = alc269_eeepc_inithook,
13567 [ALC269_ASUS_DMIC] = {
13568 .mixers = { alc269_eeepc_mixer },
13569 .cap_mixer = alc269_epc_capture_mixer,
13570 .init_verbs = { alc269_init_verbs,
13571 alc269_eeepc_dmic_init_verbs },
13572 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13573 .dac_nids = alc269_dac_nids,
13575 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13576 .channel_mode = alc269_modes,
13577 .unsol_event = alc269_eeepc_unsol_event,
13578 .setup = alc269_eeepc_dmic_setup,
13579 .init_hook = alc269_eeepc_inithook,
13581 [ALC269_FUJITSU] = {
13582 .mixers = { alc269_fujitsu_mixer },
13583 .cap_mixer = alc269_epc_capture_mixer,
13584 .init_verbs = { alc269_init_verbs,
13585 alc269_eeepc_dmic_init_verbs },
13586 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13587 .dac_nids = alc269_dac_nids,
13589 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13590 .channel_mode = alc269_modes,
13591 .unsol_event = alc269_eeepc_unsol_event,
13592 .setup = alc269_eeepc_dmic_setup,
13593 .init_hook = alc269_eeepc_inithook,
13595 [ALC269_LIFEBOOK] = {
13596 .mixers = { alc269_lifebook_mixer },
13597 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13598 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13599 .dac_nids = alc269_dac_nids,
13601 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13602 .channel_mode = alc269_modes,
13603 .input_mux = &alc269_capture_source,
13604 .unsol_event = alc269_lifebook_unsol_event,
13605 .init_hook = alc269_lifebook_init_hook,
13609 static int patch_alc269(struct hda_codec *codec)
13611 struct alc_spec *spec;
13615 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13619 codec->spec = spec;
13621 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13623 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13624 kfree(codec->chip_name);
13625 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13626 if (!codec->chip_name) {
13632 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13636 if (board_config < 0) {
13637 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13639 board_config = ALC269_AUTO;
13642 if (board_config == ALC269_AUTO) {
13643 /* automatic parse from the BIOS config */
13644 err = alc269_parse_auto_config(codec);
13650 "hda_codec: Cannot set up configuration "
13651 "from BIOS. Using base mode...\n");
13652 board_config = ALC269_BASIC;
13656 err = snd_hda_attach_beep_device(codec, 0x1);
13662 if (board_config != ALC269_AUTO)
13663 setup_preset(codec, &alc269_presets[board_config]);
13665 if (codec->subsystem_id == 0x17aa3bf8) {
13666 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13667 * fix the sample rate of analog I/O to 44.1kHz
13669 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13670 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13672 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13673 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13675 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13676 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13678 spec->adc_nids = alc269_adc_nids;
13679 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13680 spec->capsrc_nids = alc269_capsrc_nids;
13681 if (!spec->cap_mixer)
13682 set_capture_mixer(codec);
13683 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13685 spec->vmaster_nid = 0x02;
13687 codec->patch_ops = alc_patch_ops;
13688 if (board_config == ALC269_AUTO)
13689 spec->init_hook = alc269_auto_init;
13690 #ifdef CONFIG_SND_HDA_POWER_SAVE
13691 if (!spec->loopback.amplist)
13692 spec->loopback.amplist = alc269_loopbacks;
13694 codec->proc_widget_hook = print_realtek_coef;
13700 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13704 * set the path ways for 2 channel output
13705 * need to set the codec line out and mic 1 pin widgets to inputs
13707 static struct hda_verb alc861_threestack_ch2_init[] = {
13708 /* set pin widget 1Ah (line in) for input */
13709 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13710 /* set pin widget 18h (mic1/2) for input, for mic also enable
13713 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13715 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13717 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13718 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13724 * need to set the codec line out and mic 1 pin widgets to outputs
13726 static struct hda_verb alc861_threestack_ch6_init[] = {
13727 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13728 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13729 /* set pin widget 18h (mic1) for output (CLFE)*/
13730 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13732 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13733 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13735 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13737 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13738 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13743 static struct hda_channel_mode alc861_threestack_modes[2] = {
13744 { 2, alc861_threestack_ch2_init },
13745 { 6, alc861_threestack_ch6_init },
13747 /* Set mic1 as input and unmute the mixer */
13748 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13749 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13750 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13753 /* Set mic1 as output and mute mixer */
13754 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13755 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13756 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13760 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13761 { 2, alc861_uniwill_m31_ch2_init },
13762 { 4, alc861_uniwill_m31_ch4_init },
13765 /* Set mic1 and line-in as input and unmute the mixer */
13766 static struct hda_verb alc861_asus_ch2_init[] = {
13767 /* set pin widget 1Ah (line in) for input */
13768 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13769 /* set pin widget 18h (mic1/2) for input, for mic also enable
13772 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13774 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13776 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13777 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13781 /* Set mic1 nad line-in as output and mute mixer */
13782 static struct hda_verb alc861_asus_ch6_init[] = {
13783 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13784 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13785 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13786 /* set pin widget 18h (mic1) for output (CLFE)*/
13787 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13788 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13789 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13790 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13795 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13800 static struct hda_channel_mode alc861_asus_modes[2] = {
13801 { 2, alc861_asus_ch2_init },
13802 { 6, alc861_asus_ch6_init },
13807 static struct snd_kcontrol_new alc861_base_mixer[] = {
13808 /* output mixer control */
13809 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13810 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13811 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13812 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13813 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13815 /*Input mixer control */
13816 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13817 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13818 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13819 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13820 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13821 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13823 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13824 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13825 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13830 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13831 /* output mixer control */
13832 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13833 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13834 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13835 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13836 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13838 /* Input mixer control */
13839 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13840 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13841 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13842 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13843 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13844 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13846 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13851 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13852 .name = "Channel Mode",
13853 .info = alc_ch_mode_info,
13854 .get = alc_ch_mode_get,
13855 .put = alc_ch_mode_put,
13856 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13861 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13862 /* output mixer control */
13863 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13865 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13870 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13871 /* output mixer control */
13872 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13873 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13874 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13875 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13876 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13878 /* Input mixer control */
13879 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13880 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13881 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13882 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13883 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13884 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13886 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13887 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13891 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13892 .name = "Channel Mode",
13893 .info = alc_ch_mode_info,
13894 .get = alc_ch_mode_get,
13895 .put = alc_ch_mode_put,
13896 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13901 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13902 /* output mixer control */
13903 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13904 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13905 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13906 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13907 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13909 /* Input mixer control */
13910 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13911 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13912 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13913 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13914 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13915 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13917 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13919 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13923 .name = "Channel Mode",
13924 .info = alc_ch_mode_info,
13925 .get = alc_ch_mode_get,
13926 .put = alc_ch_mode_put,
13927 .private_value = ARRAY_SIZE(alc861_asus_modes),
13932 /* additional mixer */
13933 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13934 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13935 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13940 * generic initialization of ADC, input mixers and output mixers
13942 static struct hda_verb alc861_base_init_verbs[] = {
13944 * Unmute ADC0 and set the default input to mic-in
13946 /* port-A for surround (rear panel) */
13947 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13948 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13949 /* port-B for mic-in (rear panel) with vref */
13950 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13951 /* port-C for line-in (rear panel) */
13952 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13953 /* port-D for Front */
13954 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13955 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13956 /* port-E for HP out (front panel) */
13957 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13958 /* route front PCM to HP */
13959 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13960 /* port-F for mic-in (front panel) with vref */
13961 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13962 /* port-G for CLFE (rear panel) */
13963 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13964 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13965 /* port-H for side (rear panel) */
13966 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13967 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13969 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13970 /* route front mic to ADC1*/
13971 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13974 /* Unmute DAC0~3 & spdif out*/
13975 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13976 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13977 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13978 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13981 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13982 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13983 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13984 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13987 /* Unmute Stereo Mixer 15 */
13988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13993 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13995 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13997 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 /* hp used DAC 3 (Front) */
14002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14008 static struct hda_verb alc861_threestack_init_verbs[] = {
14010 * Unmute ADC0 and set the default input to mic-in
14012 /* port-A for surround (rear panel) */
14013 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14014 /* port-B for mic-in (rear panel) with vref */
14015 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14016 /* port-C for line-in (rear panel) */
14017 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14018 /* port-D for Front */
14019 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14020 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14021 /* port-E for HP out (front panel) */
14022 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14023 /* route front PCM to HP */
14024 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14025 /* port-F for mic-in (front panel) with vref */
14026 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14027 /* port-G for CLFE (rear panel) */
14028 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14029 /* port-H for side (rear panel) */
14030 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14032 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14033 /* route front mic to ADC1*/
14034 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14036 /* Unmute DAC0~3 & spdif out*/
14037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14038 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14039 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14040 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14043 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14044 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14045 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14046 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14047 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14049 /* Unmute Stereo Mixer 15 */
14050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14058 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14063 /* hp used DAC 3 (Front) */
14064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14069 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14071 * Unmute ADC0 and set the default input to mic-in
14073 /* port-A for surround (rear panel) */
14074 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14075 /* port-B for mic-in (rear panel) with vref */
14076 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14077 /* port-C for line-in (rear panel) */
14078 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14079 /* port-D for Front */
14080 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14081 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14082 /* port-E for HP out (front panel) */
14083 /* this has to be set to VREF80 */
14084 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14085 /* route front PCM to HP */
14086 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14087 /* port-F for mic-in (front panel) with vref */
14088 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14089 /* port-G for CLFE (rear panel) */
14090 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14091 /* port-H for side (rear panel) */
14092 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14094 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14095 /* route front mic to ADC1*/
14096 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14098 /* Unmute DAC0~3 & spdif out*/
14099 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14100 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14102 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14105 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14106 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14107 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14108 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14111 /* Unmute Stereo Mixer 15 */
14112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14118 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14120 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14124 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14125 /* hp used DAC 3 (Front) */
14126 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14127 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14131 static struct hda_verb alc861_asus_init_verbs[] = {
14133 * Unmute ADC0 and set the default input to mic-in
14135 /* port-A for surround (rear panel)
14136 * according to codec#0 this is the HP jack
14138 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14139 /* route front PCM to HP */
14140 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14141 /* port-B for mic-in (rear panel) with vref */
14142 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14143 /* port-C for line-in (rear panel) */
14144 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14145 /* port-D for Front */
14146 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14147 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14148 /* port-E for HP out (front panel) */
14149 /* this has to be set to VREF80 */
14150 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14151 /* route front PCM to HP */
14152 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14153 /* port-F for mic-in (front panel) with vref */
14154 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14155 /* port-G for CLFE (rear panel) */
14156 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14157 /* port-H for side (rear panel) */
14158 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14160 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14161 /* route front mic to ADC1*/
14162 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14163 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14164 /* Unmute DAC0~3 & spdif out*/
14165 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14166 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14167 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14168 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14170 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14171 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14172 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14173 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14174 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14176 /* Unmute Stereo Mixer 15 */
14177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14182 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14190 /* hp used DAC 3 (Front) */
14191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14192 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14196 /* additional init verbs for ASUS laptops */
14197 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14198 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14199 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14204 * generic initialization of ADC, input mixers and output mixers
14206 static struct hda_verb alc861_auto_init_verbs[] = {
14208 * Unmute ADC0 and set the default input to mic-in
14210 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14211 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14213 /* Unmute DAC0~3 & spdif out*/
14214 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14215 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14216 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14217 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14220 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14221 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14222 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14223 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14224 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14226 /* Unmute Stereo Mixer 15 */
14227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14230 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14232 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14233 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14234 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14235 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14236 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14237 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14238 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14239 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14241 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14242 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14243 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14244 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14245 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14247 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14250 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14255 static struct hda_verb alc861_toshiba_init_verbs[] = {
14256 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14261 /* toggle speaker-output according to the hp-jack state */
14262 static void alc861_toshiba_automute(struct hda_codec *codec)
14264 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14266 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14267 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14268 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14269 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14272 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14275 if ((res >> 26) == ALC880_HP_EVENT)
14276 alc861_toshiba_automute(codec);
14279 /* pcm configuration: identical with ALC880 */
14280 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14281 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14282 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14283 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14286 #define ALC861_DIGOUT_NID 0x07
14288 static struct hda_channel_mode alc861_8ch_modes[1] = {
14292 static hda_nid_t alc861_dac_nids[4] = {
14293 /* front, surround, clfe, side */
14294 0x03, 0x06, 0x05, 0x04
14297 static hda_nid_t alc660_dac_nids[3] = {
14298 /* front, clfe, surround */
14302 static hda_nid_t alc861_adc_nids[1] = {
14307 static struct hda_input_mux alc861_capture_source = {
14311 { "Front Mic", 0x3 },
14318 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14320 struct alc_spec *spec = codec->spec;
14321 hda_nid_t mix, srcs[5];
14324 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14326 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14329 for (i = 0; i < num; i++) {
14331 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14332 if (type != AC_WID_AUD_OUT)
14334 for (j = 0; j < spec->multiout.num_dacs; j++)
14335 if (spec->multiout.dac_nids[j] == srcs[i])
14337 if (j >= spec->multiout.num_dacs)
14343 /* fill in the dac_nids table from the parsed pin configuration */
14344 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14345 const struct auto_pin_cfg *cfg)
14347 struct alc_spec *spec = codec->spec;
14349 hda_nid_t nid, dac;
14351 spec->multiout.dac_nids = spec->private_dac_nids;
14352 for (i = 0; i < cfg->line_outs; i++) {
14353 nid = cfg->line_out_pins[i];
14354 dac = alc861_look_for_dac(codec, nid);
14357 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14362 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14363 hda_nid_t nid, unsigned int chs)
14365 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14366 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14369 /* add playback controls from the parsed DAC table */
14370 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14371 const struct auto_pin_cfg *cfg)
14373 struct alc_spec *spec = codec->spec;
14374 static const char *chname[4] = {
14375 "Front", "Surround", NULL /*CLFE*/, "Side"
14380 if (cfg->line_outs == 1) {
14381 const char *pfx = NULL;
14384 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14387 nid = spec->multiout.dac_nids[0];
14388 return alc861_create_out_sw(codec, pfx, nid, 3);
14392 for (i = 0; i < cfg->line_outs; i++) {
14393 nid = spec->multiout.dac_nids[i];
14398 err = alc861_create_out_sw(codec, "Center", nid, 1);
14401 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14405 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14413 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14415 struct alc_spec *spec = codec->spec;
14422 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14423 nid = alc861_look_for_dac(codec, pin);
14425 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14428 spec->multiout.hp_nid = nid;
14434 /* create playback/capture controls for input pins */
14435 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14436 const struct auto_pin_cfg *cfg)
14438 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14441 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14443 int pin_type, hda_nid_t dac)
14445 hda_nid_t mix, srcs[5];
14448 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14450 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14452 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14454 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14457 for (i = 0; i < num; i++) {
14459 if (srcs[i] == dac || srcs[i] == 0x15)
14460 mute = AMP_IN_UNMUTE(i);
14462 mute = AMP_IN_MUTE(i);
14463 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14468 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14470 struct alc_spec *spec = codec->spec;
14473 for (i = 0; i < spec->autocfg.line_outs; i++) {
14474 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14475 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14477 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14478 spec->multiout.dac_nids[i]);
14482 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14484 struct alc_spec *spec = codec->spec;
14486 if (spec->autocfg.hp_outs)
14487 alc861_auto_set_output_and_unmute(codec,
14488 spec->autocfg.hp_pins[0],
14490 spec->multiout.hp_nid);
14491 if (spec->autocfg.speaker_outs)
14492 alc861_auto_set_output_and_unmute(codec,
14493 spec->autocfg.speaker_pins[0],
14495 spec->multiout.dac_nids[0]);
14498 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14500 struct alc_spec *spec = codec->spec;
14503 for (i = 0; i < AUTO_PIN_LAST; i++) {
14504 hda_nid_t nid = spec->autocfg.input_pins[i];
14505 if (nid >= 0x0c && nid <= 0x11)
14506 alc_set_input_pin(codec, nid, i);
14510 /* parse the BIOS configuration and set up the alc_spec */
14511 /* return 1 if successful, 0 if the proper config is not found,
14512 * or a negative error code
14514 static int alc861_parse_auto_config(struct hda_codec *codec)
14516 struct alc_spec *spec = codec->spec;
14518 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14520 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14524 if (!spec->autocfg.line_outs)
14525 return 0; /* can't find valid BIOS pin config */
14527 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14530 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14533 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14536 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14540 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14542 if (spec->autocfg.dig_outs)
14543 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14545 if (spec->kctls.list)
14546 add_mixer(spec, spec->kctls.list);
14548 add_verb(spec, alc861_auto_init_verbs);
14550 spec->num_mux_defs = 1;
14551 spec->input_mux = &spec->private_imux[0];
14553 spec->adc_nids = alc861_adc_nids;
14554 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14555 set_capture_mixer(codec);
14557 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14562 /* additional initialization for auto-configuration model */
14563 static void alc861_auto_init(struct hda_codec *codec)
14565 struct alc_spec *spec = codec->spec;
14566 alc861_auto_init_multi_out(codec);
14567 alc861_auto_init_hp_out(codec);
14568 alc861_auto_init_analog_input(codec);
14569 if (spec->unsol_event)
14570 alc_inithook(codec);
14573 #ifdef CONFIG_SND_HDA_POWER_SAVE
14574 static struct hda_amp_list alc861_loopbacks[] = {
14575 { 0x15, HDA_INPUT, 0 },
14576 { 0x15, HDA_INPUT, 1 },
14577 { 0x15, HDA_INPUT, 2 },
14578 { 0x15, HDA_INPUT, 3 },
14585 * configuration and preset
14587 static const char *alc861_models[ALC861_MODEL_LAST] = {
14588 [ALC861_3ST] = "3stack",
14589 [ALC660_3ST] = "3stack-660",
14590 [ALC861_3ST_DIG] = "3stack-dig",
14591 [ALC861_6ST_DIG] = "6stack-dig",
14592 [ALC861_UNIWILL_M31] = "uniwill-m31",
14593 [ALC861_TOSHIBA] = "toshiba",
14594 [ALC861_ASUS] = "asus",
14595 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14596 [ALC861_AUTO] = "auto",
14599 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14600 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14601 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14602 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14603 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14604 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14605 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14606 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14607 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14608 * Any other models that need this preset?
14610 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14611 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14612 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14613 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14614 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14615 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14616 /* FIXME: the below seems conflict */
14617 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14618 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14619 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14623 static struct alc_config_preset alc861_presets[] = {
14625 .mixers = { alc861_3ST_mixer },
14626 .init_verbs = { alc861_threestack_init_verbs },
14627 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14628 .dac_nids = alc861_dac_nids,
14629 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14630 .channel_mode = alc861_threestack_modes,
14632 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14633 .adc_nids = alc861_adc_nids,
14634 .input_mux = &alc861_capture_source,
14636 [ALC861_3ST_DIG] = {
14637 .mixers = { alc861_base_mixer },
14638 .init_verbs = { alc861_threestack_init_verbs },
14639 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14640 .dac_nids = alc861_dac_nids,
14641 .dig_out_nid = ALC861_DIGOUT_NID,
14642 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14643 .channel_mode = alc861_threestack_modes,
14645 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14646 .adc_nids = alc861_adc_nids,
14647 .input_mux = &alc861_capture_source,
14649 [ALC861_6ST_DIG] = {
14650 .mixers = { alc861_base_mixer },
14651 .init_verbs = { alc861_base_init_verbs },
14652 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14653 .dac_nids = alc861_dac_nids,
14654 .dig_out_nid = ALC861_DIGOUT_NID,
14655 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14656 .channel_mode = alc861_8ch_modes,
14657 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14658 .adc_nids = alc861_adc_nids,
14659 .input_mux = &alc861_capture_source,
14662 .mixers = { alc861_3ST_mixer },
14663 .init_verbs = { alc861_threestack_init_verbs },
14664 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14665 .dac_nids = alc660_dac_nids,
14666 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14667 .channel_mode = alc861_threestack_modes,
14669 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14670 .adc_nids = alc861_adc_nids,
14671 .input_mux = &alc861_capture_source,
14673 [ALC861_UNIWILL_M31] = {
14674 .mixers = { alc861_uniwill_m31_mixer },
14675 .init_verbs = { alc861_uniwill_m31_init_verbs },
14676 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14677 .dac_nids = alc861_dac_nids,
14678 .dig_out_nid = ALC861_DIGOUT_NID,
14679 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14680 .channel_mode = alc861_uniwill_m31_modes,
14682 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14683 .adc_nids = alc861_adc_nids,
14684 .input_mux = &alc861_capture_source,
14686 [ALC861_TOSHIBA] = {
14687 .mixers = { alc861_toshiba_mixer },
14688 .init_verbs = { alc861_base_init_verbs,
14689 alc861_toshiba_init_verbs },
14690 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14691 .dac_nids = alc861_dac_nids,
14692 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14693 .channel_mode = alc883_3ST_2ch_modes,
14694 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14695 .adc_nids = alc861_adc_nids,
14696 .input_mux = &alc861_capture_source,
14697 .unsol_event = alc861_toshiba_unsol_event,
14698 .init_hook = alc861_toshiba_automute,
14701 .mixers = { alc861_asus_mixer },
14702 .init_verbs = { alc861_asus_init_verbs },
14703 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14704 .dac_nids = alc861_dac_nids,
14705 .dig_out_nid = ALC861_DIGOUT_NID,
14706 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14707 .channel_mode = alc861_asus_modes,
14710 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14711 .adc_nids = alc861_adc_nids,
14712 .input_mux = &alc861_capture_source,
14714 [ALC861_ASUS_LAPTOP] = {
14715 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14716 .init_verbs = { alc861_asus_init_verbs,
14717 alc861_asus_laptop_init_verbs },
14718 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14719 .dac_nids = alc861_dac_nids,
14720 .dig_out_nid = ALC861_DIGOUT_NID,
14721 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14722 .channel_mode = alc883_3ST_2ch_modes,
14724 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14725 .adc_nids = alc861_adc_nids,
14726 .input_mux = &alc861_capture_source,
14730 /* Pin config fixes */
14732 PINFIX_FSC_AMILO_PI1505,
14735 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14736 { 0x0b, 0x0221101f }, /* HP */
14737 { 0x0f, 0x90170310 }, /* speaker */
14741 static const struct alc_fixup alc861_fixups[] = {
14742 [PINFIX_FSC_AMILO_PI1505] = {
14743 .pins = alc861_fsc_amilo_pi1505_pinfix
14747 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14748 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14752 static int patch_alc861(struct hda_codec *codec)
14754 struct alc_spec *spec;
14758 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14762 codec->spec = spec;
14764 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14768 if (board_config < 0) {
14769 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14771 board_config = ALC861_AUTO;
14774 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14776 if (board_config == ALC861_AUTO) {
14777 /* automatic parse from the BIOS config */
14778 err = alc861_parse_auto_config(codec);
14784 "hda_codec: Cannot set up configuration "
14785 "from BIOS. Using base mode...\n");
14786 board_config = ALC861_3ST_DIG;
14790 err = snd_hda_attach_beep_device(codec, 0x23);
14796 if (board_config != ALC861_AUTO)
14797 setup_preset(codec, &alc861_presets[board_config]);
14799 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14800 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14802 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14803 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14805 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14807 spec->vmaster_nid = 0x03;
14809 codec->patch_ops = alc_patch_ops;
14810 if (board_config == ALC861_AUTO)
14811 spec->init_hook = alc861_auto_init;
14812 #ifdef CONFIG_SND_HDA_POWER_SAVE
14813 if (!spec->loopback.amplist)
14814 spec->loopback.amplist = alc861_loopbacks;
14816 codec->proc_widget_hook = print_realtek_coef;
14822 * ALC861-VD support
14826 * In addition, an independent DAC
14828 #define ALC861VD_DIGOUT_NID 0x06
14830 static hda_nid_t alc861vd_dac_nids[4] = {
14831 /* front, surr, clfe, side surr */
14832 0x02, 0x03, 0x04, 0x05
14835 /* dac_nids for ALC660vd are in a different order - according to
14836 * Realtek's driver.
14837 * This should probably result in a different mixer for 6stack models
14838 * of ALC660vd codecs, but for now there is only 3stack mixer
14839 * - and it is the same as in 861vd.
14840 * adc_nids in ALC660vd are (is) the same as in 861vd
14842 static hda_nid_t alc660vd_dac_nids[3] = {
14843 /* front, rear, clfe, rear_surr */
14847 static hda_nid_t alc861vd_adc_nids[1] = {
14852 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14855 /* FIXME: should be a matrix-type input source selection */
14856 static struct hda_input_mux alc861vd_capture_source = {
14860 { "Front Mic", 0x1 },
14866 static struct hda_input_mux alc861vd_dallas_capture_source = {
14869 { "Ext Mic", 0x0 },
14870 { "Int Mic", 0x1 },
14874 static struct hda_input_mux alc861vd_hp_capture_source = {
14877 { "Front Mic", 0x0 },
14878 { "ATAPI Mic", 0x1 },
14885 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14892 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14893 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14894 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14895 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14896 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14903 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14904 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14905 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14906 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14907 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14911 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14912 { 6, alc861vd_6stack_ch6_init },
14913 { 8, alc861vd_6stack_ch8_init },
14916 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14919 .name = "Channel Mode",
14920 .info = alc_ch_mode_info,
14921 .get = alc_ch_mode_get,
14922 .put = alc_ch_mode_put,
14927 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14928 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14930 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14931 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14932 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14934 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14935 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14937 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14941 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14942 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14944 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14945 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14949 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14953 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14954 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14955 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14957 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14958 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14966 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14967 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14974 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14976 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14989 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14990 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14991 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14992 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14996 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15000 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15001 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15002 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15004 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15005 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15010 /* Pin assignment: Speaker=0x14, HP = 0x15,
15011 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15013 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15014 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15015 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15016 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15017 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15018 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15019 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15020 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15021 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15022 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15023 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15027 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15028 * Front Mic=0x18, ATAPI Mic = 0x19,
15030 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15031 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15032 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15033 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15034 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15035 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15037 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15038 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15044 * generic initialization of ADC, input mixers and output mixers
15046 static struct hda_verb alc861vd_volume_init_verbs[] = {
15048 * Unmute ADC0 and set the default input to mic-in
15050 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15051 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15053 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15054 * the analog-loopback mixer widget
15056 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15063 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15065 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15070 * Set up output mixers (0x02 - 0x05)
15072 /* set vol=0 to output mixers */
15073 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15074 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15075 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15076 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15078 /* set up input amps for analog loopback */
15079 /* Amp Indices: DAC = 0, mixer = 1 */
15080 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15082 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15083 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15084 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15085 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15086 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15087 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15093 * 3-stack pin configuration:
15094 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15096 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15098 * Set pin mode and muting
15100 /* set front pin widgets 0x14 for output */
15101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15103 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15105 /* Mic (rear) pin: input vref at 80% */
15106 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15107 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15108 /* Front Mic pin: input vref at 80% */
15109 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15110 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15111 /* Line In pin: input */
15112 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15113 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15114 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15116 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15117 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15118 /* CD pin widget for input */
15119 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15125 * 6-stack pin configuration:
15127 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15129 * Set pin mode and muting
15131 /* set front pin widgets 0x14 for output */
15132 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15133 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15134 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15136 /* Rear Pin: output 1 (0x0d) */
15137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15140 /* CLFE Pin: output 2 (0x0e) */
15141 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15142 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15143 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15144 /* Side Pin: output 3 (0x0f) */
15145 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15147 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15149 /* Mic (rear) pin: input vref at 80% */
15150 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15152 /* Front Mic pin: input vref at 80% */
15153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15154 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15155 /* Line In pin: input */
15156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15158 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15159 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15161 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15162 /* CD pin widget for input */
15163 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15168 static struct hda_verb alc861vd_eapd_verbs[] = {
15169 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15173 static struct hda_verb alc660vd_eapd_verbs[] = {
15174 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15175 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15179 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15183 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15184 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15188 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15190 unsigned int present;
15191 unsigned char bits;
15193 present = snd_hda_jack_detect(codec, 0x18);
15194 bits = present ? HDA_AMP_MUTE : 0;
15196 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15197 HDA_AMP_MUTE, bits);
15200 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15202 struct alc_spec *spec = codec->spec;
15203 spec->autocfg.hp_pins[0] = 0x1b;
15204 spec->autocfg.speaker_pins[0] = 0x14;
15207 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15209 alc_automute_amp(codec);
15210 alc861vd_lenovo_mic_automute(codec);
15213 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15216 switch (res >> 26) {
15217 case ALC880_MIC_EVENT:
15218 alc861vd_lenovo_mic_automute(codec);
15221 alc_automute_amp_unsol_event(codec, res);
15226 static struct hda_verb alc861vd_dallas_verbs[] = {
15227 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15228 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15229 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15230 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15234 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15238 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15243 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15245 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15246 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15247 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15248 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15256 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15257 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15265 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15266 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15271 /* toggle speaker-output according to the hp-jack state */
15272 static void alc861vd_dallas_setup(struct hda_codec *codec)
15274 struct alc_spec *spec = codec->spec;
15276 spec->autocfg.hp_pins[0] = 0x15;
15277 spec->autocfg.speaker_pins[0] = 0x14;
15280 #ifdef CONFIG_SND_HDA_POWER_SAVE
15281 #define alc861vd_loopbacks alc880_loopbacks
15284 /* pcm configuration: identical with ALC880 */
15285 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15286 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15287 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15288 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15291 * configuration and preset
15293 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15294 [ALC660VD_3ST] = "3stack-660",
15295 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15296 [ALC660VD_ASUS_V1S] = "asus-v1s",
15297 [ALC861VD_3ST] = "3stack",
15298 [ALC861VD_3ST_DIG] = "3stack-digout",
15299 [ALC861VD_6ST_DIG] = "6stack-digout",
15300 [ALC861VD_LENOVO] = "lenovo",
15301 [ALC861VD_DALLAS] = "dallas",
15302 [ALC861VD_HP] = "hp",
15303 [ALC861VD_AUTO] = "auto",
15306 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15307 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15308 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15309 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15310 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15311 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15312 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15313 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15314 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15315 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15316 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15317 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15318 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15319 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15320 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15321 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15325 static struct alc_config_preset alc861vd_presets[] = {
15327 .mixers = { alc861vd_3st_mixer },
15328 .init_verbs = { alc861vd_volume_init_verbs,
15329 alc861vd_3stack_init_verbs },
15330 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15331 .dac_nids = alc660vd_dac_nids,
15332 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15333 .channel_mode = alc861vd_3stack_2ch_modes,
15334 .input_mux = &alc861vd_capture_source,
15336 [ALC660VD_3ST_DIG] = {
15337 .mixers = { alc861vd_3st_mixer },
15338 .init_verbs = { alc861vd_volume_init_verbs,
15339 alc861vd_3stack_init_verbs },
15340 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15341 .dac_nids = alc660vd_dac_nids,
15342 .dig_out_nid = ALC861VD_DIGOUT_NID,
15343 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15344 .channel_mode = alc861vd_3stack_2ch_modes,
15345 .input_mux = &alc861vd_capture_source,
15348 .mixers = { alc861vd_3st_mixer },
15349 .init_verbs = { alc861vd_volume_init_verbs,
15350 alc861vd_3stack_init_verbs },
15351 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15352 .dac_nids = alc861vd_dac_nids,
15353 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15354 .channel_mode = alc861vd_3stack_2ch_modes,
15355 .input_mux = &alc861vd_capture_source,
15357 [ALC861VD_3ST_DIG] = {
15358 .mixers = { alc861vd_3st_mixer },
15359 .init_verbs = { alc861vd_volume_init_verbs,
15360 alc861vd_3stack_init_verbs },
15361 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15362 .dac_nids = alc861vd_dac_nids,
15363 .dig_out_nid = ALC861VD_DIGOUT_NID,
15364 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15365 .channel_mode = alc861vd_3stack_2ch_modes,
15366 .input_mux = &alc861vd_capture_source,
15368 [ALC861VD_6ST_DIG] = {
15369 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15370 .init_verbs = { alc861vd_volume_init_verbs,
15371 alc861vd_6stack_init_verbs },
15372 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15373 .dac_nids = alc861vd_dac_nids,
15374 .dig_out_nid = ALC861VD_DIGOUT_NID,
15375 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15376 .channel_mode = alc861vd_6stack_modes,
15377 .input_mux = &alc861vd_capture_source,
15379 [ALC861VD_LENOVO] = {
15380 .mixers = { alc861vd_lenovo_mixer },
15381 .init_verbs = { alc861vd_volume_init_verbs,
15382 alc861vd_3stack_init_verbs,
15383 alc861vd_eapd_verbs,
15384 alc861vd_lenovo_unsol_verbs },
15385 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15386 .dac_nids = alc660vd_dac_nids,
15387 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15388 .channel_mode = alc861vd_3stack_2ch_modes,
15389 .input_mux = &alc861vd_capture_source,
15390 .unsol_event = alc861vd_lenovo_unsol_event,
15391 .setup = alc861vd_lenovo_setup,
15392 .init_hook = alc861vd_lenovo_init_hook,
15394 [ALC861VD_DALLAS] = {
15395 .mixers = { alc861vd_dallas_mixer },
15396 .init_verbs = { alc861vd_dallas_verbs },
15397 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15398 .dac_nids = alc861vd_dac_nids,
15399 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15400 .channel_mode = alc861vd_3stack_2ch_modes,
15401 .input_mux = &alc861vd_dallas_capture_source,
15402 .unsol_event = alc_automute_amp_unsol_event,
15403 .setup = alc861vd_dallas_setup,
15404 .init_hook = alc_automute_amp,
15407 .mixers = { alc861vd_hp_mixer },
15408 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15409 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15410 .dac_nids = alc861vd_dac_nids,
15411 .dig_out_nid = ALC861VD_DIGOUT_NID,
15412 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15413 .channel_mode = alc861vd_3stack_2ch_modes,
15414 .input_mux = &alc861vd_hp_capture_source,
15415 .unsol_event = alc_automute_amp_unsol_event,
15416 .setup = alc861vd_dallas_setup,
15417 .init_hook = alc_automute_amp,
15419 [ALC660VD_ASUS_V1S] = {
15420 .mixers = { alc861vd_lenovo_mixer },
15421 .init_verbs = { alc861vd_volume_init_verbs,
15422 alc861vd_3stack_init_verbs,
15423 alc861vd_eapd_verbs,
15424 alc861vd_lenovo_unsol_verbs },
15425 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15426 .dac_nids = alc660vd_dac_nids,
15427 .dig_out_nid = ALC861VD_DIGOUT_NID,
15428 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15429 .channel_mode = alc861vd_3stack_2ch_modes,
15430 .input_mux = &alc861vd_capture_source,
15431 .unsol_event = alc861vd_lenovo_unsol_event,
15432 .setup = alc861vd_lenovo_setup,
15433 .init_hook = alc861vd_lenovo_init_hook,
15438 * BIOS auto configuration
15440 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15441 const struct auto_pin_cfg *cfg)
15443 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15447 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15448 hda_nid_t nid, int pin_type, int dac_idx)
15450 alc_set_pin_output(codec, nid, pin_type);
15453 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15455 struct alc_spec *spec = codec->spec;
15458 for (i = 0; i <= HDA_SIDE; i++) {
15459 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15460 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15462 alc861vd_auto_set_output_and_unmute(codec, nid,
15468 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15470 struct alc_spec *spec = codec->spec;
15473 pin = spec->autocfg.hp_pins[0];
15474 if (pin) /* connect to front and use dac 0 */
15475 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15476 pin = spec->autocfg.speaker_pins[0];
15478 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15481 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15483 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15485 struct alc_spec *spec = codec->spec;
15488 for (i = 0; i < AUTO_PIN_LAST; i++) {
15489 hda_nid_t nid = spec->autocfg.input_pins[i];
15490 if (alc_is_input_pin(codec, nid)) {
15491 alc_set_input_pin(codec, nid, i);
15492 if (nid != ALC861VD_PIN_CD_NID &&
15493 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15494 snd_hda_codec_write(codec, nid, 0,
15495 AC_VERB_SET_AMP_GAIN_MUTE,
15501 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15503 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15504 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15506 /* add playback controls from the parsed DAC table */
15507 /* Based on ALC880 version. But ALC861VD has separate,
15508 * different NIDs for mute/unmute switch and volume control */
15509 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15510 const struct auto_pin_cfg *cfg)
15512 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15513 hda_nid_t nid_v, nid_s;
15516 for (i = 0; i < cfg->line_outs; i++) {
15517 if (!spec->multiout.dac_nids[i])
15519 nid_v = alc861vd_idx_to_mixer_vol(
15521 spec->multiout.dac_nids[i]));
15522 nid_s = alc861vd_idx_to_mixer_switch(
15524 spec->multiout.dac_nids[i]));
15528 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15530 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15534 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15536 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15540 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15542 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15546 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15548 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15554 if (cfg->line_outs == 1 &&
15555 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15562 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15563 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15567 if (cfg->line_outs == 1 &&
15568 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15570 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15571 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15580 /* add playback controls for speaker and HP outputs */
15581 /* Based on ALC880 version. But ALC861VD has separate,
15582 * different NIDs for mute/unmute switch and volume control */
15583 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15584 hda_nid_t pin, const char *pfx)
15586 hda_nid_t nid_v, nid_s;
15592 if (alc880_is_fixed_pin(pin)) {
15593 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15594 /* specify the DAC as the extra output */
15595 if (!spec->multiout.hp_nid)
15596 spec->multiout.hp_nid = nid_v;
15598 spec->multiout.extra_out_nid[0] = nid_v;
15599 /* control HP volume/switch on the output mixer amp */
15600 nid_v = alc861vd_idx_to_mixer_vol(
15601 alc880_fixed_pin_idx(pin));
15602 nid_s = alc861vd_idx_to_mixer_switch(
15603 alc880_fixed_pin_idx(pin));
15605 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15606 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15609 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15610 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15613 } else if (alc880_is_multi_pin(pin)) {
15614 /* set manual connection */
15615 /* we have only a switch on HP-out PIN */
15616 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15617 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15624 /* parse the BIOS configuration and set up the alc_spec
15625 * return 1 if successful, 0 if the proper config is not found,
15626 * or a negative error code
15627 * Based on ALC880 version - had to change it to override
15628 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15629 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15631 struct alc_spec *spec = codec->spec;
15633 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15635 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15639 if (!spec->autocfg.line_outs)
15640 return 0; /* can't find valid BIOS pin config */
15642 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15645 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15648 err = alc861vd_auto_create_extra_out(spec,
15649 spec->autocfg.speaker_pins[0],
15653 err = alc861vd_auto_create_extra_out(spec,
15654 spec->autocfg.hp_pins[0],
15658 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15662 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15664 if (spec->autocfg.dig_outs)
15665 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15667 if (spec->kctls.list)
15668 add_mixer(spec, spec->kctls.list);
15670 add_verb(spec, alc861vd_volume_init_verbs);
15672 spec->num_mux_defs = 1;
15673 spec->input_mux = &spec->private_imux[0];
15675 err = alc_auto_add_mic_boost(codec);
15679 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15684 /* additional initialization for auto-configuration model */
15685 static void alc861vd_auto_init(struct hda_codec *codec)
15687 struct alc_spec *spec = codec->spec;
15688 alc861vd_auto_init_multi_out(codec);
15689 alc861vd_auto_init_hp_out(codec);
15690 alc861vd_auto_init_analog_input(codec);
15691 alc861vd_auto_init_input_src(codec);
15692 if (spec->unsol_event)
15693 alc_inithook(codec);
15697 ALC660VD_FIX_ASUS_GPIO1
15701 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15702 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15703 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15704 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15708 static const struct alc_fixup alc861vd_fixups[] = {
15709 [ALC660VD_FIX_ASUS_GPIO1] = {
15710 .verbs = alc660vd_fix_asus_gpio1_verbs,
15714 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15715 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15719 static int patch_alc861vd(struct hda_codec *codec)
15721 struct alc_spec *spec;
15722 int err, board_config;
15724 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15728 codec->spec = spec;
15730 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15734 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15735 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15737 board_config = ALC861VD_AUTO;
15740 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15742 if (board_config == ALC861VD_AUTO) {
15743 /* automatic parse from the BIOS config */
15744 err = alc861vd_parse_auto_config(codec);
15750 "hda_codec: Cannot set up configuration "
15751 "from BIOS. Using base mode...\n");
15752 board_config = ALC861VD_3ST;
15756 err = snd_hda_attach_beep_device(codec, 0x23);
15762 if (board_config != ALC861VD_AUTO)
15763 setup_preset(codec, &alc861vd_presets[board_config]);
15765 if (codec->vendor_id == 0x10ec0660) {
15766 /* always turn on EAPD */
15767 add_verb(spec, alc660vd_eapd_verbs);
15770 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15771 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15773 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15774 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15776 if (!spec->adc_nids) {
15777 spec->adc_nids = alc861vd_adc_nids;
15778 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15780 if (!spec->capsrc_nids)
15781 spec->capsrc_nids = alc861vd_capsrc_nids;
15783 set_capture_mixer(codec);
15784 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15786 spec->vmaster_nid = 0x02;
15788 codec->patch_ops = alc_patch_ops;
15790 if (board_config == ALC861VD_AUTO)
15791 spec->init_hook = alc861vd_auto_init;
15792 #ifdef CONFIG_SND_HDA_POWER_SAVE
15793 if (!spec->loopback.amplist)
15794 spec->loopback.amplist = alc861vd_loopbacks;
15796 codec->proc_widget_hook = print_realtek_coef;
15804 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15805 * configuration. Each pin widget can choose any input DACs and a mixer.
15806 * Each ADC is connected from a mixer of all inputs. This makes possible
15807 * 6-channel independent captures.
15809 * In addition, an independent DAC for the multi-playback (not used in this
15812 #define ALC662_DIGOUT_NID 0x06
15813 #define ALC662_DIGIN_NID 0x0a
15815 static hda_nid_t alc662_dac_nids[4] = {
15816 /* front, rear, clfe, rear_surr */
15820 static hda_nid_t alc272_dac_nids[2] = {
15824 static hda_nid_t alc662_adc_nids[2] = {
15829 static hda_nid_t alc272_adc_nids[1] = {
15834 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15835 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15839 /* FIXME: should be a matrix-type input source selection */
15840 static struct hda_input_mux alc662_capture_source = {
15844 { "Front Mic", 0x1 },
15850 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15858 static struct hda_input_mux alc663_capture_source = {
15862 { "Front Mic", 0x1 },
15867 #if 0 /* set to 1 for testing other input sources below */
15868 static struct hda_input_mux alc272_nc10_capture_source = {
15871 { "Autoselect Mic", 0x0 },
15872 { "Internal Mic", 0x1 },
15873 { "In-0x02", 0x2 },
15874 { "In-0x03", 0x3 },
15875 { "In-0x04", 0x4 },
15876 { "In-0x05", 0x5 },
15877 { "In-0x06", 0x6 },
15878 { "In-0x07", 0x7 },
15879 { "In-0x08", 0x8 },
15880 { "In-0x09", 0x9 },
15881 { "In-0x0a", 0x0a },
15882 { "In-0x0b", 0x0b },
15883 { "In-0x0c", 0x0c },
15884 { "In-0x0d", 0x0d },
15885 { "In-0x0e", 0x0e },
15886 { "In-0x0f", 0x0f },
15894 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15901 static struct hda_verb alc662_3ST_ch2_init[] = {
15902 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15903 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15904 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15905 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15912 static struct hda_verb alc662_3ST_ch6_init[] = {
15913 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15914 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15915 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15916 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15917 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15918 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15922 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15923 { 2, alc662_3ST_ch2_init },
15924 { 6, alc662_3ST_ch6_init },
15930 static struct hda_verb alc662_sixstack_ch6_init[] = {
15931 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15932 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15933 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15940 static struct hda_verb alc662_sixstack_ch8_init[] = {
15941 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15942 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15943 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15947 static struct hda_channel_mode alc662_5stack_modes[2] = {
15948 { 2, alc662_sixstack_ch6_init },
15949 { 6, alc662_sixstack_ch8_init },
15952 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15953 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15956 static struct snd_kcontrol_new alc662_base_mixer[] = {
15957 /* output mixer control */
15958 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15959 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15960 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15961 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15962 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15963 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15964 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15965 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15968 /*Input mixer control */
15969 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15970 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15971 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15972 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15973 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15974 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15975 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15980 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15981 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15982 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15990 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15991 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15995 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15996 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15997 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15998 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15999 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16000 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16001 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16002 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16003 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16005 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16006 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16010 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16011 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16012 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16016 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16017 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16018 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16019 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16020 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16029 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16030 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16031 ALC262_HIPPO_MASTER_SWITCH,
16033 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16034 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16035 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16037 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16038 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16039 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16043 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16044 ALC262_HIPPO_MASTER_SWITCH,
16045 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16046 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16049 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16050 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16051 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16057 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16058 .ops = &snd_hda_bind_vol,
16060 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16061 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16066 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16067 .ops = &snd_hda_bind_sw,
16069 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16070 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16075 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16076 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16077 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16083 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16084 .ops = &snd_hda_bind_sw,
16086 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16087 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16088 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16093 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16094 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16095 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16098 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16099 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16104 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16105 .ops = &snd_hda_bind_sw,
16107 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16108 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16109 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16114 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16115 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16116 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16119 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16120 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16124 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16125 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16126 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16131 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16135 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16136 .ops = &snd_hda_bind_vol,
16138 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16139 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16144 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16145 .ops = &snd_hda_bind_sw,
16147 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16148 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16153 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16154 HDA_BIND_VOL("Master Playback Volume",
16155 &alc663_asus_two_bind_master_vol),
16156 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16157 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16158 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16164 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16165 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16166 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16167 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16174 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16175 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16176 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16177 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16178 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16179 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16183 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16184 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16188 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16190 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16195 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16196 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16197 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16198 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16202 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16203 .ops = &snd_hda_bind_sw,
16205 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16206 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16207 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16208 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16209 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16214 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16215 .ops = &snd_hda_bind_sw,
16217 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16218 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16223 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16224 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16225 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16226 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16227 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16228 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16229 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16230 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16236 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16237 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16238 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16239 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16240 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16241 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16248 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16251 .name = "Channel Mode",
16252 .info = alc_ch_mode_info,
16253 .get = alc_ch_mode_get,
16254 .put = alc_ch_mode_put,
16259 static struct hda_verb alc662_init_verbs[] = {
16260 /* ADC: mute amp left and right */
16261 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16262 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16263 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16274 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16278 /* Front Pin: output 0 (0x0c) */
16279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16280 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16282 /* Rear Pin: output 1 (0x0d) */
16283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16286 /* CLFE Pin: output 2 (0x0e) */
16287 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16290 /* Mic (rear) pin: input vref at 80% */
16291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16293 /* Front Mic pin: input vref at 80% */
16294 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16295 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16296 /* Line In pin: input */
16297 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16299 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16302 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16303 /* CD pin widget for input */
16304 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16306 /* FIXME: use matrix-type input source selection */
16307 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16312 /* always trun on EAPD */
16313 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16314 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16319 static struct hda_verb alc662_sue_init_verbs[] = {
16320 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16325 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16326 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16327 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16331 /* Set Unsolicited Event*/
16332 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16334 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16339 * generic initialization of ADC, input mixers and output mixers
16341 static struct hda_verb alc662_auto_init_verbs[] = {
16343 * Unmute ADC and set the default input to mic-in
16345 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16346 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16348 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16350 * Note: PASD motherboards uses the Line In 2 as the input for front
16351 * panel mic (mic 2)
16353 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16361 * Set up output mixers (0x0c - 0x0f)
16363 /* set vol=0 to output mixers */
16364 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16365 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16368 /* set up input amps for analog loopback */
16369 /* Amp Indices: DAC = 0, mixer = 1 */
16370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16372 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16374 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16378 /* FIXME: use matrix-type input source selection */
16379 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16386 /* additional verbs for ALC663 */
16387 static struct hda_verb alc663_auto_init_verbs[] = {
16388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16393 static struct hda_verb alc663_m51va_init_verbs[] = {
16394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16395 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16396 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16397 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16398 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16402 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16406 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16407 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16408 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16409 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16412 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16413 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16417 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16418 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16419 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16420 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16421 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16424 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16425 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16429 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16435 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16440 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16441 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16442 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16443 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16444 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16450 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16451 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16452 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16456 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16459 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16460 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16462 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16463 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16468 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16472 static struct hda_verb alc663_g71v_init_verbs[] = {
16473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16474 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16475 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16477 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16478 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16479 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16481 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16482 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16483 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16487 static struct hda_verb alc663_g50v_init_verbs[] = {
16488 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16489 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16490 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16492 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16493 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16497 static struct hda_verb alc662_ecs_init_verbs[] = {
16498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16500 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16501 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16505 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16506 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16507 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16509 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16510 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16511 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16512 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16515 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16516 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16520 static struct hda_verb alc272_dell_init_verbs[] = {
16521 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16522 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16525 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16526 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16527 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16530 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16531 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16535 static struct hda_verb alc663_mode7_init_verbs[] = {
16536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16538 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16539 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16540 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16542 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16543 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16544 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16545 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16548 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16549 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16550 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16554 static struct hda_verb alc663_mode8_init_verbs[] = {
16555 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16558 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16559 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16560 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16561 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16563 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16564 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16565 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16569 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16570 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16574 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16575 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16576 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16580 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16581 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16582 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16586 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16588 unsigned int present;
16589 unsigned char bits;
16591 present = snd_hda_jack_detect(codec, 0x14);
16592 bits = present ? HDA_AMP_MUTE : 0;
16594 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16595 HDA_AMP_MUTE, bits);
16598 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16600 unsigned int present;
16601 unsigned char bits;
16603 present = snd_hda_jack_detect(codec, 0x1b);
16604 bits = present ? HDA_AMP_MUTE : 0;
16606 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16607 HDA_AMP_MUTE, bits);
16608 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16609 HDA_AMP_MUTE, bits);
16612 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16615 if ((res >> 26) == ALC880_HP_EVENT)
16616 alc662_lenovo_101e_all_automute(codec);
16617 if ((res >> 26) == ALC880_FRONT_EVENT)
16618 alc662_lenovo_101e_ispeaker_automute(codec);
16621 /* unsolicited event for HP jack sensing */
16622 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16625 if ((res >> 26) == ALC880_MIC_EVENT)
16626 alc_mic_automute(codec);
16628 alc262_hippo_unsol_event(codec, res);
16631 static void alc662_eeepc_setup(struct hda_codec *codec)
16633 struct alc_spec *spec = codec->spec;
16635 alc262_hippo1_setup(codec);
16636 spec->ext_mic.pin = 0x18;
16637 spec->ext_mic.mux_idx = 0;
16638 spec->int_mic.pin = 0x19;
16639 spec->int_mic.mux_idx = 1;
16640 spec->auto_mic = 1;
16643 static void alc662_eeepc_inithook(struct hda_codec *codec)
16645 alc262_hippo_automute(codec);
16646 alc_mic_automute(codec);
16649 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16651 struct alc_spec *spec = codec->spec;
16653 spec->autocfg.hp_pins[0] = 0x14;
16654 spec->autocfg.speaker_pins[0] = 0x1b;
16657 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16659 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16661 unsigned int present;
16662 unsigned char bits;
16664 present = snd_hda_jack_detect(codec, 0x21);
16665 bits = present ? HDA_AMP_MUTE : 0;
16666 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16667 AMP_IN_MUTE(0), bits);
16668 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16669 AMP_IN_MUTE(0), bits);
16672 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16674 unsigned int present;
16675 unsigned char bits;
16677 present = snd_hda_jack_detect(codec, 0x21);
16678 bits = present ? HDA_AMP_MUTE : 0;
16679 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16680 AMP_IN_MUTE(0), bits);
16681 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16682 AMP_IN_MUTE(0), bits);
16683 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16684 AMP_IN_MUTE(0), bits);
16685 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16686 AMP_IN_MUTE(0), bits);
16689 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16691 unsigned int present;
16692 unsigned char bits;
16694 present = snd_hda_jack_detect(codec, 0x15);
16695 bits = present ? HDA_AMP_MUTE : 0;
16696 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16697 AMP_IN_MUTE(0), bits);
16698 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16699 AMP_IN_MUTE(0), bits);
16700 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16701 AMP_IN_MUTE(0), bits);
16702 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16703 AMP_IN_MUTE(0), bits);
16706 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16708 unsigned int present;
16709 unsigned char bits;
16711 present = snd_hda_jack_detect(codec, 0x1b);
16712 bits = present ? 0 : PIN_OUT;
16713 snd_hda_codec_write(codec, 0x14, 0,
16714 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16717 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16719 unsigned int present1, present2;
16721 present1 = snd_hda_jack_detect(codec, 0x21);
16722 present2 = snd_hda_jack_detect(codec, 0x15);
16724 if (present1 || present2) {
16725 snd_hda_codec_write_cache(codec, 0x14, 0,
16726 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16728 snd_hda_codec_write_cache(codec, 0x14, 0,
16729 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16733 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16735 unsigned int present1, present2;
16737 present1 = snd_hda_jack_detect(codec, 0x1b);
16738 present2 = snd_hda_jack_detect(codec, 0x15);
16740 if (present1 || present2) {
16741 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16742 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16743 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16744 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16746 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16747 AMP_IN_MUTE(0), 0);
16748 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16749 AMP_IN_MUTE(0), 0);
16753 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16755 unsigned int present1, present2;
16757 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16758 AC_VERB_GET_PIN_SENSE, 0)
16759 & AC_PINSENSE_PRESENCE;
16760 present2 = snd_hda_codec_read(codec, 0x21, 0,
16761 AC_VERB_GET_PIN_SENSE, 0)
16762 & AC_PINSENSE_PRESENCE;
16764 if (present1 || present2) {
16765 snd_hda_codec_write_cache(codec, 0x14, 0,
16766 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16767 snd_hda_codec_write_cache(codec, 0x17, 0,
16768 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16770 snd_hda_codec_write_cache(codec, 0x14, 0,
16771 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16772 snd_hda_codec_write_cache(codec, 0x17, 0,
16773 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16777 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16779 unsigned int present1, present2;
16781 present1 = snd_hda_codec_read(codec, 0x21, 0,
16782 AC_VERB_GET_PIN_SENSE, 0)
16783 & AC_PINSENSE_PRESENCE;
16784 present2 = snd_hda_codec_read(codec, 0x15, 0,
16785 AC_VERB_GET_PIN_SENSE, 0)
16786 & AC_PINSENSE_PRESENCE;
16788 if (present1 || present2) {
16789 snd_hda_codec_write_cache(codec, 0x14, 0,
16790 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16791 snd_hda_codec_write_cache(codec, 0x17, 0,
16792 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16794 snd_hda_codec_write_cache(codec, 0x14, 0,
16795 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16796 snd_hda_codec_write_cache(codec, 0x17, 0,
16797 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16801 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16804 switch (res >> 26) {
16805 case ALC880_HP_EVENT:
16806 alc663_m51va_speaker_automute(codec);
16808 case ALC880_MIC_EVENT:
16809 alc_mic_automute(codec);
16814 static void alc663_m51va_setup(struct hda_codec *codec)
16816 struct alc_spec *spec = codec->spec;
16817 spec->ext_mic.pin = 0x18;
16818 spec->ext_mic.mux_idx = 0;
16819 spec->int_mic.pin = 0x12;
16820 spec->int_mic.mux_idx = 9;
16821 spec->auto_mic = 1;
16824 static void alc663_m51va_inithook(struct hda_codec *codec)
16826 alc663_m51va_speaker_automute(codec);
16827 alc_mic_automute(codec);
16830 /* ***************** Mode1 ******************************/
16831 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16833 static void alc663_mode1_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 = 0x19;
16839 spec->int_mic.mux_idx = 1;
16840 spec->auto_mic = 1;
16843 #define alc663_mode1_inithook alc663_m51va_inithook
16845 /* ***************** Mode2 ******************************/
16846 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16849 switch (res >> 26) {
16850 case ALC880_HP_EVENT:
16851 alc662_f5z_speaker_automute(codec);
16853 case ALC880_MIC_EVENT:
16854 alc_mic_automute(codec);
16859 #define alc662_mode2_setup alc663_mode1_setup
16861 static void alc662_mode2_inithook(struct hda_codec *codec)
16863 alc662_f5z_speaker_automute(codec);
16864 alc_mic_automute(codec);
16866 /* ***************** Mode3 ******************************/
16867 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16870 switch (res >> 26) {
16871 case ALC880_HP_EVENT:
16872 alc663_two_hp_m1_speaker_automute(codec);
16874 case ALC880_MIC_EVENT:
16875 alc_mic_automute(codec);
16880 #define alc663_mode3_setup alc663_mode1_setup
16882 static void alc663_mode3_inithook(struct hda_codec *codec)
16884 alc663_two_hp_m1_speaker_automute(codec);
16885 alc_mic_automute(codec);
16887 /* ***************** Mode4 ******************************/
16888 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16891 switch (res >> 26) {
16892 case ALC880_HP_EVENT:
16893 alc663_21jd_two_speaker_automute(codec);
16895 case ALC880_MIC_EVENT:
16896 alc_mic_automute(codec);
16901 #define alc663_mode4_setup alc663_mode1_setup
16903 static void alc663_mode4_inithook(struct hda_codec *codec)
16905 alc663_21jd_two_speaker_automute(codec);
16906 alc_mic_automute(codec);
16908 /* ***************** Mode5 ******************************/
16909 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16912 switch (res >> 26) {
16913 case ALC880_HP_EVENT:
16914 alc663_15jd_two_speaker_automute(codec);
16916 case ALC880_MIC_EVENT:
16917 alc_mic_automute(codec);
16922 #define alc663_mode5_setup alc663_mode1_setup
16924 static void alc663_mode5_inithook(struct hda_codec *codec)
16926 alc663_15jd_two_speaker_automute(codec);
16927 alc_mic_automute(codec);
16929 /* ***************** Mode6 ******************************/
16930 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16933 switch (res >> 26) {
16934 case ALC880_HP_EVENT:
16935 alc663_two_hp_m2_speaker_automute(codec);
16937 case ALC880_MIC_EVENT:
16938 alc_mic_automute(codec);
16943 #define alc663_mode6_setup alc663_mode1_setup
16945 static void alc663_mode6_inithook(struct hda_codec *codec)
16947 alc663_two_hp_m2_speaker_automute(codec);
16948 alc_mic_automute(codec);
16951 /* ***************** Mode7 ******************************/
16952 static void alc663_mode7_unsol_event(struct hda_codec *codec,
16955 switch (res >> 26) {
16956 case ALC880_HP_EVENT:
16957 alc663_two_hp_m7_speaker_automute(codec);
16959 case ALC880_MIC_EVENT:
16960 alc_mic_automute(codec);
16965 #define alc663_mode7_setup alc663_mode1_setup
16967 static void alc663_mode7_inithook(struct hda_codec *codec)
16969 alc663_two_hp_m7_speaker_automute(codec);
16970 alc_mic_automute(codec);
16973 /* ***************** Mode8 ******************************/
16974 static void alc663_mode8_unsol_event(struct hda_codec *codec,
16977 switch (res >> 26) {
16978 case ALC880_HP_EVENT:
16979 alc663_two_hp_m8_speaker_automute(codec);
16981 case ALC880_MIC_EVENT:
16982 alc_mic_automute(codec);
16987 #define alc663_mode8_setup alc663_m51va_setup
16989 static void alc663_mode8_inithook(struct hda_codec *codec)
16991 alc663_two_hp_m8_speaker_automute(codec);
16992 alc_mic_automute(codec);
16995 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16997 unsigned int present;
16998 unsigned char bits;
17000 present = snd_hda_jack_detect(codec, 0x21);
17001 bits = present ? HDA_AMP_MUTE : 0;
17002 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17003 HDA_AMP_MUTE, bits);
17004 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17005 HDA_AMP_MUTE, bits);
17008 static void alc663_g71v_front_automute(struct hda_codec *codec)
17010 unsigned int present;
17011 unsigned char bits;
17013 present = snd_hda_jack_detect(codec, 0x15);
17014 bits = present ? HDA_AMP_MUTE : 0;
17015 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17016 HDA_AMP_MUTE, bits);
17019 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17022 switch (res >> 26) {
17023 case ALC880_HP_EVENT:
17024 alc663_g71v_hp_automute(codec);
17026 case ALC880_FRONT_EVENT:
17027 alc663_g71v_front_automute(codec);
17029 case ALC880_MIC_EVENT:
17030 alc_mic_automute(codec);
17035 #define alc663_g71v_setup alc663_m51va_setup
17037 static void alc663_g71v_inithook(struct hda_codec *codec)
17039 alc663_g71v_front_automute(codec);
17040 alc663_g71v_hp_automute(codec);
17041 alc_mic_automute(codec);
17044 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17047 switch (res >> 26) {
17048 case ALC880_HP_EVENT:
17049 alc663_m51va_speaker_automute(codec);
17051 case ALC880_MIC_EVENT:
17052 alc_mic_automute(codec);
17057 #define alc663_g50v_setup alc663_m51va_setup
17059 static void alc663_g50v_inithook(struct hda_codec *codec)
17061 alc663_m51va_speaker_automute(codec);
17062 alc_mic_automute(codec);
17065 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17066 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17067 ALC262_HIPPO_MASTER_SWITCH,
17069 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17070 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17071 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17073 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17074 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17075 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17079 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17080 /* Master Playback automatically created from Speaker and Headphone */
17081 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17082 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17084 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17086 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17087 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17088 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17090 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17091 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17092 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17096 #ifdef CONFIG_SND_HDA_POWER_SAVE
17097 #define alc662_loopbacks alc880_loopbacks
17101 /* pcm configuration: identical with ALC880 */
17102 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17103 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17104 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17105 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17108 * configuration and preset
17110 static const char *alc662_models[ALC662_MODEL_LAST] = {
17111 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17112 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17113 [ALC662_3ST_6ch] = "3stack-6ch",
17114 [ALC662_5ST_DIG] = "6stack-dig",
17115 [ALC662_LENOVO_101E] = "lenovo-101e",
17116 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17117 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17118 [ALC662_ECS] = "ecs",
17119 [ALC663_ASUS_M51VA] = "m51va",
17120 [ALC663_ASUS_G71V] = "g71v",
17121 [ALC663_ASUS_H13] = "h13",
17122 [ALC663_ASUS_G50V] = "g50v",
17123 [ALC663_ASUS_MODE1] = "asus-mode1",
17124 [ALC662_ASUS_MODE2] = "asus-mode2",
17125 [ALC663_ASUS_MODE3] = "asus-mode3",
17126 [ALC663_ASUS_MODE4] = "asus-mode4",
17127 [ALC663_ASUS_MODE5] = "asus-mode5",
17128 [ALC663_ASUS_MODE6] = "asus-mode6",
17129 [ALC663_ASUS_MODE7] = "asus-mode7",
17130 [ALC663_ASUS_MODE8] = "asus-mode8",
17131 [ALC272_DELL] = "dell",
17132 [ALC272_DELL_ZM1] = "dell-zm1",
17133 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17134 [ALC662_AUTO] = "auto",
17137 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17138 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17139 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17140 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17141 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17142 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17143 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17144 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17145 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17146 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17147 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17148 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17149 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17150 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17151 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17152 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17153 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17154 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17155 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17156 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17157 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17158 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17159 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17160 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17161 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17162 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17163 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17164 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17165 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17166 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17167 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17168 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17169 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17170 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17171 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17172 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17173 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17174 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17175 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17176 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17177 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17178 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17179 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17180 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17181 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17182 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17183 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17184 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17185 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17186 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17187 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17188 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17189 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17190 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17191 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17192 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17193 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17194 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17195 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17196 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17197 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17198 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17199 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17200 ALC662_3ST_6ch_DIG),
17201 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17202 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17203 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17204 ALC662_3ST_6ch_DIG),
17205 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17206 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17207 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17208 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17209 ALC662_3ST_6ch_DIG),
17210 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17212 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17216 static struct alc_config_preset alc662_presets[] = {
17217 [ALC662_3ST_2ch_DIG] = {
17218 .mixers = { alc662_3ST_2ch_mixer },
17219 .init_verbs = { alc662_init_verbs },
17220 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17221 .dac_nids = alc662_dac_nids,
17222 .dig_out_nid = ALC662_DIGOUT_NID,
17223 .dig_in_nid = ALC662_DIGIN_NID,
17224 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17225 .channel_mode = alc662_3ST_2ch_modes,
17226 .input_mux = &alc662_capture_source,
17228 [ALC662_3ST_6ch_DIG] = {
17229 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17230 .init_verbs = { alc662_init_verbs },
17231 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17232 .dac_nids = alc662_dac_nids,
17233 .dig_out_nid = ALC662_DIGOUT_NID,
17234 .dig_in_nid = ALC662_DIGIN_NID,
17235 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17236 .channel_mode = alc662_3ST_6ch_modes,
17238 .input_mux = &alc662_capture_source,
17240 [ALC662_3ST_6ch] = {
17241 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17242 .init_verbs = { alc662_init_verbs },
17243 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17244 .dac_nids = alc662_dac_nids,
17245 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17246 .channel_mode = alc662_3ST_6ch_modes,
17248 .input_mux = &alc662_capture_source,
17250 [ALC662_5ST_DIG] = {
17251 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17252 .init_verbs = { alc662_init_verbs },
17253 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17254 .dac_nids = alc662_dac_nids,
17255 .dig_out_nid = ALC662_DIGOUT_NID,
17256 .dig_in_nid = ALC662_DIGIN_NID,
17257 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17258 .channel_mode = alc662_5stack_modes,
17259 .input_mux = &alc662_capture_source,
17261 [ALC662_LENOVO_101E] = {
17262 .mixers = { alc662_lenovo_101e_mixer },
17263 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17264 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17265 .dac_nids = alc662_dac_nids,
17266 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17267 .channel_mode = alc662_3ST_2ch_modes,
17268 .input_mux = &alc662_lenovo_101e_capture_source,
17269 .unsol_event = alc662_lenovo_101e_unsol_event,
17270 .init_hook = alc662_lenovo_101e_all_automute,
17272 [ALC662_ASUS_EEEPC_P701] = {
17273 .mixers = { alc662_eeepc_p701_mixer },
17274 .init_verbs = { alc662_init_verbs,
17275 alc662_eeepc_sue_init_verbs },
17276 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17277 .dac_nids = alc662_dac_nids,
17278 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17279 .channel_mode = alc662_3ST_2ch_modes,
17280 .unsol_event = alc662_eeepc_unsol_event,
17281 .setup = alc662_eeepc_setup,
17282 .init_hook = alc662_eeepc_inithook,
17284 [ALC662_ASUS_EEEPC_EP20] = {
17285 .mixers = { alc662_eeepc_ep20_mixer,
17286 alc662_chmode_mixer },
17287 .init_verbs = { alc662_init_verbs,
17288 alc662_eeepc_ep20_sue_init_verbs },
17289 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17290 .dac_nids = alc662_dac_nids,
17291 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17292 .channel_mode = alc662_3ST_6ch_modes,
17293 .input_mux = &alc662_lenovo_101e_capture_source,
17294 .unsol_event = alc662_eeepc_unsol_event,
17295 .setup = alc662_eeepc_ep20_setup,
17296 .init_hook = alc662_eeepc_ep20_inithook,
17299 .mixers = { alc662_ecs_mixer },
17300 .init_verbs = { alc662_init_verbs,
17301 alc662_ecs_init_verbs },
17302 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17303 .dac_nids = alc662_dac_nids,
17304 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17305 .channel_mode = alc662_3ST_2ch_modes,
17306 .unsol_event = alc662_eeepc_unsol_event,
17307 .setup = alc662_eeepc_setup,
17308 .init_hook = alc662_eeepc_inithook,
17310 [ALC663_ASUS_M51VA] = {
17311 .mixers = { alc663_m51va_mixer },
17312 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17313 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17314 .dac_nids = alc662_dac_nids,
17315 .dig_out_nid = ALC662_DIGOUT_NID,
17316 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17317 .channel_mode = alc662_3ST_2ch_modes,
17318 .unsol_event = alc663_m51va_unsol_event,
17319 .setup = alc663_m51va_setup,
17320 .init_hook = alc663_m51va_inithook,
17322 [ALC663_ASUS_G71V] = {
17323 .mixers = { alc663_g71v_mixer },
17324 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17325 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17326 .dac_nids = alc662_dac_nids,
17327 .dig_out_nid = ALC662_DIGOUT_NID,
17328 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17329 .channel_mode = alc662_3ST_2ch_modes,
17330 .unsol_event = alc663_g71v_unsol_event,
17331 .setup = alc663_g71v_setup,
17332 .init_hook = alc663_g71v_inithook,
17334 [ALC663_ASUS_H13] = {
17335 .mixers = { alc663_m51va_mixer },
17336 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17337 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17338 .dac_nids = alc662_dac_nids,
17339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17340 .channel_mode = alc662_3ST_2ch_modes,
17341 .unsol_event = alc663_m51va_unsol_event,
17342 .init_hook = alc663_m51va_inithook,
17344 [ALC663_ASUS_G50V] = {
17345 .mixers = { alc663_g50v_mixer },
17346 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17347 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17348 .dac_nids = alc662_dac_nids,
17349 .dig_out_nid = ALC662_DIGOUT_NID,
17350 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17351 .channel_mode = alc662_3ST_6ch_modes,
17352 .input_mux = &alc663_capture_source,
17353 .unsol_event = alc663_g50v_unsol_event,
17354 .setup = alc663_g50v_setup,
17355 .init_hook = alc663_g50v_inithook,
17357 [ALC663_ASUS_MODE1] = {
17358 .mixers = { alc663_m51va_mixer },
17359 .cap_mixer = alc662_auto_capture_mixer,
17360 .init_verbs = { alc662_init_verbs,
17361 alc663_21jd_amic_init_verbs },
17362 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17364 .dac_nids = alc662_dac_nids,
17365 .dig_out_nid = ALC662_DIGOUT_NID,
17366 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17367 .channel_mode = alc662_3ST_2ch_modes,
17368 .unsol_event = alc663_mode1_unsol_event,
17369 .setup = alc663_mode1_setup,
17370 .init_hook = alc663_mode1_inithook,
17372 [ALC662_ASUS_MODE2] = {
17373 .mixers = { alc662_1bjd_mixer },
17374 .cap_mixer = alc662_auto_capture_mixer,
17375 .init_verbs = { alc662_init_verbs,
17376 alc662_1bjd_amic_init_verbs },
17377 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17378 .dac_nids = alc662_dac_nids,
17379 .dig_out_nid = ALC662_DIGOUT_NID,
17380 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17381 .channel_mode = alc662_3ST_2ch_modes,
17382 .unsol_event = alc662_mode2_unsol_event,
17383 .setup = alc662_mode2_setup,
17384 .init_hook = alc662_mode2_inithook,
17386 [ALC663_ASUS_MODE3] = {
17387 .mixers = { alc663_two_hp_m1_mixer },
17388 .cap_mixer = alc662_auto_capture_mixer,
17389 .init_verbs = { alc662_init_verbs,
17390 alc663_two_hp_amic_m1_init_verbs },
17391 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17393 .dac_nids = alc662_dac_nids,
17394 .dig_out_nid = ALC662_DIGOUT_NID,
17395 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17396 .channel_mode = alc662_3ST_2ch_modes,
17397 .unsol_event = alc663_mode3_unsol_event,
17398 .setup = alc663_mode3_setup,
17399 .init_hook = alc663_mode3_inithook,
17401 [ALC663_ASUS_MODE4] = {
17402 .mixers = { alc663_asus_21jd_clfe_mixer },
17403 .cap_mixer = alc662_auto_capture_mixer,
17404 .init_verbs = { alc662_init_verbs,
17405 alc663_21jd_amic_init_verbs},
17406 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17408 .dac_nids = alc662_dac_nids,
17409 .dig_out_nid = ALC662_DIGOUT_NID,
17410 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17411 .channel_mode = alc662_3ST_2ch_modes,
17412 .unsol_event = alc663_mode4_unsol_event,
17413 .setup = alc663_mode4_setup,
17414 .init_hook = alc663_mode4_inithook,
17416 [ALC663_ASUS_MODE5] = {
17417 .mixers = { alc663_asus_15jd_clfe_mixer },
17418 .cap_mixer = alc662_auto_capture_mixer,
17419 .init_verbs = { alc662_init_verbs,
17420 alc663_15jd_amic_init_verbs },
17421 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17423 .dac_nids = alc662_dac_nids,
17424 .dig_out_nid = ALC662_DIGOUT_NID,
17425 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17426 .channel_mode = alc662_3ST_2ch_modes,
17427 .unsol_event = alc663_mode5_unsol_event,
17428 .setup = alc663_mode5_setup,
17429 .init_hook = alc663_mode5_inithook,
17431 [ALC663_ASUS_MODE6] = {
17432 .mixers = { alc663_two_hp_m2_mixer },
17433 .cap_mixer = alc662_auto_capture_mixer,
17434 .init_verbs = { alc662_init_verbs,
17435 alc663_two_hp_amic_m2_init_verbs },
17436 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17438 .dac_nids = alc662_dac_nids,
17439 .dig_out_nid = ALC662_DIGOUT_NID,
17440 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17441 .channel_mode = alc662_3ST_2ch_modes,
17442 .unsol_event = alc663_mode6_unsol_event,
17443 .setup = alc663_mode6_setup,
17444 .init_hook = alc663_mode6_inithook,
17446 [ALC663_ASUS_MODE7] = {
17447 .mixers = { alc663_mode7_mixer },
17448 .cap_mixer = alc662_auto_capture_mixer,
17449 .init_verbs = { alc662_init_verbs,
17450 alc663_mode7_init_verbs },
17451 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17453 .dac_nids = alc662_dac_nids,
17454 .dig_out_nid = ALC662_DIGOUT_NID,
17455 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17456 .channel_mode = alc662_3ST_2ch_modes,
17457 .unsol_event = alc663_mode7_unsol_event,
17458 .setup = alc663_mode7_setup,
17459 .init_hook = alc663_mode7_inithook,
17461 [ALC663_ASUS_MODE8] = {
17462 .mixers = { alc663_mode8_mixer },
17463 .cap_mixer = alc662_auto_capture_mixer,
17464 .init_verbs = { alc662_init_verbs,
17465 alc663_mode8_init_verbs },
17466 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17468 .dac_nids = alc662_dac_nids,
17469 .dig_out_nid = ALC662_DIGOUT_NID,
17470 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17471 .channel_mode = alc662_3ST_2ch_modes,
17472 .unsol_event = alc663_mode8_unsol_event,
17473 .setup = alc663_mode8_setup,
17474 .init_hook = alc663_mode8_inithook,
17477 .mixers = { alc663_m51va_mixer },
17478 .cap_mixer = alc272_auto_capture_mixer,
17479 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17480 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17481 .dac_nids = alc662_dac_nids,
17482 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17483 .adc_nids = alc272_adc_nids,
17484 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17485 .capsrc_nids = alc272_capsrc_nids,
17486 .channel_mode = alc662_3ST_2ch_modes,
17487 .unsol_event = alc663_m51va_unsol_event,
17488 .setup = alc663_m51va_setup,
17489 .init_hook = alc663_m51va_inithook,
17491 [ALC272_DELL_ZM1] = {
17492 .mixers = { alc663_m51va_mixer },
17493 .cap_mixer = alc662_auto_capture_mixer,
17494 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17495 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17498 .adc_nids = alc662_adc_nids,
17500 .capsrc_nids = alc662_capsrc_nids,
17501 .channel_mode = alc662_3ST_2ch_modes,
17502 .unsol_event = alc663_m51va_unsol_event,
17503 .setup = alc663_m51va_setup,
17504 .init_hook = alc663_m51va_inithook,
17506 [ALC272_SAMSUNG_NC10] = {
17507 .mixers = { alc272_nc10_mixer },
17508 .init_verbs = { alc662_init_verbs,
17509 alc663_21jd_amic_init_verbs },
17510 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17511 .dac_nids = alc272_dac_nids,
17512 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17513 .channel_mode = alc662_3ST_2ch_modes,
17514 /*.input_mux = &alc272_nc10_capture_source,*/
17515 .unsol_event = alc663_mode4_unsol_event,
17516 .setup = alc663_mode4_setup,
17517 .init_hook = alc663_mode4_inithook,
17523 * BIOS auto configuration
17526 /* convert from MIX nid to DAC */
17527 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17531 else if (nid >= 0x0c && nid <= 0x0e)
17532 return nid - 0x0c + 0x02;
17537 /* get MIX nid connected to the given pin targeted to DAC */
17538 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17544 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17545 for (i = 0; i < num; i++) {
17546 if (alc662_mix_to_dac(mix[i]) == dac)
17552 /* look for an empty DAC slot */
17553 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17555 struct alc_spec *spec = codec->spec;
17559 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17562 for (i = 0; i < num; i++) {
17563 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17566 for (j = 0; j < spec->multiout.num_dacs; j++)
17567 if (spec->multiout.dac_nids[j] == nid)
17569 if (j >= spec->multiout.num_dacs)
17575 /* fill in the dac_nids table from the parsed pin configuration */
17576 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17577 const struct auto_pin_cfg *cfg)
17579 struct alc_spec *spec = codec->spec;
17583 spec->multiout.dac_nids = spec->private_dac_nids;
17584 for (i = 0; i < cfg->line_outs; i++) {
17585 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17588 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17593 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17594 hda_nid_t nid, unsigned int chs)
17596 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17597 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17600 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17601 hda_nid_t nid, unsigned int chs)
17603 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17604 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17607 #define alc662_add_stereo_vol(spec, pfx, nid) \
17608 alc662_add_vol_ctl(spec, pfx, nid, 3)
17609 #define alc662_add_stereo_sw(spec, pfx, nid) \
17610 alc662_add_sw_ctl(spec, pfx, nid, 3)
17612 /* add playback controls from the parsed DAC table */
17613 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17614 const struct auto_pin_cfg *cfg)
17616 struct alc_spec *spec = codec->spec;
17617 static const char *chname[4] = {
17618 "Front", "Surround", NULL /*CLFE*/, "Side"
17620 hda_nid_t nid, mix;
17623 for (i = 0; i < cfg->line_outs; i++) {
17624 nid = spec->multiout.dac_nids[i];
17627 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17632 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17635 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17638 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17641 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17646 if (cfg->line_outs == 1 &&
17647 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17654 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17657 if (cfg->line_outs == 1 &&
17658 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17660 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17668 /* add playback controls for speaker and HP outputs */
17669 /* return DAC nid if any new DAC is assigned */
17670 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17673 struct alc_spec *spec = codec->spec;
17674 hda_nid_t nid, mix;
17679 nid = alc662_look_for_dac(codec, pin);
17681 /* the corresponding DAC is already occupied */
17682 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17683 return 0; /* no way */
17684 /* create a switch only */
17685 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17686 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17689 mix = alc662_dac_to_mix(codec, pin, nid);
17692 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17695 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17701 /* create playback/capture controls for input pins */
17702 #define alc662_auto_create_input_ctls \
17703 alc882_auto_create_input_ctls
17705 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17706 hda_nid_t nid, int pin_type,
17712 alc_set_pin_output(codec, nid, pin_type);
17713 /* need the manual connection? */
17714 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17717 for (i = 0; i < num; i++) {
17718 if (alc662_mix_to_dac(srcs[i]) != dac)
17720 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17725 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17727 struct alc_spec *spec = codec->spec;
17728 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17731 for (i = 0; i <= HDA_SIDE; i++) {
17732 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17734 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17735 spec->multiout.dac_nids[i]);
17739 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17741 struct alc_spec *spec = codec->spec;
17744 pin = spec->autocfg.hp_pins[0];
17746 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17747 spec->multiout.hp_nid);
17748 pin = spec->autocfg.speaker_pins[0];
17750 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17751 spec->multiout.extra_out_nid[0]);
17754 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17756 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17758 struct alc_spec *spec = codec->spec;
17761 for (i = 0; i < AUTO_PIN_LAST; i++) {
17762 hda_nid_t nid = spec->autocfg.input_pins[i];
17763 if (alc_is_input_pin(codec, nid)) {
17764 alc_set_input_pin(codec, nid, i);
17765 if (nid != ALC662_PIN_CD_NID &&
17766 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17767 snd_hda_codec_write(codec, nid, 0,
17768 AC_VERB_SET_AMP_GAIN_MUTE,
17774 #define alc662_auto_init_input_src alc882_auto_init_input_src
17776 static int alc662_parse_auto_config(struct hda_codec *codec)
17778 struct alc_spec *spec = codec->spec;
17780 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17782 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17786 if (!spec->autocfg.line_outs)
17787 return 0; /* can't find valid BIOS pin config */
17789 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17792 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17795 err = alc662_auto_create_extra_out(codec,
17796 spec->autocfg.speaker_pins[0],
17801 spec->multiout.extra_out_nid[0] = err;
17802 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17807 spec->multiout.hp_nid = err;
17808 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17812 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17814 if (spec->autocfg.dig_outs)
17815 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17817 if (spec->kctls.list)
17818 add_mixer(spec, spec->kctls.list);
17820 spec->num_mux_defs = 1;
17821 spec->input_mux = &spec->private_imux[0];
17823 add_verb(spec, alc662_auto_init_verbs);
17824 if (codec->vendor_id == 0x10ec0663)
17825 add_verb(spec, alc663_auto_init_verbs);
17827 err = alc_auto_add_mic_boost(codec);
17831 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17836 /* additional initialization for auto-configuration model */
17837 static void alc662_auto_init(struct hda_codec *codec)
17839 struct alc_spec *spec = codec->spec;
17840 alc662_auto_init_multi_out(codec);
17841 alc662_auto_init_hp_out(codec);
17842 alc662_auto_init_analog_input(codec);
17843 alc662_auto_init_input_src(codec);
17844 if (spec->unsol_event)
17845 alc_inithook(codec);
17848 static int patch_alc662(struct hda_codec *codec)
17850 struct alc_spec *spec;
17851 int err, board_config;
17853 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17857 codec->spec = spec;
17859 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17861 if (alc_read_coef_idx(codec, 0)==0x8020){
17862 kfree(codec->chip_name);
17863 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17864 if (!codec->chip_name) {
17870 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17873 if (board_config < 0) {
17874 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17876 board_config = ALC662_AUTO;
17879 if (board_config == ALC662_AUTO) {
17880 /* automatic parse from the BIOS config */
17881 err = alc662_parse_auto_config(codec);
17887 "hda_codec: Cannot set up configuration "
17888 "from BIOS. Using base mode...\n");
17889 board_config = ALC662_3ST_2ch_DIG;
17893 err = snd_hda_attach_beep_device(codec, 0x1);
17899 if (board_config != ALC662_AUTO)
17900 setup_preset(codec, &alc662_presets[board_config]);
17902 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17903 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17905 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17906 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17908 if (!spec->adc_nids) {
17909 spec->adc_nids = alc662_adc_nids;
17910 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17912 if (!spec->capsrc_nids)
17913 spec->capsrc_nids = alc662_capsrc_nids;
17915 if (!spec->cap_mixer)
17916 set_capture_mixer(codec);
17917 if (codec->vendor_id == 0x10ec0662)
17918 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17920 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17922 spec->vmaster_nid = 0x02;
17924 codec->patch_ops = alc_patch_ops;
17925 if (board_config == ALC662_AUTO)
17926 spec->init_hook = alc662_auto_init;
17927 #ifdef CONFIG_SND_HDA_POWER_SAVE
17928 if (!spec->loopback.amplist)
17929 spec->loopback.amplist = alc662_loopbacks;
17931 codec->proc_widget_hook = print_realtek_coef;
17936 static int patch_alc888(struct hda_codec *codec)
17938 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17939 kfree(codec->chip_name);
17940 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17941 if (!codec->chip_name) {
17945 return patch_alc662(codec);
17947 return patch_alc882(codec);
17953 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17954 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17955 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17956 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17957 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17958 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17959 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17960 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17961 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17962 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17963 .patch = patch_alc861 },
17964 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17965 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17966 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17967 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17968 .patch = patch_alc882 },
17969 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17970 .patch = patch_alc662 },
17971 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17972 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17973 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17974 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17975 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17976 .patch = patch_alc882 },
17977 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17978 .patch = patch_alc882 },
17979 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17980 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17981 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17982 .patch = patch_alc882 },
17983 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
17984 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17985 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
17986 {} /* terminator */
17989 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17991 MODULE_LICENSE("GPL");
17992 MODULE_DESCRIPTION("Realtek HD-audio codec");
17994 static struct hda_codec_preset_list realtek_list = {
17995 .preset = snd_hda_preset_realtek,
17996 .owner = THIS_MODULE,
17999 static int __init patch_realtek_init(void)
18001 return snd_hda_add_codec_preset(&realtek_list);
18004 static void __exit patch_realtek_exit(void)
18006 snd_hda_delete_codec_preset(&realtek_list);
18009 module_init(patch_realtek_init)
18010 module_exit(patch_realtek_exit)