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},
1668 /* Enable amplifiers */
1669 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1670 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1672 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1673 * which makes the stereo useless. However, either the mic or the ALC889
1674 * makes the signal become a difference/sum signal instead of standard
1675 * stereo, which is annoying. So instead we flip this bit which makes the
1676 * codec replicate the sum signal to both channels, turning it into a
1679 /* DMIC_CONTROL? Init value = 0x0001 */
1680 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1681 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1685 static struct hda_input_mux alc888_2_capture_sources[2] = {
1686 /* Front mic only available on one ADC */
1693 { "Front Mic", 0xb },
1706 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1707 /* Interal mic only available on one ADC */
1714 { "Input Mix", 0xa },
1724 { "Input Mix", 0xa },
1729 static struct hda_input_mux alc889_capture_sources[3] = {
1730 /* Digital mic only available on first "ADC" */
1737 { "Front Mic", 0xb },
1738 { "Input Mix", 0xa },
1747 { "Input Mix", 0xa },
1756 { "Input Mix", 0xa },
1761 static struct snd_kcontrol_new alc888_base_mixer[] = {
1762 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1763 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1764 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1768 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1770 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1772 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1783 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1785 struct alc_spec *spec = codec->spec;
1787 spec->autocfg.hp_pins[0] = 0x15;
1788 spec->autocfg.speaker_pins[0] = 0x14;
1789 spec->autocfg.speaker_pins[1] = 0x16;
1790 spec->autocfg.speaker_pins[2] = 0x17;
1793 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1795 struct alc_spec *spec = codec->spec;
1797 spec->autocfg.hp_pins[0] = 0x15;
1798 spec->autocfg.speaker_pins[0] = 0x14;
1799 spec->autocfg.speaker_pins[1] = 0x16;
1800 spec->autocfg.speaker_pins[2] = 0x17;
1803 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1805 struct alc_spec *spec = codec->spec;
1807 spec->autocfg.hp_pins[0] = 0x15;
1808 spec->autocfg.speaker_pins[0] = 0x14;
1809 spec->autocfg.speaker_pins[1] = 0x16;
1810 spec->autocfg.speaker_pins[2] = 0x1b;
1814 * ALC880 3-stack model
1816 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1817 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1818 * F-Mic = 0x1b, HP = 0x19
1821 static hda_nid_t alc880_dac_nids[4] = {
1822 /* front, rear, clfe, rear_surr */
1823 0x02, 0x05, 0x04, 0x03
1826 static hda_nid_t alc880_adc_nids[3] = {
1831 /* The datasheet says the node 0x07 is connected from inputs,
1832 * but it shows zero connection in the real implementation on some devices.
1833 * Note: this is a 915GAV bug, fixed on 915GLV
1835 static hda_nid_t alc880_adc_nids_alt[2] = {
1840 #define ALC880_DIGOUT_NID 0x06
1841 #define ALC880_DIGIN_NID 0x0a
1843 static struct hda_input_mux alc880_capture_source = {
1847 { "Front Mic", 0x3 },
1853 /* channel source setting (2/6 channel selection for 3-stack) */
1855 static struct hda_verb alc880_threestack_ch2_init[] = {
1856 /* set line-in to input, mute it */
1857 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1858 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1859 /* set mic-in to input vref 80%, mute it */
1860 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1861 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1866 static struct hda_verb alc880_threestack_ch6_init[] = {
1867 /* set line-in to output, unmute it */
1868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1870 /* set mic-in to output, unmute it */
1871 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1872 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1876 static struct hda_channel_mode alc880_threestack_modes[2] = {
1877 { 2, alc880_threestack_ch2_init },
1878 { 6, alc880_threestack_ch6_init },
1881 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1882 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1883 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1887 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1888 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1889 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1896 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1897 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1900 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1901 .name = "Channel Mode",
1902 .info = alc_ch_mode_info,
1903 .get = alc_ch_mode_get,
1904 .put = alc_ch_mode_put,
1909 /* capture mixer elements */
1910 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1911 struct snd_ctl_elem_info *uinfo)
1913 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1914 struct alc_spec *spec = codec->spec;
1917 mutex_lock(&codec->control_mutex);
1918 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1920 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1921 mutex_unlock(&codec->control_mutex);
1925 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1926 unsigned int size, unsigned int __user *tlv)
1928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1929 struct alc_spec *spec = codec->spec;
1932 mutex_lock(&codec->control_mutex);
1933 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1935 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1936 mutex_unlock(&codec->control_mutex);
1940 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1941 struct snd_ctl_elem_value *ucontrol);
1943 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1944 struct snd_ctl_elem_value *ucontrol,
1947 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1948 struct alc_spec *spec = codec->spec;
1949 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1952 mutex_lock(&codec->control_mutex);
1953 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1955 err = func(kcontrol, ucontrol);
1956 mutex_unlock(&codec->control_mutex);
1960 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1961 struct snd_ctl_elem_value *ucontrol)
1963 return alc_cap_getput_caller(kcontrol, ucontrol,
1964 snd_hda_mixer_amp_volume_get);
1967 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1968 struct snd_ctl_elem_value *ucontrol)
1970 return alc_cap_getput_caller(kcontrol, ucontrol,
1971 snd_hda_mixer_amp_volume_put);
1974 /* capture mixer elements */
1975 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1977 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1978 struct snd_ctl_elem_value *ucontrol)
1980 return alc_cap_getput_caller(kcontrol, ucontrol,
1981 snd_hda_mixer_amp_switch_get);
1984 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1985 struct snd_ctl_elem_value *ucontrol)
1987 return alc_cap_getput_caller(kcontrol, ucontrol,
1988 snd_hda_mixer_amp_switch_put);
1991 #define _DEFINE_CAPMIX(num) \
1993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1994 .name = "Capture Switch", \
1995 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1997 .info = alc_cap_sw_info, \
1998 .get = alc_cap_sw_get, \
1999 .put = alc_cap_sw_put, \
2002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2003 .name = "Capture Volume", \
2004 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2005 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2006 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2008 .info = alc_cap_vol_info, \
2009 .get = alc_cap_vol_get, \
2010 .put = alc_cap_vol_put, \
2011 .tlv = { .c = alc_cap_vol_tlv }, \
2014 #define _DEFINE_CAPSRC(num) \
2016 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2017 /* .name = "Capture Source", */ \
2018 .name = "Input Source", \
2020 .info = alc_mux_enum_info, \
2021 .get = alc_mux_enum_get, \
2022 .put = alc_mux_enum_put, \
2025 #define DEFINE_CAPMIX(num) \
2026 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2027 _DEFINE_CAPMIX(num), \
2028 _DEFINE_CAPSRC(num), \
2032 #define DEFINE_CAPMIX_NOSRC(num) \
2033 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2034 _DEFINE_CAPMIX(num), \
2038 /* up to three ADCs */
2042 DEFINE_CAPMIX_NOSRC(1);
2043 DEFINE_CAPMIX_NOSRC(2);
2044 DEFINE_CAPMIX_NOSRC(3);
2047 * ALC880 5-stack model
2049 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2051 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2052 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2055 /* additional mixers to alc880_three_stack_mixer */
2056 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2057 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2058 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2062 /* channel source setting (6/8 channel selection for 5-stack) */
2064 static struct hda_verb alc880_fivestack_ch6_init[] = {
2065 /* set line-in to input, mute it */
2066 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2067 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2072 static struct hda_verb alc880_fivestack_ch8_init[] = {
2073 /* set line-in to output, unmute it */
2074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2079 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2080 { 6, alc880_fivestack_ch6_init },
2081 { 8, alc880_fivestack_ch8_init },
2086 * ALC880 6-stack model
2088 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2089 * Side = 0x05 (0x0f)
2090 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2091 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2094 static hda_nid_t alc880_6st_dac_nids[4] = {
2095 /* front, rear, clfe, rear_surr */
2096 0x02, 0x03, 0x04, 0x05
2099 static struct hda_input_mux alc880_6stack_capture_source = {
2103 { "Front Mic", 0x1 },
2109 /* fixed 8-channels */
2110 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2114 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2115 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2116 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2117 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2120 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2121 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2122 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2124 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2132 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2135 .name = "Channel Mode",
2136 .info = alc_ch_mode_info,
2137 .get = alc_ch_mode_get,
2138 .put = alc_ch_mode_put,
2147 * W810 has rear IO for:
2150 * Center/LFE (DAC 04)
2153 * The system also has a pair of internal speakers, and a headphone jack.
2154 * These are both connected to Line2 on the codec, hence to DAC 02.
2156 * There is a variable resistor to control the speaker or headphone
2157 * volume. This is a hardware-only device without a software API.
2159 * Plugging headphones in will disable the internal speakers. This is
2160 * implemented in hardware, not via the driver using jack sense. In
2161 * a similar fashion, plugging into the rear socket marked "front" will
2162 * disable both the speakers and headphones.
2164 * For input, there's a microphone jack, and an "audio in" jack.
2165 * These may not do anything useful with this driver yet, because I
2166 * haven't setup any initialization verbs for these yet...
2169 static hda_nid_t alc880_w810_dac_nids[3] = {
2170 /* front, rear/surround, clfe */
2174 /* fixed 6 channels */
2175 static struct hda_channel_mode alc880_w810_modes[1] = {
2179 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2180 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2183 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2185 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2186 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2187 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2188 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2197 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2198 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2202 static hda_nid_t alc880_z71v_dac_nids[1] = {
2205 #define ALC880_Z71V_HP_DAC 0x03
2207 /* fixed 2 channels */
2208 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2212 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2226 * ALC880 F1734 model
2228 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2229 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2232 static hda_nid_t alc880_f1734_dac_nids[1] = {
2235 #define ALC880_F1734_HP_DAC 0x02
2237 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2238 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2241 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2249 static struct hda_input_mux alc880_f1734_capture_source = {
2261 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2262 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2263 * Mic = 0x18, Line = 0x1a
2266 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2267 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2269 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2279 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2281 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2285 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2286 .name = "Channel Mode",
2287 .info = alc_ch_mode_info,
2288 .get = alc_ch_mode_get,
2289 .put = alc_ch_mode_put,
2295 * ALC880 ASUS W1V model
2297 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2298 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2299 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2302 /* additional mixers to alc880_asus_mixer */
2303 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2304 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2305 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2310 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2312 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2315 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2319 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2324 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2325 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2326 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2330 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2331 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2332 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2333 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2334 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2336 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2338 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2340 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2342 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2343 .name = "Channel Mode",
2344 .info = alc_ch_mode_info,
2345 .get = alc_ch_mode_get,
2346 .put = alc_ch_mode_put,
2351 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2352 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2355 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2356 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2357 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2358 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2359 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2360 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2361 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2365 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2367 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2376 * virtual master controls
2380 * slave controls for virtual master
2382 static const char *alc_slave_vols[] = {
2383 "Front Playback Volume",
2384 "Surround Playback Volume",
2385 "Center Playback Volume",
2386 "LFE Playback Volume",
2387 "Side Playback Volume",
2388 "Headphone Playback Volume",
2389 "Speaker Playback Volume",
2390 "Mono Playback Volume",
2391 "Line-Out Playback Volume",
2392 "PCM Playback Volume",
2396 static const char *alc_slave_sws[] = {
2397 "Front Playback Switch",
2398 "Surround Playback Switch",
2399 "Center Playback Switch",
2400 "LFE Playback Switch",
2401 "Side Playback Switch",
2402 "Headphone Playback Switch",
2403 "Speaker Playback Switch",
2404 "Mono Playback Switch",
2405 "IEC958 Playback Switch",
2406 "Line-Out Playback Switch",
2407 "PCM Playback Switch",
2412 * build control elements
2415 static void alc_free_kctls(struct hda_codec *codec);
2417 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2418 /* additional beep mixers; the actual parameters are overwritten at build */
2419 static struct snd_kcontrol_new alc_beep_mixer[] = {
2420 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2421 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2426 static int alc_build_controls(struct hda_codec *codec)
2428 struct alc_spec *spec = codec->spec;
2432 for (i = 0; i < spec->num_mixers; i++) {
2433 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2437 if (spec->cap_mixer) {
2438 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2442 if (spec->multiout.dig_out_nid) {
2443 err = snd_hda_create_spdif_out_ctls(codec,
2444 spec->multiout.dig_out_nid);
2447 if (!spec->no_analog) {
2448 err = snd_hda_create_spdif_share_sw(codec,
2452 spec->multiout.share_spdif = 1;
2455 if (spec->dig_in_nid) {
2456 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2461 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2462 /* create beep controls if needed */
2463 if (spec->beep_amp) {
2464 struct snd_kcontrol_new *knew;
2465 for (knew = alc_beep_mixer; knew->name; knew++) {
2466 struct snd_kcontrol *kctl;
2467 kctl = snd_ctl_new1(knew, codec);
2470 kctl->private_value = spec->beep_amp;
2471 err = snd_hda_ctl_add(codec,
2472 get_amp_nid_(spec->beep_amp), kctl);
2479 /* if we have no master control, let's create it */
2480 if (!spec->no_analog &&
2481 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2482 unsigned int vmaster_tlv[4];
2483 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2484 HDA_OUTPUT, vmaster_tlv);
2485 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2486 vmaster_tlv, alc_slave_vols);
2490 if (!spec->no_analog &&
2491 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2492 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2493 NULL, alc_slave_sws);
2498 alc_free_kctls(codec); /* no longer needed */
2504 * initialize the codec volumes, etc
2508 * generic initialization of ADC, input mixers and output mixers
2510 static struct hda_verb alc880_volume_init_verbs[] = {
2512 * Unmute ADC0-2 and set the default input to mic-in
2514 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2516 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2517 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2518 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2521 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2523 * Note: PASD motherboards uses the Line In 2 as the input for front
2526 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2536 * Set up output mixers (0x0c - 0x0f)
2538 /* set vol=0 to output mixers */
2539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2542 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2543 /* set up input amps for analog loopback */
2544 /* Amp Indices: DAC = 0, mixer = 1 */
2545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2551 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2552 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2558 * 3-stack pin configuration:
2559 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2561 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2563 * preset connection lists of input pins
2564 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2566 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2567 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2568 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2571 * Set pin mode and muting
2573 /* set front pin widgets 0x14 for output */
2574 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2575 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2576 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2579 /* Mic2 (as headphone out) for HP output */
2580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2581 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2582 /* Line In pin widget for input */
2583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2584 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2585 /* Line2 (as front mic) pin widget for input and vref at 80% */
2586 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2588 /* CD pin widget for input */
2589 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2595 * 5-stack pin configuration:
2596 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2597 * line-in/side = 0x1a, f-mic = 0x1b
2599 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2601 * preset connection lists of input pins
2602 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2604 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2605 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2608 * Set pin mode and muting
2610 /* set pin widgets 0x14-0x17 for output */
2611 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2613 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2614 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2615 /* unmute pins for output (no gain on this amp) */
2616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2618 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2619 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2621 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2622 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2623 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2624 /* Mic2 (as headphone out) for HP output */
2625 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2626 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2627 /* Line In pin widget for input */
2628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2630 /* Line2 (as front mic) pin widget for input and vref at 80% */
2631 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2633 /* CD pin widget for input */
2634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2640 * W810 pin configuration:
2641 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2643 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2644 /* hphone/speaker input selector: front DAC */
2645 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2647 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2648 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2652 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2654 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2655 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2661 * Z71V pin configuration:
2662 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2664 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2670 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2673 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2679 * 6-stack pin configuration:
2680 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2681 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2683 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2684 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2695 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2703 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2709 * Uniwill pin configuration:
2710 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2713 static struct hda_verb alc880_uniwill_init_verbs[] = {
2714 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2720 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2721 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2722 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2723 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2726 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2728 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2731 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2733 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2737 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2738 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2741 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2749 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2751 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2752 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2755 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2758 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2759 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2760 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2762 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2763 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2764 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2765 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2769 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2770 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2771 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2774 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2775 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2780 static struct hda_verb alc880_beep_init_verbs[] = {
2781 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2785 /* auto-toggle front mic */
2786 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2788 unsigned int present;
2791 present = snd_hda_jack_detect(codec, 0x18);
2792 bits = present ? HDA_AMP_MUTE : 0;
2793 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2796 static void alc880_uniwill_setup(struct hda_codec *codec)
2798 struct alc_spec *spec = codec->spec;
2800 spec->autocfg.hp_pins[0] = 0x14;
2801 spec->autocfg.speaker_pins[0] = 0x15;
2802 spec->autocfg.speaker_pins[0] = 0x16;
2805 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2807 alc_automute_amp(codec);
2808 alc880_uniwill_mic_automute(codec);
2811 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2814 /* Looks like the unsol event is incompatible with the standard
2815 * definition. 4bit tag is placed at 28 bit!
2817 switch (res >> 28) {
2818 case ALC880_MIC_EVENT:
2819 alc880_uniwill_mic_automute(codec);
2822 alc_automute_amp_unsol_event(codec, res);
2827 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2829 struct alc_spec *spec = codec->spec;
2831 spec->autocfg.hp_pins[0] = 0x14;
2832 spec->autocfg.speaker_pins[0] = 0x15;
2835 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2837 unsigned int present;
2839 present = snd_hda_codec_read(codec, 0x21, 0,
2840 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2841 present &= HDA_AMP_VOLMASK;
2842 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2843 HDA_AMP_VOLMASK, present);
2844 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2845 HDA_AMP_VOLMASK, present);
2848 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2851 /* Looks like the unsol event is incompatible with the standard
2852 * definition. 4bit tag is placed at 28 bit!
2854 if ((res >> 28) == ALC880_DCVOL_EVENT)
2855 alc880_uniwill_p53_dcvol_automute(codec);
2857 alc_automute_amp_unsol_event(codec, res);
2861 * F1734 pin configuration:
2862 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2864 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2865 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2866 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2867 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2868 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2869 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2872 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2877 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2880 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2882 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2883 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2884 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2886 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2887 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2893 * ASUS pin configuration:
2894 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2896 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2897 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2898 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2899 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2900 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2902 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2905 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2906 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2907 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2908 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2911 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2913 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2915 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2917 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2918 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2924 /* Enable GPIO mask and set output */
2925 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2926 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2927 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2929 /* Clevo m520g init */
2930 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2931 /* headphone output */
2932 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2941 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2942 /* Mic1 (rear panel) */
2943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2945 /* Mic2 (front panel) */
2946 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2947 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2950 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2951 /* change to EAPD mode */
2952 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2953 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2958 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2959 /* change to EAPD mode */
2960 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2961 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2963 /* Headphone output */
2964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2966 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2967 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2969 /* Line In pin widget for input */
2970 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2971 /* CD pin widget for input */
2972 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2973 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2974 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2976 /* change to EAPD mode */
2977 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2978 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2984 * LG m1 express dual
2987 * Rear Line-In/Out (blue): 0x14
2988 * Build-in Mic-In: 0x15
2990 * HP-Out (green): 0x1b
2991 * Mic-In/Out (red): 0x19
2995 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2996 static hda_nid_t alc880_lg_dac_nids[3] = {
3000 /* seems analog CD is not working */
3001 static struct hda_input_mux alc880_lg_capture_source = {
3006 { "Internal Mic", 0x6 },
3010 /* 2,4,6 channel modes */
3011 static struct hda_verb alc880_lg_ch2_init[] = {
3012 /* set line-in and mic-in to input */
3013 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3014 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3018 static struct hda_verb alc880_lg_ch4_init[] = {
3019 /* set line-in to out and mic-in to input */
3020 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3021 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3025 static struct hda_verb alc880_lg_ch6_init[] = {
3026 /* set line-in and mic-in to output */
3027 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3028 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3032 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3033 { 2, alc880_lg_ch2_init },
3034 { 4, alc880_lg_ch4_init },
3035 { 6, alc880_lg_ch6_init },
3038 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3040 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3041 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3042 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3043 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3044 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3045 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3046 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3051 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3052 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3054 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3055 .name = "Channel Mode",
3056 .info = alc_ch_mode_info,
3057 .get = alc_ch_mode_get,
3058 .put = alc_ch_mode_put,
3063 static struct hda_verb alc880_lg_init_verbs[] = {
3064 /* set capture source to mic-in */
3065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3066 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3068 /* mute all amp mixer inputs */
3069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3072 /* line-in to input */
3073 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3074 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3079 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3080 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3081 /* mic-in to input */
3082 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3083 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3086 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3090 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3094 /* toggle speaker-output according to the hp-jack state */
3095 static void alc880_lg_setup(struct hda_codec *codec)
3097 struct alc_spec *spec = codec->spec;
3099 spec->autocfg.hp_pins[0] = 0x1b;
3100 spec->autocfg.speaker_pins[0] = 0x17;
3109 * Built-in Mic-In: 0x19
3115 static struct hda_input_mux alc880_lg_lw_capture_source = {
3119 { "Internal Mic", 0x1 },
3124 #define alc880_lg_lw_modes alc880_threestack_modes
3126 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3129 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3130 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3131 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3133 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3134 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3135 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3136 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3139 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3140 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3143 .name = "Channel Mode",
3144 .info = alc_ch_mode_info,
3145 .get = alc_ch_mode_get,
3146 .put = alc_ch_mode_put,
3151 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3152 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3153 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3154 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3156 /* set capture source to mic-in */
3157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3159 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3162 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3163 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3165 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3166 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3167 /* mic-in to input */
3168 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3169 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3172 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3174 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3178 /* toggle speaker-output according to the hp-jack state */
3179 static void alc880_lg_lw_setup(struct hda_codec *codec)
3181 struct alc_spec *spec = codec->spec;
3183 spec->autocfg.hp_pins[0] = 0x1b;
3184 spec->autocfg.speaker_pins[0] = 0x14;
3187 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3188 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3189 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3192 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3193 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3197 static struct hda_input_mux alc880_medion_rim_capture_source = {
3201 { "Internal Mic", 0x1 },
3205 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3206 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3211 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3212 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3213 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3214 /* Mic2 (as headphone out) for HP output */
3215 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3216 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3217 /* Internal Speaker */
3218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3219 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3221 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3222 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3224 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3228 /* toggle speaker-output according to the hp-jack state */
3229 static void alc880_medion_rim_automute(struct hda_codec *codec)
3231 struct alc_spec *spec = codec->spec;
3232 alc_automute_amp(codec);
3234 if (spec->jack_present)
3235 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3237 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3240 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3243 /* Looks like the unsol event is incompatible with the standard
3244 * definition. 4bit tag is placed at 28 bit!
3246 if ((res >> 28) == ALC880_HP_EVENT)
3247 alc880_medion_rim_automute(codec);
3250 static void alc880_medion_rim_setup(struct hda_codec *codec)
3252 struct alc_spec *spec = codec->spec;
3254 spec->autocfg.hp_pins[0] = 0x14;
3255 spec->autocfg.speaker_pins[0] = 0x1b;
3258 #ifdef CONFIG_SND_HDA_POWER_SAVE
3259 static struct hda_amp_list alc880_loopbacks[] = {
3260 { 0x0b, HDA_INPUT, 0 },
3261 { 0x0b, HDA_INPUT, 1 },
3262 { 0x0b, HDA_INPUT, 2 },
3263 { 0x0b, HDA_INPUT, 3 },
3264 { 0x0b, HDA_INPUT, 4 },
3268 static struct hda_amp_list alc880_lg_loopbacks[] = {
3269 { 0x0b, HDA_INPUT, 1 },
3270 { 0x0b, HDA_INPUT, 6 },
3271 { 0x0b, HDA_INPUT, 7 },
3280 static int alc_init(struct hda_codec *codec)
3282 struct alc_spec *spec = codec->spec;
3286 alc_auto_init_amp(codec, spec->init_amp);
3288 for (i = 0; i < spec->num_init_verbs; i++)
3289 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3291 if (spec->init_hook)
3292 spec->init_hook(codec);
3297 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3299 struct alc_spec *spec = codec->spec;
3301 if (spec->unsol_event)
3302 spec->unsol_event(codec, res);
3305 #ifdef CONFIG_SND_HDA_POWER_SAVE
3306 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3308 struct alc_spec *spec = codec->spec;
3309 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3314 * Analog playback callbacks
3316 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3317 struct hda_codec *codec,
3318 struct snd_pcm_substream *substream)
3320 struct alc_spec *spec = codec->spec;
3321 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3325 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3326 struct hda_codec *codec,
3327 unsigned int stream_tag,
3328 unsigned int format,
3329 struct snd_pcm_substream *substream)
3331 struct alc_spec *spec = codec->spec;
3332 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3333 stream_tag, format, substream);
3336 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3337 struct hda_codec *codec,
3338 struct snd_pcm_substream *substream)
3340 struct alc_spec *spec = codec->spec;
3341 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3347 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3348 struct hda_codec *codec,
3349 struct snd_pcm_substream *substream)
3351 struct alc_spec *spec = codec->spec;
3352 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3355 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3356 struct hda_codec *codec,
3357 unsigned int stream_tag,
3358 unsigned int format,
3359 struct snd_pcm_substream *substream)
3361 struct alc_spec *spec = codec->spec;
3362 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3363 stream_tag, format, substream);
3366 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3367 struct hda_codec *codec,
3368 struct snd_pcm_substream *substream)
3370 struct alc_spec *spec = codec->spec;
3371 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3374 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3375 struct hda_codec *codec,
3376 struct snd_pcm_substream *substream)
3378 struct alc_spec *spec = codec->spec;
3379 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3385 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3386 struct hda_codec *codec,
3387 unsigned int stream_tag,
3388 unsigned int format,
3389 struct snd_pcm_substream *substream)
3391 struct alc_spec *spec = codec->spec;
3393 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3394 stream_tag, 0, format);
3398 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3399 struct hda_codec *codec,
3400 struct snd_pcm_substream *substream)
3402 struct alc_spec *spec = codec->spec;
3404 snd_hda_codec_cleanup_stream(codec,
3405 spec->adc_nids[substream->number + 1]);
3412 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3416 /* NID is set in alc_build_pcms */
3418 .open = alc880_playback_pcm_open,
3419 .prepare = alc880_playback_pcm_prepare,
3420 .cleanup = alc880_playback_pcm_cleanup
3424 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3428 /* NID is set in alc_build_pcms */
3431 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3435 /* NID is set in alc_build_pcms */
3438 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3439 .substreams = 2, /* can be overridden */
3442 /* NID is set in alc_build_pcms */
3444 .prepare = alc880_alt_capture_pcm_prepare,
3445 .cleanup = alc880_alt_capture_pcm_cleanup
3449 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3453 /* NID is set in alc_build_pcms */
3455 .open = alc880_dig_playback_pcm_open,
3456 .close = alc880_dig_playback_pcm_close,
3457 .prepare = alc880_dig_playback_pcm_prepare,
3458 .cleanup = alc880_dig_playback_pcm_cleanup
3462 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3466 /* NID is set in alc_build_pcms */
3469 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3470 static struct hda_pcm_stream alc_pcm_null_stream = {
3476 static int alc_build_pcms(struct hda_codec *codec)
3478 struct alc_spec *spec = codec->spec;
3479 struct hda_pcm *info = spec->pcm_rec;
3482 codec->num_pcms = 1;
3483 codec->pcm_info = info;
3485 if (spec->no_analog)
3488 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3489 "%s Analog", codec->chip_name);
3490 info->name = spec->stream_name_analog;
3492 if (spec->stream_analog_playback) {
3493 if (snd_BUG_ON(!spec->multiout.dac_nids))
3495 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3496 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3498 if (spec->stream_analog_capture) {
3499 if (snd_BUG_ON(!spec->adc_nids))
3501 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3502 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3505 if (spec->channel_mode) {
3506 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3507 for (i = 0; i < spec->num_channel_mode; i++) {
3508 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3509 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3515 /* SPDIF for stream index #1 */
3516 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3517 snprintf(spec->stream_name_digital,
3518 sizeof(spec->stream_name_digital),
3519 "%s Digital", codec->chip_name);
3520 codec->num_pcms = 2;
3521 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3522 info = spec->pcm_rec + 1;
3523 info->name = spec->stream_name_digital;
3524 if (spec->dig_out_type)
3525 info->pcm_type = spec->dig_out_type;
3527 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3528 if (spec->multiout.dig_out_nid &&
3529 spec->stream_digital_playback) {
3530 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3531 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3533 if (spec->dig_in_nid &&
3534 spec->stream_digital_capture) {
3535 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3536 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3538 /* FIXME: do we need this for all Realtek codec models? */
3539 codec->spdif_status_reset = 1;
3542 if (spec->no_analog)
3545 /* If the use of more than one ADC is requested for the current
3546 * model, configure a second analog capture-only PCM.
3548 /* Additional Analaog capture for index #2 */
3549 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3550 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3551 codec->num_pcms = 3;
3552 info = spec->pcm_rec + 2;
3553 info->name = spec->stream_name_analog;
3554 if (spec->alt_dac_nid) {
3555 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3556 *spec->stream_analog_alt_playback;
3557 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3560 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3561 alc_pcm_null_stream;
3562 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3564 if (spec->num_adc_nids > 1) {
3565 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3566 *spec->stream_analog_alt_capture;
3567 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3569 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3570 spec->num_adc_nids - 1;
3572 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3573 alc_pcm_null_stream;
3574 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3581 static void alc_free_kctls(struct hda_codec *codec)
3583 struct alc_spec *spec = codec->spec;
3585 if (spec->kctls.list) {
3586 struct snd_kcontrol_new *kctl = spec->kctls.list;
3588 for (i = 0; i < spec->kctls.used; i++)
3589 kfree(kctl[i].name);
3591 snd_array_free(&spec->kctls);
3594 static void alc_free(struct hda_codec *codec)
3596 struct alc_spec *spec = codec->spec;
3601 alc_free_kctls(codec);
3603 snd_hda_detach_beep_device(codec);
3606 #ifdef SND_HDA_NEEDS_RESUME
3607 static int alc_resume(struct hda_codec *codec)
3609 codec->patch_ops.init(codec);
3610 snd_hda_codec_resume_amp(codec);
3611 snd_hda_codec_resume_cache(codec);
3618 static struct hda_codec_ops alc_patch_ops = {
3619 .build_controls = alc_build_controls,
3620 .build_pcms = alc_build_pcms,
3623 .unsol_event = alc_unsol_event,
3624 #ifdef SND_HDA_NEEDS_RESUME
3625 .resume = alc_resume,
3627 #ifdef CONFIG_SND_HDA_POWER_SAVE
3628 .check_power_status = alc_check_power_status,
3634 * Test configuration for debugging
3636 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3639 #ifdef CONFIG_SND_DEBUG
3640 static hda_nid_t alc880_test_dac_nids[4] = {
3641 0x02, 0x03, 0x04, 0x05
3644 static struct hda_input_mux alc880_test_capture_source = {
3653 { "Surround", 0x6 },
3657 static struct hda_channel_mode alc880_test_modes[4] = {
3664 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3665 struct snd_ctl_elem_info *uinfo)
3667 static char *texts[] = {
3668 "N/A", "Line Out", "HP Out",
3669 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3671 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3673 uinfo->value.enumerated.items = 8;
3674 if (uinfo->value.enumerated.item >= 8)
3675 uinfo->value.enumerated.item = 7;
3676 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3680 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3681 struct snd_ctl_elem_value *ucontrol)
3683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3684 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3685 unsigned int pin_ctl, item = 0;
3687 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3688 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3689 if (pin_ctl & AC_PINCTL_OUT_EN) {
3690 if (pin_ctl & AC_PINCTL_HP_EN)
3694 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3695 switch (pin_ctl & AC_PINCTL_VREFEN) {
3696 case AC_PINCTL_VREF_HIZ: item = 3; break;
3697 case AC_PINCTL_VREF_50: item = 4; break;
3698 case AC_PINCTL_VREF_GRD: item = 5; break;
3699 case AC_PINCTL_VREF_80: item = 6; break;
3700 case AC_PINCTL_VREF_100: item = 7; break;
3703 ucontrol->value.enumerated.item[0] = item;
3707 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3708 struct snd_ctl_elem_value *ucontrol)
3710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3711 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3712 static unsigned int ctls[] = {
3713 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3714 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3715 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3716 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3717 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3718 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3720 unsigned int old_ctl, new_ctl;
3722 old_ctl = snd_hda_codec_read(codec, nid, 0,
3723 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3724 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3725 if (old_ctl != new_ctl) {
3727 snd_hda_codec_write_cache(codec, nid, 0,
3728 AC_VERB_SET_PIN_WIDGET_CONTROL,
3730 val = ucontrol->value.enumerated.item[0] >= 3 ?
3732 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3739 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3740 struct snd_ctl_elem_info *uinfo)
3742 static char *texts[] = {
3743 "Front", "Surround", "CLFE", "Side"
3745 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3747 uinfo->value.enumerated.items = 4;
3748 if (uinfo->value.enumerated.item >= 4)
3749 uinfo->value.enumerated.item = 3;
3750 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3754 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3755 struct snd_ctl_elem_value *ucontrol)
3757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3758 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3761 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3762 ucontrol->value.enumerated.item[0] = sel & 3;
3766 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3767 struct snd_ctl_elem_value *ucontrol)
3769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3770 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3773 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3774 if (ucontrol->value.enumerated.item[0] != sel) {
3775 sel = ucontrol->value.enumerated.item[0] & 3;
3776 snd_hda_codec_write_cache(codec, nid, 0,
3777 AC_VERB_SET_CONNECT_SEL, sel);
3783 #define PIN_CTL_TEST(xname,nid) { \
3784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3786 .info = alc_test_pin_ctl_info, \
3787 .get = alc_test_pin_ctl_get, \
3788 .put = alc_test_pin_ctl_put, \
3789 .private_value = nid \
3792 #define PIN_SRC_TEST(xname,nid) { \
3793 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3795 .info = alc_test_pin_src_info, \
3796 .get = alc_test_pin_src_get, \
3797 .put = alc_test_pin_src_put, \
3798 .private_value = nid \
3801 static struct snd_kcontrol_new alc880_test_mixer[] = {
3802 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3803 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3804 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3805 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3807 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3808 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3809 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3810 PIN_CTL_TEST("Front Pin Mode", 0x14),
3811 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3812 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3813 PIN_CTL_TEST("Side Pin Mode", 0x17),
3814 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3815 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3816 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3817 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3818 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3819 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3820 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3821 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3822 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3823 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3824 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3825 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3826 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3827 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3828 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3829 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3830 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3831 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3834 .name = "Channel Mode",
3835 .info = alc_ch_mode_info,
3836 .get = alc_ch_mode_get,
3837 .put = alc_ch_mode_put,
3842 static struct hda_verb alc880_test_init_verbs[] = {
3843 /* Unmute inputs of 0x0c - 0x0f */
3844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3852 /* Vol output for 0x0c-0x0f */
3853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3856 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3857 /* Set output pins 0x14-0x17 */
3858 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3861 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3862 /* Unmute output pins 0x14-0x17 */
3863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3866 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3867 /* Set input pins 0x18-0x1c */
3868 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3869 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3870 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3871 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3872 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3873 /* Mute input pins 0x18-0x1b */
3874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3877 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3879 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3880 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3881 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3882 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3883 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3884 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3885 /* Analog input/passthru */
3886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3898 static const char *alc880_models[ALC880_MODEL_LAST] = {
3899 [ALC880_3ST] = "3stack",
3900 [ALC880_TCL_S700] = "tcl",
3901 [ALC880_3ST_DIG] = "3stack-digout",
3902 [ALC880_CLEVO] = "clevo",
3903 [ALC880_5ST] = "5stack",
3904 [ALC880_5ST_DIG] = "5stack-digout",
3905 [ALC880_W810] = "w810",
3906 [ALC880_Z71V] = "z71v",
3907 [ALC880_6ST] = "6stack",
3908 [ALC880_6ST_DIG] = "6stack-digout",
3909 [ALC880_ASUS] = "asus",
3910 [ALC880_ASUS_W1V] = "asus-w1v",
3911 [ALC880_ASUS_DIG] = "asus-dig",
3912 [ALC880_ASUS_DIG2] = "asus-dig2",
3913 [ALC880_UNIWILL_DIG] = "uniwill",
3914 [ALC880_UNIWILL_P53] = "uniwill-p53",
3915 [ALC880_FUJITSU] = "fujitsu",
3916 [ALC880_F1734] = "F1734",
3918 [ALC880_LG_LW] = "lg-lw",
3919 [ALC880_MEDION_RIM] = "medion",
3920 #ifdef CONFIG_SND_DEBUG
3921 [ALC880_TEST] = "test",
3923 [ALC880_AUTO] = "auto",
3926 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3927 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3928 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3929 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3930 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3931 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3932 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3933 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3934 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3935 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3936 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3937 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3938 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3939 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3940 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3941 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3942 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3943 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3944 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3945 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3946 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3947 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3948 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3949 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3950 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3951 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3952 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3953 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3954 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3955 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3956 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3957 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3958 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3959 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3960 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3961 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3962 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3963 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3964 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3965 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3966 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3967 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3968 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3969 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3970 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3971 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3972 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3973 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3974 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3975 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3976 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3977 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3978 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3979 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3980 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3981 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3982 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3983 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3984 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3985 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3987 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3988 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3989 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3990 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3991 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3992 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3993 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3994 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3996 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3997 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3998 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4003 * ALC880 codec presets
4005 static struct alc_config_preset alc880_presets[] = {
4007 .mixers = { alc880_three_stack_mixer },
4008 .init_verbs = { alc880_volume_init_verbs,
4009 alc880_pin_3stack_init_verbs },
4010 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4011 .dac_nids = alc880_dac_nids,
4012 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4013 .channel_mode = alc880_threestack_modes,
4015 .input_mux = &alc880_capture_source,
4017 [ALC880_3ST_DIG] = {
4018 .mixers = { alc880_three_stack_mixer },
4019 .init_verbs = { alc880_volume_init_verbs,
4020 alc880_pin_3stack_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4022 .dac_nids = alc880_dac_nids,
4023 .dig_out_nid = ALC880_DIGOUT_NID,
4024 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4025 .channel_mode = alc880_threestack_modes,
4027 .input_mux = &alc880_capture_source,
4029 [ALC880_TCL_S700] = {
4030 .mixers = { alc880_tcl_s700_mixer },
4031 .init_verbs = { alc880_volume_init_verbs,
4032 alc880_pin_tcl_S700_init_verbs,
4033 alc880_gpio2_init_verbs },
4034 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4035 .dac_nids = alc880_dac_nids,
4036 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4037 .num_adc_nids = 1, /* single ADC */
4039 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4040 .channel_mode = alc880_2_jack_modes,
4041 .input_mux = &alc880_capture_source,
4044 .mixers = { alc880_three_stack_mixer,
4045 alc880_five_stack_mixer},
4046 .init_verbs = { alc880_volume_init_verbs,
4047 alc880_pin_5stack_init_verbs },
4048 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4049 .dac_nids = alc880_dac_nids,
4050 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4051 .channel_mode = alc880_fivestack_modes,
4052 .input_mux = &alc880_capture_source,
4054 [ALC880_5ST_DIG] = {
4055 .mixers = { alc880_three_stack_mixer,
4056 alc880_five_stack_mixer },
4057 .init_verbs = { alc880_volume_init_verbs,
4058 alc880_pin_5stack_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4060 .dac_nids = alc880_dac_nids,
4061 .dig_out_nid = ALC880_DIGOUT_NID,
4062 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4063 .channel_mode = alc880_fivestack_modes,
4064 .input_mux = &alc880_capture_source,
4067 .mixers = { alc880_six_stack_mixer },
4068 .init_verbs = { alc880_volume_init_verbs,
4069 alc880_pin_6stack_init_verbs },
4070 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4071 .dac_nids = alc880_6st_dac_nids,
4072 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4073 .channel_mode = alc880_sixstack_modes,
4074 .input_mux = &alc880_6stack_capture_source,
4076 [ALC880_6ST_DIG] = {
4077 .mixers = { alc880_six_stack_mixer },
4078 .init_verbs = { alc880_volume_init_verbs,
4079 alc880_pin_6stack_init_verbs },
4080 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4081 .dac_nids = alc880_6st_dac_nids,
4082 .dig_out_nid = ALC880_DIGOUT_NID,
4083 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4084 .channel_mode = alc880_sixstack_modes,
4085 .input_mux = &alc880_6stack_capture_source,
4088 .mixers = { alc880_w810_base_mixer },
4089 .init_verbs = { alc880_volume_init_verbs,
4090 alc880_pin_w810_init_verbs,
4091 alc880_gpio2_init_verbs },
4092 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4093 .dac_nids = alc880_w810_dac_nids,
4094 .dig_out_nid = ALC880_DIGOUT_NID,
4095 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4096 .channel_mode = alc880_w810_modes,
4097 .input_mux = &alc880_capture_source,
4100 .mixers = { alc880_z71v_mixer },
4101 .init_verbs = { alc880_volume_init_verbs,
4102 alc880_pin_z71v_init_verbs },
4103 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4104 .dac_nids = alc880_z71v_dac_nids,
4105 .dig_out_nid = ALC880_DIGOUT_NID,
4107 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4108 .channel_mode = alc880_2_jack_modes,
4109 .input_mux = &alc880_capture_source,
4112 .mixers = { alc880_f1734_mixer },
4113 .init_verbs = { alc880_volume_init_verbs,
4114 alc880_pin_f1734_init_verbs },
4115 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4116 .dac_nids = alc880_f1734_dac_nids,
4118 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4119 .channel_mode = alc880_2_jack_modes,
4120 .input_mux = &alc880_f1734_capture_source,
4121 .unsol_event = alc880_uniwill_p53_unsol_event,
4122 .setup = alc880_uniwill_p53_setup,
4123 .init_hook = alc_automute_amp,
4126 .mixers = { alc880_asus_mixer },
4127 .init_verbs = { alc880_volume_init_verbs,
4128 alc880_pin_asus_init_verbs,
4129 alc880_gpio1_init_verbs },
4130 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4131 .dac_nids = alc880_asus_dac_nids,
4132 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4133 .channel_mode = alc880_asus_modes,
4135 .input_mux = &alc880_capture_source,
4137 [ALC880_ASUS_DIG] = {
4138 .mixers = { alc880_asus_mixer },
4139 .init_verbs = { alc880_volume_init_verbs,
4140 alc880_pin_asus_init_verbs,
4141 alc880_gpio1_init_verbs },
4142 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4143 .dac_nids = alc880_asus_dac_nids,
4144 .dig_out_nid = ALC880_DIGOUT_NID,
4145 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4146 .channel_mode = alc880_asus_modes,
4148 .input_mux = &alc880_capture_source,
4150 [ALC880_ASUS_DIG2] = {
4151 .mixers = { alc880_asus_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_asus_init_verbs,
4154 alc880_gpio2_init_verbs }, /* use GPIO2 */
4155 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4156 .dac_nids = alc880_asus_dac_nids,
4157 .dig_out_nid = ALC880_DIGOUT_NID,
4158 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4159 .channel_mode = alc880_asus_modes,
4161 .input_mux = &alc880_capture_source,
4163 [ALC880_ASUS_W1V] = {
4164 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4165 .init_verbs = { alc880_volume_init_verbs,
4166 alc880_pin_asus_init_verbs,
4167 alc880_gpio1_init_verbs },
4168 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4169 .dac_nids = alc880_asus_dac_nids,
4170 .dig_out_nid = ALC880_DIGOUT_NID,
4171 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4172 .channel_mode = alc880_asus_modes,
4174 .input_mux = &alc880_capture_source,
4176 [ALC880_UNIWILL_DIG] = {
4177 .mixers = { alc880_asus_mixer },
4178 .init_verbs = { alc880_volume_init_verbs,
4179 alc880_pin_asus_init_verbs },
4180 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4181 .dac_nids = alc880_asus_dac_nids,
4182 .dig_out_nid = ALC880_DIGOUT_NID,
4183 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4184 .channel_mode = alc880_asus_modes,
4186 .input_mux = &alc880_capture_source,
4188 [ALC880_UNIWILL] = {
4189 .mixers = { alc880_uniwill_mixer },
4190 .init_verbs = { alc880_volume_init_verbs,
4191 alc880_uniwill_init_verbs },
4192 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4193 .dac_nids = alc880_asus_dac_nids,
4194 .dig_out_nid = ALC880_DIGOUT_NID,
4195 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4196 .channel_mode = alc880_threestack_modes,
4198 .input_mux = &alc880_capture_source,
4199 .unsol_event = alc880_uniwill_unsol_event,
4200 .setup = alc880_uniwill_setup,
4201 .init_hook = alc880_uniwill_init_hook,
4203 [ALC880_UNIWILL_P53] = {
4204 .mixers = { alc880_uniwill_p53_mixer },
4205 .init_verbs = { alc880_volume_init_verbs,
4206 alc880_uniwill_p53_init_verbs },
4207 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4208 .dac_nids = alc880_asus_dac_nids,
4209 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4210 .channel_mode = alc880_threestack_modes,
4211 .input_mux = &alc880_capture_source,
4212 .unsol_event = alc880_uniwill_p53_unsol_event,
4213 .setup = alc880_uniwill_p53_setup,
4214 .init_hook = alc_automute_amp,
4216 [ALC880_FUJITSU] = {
4217 .mixers = { alc880_fujitsu_mixer },
4218 .init_verbs = { alc880_volume_init_verbs,
4219 alc880_uniwill_p53_init_verbs,
4220 alc880_beep_init_verbs },
4221 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4222 .dac_nids = alc880_dac_nids,
4223 .dig_out_nid = ALC880_DIGOUT_NID,
4224 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4225 .channel_mode = alc880_2_jack_modes,
4226 .input_mux = &alc880_capture_source,
4227 .unsol_event = alc880_uniwill_p53_unsol_event,
4228 .setup = alc880_uniwill_p53_setup,
4229 .init_hook = alc_automute_amp,
4232 .mixers = { alc880_three_stack_mixer },
4233 .init_verbs = { alc880_volume_init_verbs,
4234 alc880_pin_clevo_init_verbs },
4235 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4236 .dac_nids = alc880_dac_nids,
4238 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4239 .channel_mode = alc880_threestack_modes,
4241 .input_mux = &alc880_capture_source,
4244 .mixers = { alc880_lg_mixer },
4245 .init_verbs = { alc880_volume_init_verbs,
4246 alc880_lg_init_verbs },
4247 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4248 .dac_nids = alc880_lg_dac_nids,
4249 .dig_out_nid = ALC880_DIGOUT_NID,
4250 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4251 .channel_mode = alc880_lg_ch_modes,
4253 .input_mux = &alc880_lg_capture_source,
4254 .unsol_event = alc_automute_amp_unsol_event,
4255 .setup = alc880_lg_setup,
4256 .init_hook = alc_automute_amp,
4257 #ifdef CONFIG_SND_HDA_POWER_SAVE
4258 .loopbacks = alc880_lg_loopbacks,
4262 .mixers = { alc880_lg_lw_mixer },
4263 .init_verbs = { alc880_volume_init_verbs,
4264 alc880_lg_lw_init_verbs },
4265 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4266 .dac_nids = alc880_dac_nids,
4267 .dig_out_nid = ALC880_DIGOUT_NID,
4268 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4269 .channel_mode = alc880_lg_lw_modes,
4270 .input_mux = &alc880_lg_lw_capture_source,
4271 .unsol_event = alc_automute_amp_unsol_event,
4272 .setup = alc880_lg_lw_setup,
4273 .init_hook = alc_automute_amp,
4275 [ALC880_MEDION_RIM] = {
4276 .mixers = { alc880_medion_rim_mixer },
4277 .init_verbs = { alc880_volume_init_verbs,
4278 alc880_medion_rim_init_verbs,
4279 alc_gpio2_init_verbs },
4280 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4281 .dac_nids = alc880_dac_nids,
4282 .dig_out_nid = ALC880_DIGOUT_NID,
4283 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4284 .channel_mode = alc880_2_jack_modes,
4285 .input_mux = &alc880_medion_rim_capture_source,
4286 .unsol_event = alc880_medion_rim_unsol_event,
4287 .setup = alc880_medion_rim_setup,
4288 .init_hook = alc880_medion_rim_automute,
4290 #ifdef CONFIG_SND_DEBUG
4292 .mixers = { alc880_test_mixer },
4293 .init_verbs = { alc880_test_init_verbs },
4294 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4295 .dac_nids = alc880_test_dac_nids,
4296 .dig_out_nid = ALC880_DIGOUT_NID,
4297 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4298 .channel_mode = alc880_test_modes,
4299 .input_mux = &alc880_test_capture_source,
4305 * Automatic parse of I/O pins from the BIOS configuration
4310 ALC_CTL_WIDGET_MUTE,
4313 static struct snd_kcontrol_new alc880_control_templates[] = {
4314 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4315 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4316 HDA_BIND_MUTE(NULL, 0, 0, 0),
4319 /* add dynamic controls */
4320 static int add_control(struct alc_spec *spec, int type, const char *name,
4323 struct snd_kcontrol_new *knew;
4325 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4326 knew = snd_array_new(&spec->kctls);
4329 *knew = alc880_control_templates[type];
4330 knew->name = kstrdup(name, GFP_KERNEL);
4333 if (get_amp_nid_(val))
4334 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val);
4335 knew->private_value = val;
4339 static int add_control_with_pfx(struct alc_spec *spec, int type,
4340 const char *pfx, const char *dir,
4341 const char *sfx, unsigned long val)
4344 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4345 return add_control(spec, type, name, val);
4348 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4349 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4350 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4351 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4353 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4354 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4355 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4356 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4357 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4358 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4359 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4360 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4361 #define ALC880_PIN_CD_NID 0x1c
4363 /* fill in the dac_nids table from the parsed pin configuration */
4364 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4365 const struct auto_pin_cfg *cfg)
4371 memset(assigned, 0, sizeof(assigned));
4372 spec->multiout.dac_nids = spec->private_dac_nids;
4374 /* check the pins hardwired to audio widget */
4375 for (i = 0; i < cfg->line_outs; i++) {
4376 nid = cfg->line_out_pins[i];
4377 if (alc880_is_fixed_pin(nid)) {
4378 int idx = alc880_fixed_pin_idx(nid);
4379 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4383 /* left pins can be connect to any audio widget */
4384 for (i = 0; i < cfg->line_outs; i++) {
4385 nid = cfg->line_out_pins[i];
4386 if (alc880_is_fixed_pin(nid))
4388 /* search for an empty channel */
4389 for (j = 0; j < cfg->line_outs; j++) {
4391 spec->multiout.dac_nids[i] =
4392 alc880_idx_to_dac(j);
4398 spec->multiout.num_dacs = cfg->line_outs;
4402 /* add playback controls from the parsed DAC table */
4403 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4404 const struct auto_pin_cfg *cfg)
4406 static const char *chname[4] = {
4407 "Front", "Surround", NULL /*CLFE*/, "Side"
4412 for (i = 0; i < cfg->line_outs; i++) {
4413 if (!spec->multiout.dac_nids[i])
4415 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4418 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4420 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4424 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4426 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4430 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4432 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4436 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4438 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4444 if (cfg->line_outs == 1 &&
4445 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4449 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4450 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4454 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4455 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4464 /* add playback controls for speaker and HP outputs */
4465 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4474 if (alc880_is_fixed_pin(pin)) {
4475 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4476 /* specify the DAC as the extra output */
4477 if (!spec->multiout.hp_nid)
4478 spec->multiout.hp_nid = nid;
4480 spec->multiout.extra_out_nid[0] = nid;
4481 /* control HP volume/switch on the output mixer amp */
4482 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4483 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4484 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4487 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4488 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4491 } else if (alc880_is_multi_pin(pin)) {
4492 /* set manual connection */
4493 /* we have only a switch on HP-out PIN */
4494 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4495 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4502 /* create input playback/capture controls for the given pin */
4503 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4504 const char *ctlname,
4505 int idx, hda_nid_t mix_nid)
4509 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4510 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4513 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4514 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4520 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4522 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4523 return (pincap & AC_PINCAP_IN) != 0;
4526 /* create playback/capture controls for input pins */
4527 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4528 const struct auto_pin_cfg *cfg,
4530 hda_nid_t cap1, hda_nid_t cap2)
4532 struct alc_spec *spec = codec->spec;
4533 struct hda_input_mux *imux = &spec->private_imux[0];
4536 for (i = 0; i < AUTO_PIN_LAST; i++) {
4539 pin = cfg->input_pins[i];
4540 if (!alc_is_input_pin(codec, pin))
4544 idx = get_connection_index(codec, mixer, pin);
4546 err = new_analog_input(spec, pin,
4547 auto_pin_cfg_labels[i],
4556 idx = get_connection_index(codec, cap1, pin);
4557 if (idx < 0 && cap2)
4558 idx = get_connection_index(codec, cap2, pin);
4560 imux->items[imux->num_items].label =
4561 auto_pin_cfg_labels[i];
4562 imux->items[imux->num_items].index = idx;
4569 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4570 const struct auto_pin_cfg *cfg)
4572 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4575 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4576 unsigned int pin_type)
4578 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4581 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4585 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4586 hda_nid_t nid, int pin_type,
4589 alc_set_pin_output(codec, nid, pin_type);
4590 /* need the manual connection? */
4591 if (alc880_is_multi_pin(nid)) {
4592 struct alc_spec *spec = codec->spec;
4593 int idx = alc880_multi_pin_idx(nid);
4594 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4595 AC_VERB_SET_CONNECT_SEL,
4596 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4600 static int get_pin_type(int line_out_type)
4602 if (line_out_type == AUTO_PIN_HP_OUT)
4608 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4610 struct alc_spec *spec = codec->spec;
4613 for (i = 0; i < spec->autocfg.line_outs; i++) {
4614 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4615 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4616 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4620 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4622 struct alc_spec *spec = codec->spec;
4625 pin = spec->autocfg.speaker_pins[0];
4626 if (pin) /* connect to front */
4627 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4628 pin = spec->autocfg.hp_pins[0];
4629 if (pin) /* connect to front */
4630 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4633 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4635 struct alc_spec *spec = codec->spec;
4638 for (i = 0; i < AUTO_PIN_LAST; i++) {
4639 hda_nid_t nid = spec->autocfg.input_pins[i];
4640 if (alc_is_input_pin(codec, nid)) {
4641 alc_set_input_pin(codec, nid, i);
4642 if (nid != ALC880_PIN_CD_NID &&
4643 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4644 snd_hda_codec_write(codec, nid, 0,
4645 AC_VERB_SET_AMP_GAIN_MUTE,
4651 /* parse the BIOS configuration and set up the alc_spec */
4652 /* return 1 if successful, 0 if the proper config is not found,
4653 * or a negative error code
4655 static int alc880_parse_auto_config(struct hda_codec *codec)
4657 struct alc_spec *spec = codec->spec;
4659 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4661 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4665 if (!spec->autocfg.line_outs)
4666 return 0; /* can't find valid BIOS pin config */
4668 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4671 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4674 err = alc880_auto_create_extra_out(spec,
4675 spec->autocfg.speaker_pins[0],
4679 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4683 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4687 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4689 /* check multiple SPDIF-out (for recent codecs) */
4690 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4692 err = snd_hda_get_connections(codec,
4693 spec->autocfg.dig_out_pins[i],
4698 spec->multiout.dig_out_nid = dig_nid;
4700 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4701 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4703 spec->slave_dig_outs[i - 1] = dig_nid;
4706 if (spec->autocfg.dig_in_pin)
4707 spec->dig_in_nid = ALC880_DIGIN_NID;
4709 if (spec->kctls.list)
4710 add_mixer(spec, spec->kctls.list);
4712 add_verb(spec, alc880_volume_init_verbs);
4714 spec->num_mux_defs = 1;
4715 spec->input_mux = &spec->private_imux[0];
4717 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4722 /* additional initialization for auto-configuration model */
4723 static void alc880_auto_init(struct hda_codec *codec)
4725 struct alc_spec *spec = codec->spec;
4726 alc880_auto_init_multi_out(codec);
4727 alc880_auto_init_extra_out(codec);
4728 alc880_auto_init_analog_input(codec);
4729 if (spec->unsol_event)
4730 alc_inithook(codec);
4733 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4734 * one of two digital mic pins, e.g. on ALC272
4736 static void fixup_automic_adc(struct hda_codec *codec)
4738 struct alc_spec *spec = codec->spec;
4741 for (i = 0; i < spec->num_adc_nids; i++) {
4742 hda_nid_t cap = spec->capsrc_nids ?
4743 spec->capsrc_nids[i] : spec->adc_nids[i];
4746 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4749 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4752 spec->int_mic.mux_idx = iidx;
4753 spec->ext_mic.mux_idx = eidx;
4754 if (spec->capsrc_nids)
4755 spec->capsrc_nids += i;
4756 spec->adc_nids += i;
4757 spec->num_adc_nids = 1;
4760 snd_printd(KERN_INFO "hda_codec: %s: "
4761 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4762 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4763 spec->auto_mic = 0; /* disable auto-mic to be sure */
4766 static void set_capture_mixer(struct hda_codec *codec)
4768 struct alc_spec *spec = codec->spec;
4769 static struct snd_kcontrol_new *caps[2][3] = {
4770 { alc_capture_mixer_nosrc1,
4771 alc_capture_mixer_nosrc2,
4772 alc_capture_mixer_nosrc3 },
4773 { alc_capture_mixer1,
4775 alc_capture_mixer3 },
4777 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4779 if (spec->auto_mic) {
4781 fixup_automic_adc(codec);
4782 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4786 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4790 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4791 #define set_beep_amp(spec, nid, idx, dir) \
4792 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4794 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4798 * OK, here we have finally the patch for ALC880
4801 static int patch_alc880(struct hda_codec *codec)
4803 struct alc_spec *spec;
4807 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4813 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4816 if (board_config < 0) {
4817 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4819 board_config = ALC880_AUTO;
4822 if (board_config == ALC880_AUTO) {
4823 /* automatic parse from the BIOS config */
4824 err = alc880_parse_auto_config(codec);
4830 "hda_codec: Cannot set up configuration "
4831 "from BIOS. Using 3-stack mode...\n");
4832 board_config = ALC880_3ST;
4836 err = snd_hda_attach_beep_device(codec, 0x1);
4842 if (board_config != ALC880_AUTO)
4843 setup_preset(codec, &alc880_presets[board_config]);
4845 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4846 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4847 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4849 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4850 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4852 if (!spec->adc_nids && spec->input_mux) {
4853 /* check whether NID 0x07 is valid */
4854 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4856 wcap = get_wcaps_type(wcap);
4857 if (wcap != AC_WID_AUD_IN) {
4858 spec->adc_nids = alc880_adc_nids_alt;
4859 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4861 spec->adc_nids = alc880_adc_nids;
4862 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4865 set_capture_mixer(codec);
4866 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4868 spec->vmaster_nid = 0x0c;
4870 codec->patch_ops = alc_patch_ops;
4871 if (board_config == ALC880_AUTO)
4872 spec->init_hook = alc880_auto_init;
4873 #ifdef CONFIG_SND_HDA_POWER_SAVE
4874 if (!spec->loopback.amplist)
4875 spec->loopback.amplist = alc880_loopbacks;
4877 codec->proc_widget_hook = print_realtek_coef;
4887 static hda_nid_t alc260_dac_nids[1] = {
4892 static hda_nid_t alc260_adc_nids[1] = {
4897 static hda_nid_t alc260_adc_nids_alt[1] = {
4902 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4903 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4905 static hda_nid_t alc260_dual_adc_nids[2] = {
4910 #define ALC260_DIGOUT_NID 0x03
4911 #define ALC260_DIGIN_NID 0x06
4913 static struct hda_input_mux alc260_capture_source = {
4917 { "Front Mic", 0x1 },
4923 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4924 * headphone jack and the internal CD lines since these are the only pins at
4925 * which audio can appear. For flexibility, also allow the option of
4926 * recording the mixer output on the second ADC (ADC0 doesn't have a
4927 * connection to the mixer output).
4929 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4933 { "Mic/Line", 0x0 },
4935 { "Headphone", 0x2 },
4941 { "Mic/Line", 0x0 },
4943 { "Headphone", 0x2 },
4950 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4951 * the Fujitsu S702x, but jacks are marked differently.
4953 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4960 { "Headphone", 0x5 },
4969 { "Headphone", 0x6 },
4975 /* Maxdata Favorit 100XS */
4976 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4980 { "Line/Mic", 0x0 },
4987 { "Line/Mic", 0x0 },
4995 * This is just place-holder, so there's something for alc_build_pcms to look
4996 * at when it calculates the maximum number of channels. ALC260 has no mixer
4997 * element which allows changing the channel mode, so the verb list is
5000 static struct hda_channel_mode alc260_modes[1] = {
5005 /* Mixer combinations
5007 * basic: base_output + input + pc_beep + capture
5008 * HP: base_output + input + capture_alt
5009 * HP_3013: hp_3013 + input + capture
5010 * fujitsu: fujitsu + capture
5011 * acer: acer + capture
5014 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5015 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5016 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5017 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5018 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5019 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5020 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5024 static struct snd_kcontrol_new alc260_input_mixer[] = {
5025 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5026 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5027 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5028 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5030 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5031 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5032 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5036 /* update HP, line and mono out pins according to the master switch */
5037 static void alc260_hp_master_update(struct hda_codec *codec,
5038 hda_nid_t hp, hda_nid_t line,
5041 struct alc_spec *spec = codec->spec;
5042 unsigned int val = spec->master_sw ? PIN_HP : 0;
5043 /* change HP and line-out pins */
5044 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5046 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5048 /* mono (speaker) depending on the HP jack sense */
5049 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5050 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5054 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5055 struct snd_ctl_elem_value *ucontrol)
5057 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5058 struct alc_spec *spec = codec->spec;
5059 *ucontrol->value.integer.value = spec->master_sw;
5063 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5064 struct snd_ctl_elem_value *ucontrol)
5066 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5067 struct alc_spec *spec = codec->spec;
5068 int val = !!*ucontrol->value.integer.value;
5069 hda_nid_t hp, line, mono;
5071 if (val == spec->master_sw)
5073 spec->master_sw = val;
5074 hp = (kcontrol->private_value >> 16) & 0xff;
5075 line = (kcontrol->private_value >> 8) & 0xff;
5076 mono = kcontrol->private_value & 0xff;
5077 alc260_hp_master_update(codec, hp, line, mono);
5081 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5084 .name = "Master Playback Switch",
5085 .info = snd_ctl_boolean_mono_info,
5086 .get = alc260_hp_master_sw_get,
5087 .put = alc260_hp_master_sw_put,
5088 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5090 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5091 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5092 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5093 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5094 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5096 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5100 static struct hda_verb alc260_hp_unsol_verbs[] = {
5101 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5105 static void alc260_hp_automute(struct hda_codec *codec)
5107 struct alc_spec *spec = codec->spec;
5109 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5110 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5113 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5115 if ((res >> 26) == ALC880_HP_EVENT)
5116 alc260_hp_automute(codec);
5119 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5122 .name = "Master Playback Switch",
5123 .info = snd_ctl_boolean_mono_info,
5124 .get = alc260_hp_master_sw_get,
5125 .put = alc260_hp_master_sw_put,
5126 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5128 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5129 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5130 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5131 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5134 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5135 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5139 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5140 .ops = &snd_hda_bind_vol,
5142 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5143 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5144 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5149 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5150 .ops = &snd_hda_bind_sw,
5152 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5153 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5158 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5159 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5160 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5161 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5166 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5171 static void alc260_hp_3013_automute(struct hda_codec *codec)
5173 struct alc_spec *spec = codec->spec;
5175 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5176 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5179 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5182 if ((res >> 26) == ALC880_HP_EVENT)
5183 alc260_hp_3013_automute(codec);
5186 static void alc260_hp_3012_automute(struct hda_codec *codec)
5188 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5190 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5192 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5194 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5198 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5201 if ((res >> 26) == ALC880_HP_EVENT)
5202 alc260_hp_3012_automute(codec);
5205 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5206 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5208 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5209 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5210 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5211 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5212 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5213 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5214 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5215 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5216 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5217 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5218 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5222 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5223 * versions of the ALC260 don't act on requests to enable mic bias from NID
5224 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5225 * datasheet doesn't mention this restriction. At this stage it's not clear
5226 * whether this behaviour is intentional or is a hardware bug in chip
5227 * revisions available in early 2006. Therefore for now allow the
5228 * "Headphone Jack Mode" control to span all choices, but if it turns out
5229 * that the lack of mic bias for this NID is intentional we could change the
5230 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5232 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5233 * don't appear to make the mic bias available from the "line" jack, even
5234 * though the NID used for this jack (0x14) can supply it. The theory is
5235 * that perhaps Acer have included blocking capacitors between the ALC260
5236 * and the output jack. If this turns out to be the case for all such
5237 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5238 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5240 * The C20x Tablet series have a mono internal speaker which is controlled
5241 * via the chip's Mono sum widget and pin complex, so include the necessary
5242 * controls for such models. On models without a "mono speaker" the control
5243 * won't do anything.
5245 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5246 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5247 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5248 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5249 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5251 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5253 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5254 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5256 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5257 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5258 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5259 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5260 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5264 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5266 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5267 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5268 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5269 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5270 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5271 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5272 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5276 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5277 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5279 static struct snd_kcontrol_new alc260_will_mixer[] = {
5280 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5281 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5283 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5284 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5285 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5286 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5287 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5288 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5289 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5293 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5294 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5296 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5297 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5298 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5300 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5301 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5302 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5303 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5304 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5305 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5306 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5311 * initialization verbs
5313 static struct hda_verb alc260_init_verbs[] = {
5314 /* Line In pin widget for input */
5315 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5316 /* CD pin widget for input */
5317 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5318 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5319 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5320 /* Mic2 (front panel) pin widget for input and vref at 80% */
5321 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5322 /* LINE-2 is used for line-out in rear */
5323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5324 /* select line-out */
5325 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5327 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5329 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5331 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5332 /* mute capture amp left and right */
5333 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5334 /* set connection select to line in (default select for this ADC) */
5335 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5336 /* mute capture amp left and right */
5337 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5338 /* set connection select to line in (default select for this ADC) */
5339 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5340 /* set vol=0 Line-Out mixer amp left and right */
5341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5342 /* unmute pin widget amp left and right (no gain on this amp) */
5343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5344 /* set vol=0 HP mixer amp left and right */
5345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5346 /* unmute pin widget amp left and right (no gain on this amp) */
5347 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5348 /* set vol=0 Mono mixer amp left and right */
5349 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5350 /* unmute pin widget amp left and right (no gain on this amp) */
5351 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5352 /* unmute LINE-2 out pin */
5353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5354 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5357 /* mute analog inputs */
5358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5363 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5364 /* mute Front out path */
5365 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5366 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5367 /* mute Headphone out path */
5368 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5369 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5370 /* mute Mono out path */
5371 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5372 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5376 #if 0 /* should be identical with alc260_init_verbs? */
5377 static struct hda_verb alc260_hp_init_verbs[] = {
5378 /* Headphone and output */
5379 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5381 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5382 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5383 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5384 /* Mic2 (front panel) pin widget for input and vref at 80% */
5385 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5386 /* Line In pin widget for input */
5387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5388 /* Line-2 pin widget for output */
5389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5390 /* CD pin widget for input */
5391 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5392 /* unmute amp left and right */
5393 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5394 /* set connection select to line in (default select for this ADC) */
5395 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5396 /* unmute Line-Out mixer amp left and right (volume = 0) */
5397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5398 /* mute pin widget amp left and right (no gain on this amp) */
5399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5400 /* unmute HP mixer amp left and right (volume = 0) */
5401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5402 /* mute pin widget amp left and right (no gain on this amp) */
5403 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5404 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5407 /* mute analog inputs */
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5413 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5414 /* Unmute Front out path */
5415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5417 /* Unmute Headphone out path */
5418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5420 /* Unmute Mono out path */
5421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5422 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5427 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5428 /* Line out and output */
5429 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5431 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5432 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5433 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5434 /* Mic2 (front panel) pin widget for input and vref at 80% */
5435 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5436 /* Line In pin widget for input */
5437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5438 /* Headphone pin widget for output */
5439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5440 /* CD pin widget for input */
5441 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5442 /* unmute amp left and right */
5443 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5444 /* set connection select to line in (default select for this ADC) */
5445 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5446 /* unmute Line-Out mixer amp left and right (volume = 0) */
5447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5448 /* mute pin widget amp left and right (no gain on this amp) */
5449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5450 /* unmute HP mixer amp left and right (volume = 0) */
5451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5452 /* mute pin widget amp left and right (no gain on this amp) */
5453 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5454 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5457 /* mute analog inputs */
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5463 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5464 /* Unmute Front out path */
5465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5466 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5467 /* Unmute Headphone out path */
5468 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5469 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5470 /* Unmute Mono out path */
5471 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5472 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5476 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5477 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5478 * audio = 0x16, internal speaker = 0x10.
5480 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5481 /* Disable all GPIOs */
5482 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5483 /* Internal speaker is connected to headphone pin */
5484 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5485 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5487 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5488 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5489 /* Ensure all other unused pins are disabled and muted. */
5490 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5493 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5495 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5499 /* Disable digital (SPDIF) pins */
5500 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5501 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5503 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5504 * when acting as an output.
5506 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5508 /* Start with output sum widgets muted and their output gains at min */
5509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5511 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5513 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5516 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5517 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5519 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5520 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5521 /* Unmute Line1 pin widget output buffer since it starts as an output.
5522 * If the pin mode is changed by the user the pin mode control will
5523 * take care of enabling the pin's input/output buffers as needed.
5524 * Therefore there's no need to enable the input buffer at this
5527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5528 /* Unmute input buffer of pin widget used for Line-in (no equiv
5531 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5533 /* Mute capture amp left and right */
5534 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5535 /* Set ADC connection select to match default mixer setting - line
5538 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5540 /* Do the same for the second ADC: mute capture input amp and
5541 * set ADC connection to line in (on mic1 pin)
5543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5544 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5546 /* Mute all inputs to mixer widget (even unconnected ones) */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5559 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5560 * similar laptops (adapted from Fujitsu init verbs).
5562 static struct hda_verb alc260_acer_init_verbs[] = {
5563 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5564 * the headphone jack. Turn this on and rely on the standard mute
5565 * methods whenever the user wants to turn these outputs off.
5567 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5568 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5569 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5570 /* Internal speaker/Headphone jack is connected to Line-out pin */
5571 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5572 /* Internal microphone/Mic jack is connected to Mic1 pin */
5573 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5574 /* Line In jack is connected to Line1 pin */
5575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5576 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5577 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5578 /* Ensure all other unused pins are disabled and muted. */
5579 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5580 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5581 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5582 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5585 /* Disable digital (SPDIF) pins */
5586 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5587 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5589 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5590 * bus when acting as outputs.
5592 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5593 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5595 /* Start with output sum widgets muted and their output gains at min */
5596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5601 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5602 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5603 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5604 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5606 /* Unmute Line-out pin widget amp left and right
5607 * (no equiv mixer ctrl)
5609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5610 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5611 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5612 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5613 * inputs. If the pin mode is changed by the user the pin mode control
5614 * will take care of enabling the pin's input/output buffers as needed.
5615 * Therefore there's no need to enable the input buffer at this
5618 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5621 /* Mute capture amp left and right */
5622 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5623 /* Set ADC connection select to match default mixer setting - mic
5626 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5628 /* Do similar with the second ADC: mute capture input amp and
5629 * set ADC connection to mic to match ALSA's default state.
5631 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5634 /* Mute all inputs to mixer widget (even unconnected ones) */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5647 /* Initialisation sequence for Maxdata Favorit 100XS
5648 * (adapted from Acer init verbs).
5650 static struct hda_verb alc260_favorit100_init_verbs[] = {
5651 /* GPIO 0 enables the output jack.
5652 * Turn this on and rely on the standard mute
5653 * methods whenever the user wants to turn these outputs off.
5655 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5656 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5657 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5658 /* Line/Mic input jack is connected to Mic1 pin */
5659 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5660 /* Ensure all other unused pins are disabled and muted. */
5661 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5662 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5664 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5668 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5671 /* Disable digital (SPDIF) pins */
5672 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5673 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5675 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5676 * bus when acting as outputs.
5678 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5679 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5681 /* Start with output sum widgets muted and their output gains at min */
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5684 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5687 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5689 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5690 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5692 /* Unmute Line-out pin widget amp left and right
5693 * (no equiv mixer ctrl)
5695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5696 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5697 * inputs. If the pin mode is changed by the user the pin mode control
5698 * will take care of enabling the pin's input/output buffers as needed.
5699 * Therefore there's no need to enable the input buffer at this
5702 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5704 /* Mute capture amp left and right */
5705 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5706 /* Set ADC connection select to match default mixer setting - mic
5709 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5711 /* Do similar with the second ADC: mute capture input amp and
5712 * set ADC connection to mic to match ALSA's default state.
5714 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5715 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5717 /* Mute all inputs to mixer widget (even unconnected ones) */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5730 static struct hda_verb alc260_will_verbs[] = {
5731 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5732 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5733 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5734 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5735 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5736 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5740 static struct hda_verb alc260_replacer_672v_verbs[] = {
5741 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5742 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5743 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5745 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5746 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5747 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5749 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5753 /* toggle speaker-output according to the hp-jack state */
5754 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5756 unsigned int present;
5758 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5759 present = snd_hda_jack_detect(codec, 0x0f);
5761 snd_hda_codec_write_cache(codec, 0x01, 0,
5762 AC_VERB_SET_GPIO_DATA, 1);
5763 snd_hda_codec_write_cache(codec, 0x0f, 0,
5764 AC_VERB_SET_PIN_WIDGET_CONTROL,
5767 snd_hda_codec_write_cache(codec, 0x01, 0,
5768 AC_VERB_SET_GPIO_DATA, 0);
5769 snd_hda_codec_write_cache(codec, 0x0f, 0,
5770 AC_VERB_SET_PIN_WIDGET_CONTROL,
5775 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5778 if ((res >> 26) == ALC880_HP_EVENT)
5779 alc260_replacer_672v_automute(codec);
5782 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5783 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5784 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5785 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5787 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5789 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5790 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5791 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5796 /* Test configuration for debugging, modelled after the ALC880 test
5799 #ifdef CONFIG_SND_DEBUG
5800 static hda_nid_t alc260_test_dac_nids[1] = {
5803 static hda_nid_t alc260_test_adc_nids[2] = {
5806 /* For testing the ALC260, each input MUX needs its own definition since
5807 * the signal assignments are different. This assumes that the first ADC
5810 static struct hda_input_mux alc260_test_capture_sources[2] = {
5814 { "MIC1 pin", 0x0 },
5815 { "MIC2 pin", 0x1 },
5816 { "LINE1 pin", 0x2 },
5817 { "LINE2 pin", 0x3 },
5819 { "LINE-OUT pin", 0x5 },
5820 { "HP-OUT pin", 0x6 },
5826 { "MIC1 pin", 0x0 },
5827 { "MIC2 pin", 0x1 },
5828 { "LINE1 pin", 0x2 },
5829 { "LINE2 pin", 0x3 },
5832 { "LINE-OUT pin", 0x6 },
5833 { "HP-OUT pin", 0x7 },
5837 static struct snd_kcontrol_new alc260_test_mixer[] = {
5838 /* Output driver widgets */
5839 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5840 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5841 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5842 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5843 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5844 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5846 /* Modes for retasking pin widgets
5847 * Note: the ALC260 doesn't seem to act on requests to enable mic
5848 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5849 * mention this restriction. At this stage it's not clear whether
5850 * this behaviour is intentional or is a hardware bug in chip
5851 * revisions available at least up until early 2006. Therefore for
5852 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5853 * choices, but if it turns out that the lack of mic bias for these
5854 * NIDs is intentional we could change their modes from
5855 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5857 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5858 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5859 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5860 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5861 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5862 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5864 /* Loopback mixer controls */
5865 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5866 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5867 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5868 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5869 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5870 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5871 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5872 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5873 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5874 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5875 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5876 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5877 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5878 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5880 /* Controls for GPIO pins, assuming they are configured as outputs */
5881 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5882 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5883 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5884 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5886 /* Switches to allow the digital IO pins to be enabled. The datasheet
5887 * is ambigious as to which NID is which; testing on laptops which
5888 * make this output available should provide clarification.
5890 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5891 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5893 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5894 * this output to turn on an external amplifier.
5896 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5897 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5901 static struct hda_verb alc260_test_init_verbs[] = {
5902 /* Enable all GPIOs as outputs with an initial value of 0 */
5903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5904 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5905 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5907 /* Enable retasking pins as output, initially without power amp */
5908 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5909 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5912 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5915 /* Disable digital (SPDIF) pins initially, but users can enable
5916 * them via a mixer switch. In the case of SPDIF-out, this initverb
5917 * payload also sets the generation to 0, output to be in "consumer"
5918 * PCM format, copyright asserted, no pre-emphasis and no validity
5921 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5922 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5924 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5925 * OUT1 sum bus when acting as an output.
5927 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5928 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5929 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5930 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5932 /* Start with output sum widgets muted and their output gains at min */
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5941 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5943 /* Unmute retasking pin widget output buffers since the default
5944 * state appears to be output. As the pin mode is changed by the
5945 * user the pin mode control will take care of enabling the pin's
5946 * input/output buffers as needed.
5948 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5950 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5952 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5953 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5954 /* Also unmute the mono-out pin widget */
5955 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5957 /* Mute capture amp left and right */
5958 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5959 /* Set ADC connection select to match default mixer setting (mic1
5962 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5964 /* Do the same for the second ADC: mute capture input amp and
5965 * set ADC connection to mic1 pin
5967 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5970 /* Mute all inputs to mixer widget (even unconnected ones) */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5984 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5985 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5987 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5988 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5991 * for BIOS auto-configuration
5994 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5995 const char *pfx, int *vol_bits)
5998 unsigned long vol_val, sw_val;
6001 if (nid >= 0x0f && nid < 0x11) {
6002 nid_vol = nid - 0x7;
6003 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6004 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6005 } else if (nid == 0x11) {
6006 nid_vol = nid - 0x7;
6007 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6008 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6009 } else if (nid >= 0x12 && nid <= 0x15) {
6011 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6012 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6016 if (!(*vol_bits & (1 << nid_vol))) {
6017 /* first control for the volume widget */
6018 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6021 *vol_bits |= (1 << nid_vol);
6023 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6029 /* add playback controls from the parsed DAC table */
6030 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6031 const struct auto_pin_cfg *cfg)
6037 spec->multiout.num_dacs = 1;
6038 spec->multiout.dac_nids = spec->private_dac_nids;
6039 spec->multiout.dac_nids[0] = 0x02;
6041 nid = cfg->line_out_pins[0];
6044 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6046 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6050 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6055 nid = cfg->speaker_pins[0];
6057 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6062 nid = cfg->hp_pins[0];
6064 err = alc260_add_playback_controls(spec, nid, "Headphone",
6072 /* create playback/capture controls for input pins */
6073 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6074 const struct auto_pin_cfg *cfg)
6076 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6079 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6080 hda_nid_t nid, int pin_type,
6083 alc_set_pin_output(codec, nid, pin_type);
6084 /* need the manual connection? */
6086 int idx = nid - 0x12;
6087 snd_hda_codec_write(codec, idx + 0x0b, 0,
6088 AC_VERB_SET_CONNECT_SEL, sel_idx);
6092 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6094 struct alc_spec *spec = codec->spec;
6097 nid = spec->autocfg.line_out_pins[0];
6099 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6100 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6103 nid = spec->autocfg.speaker_pins[0];
6105 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6107 nid = spec->autocfg.hp_pins[0];
6109 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6112 #define ALC260_PIN_CD_NID 0x16
6113 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6115 struct alc_spec *spec = codec->spec;
6118 for (i = 0; i < AUTO_PIN_LAST; i++) {
6119 hda_nid_t nid = spec->autocfg.input_pins[i];
6121 alc_set_input_pin(codec, nid, i);
6122 if (nid != ALC260_PIN_CD_NID &&
6123 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6124 snd_hda_codec_write(codec, nid, 0,
6125 AC_VERB_SET_AMP_GAIN_MUTE,
6132 * generic initialization of ADC, input mixers and output mixers
6134 static struct hda_verb alc260_volume_init_verbs[] = {
6136 * Unmute ADC0-1 and set the default input to mic-in
6138 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6139 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6140 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6141 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6143 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6145 * Note: PASD motherboards uses the Line In 2 as the input for
6146 * front panel mic (mic 2)
6148 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6149 /* mute analog inputs */
6150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6151 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6152 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6153 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6157 * Set up output mixers (0x08 - 0x0a)
6159 /* set vol=0 to output mixers */
6160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6162 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6163 /* set up input amps for analog loopback */
6164 /* Amp Indices: DAC = 0, mixer = 1 */
6165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6166 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6168 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6169 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6175 static int alc260_parse_auto_config(struct hda_codec *codec)
6177 struct alc_spec *spec = codec->spec;
6179 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6181 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6185 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6188 if (!spec->kctls.list)
6189 return 0; /* can't find valid BIOS pin config */
6190 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6194 spec->multiout.max_channels = 2;
6196 if (spec->autocfg.dig_outs)
6197 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6198 if (spec->kctls.list)
6199 add_mixer(spec, spec->kctls.list);
6201 add_verb(spec, alc260_volume_init_verbs);
6203 spec->num_mux_defs = 1;
6204 spec->input_mux = &spec->private_imux[0];
6206 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6211 /* additional initialization for auto-configuration model */
6212 static void alc260_auto_init(struct hda_codec *codec)
6214 struct alc_spec *spec = codec->spec;
6215 alc260_auto_init_multi_out(codec);
6216 alc260_auto_init_analog_input(codec);
6217 if (spec->unsol_event)
6218 alc_inithook(codec);
6221 #ifdef CONFIG_SND_HDA_POWER_SAVE
6222 static struct hda_amp_list alc260_loopbacks[] = {
6223 { 0x07, HDA_INPUT, 0 },
6224 { 0x07, HDA_INPUT, 1 },
6225 { 0x07, HDA_INPUT, 2 },
6226 { 0x07, HDA_INPUT, 3 },
6227 { 0x07, HDA_INPUT, 4 },
6233 * ALC260 configurations
6235 static const char *alc260_models[ALC260_MODEL_LAST] = {
6236 [ALC260_BASIC] = "basic",
6238 [ALC260_HP_3013] = "hp-3013",
6239 [ALC260_HP_DC7600] = "hp-dc7600",
6240 [ALC260_FUJITSU_S702X] = "fujitsu",
6241 [ALC260_ACER] = "acer",
6242 [ALC260_WILL] = "will",
6243 [ALC260_REPLACER_672V] = "replacer",
6244 [ALC260_FAVORIT100] = "favorit100",
6245 #ifdef CONFIG_SND_DEBUG
6246 [ALC260_TEST] = "test",
6248 [ALC260_AUTO] = "auto",
6251 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6252 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6253 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6254 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6255 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6256 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6257 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6258 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6259 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6260 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6261 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6262 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6263 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6264 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6265 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6266 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6267 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6268 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6269 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6270 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6271 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6275 static struct alc_config_preset alc260_presets[] = {
6277 .mixers = { alc260_base_output_mixer,
6278 alc260_input_mixer },
6279 .init_verbs = { alc260_init_verbs },
6280 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6281 .dac_nids = alc260_dac_nids,
6282 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6283 .adc_nids = alc260_adc_nids,
6284 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6285 .channel_mode = alc260_modes,
6286 .input_mux = &alc260_capture_source,
6289 .mixers = { alc260_hp_output_mixer,
6290 alc260_input_mixer },
6291 .init_verbs = { alc260_init_verbs,
6292 alc260_hp_unsol_verbs },
6293 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6294 .dac_nids = alc260_dac_nids,
6295 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6296 .adc_nids = alc260_adc_nids_alt,
6297 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6298 .channel_mode = alc260_modes,
6299 .input_mux = &alc260_capture_source,
6300 .unsol_event = alc260_hp_unsol_event,
6301 .init_hook = alc260_hp_automute,
6303 [ALC260_HP_DC7600] = {
6304 .mixers = { alc260_hp_dc7600_mixer,
6305 alc260_input_mixer },
6306 .init_verbs = { alc260_init_verbs,
6307 alc260_hp_dc7600_verbs },
6308 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6309 .dac_nids = alc260_dac_nids,
6310 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6311 .adc_nids = alc260_adc_nids_alt,
6312 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6313 .channel_mode = alc260_modes,
6314 .input_mux = &alc260_capture_source,
6315 .unsol_event = alc260_hp_3012_unsol_event,
6316 .init_hook = alc260_hp_3012_automute,
6318 [ALC260_HP_3013] = {
6319 .mixers = { alc260_hp_3013_mixer,
6320 alc260_input_mixer },
6321 .init_verbs = { alc260_hp_3013_init_verbs,
6322 alc260_hp_3013_unsol_verbs },
6323 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6324 .dac_nids = alc260_dac_nids,
6325 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6326 .adc_nids = alc260_adc_nids_alt,
6327 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6328 .channel_mode = alc260_modes,
6329 .input_mux = &alc260_capture_source,
6330 .unsol_event = alc260_hp_3013_unsol_event,
6331 .init_hook = alc260_hp_3013_automute,
6333 [ALC260_FUJITSU_S702X] = {
6334 .mixers = { alc260_fujitsu_mixer },
6335 .init_verbs = { alc260_fujitsu_init_verbs },
6336 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6337 .dac_nids = alc260_dac_nids,
6338 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6339 .adc_nids = alc260_dual_adc_nids,
6340 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6341 .channel_mode = alc260_modes,
6342 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6343 .input_mux = alc260_fujitsu_capture_sources,
6346 .mixers = { alc260_acer_mixer },
6347 .init_verbs = { alc260_acer_init_verbs },
6348 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6349 .dac_nids = alc260_dac_nids,
6350 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6351 .adc_nids = alc260_dual_adc_nids,
6352 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6353 .channel_mode = alc260_modes,
6354 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6355 .input_mux = alc260_acer_capture_sources,
6357 [ALC260_FAVORIT100] = {
6358 .mixers = { alc260_favorit100_mixer },
6359 .init_verbs = { alc260_favorit100_init_verbs },
6360 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6361 .dac_nids = alc260_dac_nids,
6362 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6363 .adc_nids = alc260_dual_adc_nids,
6364 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6365 .channel_mode = alc260_modes,
6366 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6367 .input_mux = alc260_favorit100_capture_sources,
6370 .mixers = { alc260_will_mixer },
6371 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6372 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6373 .dac_nids = alc260_dac_nids,
6374 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6375 .adc_nids = alc260_adc_nids,
6376 .dig_out_nid = ALC260_DIGOUT_NID,
6377 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6378 .channel_mode = alc260_modes,
6379 .input_mux = &alc260_capture_source,
6381 [ALC260_REPLACER_672V] = {
6382 .mixers = { alc260_replacer_672v_mixer },
6383 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6384 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6385 .dac_nids = alc260_dac_nids,
6386 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6387 .adc_nids = alc260_adc_nids,
6388 .dig_out_nid = ALC260_DIGOUT_NID,
6389 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6390 .channel_mode = alc260_modes,
6391 .input_mux = &alc260_capture_source,
6392 .unsol_event = alc260_replacer_672v_unsol_event,
6393 .init_hook = alc260_replacer_672v_automute,
6395 #ifdef CONFIG_SND_DEBUG
6397 .mixers = { alc260_test_mixer },
6398 .init_verbs = { alc260_test_init_verbs },
6399 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6400 .dac_nids = alc260_test_dac_nids,
6401 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6402 .adc_nids = alc260_test_adc_nids,
6403 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6404 .channel_mode = alc260_modes,
6405 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6406 .input_mux = alc260_test_capture_sources,
6411 static int patch_alc260(struct hda_codec *codec)
6413 struct alc_spec *spec;
6414 int err, board_config;
6416 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6422 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6425 if (board_config < 0) {
6426 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6428 board_config = ALC260_AUTO;
6431 if (board_config == ALC260_AUTO) {
6432 /* automatic parse from the BIOS config */
6433 err = alc260_parse_auto_config(codec);
6439 "hda_codec: Cannot set up configuration "
6440 "from BIOS. Using base mode...\n");
6441 board_config = ALC260_BASIC;
6445 err = snd_hda_attach_beep_device(codec, 0x1);
6451 if (board_config != ALC260_AUTO)
6452 setup_preset(codec, &alc260_presets[board_config]);
6454 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6455 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6457 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6458 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6460 if (!spec->adc_nids && spec->input_mux) {
6461 /* check whether NID 0x04 is valid */
6462 unsigned int wcap = get_wcaps(codec, 0x04);
6463 wcap = get_wcaps_type(wcap);
6465 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6466 spec->adc_nids = alc260_adc_nids_alt;
6467 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6469 spec->adc_nids = alc260_adc_nids;
6470 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6473 set_capture_mixer(codec);
6474 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6476 spec->vmaster_nid = 0x08;
6478 codec->patch_ops = alc_patch_ops;
6479 if (board_config == ALC260_AUTO)
6480 spec->init_hook = alc260_auto_init;
6481 #ifdef CONFIG_SND_HDA_POWER_SAVE
6482 if (!spec->loopback.amplist)
6483 spec->loopback.amplist = alc260_loopbacks;
6485 codec->proc_widget_hook = print_realtek_coef;
6492 * ALC882/883/885/888/889 support
6494 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6495 * configuration. Each pin widget can choose any input DACs and a mixer.
6496 * Each ADC is connected from a mixer of all inputs. This makes possible
6497 * 6-channel independent captures.
6499 * In addition, an independent DAC for the multi-playback (not used in this
6502 #define ALC882_DIGOUT_NID 0x06
6503 #define ALC882_DIGIN_NID 0x0a
6504 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6505 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6506 #define ALC1200_DIGOUT_NID 0x10
6509 static struct hda_channel_mode alc882_ch_modes[1] = {
6514 static hda_nid_t alc882_dac_nids[4] = {
6515 /* front, rear, clfe, rear_surr */
6516 0x02, 0x03, 0x04, 0x05
6518 #define alc883_dac_nids alc882_dac_nids
6521 #define alc882_adc_nids alc880_adc_nids
6522 #define alc882_adc_nids_alt alc880_adc_nids_alt
6523 #define alc883_adc_nids alc882_adc_nids_alt
6524 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6525 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6526 #define alc889_adc_nids alc880_adc_nids
6528 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6529 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6530 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6531 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6532 #define alc889_capsrc_nids alc882_capsrc_nids
6535 /* FIXME: should be a matrix-type input source selection */
6537 static struct hda_input_mux alc882_capture_source = {
6541 { "Front Mic", 0x1 },
6547 #define alc883_capture_source alc882_capture_source
6549 static struct hda_input_mux alc889_capture_source = {
6552 { "Front Mic", 0x0 },
6558 static struct hda_input_mux mb5_capture_source = {
6567 static struct hda_input_mux alc883_3stack_6ch_intel = {
6571 { "Front Mic", 0x0 },
6577 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6585 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6595 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6603 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6607 { "Front Mic", 0x1 },
6612 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6620 static struct hda_input_mux alc889A_mb31_capture_source = {
6624 /* Front Mic (0x01) unused */
6626 /* Line 2 (0x03) unused */
6627 /* CD (0x04) unsused? */
6634 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6641 static struct hda_verb alc882_3ST_ch2_init[] = {
6642 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6643 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6652 static struct hda_verb alc882_3ST_ch4_init[] = {
6653 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6654 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6655 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6656 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6657 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6664 static struct hda_verb alc882_3ST_ch6_init[] = {
6665 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6666 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6667 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6668 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6669 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6670 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6674 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6675 { 2, alc882_3ST_ch2_init },
6676 { 4, alc882_3ST_ch4_init },
6677 { 6, alc882_3ST_ch6_init },
6680 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6685 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6686 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6687 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6688 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6689 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6690 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6697 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6698 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6699 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6700 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6703 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6710 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6711 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6712 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6713 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6714 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6715 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6716 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6717 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6721 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6722 { 2, alc883_3ST_ch2_clevo_init },
6723 { 4, alc883_3ST_ch4_clevo_init },
6724 { 6, alc883_3ST_ch6_clevo_init },
6731 static struct hda_verb alc882_sixstack_ch6_init[] = {
6732 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6733 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6734 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6735 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6742 static struct hda_verb alc882_sixstack_ch8_init[] = {
6743 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6744 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6745 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6746 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6750 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6751 { 6, alc882_sixstack_ch6_init },
6752 { 8, alc882_sixstack_ch8_init },
6756 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6762 static struct hda_verb alc885_mbp_ch2_init[] = {
6763 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6764 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6765 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6772 static struct hda_verb alc885_mbp_ch4_init[] = {
6773 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6774 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6775 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6776 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6777 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6781 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6782 { 2, alc885_mbp_ch2_init },
6783 { 4, alc885_mbp_ch4_init },
6788 * Speakers/Woofer/HP = Front
6791 static struct hda_verb alc885_mb5_ch2_init[] = {
6792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6799 * Speakers/HP = Front
6803 static struct hda_verb alc885_mb5_ch6_init[] = {
6804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6810 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6811 { 2, alc885_mb5_ch2_init },
6812 { 6, alc885_mb5_ch6_init },
6819 static struct hda_verb alc883_4ST_ch2_init[] = {
6820 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6821 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6822 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6823 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6824 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6825 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6832 static struct hda_verb alc883_4ST_ch4_init[] = {
6833 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6835 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6836 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6837 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6838 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6839 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6846 static struct hda_verb alc883_4ST_ch6_init[] = {
6847 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6848 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6851 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6854 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6861 static struct hda_verb alc883_4ST_ch8_init[] = {
6862 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6863 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6864 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6865 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6866 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6867 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6870 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6874 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6875 { 2, alc883_4ST_ch2_init },
6876 { 4, alc883_4ST_ch4_init },
6877 { 6, alc883_4ST_ch6_init },
6878 { 8, alc883_4ST_ch8_init },
6885 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6886 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6887 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6888 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6889 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6896 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6897 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6898 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6899 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6900 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6901 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6908 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6909 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6910 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6911 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6912 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6913 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6914 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6918 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6919 { 2, alc883_3ST_ch2_intel_init },
6920 { 4, alc883_3ST_ch4_intel_init },
6921 { 6, alc883_3ST_ch6_intel_init },
6927 static struct hda_verb alc889_ch2_intel_init[] = {
6928 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6929 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6930 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6931 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6932 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6933 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6940 static struct hda_verb alc889_ch6_intel_init[] = {
6941 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6942 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6943 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6944 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6945 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6946 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6953 static struct hda_verb alc889_ch8_intel_init[] = {
6954 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6955 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6956 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6957 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6958 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6960 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6964 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6965 { 2, alc889_ch2_intel_init },
6966 { 6, alc889_ch6_intel_init },
6967 { 8, alc889_ch8_intel_init },
6973 static struct hda_verb alc883_sixstack_ch6_init[] = {
6974 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6975 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6976 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6977 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6984 static struct hda_verb alc883_sixstack_ch8_init[] = {
6985 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6987 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6992 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6993 { 6, alc883_sixstack_ch6_init },
6994 { 8, alc883_sixstack_ch8_init },
6998 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6999 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7001 static struct snd_kcontrol_new alc882_base_mixer[] = {
7002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7005 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7007 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7008 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7009 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7010 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7011 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7018 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7021 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7022 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7026 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7027 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7028 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7030 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7031 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7032 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7033 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7035 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7036 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7041 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7042 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7043 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7044 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7045 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7046 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7047 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7048 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7049 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7051 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7053 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7054 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7055 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7059 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7060 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7061 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7062 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7063 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7064 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7065 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7067 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7068 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7073 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7074 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7075 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7086 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7088 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7098 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7103 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7104 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7106 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7108 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7109 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7110 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7111 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7112 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7115 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7116 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7123 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7137 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7140 .name = "Channel Mode",
7141 .info = alc_ch_mode_info,
7142 .get = alc_ch_mode_get,
7143 .put = alc_ch_mode_put,
7148 static struct hda_verb alc882_base_init_verbs[] = {
7149 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7155 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7156 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7159 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7160 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7163 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7164 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7166 /* mute analog input loopbacks */
7167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7173 /* Front Pin: output 0 (0x0c) */
7174 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7175 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7176 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7177 /* Rear Pin: output 1 (0x0d) */
7178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7181 /* CLFE Pin: output 2 (0x0e) */
7182 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7184 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7185 /* Side Pin: output 3 (0x0f) */
7186 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7188 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7189 /* Mic (rear) pin: input vref at 80% */
7190 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7191 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7192 /* Front Mic pin: input vref at 80% */
7193 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7194 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7195 /* Line In pin: input */
7196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7197 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7198 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7199 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7200 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7201 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7202 /* CD pin widget for input */
7203 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7205 /* FIXME: use matrix-type input source selection */
7206 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7210 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7211 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7213 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7217 /* ADC2: mute amp left and right */
7218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7220 /* ADC3: mute amp left and right */
7221 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7222 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7227 static struct hda_verb alc882_adc1_init_verbs[] = {
7228 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7230 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7231 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7233 /* ADC1: mute amp left and right */
7234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7235 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7239 static struct hda_verb alc882_eapd_verbs[] = {
7240 /* change to EAPD mode */
7241 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7242 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7246 static struct hda_verb alc889_eapd_verbs[] = {
7247 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7248 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7252 static struct hda_verb alc_hp15_unsol_verbs[] = {
7253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7258 static struct hda_verb alc885_init_verbs[] = {
7259 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7270 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7272 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7273 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7274 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7276 /* mute analog input loopbacks */
7277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7281 /* Front HP Pin: output 0 (0x0c) */
7282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7285 /* Front Pin: output 0 (0x0c) */
7286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7288 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7289 /* Rear Pin: output 1 (0x0d) */
7290 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7292 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7293 /* CLFE Pin: output 2 (0x0e) */
7294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7295 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7296 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7297 /* Side Pin: output 3 (0x0f) */
7298 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7299 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7300 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7301 /* Mic (rear) pin: input vref at 80% */
7302 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7303 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7304 /* Front Mic pin: input vref at 80% */
7305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7307 /* Line In pin: input */
7308 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7309 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7311 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7317 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7321 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7324 /* ADC2: mute amp left and right */
7325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7326 /* ADC3: mute amp left and right */
7327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7332 static struct hda_verb alc885_init_input_verbs[] = {
7333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7340 /* Unmute Selector 24h and set the default input to front mic */
7341 static struct hda_verb alc889_init_input_verbs[] = {
7342 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7348 #define alc883_init_verbs alc882_base_init_verbs
7351 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7352 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7353 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7355 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7356 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7357 /* FIXME: this looks suspicious...
7358 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7359 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7364 static struct hda_verb alc882_macpro_init_verbs[] = {
7365 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7369 /* Front Pin: output 0 (0x0c) */
7370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7371 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7373 /* Front Mic pin: input vref at 80% */
7374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7376 /* Speaker: output */
7377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7379 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7380 /* Headphone output (output 0 - 0x0c) */
7381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7383 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7385 /* FIXME: use matrix-type input source selection */
7386 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7387 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7389 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7402 /* ADC1: mute amp left and right */
7403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7404 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7405 /* ADC2: mute amp left and right */
7406 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7408 /* ADC3: mute amp left and right */
7409 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7410 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7416 static struct hda_verb alc885_mb5_init_verbs[] = {
7418 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7419 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7420 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7421 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7426 /* Surround mixer */
7427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7431 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7435 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7436 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7437 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7438 /* Front Pin (0x0c) */
7439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7441 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7442 /* LFE Pin (0x0e) */
7443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7445 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7449 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7450 /* Front Mic pin: input vref at 80% */
7451 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7464 /* Macbook Pro rev3 */
7465 static struct hda_verb alc885_mbp3_init_verbs[] = {
7466 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7478 /* Front Pin: output 0 (0x0c) */
7479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7481 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7482 /* HP Pin: output 0 (0x0e) */
7483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7486 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7487 /* Mic (rear) pin: input vref at 80% */
7488 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7490 /* Front Mic pin: input vref at 80% */
7491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7492 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7493 /* Line In pin: use output 1 when in LineOut mode */
7494 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7496 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7498 /* FIXME: use matrix-type input source selection */
7499 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7500 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7502 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7503 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7507 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7515 /* ADC1: mute amp left and right */
7516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7517 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7518 /* ADC2: mute amp left and right */
7519 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7520 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7521 /* ADC3: mute amp left and right */
7522 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7523 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7529 static struct hda_verb alc885_imac91_init_verbs[] = {
7530 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7538 /* HP Pin: output 0 (0x0c) */
7539 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7540 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7541 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7542 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7543 /* Internal Speakers: output 0 (0x0d) */
7544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7545 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7547 /* Mic (rear) pin: input vref at 80% */
7548 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7549 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7550 /* Front Mic pin: input vref at 80% */
7551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7553 /* Line In pin: use output 1 when in LineOut mode */
7554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7555 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7556 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7558 /* FIXME: use matrix-type input source selection */
7559 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7560 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7561 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7562 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7563 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7564 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7567 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7575 /* ADC1: mute amp left and right */
7576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7577 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7578 /* ADC2: mute amp left and right */
7579 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7580 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7581 /* ADC3: mute amp left and right */
7582 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7583 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7588 /* iMac 24 mixer. */
7589 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7590 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7591 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7595 /* iMac 24 init verbs. */
7596 static struct hda_verb alc885_imac24_init_verbs[] = {
7597 /* Internal speakers: output 0 (0x0c) */
7598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7600 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7601 /* Internal speakers: output 0 (0x0c) */
7602 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7603 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7604 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7605 /* Headphone: output 0 (0x0c) */
7606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7608 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7609 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7610 /* Front Mic: input vref at 80% */
7611 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7612 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7616 /* Toggle speaker-output according to the hp-jack state */
7617 static void alc885_imac24_setup(struct hda_codec *codec)
7619 struct alc_spec *spec = codec->spec;
7621 spec->autocfg.hp_pins[0] = 0x14;
7622 spec->autocfg.speaker_pins[0] = 0x18;
7623 spec->autocfg.speaker_pins[1] = 0x1a;
7626 static void alc885_mbp3_setup(struct hda_codec *codec)
7628 struct alc_spec *spec = codec->spec;
7630 spec->autocfg.hp_pins[0] = 0x15;
7631 spec->autocfg.speaker_pins[0] = 0x14;
7634 static void alc885_imac91_automute(struct hda_codec *codec)
7636 unsigned int present;
7638 present = snd_hda_codec_read(codec, 0x14, 0,
7639 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7640 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7641 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7642 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7643 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7647 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7650 /* Headphone insertion or removal. */
7651 if ((res >> 26) == ALC880_HP_EVENT)
7652 alc885_imac91_automute(codec);
7655 static struct hda_verb alc882_targa_verbs[] = {
7656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7660 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7662 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7663 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7664 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7666 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7670 /* toggle speaker-output according to the hp-jack state */
7671 static void alc882_targa_automute(struct hda_codec *codec)
7673 struct alc_spec *spec = codec->spec;
7674 alc_automute_amp(codec);
7675 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7676 spec->jack_present ? 1 : 3);
7679 static void alc882_targa_setup(struct hda_codec *codec)
7681 struct alc_spec *spec = codec->spec;
7683 spec->autocfg.hp_pins[0] = 0x14;
7684 spec->autocfg.speaker_pins[0] = 0x1b;
7687 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7689 if ((res >> 26) == ALC880_HP_EVENT)
7690 alc882_targa_automute(codec);
7693 static struct hda_verb alc882_asus_a7j_verbs[] = {
7694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7697 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7701 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7703 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7705 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7706 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7707 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7711 static struct hda_verb alc882_asus_a7m_verbs[] = {
7712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7713 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7717 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7719 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7720 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7721 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7723 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7724 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7725 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7729 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7731 unsigned int gpiostate, gpiomask, gpiodir;
7733 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7734 AC_VERB_GET_GPIO_DATA, 0);
7737 gpiostate |= (1 << pin);
7739 gpiostate &= ~(1 << pin);
7741 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7742 AC_VERB_GET_GPIO_MASK, 0);
7743 gpiomask |= (1 << pin);
7745 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7746 AC_VERB_GET_GPIO_DIRECTION, 0);
7747 gpiodir |= (1 << pin);
7750 snd_hda_codec_write(codec, codec->afg, 0,
7751 AC_VERB_SET_GPIO_MASK, gpiomask);
7752 snd_hda_codec_write(codec, codec->afg, 0,
7753 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7757 snd_hda_codec_write(codec, codec->afg, 0,
7758 AC_VERB_SET_GPIO_DATA, gpiostate);
7761 /* set up GPIO at initialization */
7762 static void alc885_macpro_init_hook(struct hda_codec *codec)
7764 alc882_gpio_mute(codec, 0, 0);
7765 alc882_gpio_mute(codec, 1, 0);
7768 /* set up GPIO and update auto-muting at initialization */
7769 static void alc885_imac24_init_hook(struct hda_codec *codec)
7771 alc885_macpro_init_hook(codec);
7772 alc_automute_amp(codec);
7776 * generic initialization of ADC, input mixers and output mixers
7778 static struct hda_verb alc883_auto_init_verbs[] = {
7780 * Unmute ADC0-2 and set the default input to mic-in
7782 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7784 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7787 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7789 * Note: PASD motherboards uses the Line In 2 as the input for
7790 * front panel mic (mic 2)
7792 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7800 * Set up output mixers (0x0c - 0x0f)
7802 /* set vol=0 to output mixers */
7803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7806 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7807 /* set up input amps for analog loopback */
7808 /* Amp Indices: DAC = 0, mixer = 1 */
7809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7815 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7816 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7817 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7818 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7820 /* FIXME: use matrix-type input source selection */
7821 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7836 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7837 static struct hda_verb alc889A_mb31_ch2_init[] = {
7838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7840 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7845 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7846 static struct hda_verb alc889A_mb31_ch4_init[] = {
7847 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7848 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7854 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7855 static struct hda_verb alc889A_mb31_ch5_init[] = {
7856 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7863 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7864 static struct hda_verb alc889A_mb31_ch6_init[] = {
7865 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7866 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7867 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7872 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7873 { 2, alc889A_mb31_ch2_init },
7874 { 4, alc889A_mb31_ch4_init },
7875 { 5, alc889A_mb31_ch5_init },
7876 { 6, alc889A_mb31_ch6_init },
7879 static struct hda_verb alc883_medion_eapd_verbs[] = {
7880 /* eanable EAPD on medion laptop */
7881 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7882 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7886 #define alc883_base_mixer alc882_base_mixer
7888 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7889 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7890 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7891 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7892 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7893 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7894 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7900 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7901 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7905 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7906 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7907 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7909 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7911 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7913 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7914 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7915 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7919 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7921 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7922 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7923 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7925 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7926 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7927 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7929 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7933 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7936 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7945 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7946 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7950 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7954 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7955 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7956 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7957 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7958 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7963 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7966 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7973 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7974 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7975 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7977 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7978 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7980 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7981 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7982 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7997 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7999 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8001 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8002 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8004 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8005 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8006 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8008 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8021 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8022 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8023 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8026 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8027 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8029 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8033 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8034 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8040 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8044 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8048 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8050 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8051 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8052 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8053 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8054 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8065 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8066 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8067 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8069 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8070 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8071 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8077 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8081 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8082 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8083 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8085 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8086 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8090 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8093 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8094 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8102 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8103 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8104 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8110 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8111 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8115 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8116 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8118 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8124 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8128 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8130 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8140 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8141 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8142 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8143 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8144 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8147 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8148 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8151 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8155 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8157 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8159 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8160 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8161 0x0d, 1, 0x0, HDA_OUTPUT),
8162 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8164 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8165 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8176 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8180 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8182 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8183 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8184 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8185 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8186 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8188 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8189 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8190 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8191 /* Output switches */
8192 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8193 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8194 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8196 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8197 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8201 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8202 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8206 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8211 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8216 static struct hda_bind_ctls alc883_bind_cap_vol = {
8217 .ops = &snd_hda_bind_vol,
8219 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8220 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8225 static struct hda_bind_ctls alc883_bind_cap_switch = {
8226 .ops = &snd_hda_bind_sw,
8228 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8229 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8234 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8235 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8236 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8246 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8247 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8248 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8251 /* .name = "Capture Source", */
8252 .name = "Input Source",
8254 .info = alc_mux_enum_info,
8255 .get = alc_mux_enum_get,
8256 .put = alc_mux_enum_put,
8261 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8263 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8264 .name = "Channel Mode",
8265 .info = alc_ch_mode_info,
8266 .get = alc_ch_mode_get,
8267 .put = alc_ch_mode_put,
8272 /* toggle speaker-output according to the hp-jack state */
8273 static void alc883_mitac_setup(struct hda_codec *codec)
8275 struct alc_spec *spec = codec->spec;
8277 spec->autocfg.hp_pins[0] = 0x15;
8278 spec->autocfg.speaker_pins[0] = 0x14;
8279 spec->autocfg.speaker_pins[1] = 0x17;
8282 /* auto-toggle front mic */
8284 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8286 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8288 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8292 static struct hda_verb alc883_mitac_verbs[] = {
8294 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8297 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8298 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8300 /* enable unsolicited event */
8301 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8302 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8307 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8310 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8312 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8314 /* enable unsolicited event */
8316 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8317 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8323 static struct hda_verb alc883_clevo_m720_verbs[] = {
8325 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8328 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8331 /* enable unsolicited event */
8332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8333 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8338 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8340 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8346 /* enable unsolicited event */
8347 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8352 static struct hda_verb alc883_targa_verbs[] = {
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8357 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8359 /* Connect Line-Out side jack (SPDIF) to Side */
8360 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8361 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8362 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8363 /* Connect Mic jack to CLFE */
8364 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8365 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8366 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8367 /* Connect Line-in jack to Surround */
8368 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8369 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8370 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8371 /* Connect HP out jack to Front */
8372 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8373 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8374 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8376 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8381 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8384 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8388 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8389 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8391 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8396 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8399 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8400 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8405 static struct hda_verb alc883_haier_w66_verbs[] = {
8406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8411 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8412 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8413 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8414 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8418 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8423 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8424 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8425 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8426 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8430 static struct hda_verb alc888_6st_dell_verbs[] = {
8431 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8435 static struct hda_verb alc883_vaiott_verbs[] = {
8437 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8440 /* enable unsolicited event */
8441 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8446 static void alc888_3st_hp_setup(struct hda_codec *codec)
8448 struct alc_spec *spec = codec->spec;
8450 spec->autocfg.hp_pins[0] = 0x1b;
8451 spec->autocfg.speaker_pins[0] = 0x14;
8452 spec->autocfg.speaker_pins[1] = 0x16;
8453 spec->autocfg.speaker_pins[2] = 0x18;
8456 static struct hda_verb alc888_3st_hp_verbs[] = {
8457 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8458 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8459 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8460 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8467 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8468 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8469 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8470 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8471 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8478 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8479 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8480 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8481 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8482 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8483 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8490 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8491 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8492 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8493 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8494 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8495 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8496 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8500 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8501 { 2, alc888_3st_hp_2ch_init },
8502 { 4, alc888_3st_hp_4ch_init },
8503 { 6, alc888_3st_hp_6ch_init },
8506 /* toggle front-jack and RCA according to the hp-jack state */
8507 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8509 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8511 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8512 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8513 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8514 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8517 /* toggle RCA according to the front-jack state */
8518 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8520 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8522 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8523 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8526 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8529 if ((res >> 26) == ALC880_HP_EVENT)
8530 alc888_lenovo_ms7195_front_automute(codec);
8531 if ((res >> 26) == ALC880_FRONT_EVENT)
8532 alc888_lenovo_ms7195_rca_automute(codec);
8535 static struct hda_verb alc883_medion_md2_verbs[] = {
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8539 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8541 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8545 /* toggle speaker-output according to the hp-jack state */
8546 static void alc883_medion_md2_setup(struct hda_codec *codec)
8548 struct alc_spec *spec = codec->spec;
8550 spec->autocfg.hp_pins[0] = 0x14;
8551 spec->autocfg.speaker_pins[0] = 0x15;
8554 /* toggle speaker-output according to the hp-jack state */
8555 #define alc883_targa_init_hook alc882_targa_init_hook
8556 #define alc883_targa_unsol_event alc882_targa_unsol_event
8558 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8560 unsigned int present;
8562 present = snd_hda_jack_detect(codec, 0x18);
8563 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8564 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8567 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8569 struct alc_spec *spec = codec->spec;
8571 spec->autocfg.hp_pins[0] = 0x15;
8572 spec->autocfg.speaker_pins[0] = 0x14;
8575 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8577 alc_automute_amp(codec);
8578 alc883_clevo_m720_mic_automute(codec);
8581 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8584 switch (res >> 26) {
8585 case ALC880_MIC_EVENT:
8586 alc883_clevo_m720_mic_automute(codec);
8589 alc_automute_amp_unsol_event(codec, res);
8594 /* toggle speaker-output according to the hp-jack state */
8595 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8597 struct alc_spec *spec = codec->spec;
8599 spec->autocfg.hp_pins[0] = 0x14;
8600 spec->autocfg.speaker_pins[0] = 0x15;
8603 static void alc883_haier_w66_setup(struct hda_codec *codec)
8605 struct alc_spec *spec = codec->spec;
8607 spec->autocfg.hp_pins[0] = 0x1b;
8608 spec->autocfg.speaker_pins[0] = 0x14;
8611 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8613 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8615 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8616 HDA_AMP_MUTE, bits);
8619 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8621 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8623 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8624 HDA_AMP_MUTE, bits);
8625 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8626 HDA_AMP_MUTE, bits);
8629 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8632 if ((res >> 26) == ALC880_HP_EVENT)
8633 alc883_lenovo_101e_all_automute(codec);
8634 if ((res >> 26) == ALC880_FRONT_EVENT)
8635 alc883_lenovo_101e_ispeaker_automute(codec);
8638 /* toggle speaker-output according to the hp-jack state */
8639 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8641 struct alc_spec *spec = codec->spec;
8643 spec->autocfg.hp_pins[0] = 0x14;
8644 spec->autocfg.speaker_pins[0] = 0x15;
8645 spec->autocfg.speaker_pins[1] = 0x16;
8648 static struct hda_verb alc883_acer_eapd_verbs[] = {
8649 /* HP Pin: output 0 (0x0c) */
8650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8651 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8652 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8653 /* Front Pin: output 0 (0x0c) */
8654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8655 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8657 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8658 /* eanable EAPD on medion laptop */
8659 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8660 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8661 /* enable unsolicited event */
8662 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8666 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8668 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8669 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8673 static void alc888_6st_dell_setup(struct hda_codec *codec)
8675 struct alc_spec *spec = codec->spec;
8677 spec->autocfg.hp_pins[0] = 0x1b;
8678 spec->autocfg.speaker_pins[0] = 0x14;
8679 spec->autocfg.speaker_pins[1] = 0x15;
8680 spec->autocfg.speaker_pins[2] = 0x16;
8681 spec->autocfg.speaker_pins[3] = 0x17;
8684 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8686 struct alc_spec *spec = codec->spec;
8688 spec->autocfg.hp_pins[0] = 0x1b;
8689 spec->autocfg.speaker_pins[0] = 0x14;
8690 spec->autocfg.speaker_pins[1] = 0x15;
8691 spec->autocfg.speaker_pins[2] = 0x16;
8692 spec->autocfg.speaker_pins[3] = 0x17;
8693 spec->autocfg.speaker_pins[4] = 0x1a;
8696 static void alc883_vaiott_setup(struct hda_codec *codec)
8698 struct alc_spec *spec = codec->spec;
8700 spec->autocfg.hp_pins[0] = 0x15;
8701 spec->autocfg.speaker_pins[0] = 0x14;
8702 spec->autocfg.speaker_pins[1] = 0x17;
8705 static struct hda_verb alc888_asus_m90v_verbs[] = {
8706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8709 /* enable unsolicited event */
8710 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8711 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8715 static void alc883_mode2_setup(struct hda_codec *codec)
8717 struct alc_spec *spec = codec->spec;
8719 spec->autocfg.hp_pins[0] = 0x1b;
8720 spec->autocfg.speaker_pins[0] = 0x14;
8721 spec->autocfg.speaker_pins[1] = 0x15;
8722 spec->autocfg.speaker_pins[2] = 0x16;
8723 spec->ext_mic.pin = 0x18;
8724 spec->int_mic.pin = 0x19;
8725 spec->ext_mic.mux_idx = 0;
8726 spec->int_mic.mux_idx = 1;
8730 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8734 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8735 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8736 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8737 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8738 /* enable unsolicited event */
8739 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8743 static void alc883_eee1601_inithook(struct hda_codec *codec)
8745 struct alc_spec *spec = codec->spec;
8747 spec->autocfg.hp_pins[0] = 0x14;
8748 spec->autocfg.speaker_pins[0] = 0x1b;
8749 alc_automute_pin(codec);
8752 static struct hda_verb alc889A_mb31_verbs[] = {
8753 /* Init rear pin (used as headphone output) */
8754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8755 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8756 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8757 /* Init line pin (used as output in 4ch and 6ch mode) */
8758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8759 /* Init line 2 pin (used as headphone out by default) */
8760 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8761 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8765 /* Mute speakers according to the headphone jack state */
8766 static void alc889A_mb31_automute(struct hda_codec *codec)
8768 unsigned int present;
8770 /* Mute only in 2ch or 4ch mode */
8771 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8773 present = snd_hda_jack_detect(codec, 0x15);
8774 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8775 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8776 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8777 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8781 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8783 if ((res >> 26) == ALC880_HP_EVENT)
8784 alc889A_mb31_automute(codec);
8788 #ifdef CONFIG_SND_HDA_POWER_SAVE
8789 #define alc882_loopbacks alc880_loopbacks
8792 /* pcm configuration: identical with ALC880 */
8793 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8794 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8795 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8796 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8798 static hda_nid_t alc883_slave_dig_outs[] = {
8799 ALC1200_DIGOUT_NID, 0,
8802 static hda_nid_t alc1200_slave_dig_outs[] = {
8803 ALC883_DIGOUT_NID, 0,
8807 * configuration and preset
8809 static const char *alc882_models[ALC882_MODEL_LAST] = {
8810 [ALC882_3ST_DIG] = "3stack-dig",
8811 [ALC882_6ST_DIG] = "6stack-dig",
8812 [ALC882_ARIMA] = "arima",
8813 [ALC882_W2JC] = "w2jc",
8814 [ALC882_TARGA] = "targa",
8815 [ALC882_ASUS_A7J] = "asus-a7j",
8816 [ALC882_ASUS_A7M] = "asus-a7m",
8817 [ALC885_MACPRO] = "macpro",
8818 [ALC885_MB5] = "mb5",
8819 [ALC885_MBP3] = "mbp3",
8820 [ALC885_IMAC24] = "imac24",
8821 [ALC885_IMAC91] = "imac91",
8822 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8823 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8824 [ALC883_3ST_6ch] = "3stack-6ch",
8825 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8826 [ALC883_TARGA_DIG] = "targa-dig",
8827 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8828 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8829 [ALC883_ACER] = "acer",
8830 [ALC883_ACER_ASPIRE] = "acer-aspire",
8831 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8832 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8833 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8834 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8835 [ALC883_MEDION] = "medion",
8836 [ALC883_MEDION_MD2] = "medion-md2",
8837 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8838 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8839 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8840 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8841 [ALC888_LENOVO_SKY] = "lenovo-sky",
8842 [ALC883_HAIER_W66] = "haier-w66",
8843 [ALC888_3ST_HP] = "3stack-hp",
8844 [ALC888_6ST_DELL] = "6stack-dell",
8845 [ALC883_MITAC] = "mitac",
8846 [ALC883_CLEVO_M540R] = "clevo-m540r",
8847 [ALC883_CLEVO_M720] = "clevo-m720",
8848 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8849 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8850 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8851 [ALC889A_INTEL] = "intel-alc889a",
8852 [ALC889_INTEL] = "intel-x58",
8853 [ALC1200_ASUS_P5Q] = "asus-p5q",
8854 [ALC889A_MB31] = "mb31",
8855 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8856 [ALC882_AUTO] = "auto",
8859 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8860 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8862 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8863 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8864 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8865 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8866 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8867 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8868 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8869 ALC888_ACER_ASPIRE_4930G),
8870 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8871 ALC888_ACER_ASPIRE_4930G),
8872 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8873 ALC888_ACER_ASPIRE_8930G),
8874 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8875 ALC888_ACER_ASPIRE_8930G),
8876 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8877 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8878 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8879 ALC888_ACER_ASPIRE_6530G),
8880 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8881 ALC888_ACER_ASPIRE_6530G),
8882 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8883 ALC888_ACER_ASPIRE_7730G),
8884 /* default Acer -- disabled as it causes more problems.
8885 * model=auto should work fine now
8887 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8889 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8891 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8892 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8893 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8894 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8895 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8896 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8898 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8899 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8900 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8901 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8902 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8903 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8904 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8905 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8906 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8907 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8908 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8910 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8911 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8912 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8913 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8914 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8915 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8916 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8917 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8918 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8921 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8922 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8923 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8924 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8925 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8926 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8927 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8928 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8929 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8930 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8931 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8932 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8933 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8934 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8935 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8936 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8937 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8938 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8939 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8940 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8941 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8942 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8943 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8944 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8945 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8946 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8947 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8948 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8950 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8951 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8952 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8953 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
8954 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8955 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8956 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8957 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8958 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8959 ALC883_FUJITSU_PI2515),
8960 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8961 ALC888_FUJITSU_XA3530),
8962 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8963 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8964 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8965 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8966 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8967 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8968 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8969 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8970 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8972 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8973 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8974 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8975 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8976 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8977 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8978 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8983 /* codec SSID table for Intel Mac */
8984 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8985 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8986 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8987 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8988 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8989 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8990 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8991 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8992 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8993 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8994 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8995 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
8996 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8997 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
8998 * so apparently no perfect solution yet
9000 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9001 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9005 static struct alc_config_preset alc882_presets[] = {
9006 [ALC882_3ST_DIG] = {
9007 .mixers = { alc882_base_mixer },
9008 .init_verbs = { alc882_base_init_verbs,
9009 alc882_adc1_init_verbs },
9010 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9011 .dac_nids = alc882_dac_nids,
9012 .dig_out_nid = ALC882_DIGOUT_NID,
9013 .dig_in_nid = ALC882_DIGIN_NID,
9014 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9015 .channel_mode = alc882_ch_modes,
9017 .input_mux = &alc882_capture_source,
9019 [ALC882_6ST_DIG] = {
9020 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9021 .init_verbs = { alc882_base_init_verbs,
9022 alc882_adc1_init_verbs },
9023 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9024 .dac_nids = alc882_dac_nids,
9025 .dig_out_nid = ALC882_DIGOUT_NID,
9026 .dig_in_nid = ALC882_DIGIN_NID,
9027 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9028 .channel_mode = alc882_sixstack_modes,
9029 .input_mux = &alc882_capture_source,
9032 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9033 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9034 alc882_eapd_verbs },
9035 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9036 .dac_nids = alc882_dac_nids,
9037 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9038 .channel_mode = alc882_sixstack_modes,
9039 .input_mux = &alc882_capture_source,
9042 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9043 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9044 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9045 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9046 .dac_nids = alc882_dac_nids,
9047 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9048 .channel_mode = alc880_threestack_modes,
9050 .input_mux = &alc882_capture_source,
9051 .dig_out_nid = ALC882_DIGOUT_NID,
9054 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9055 .init_verbs = { alc885_mbp3_init_verbs,
9056 alc880_gpio1_init_verbs },
9058 .dac_nids = alc882_dac_nids,
9060 .channel_mode = alc885_mbp_4ch_modes,
9061 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9062 .input_mux = &alc882_capture_source,
9063 .dig_out_nid = ALC882_DIGOUT_NID,
9064 .dig_in_nid = ALC882_DIGIN_NID,
9065 .unsol_event = alc_automute_amp_unsol_event,
9066 .setup = alc885_mbp3_setup,
9067 .init_hook = alc_automute_amp,
9070 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9071 .init_verbs = { alc885_mb5_init_verbs,
9072 alc880_gpio1_init_verbs },
9073 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9074 .dac_nids = alc882_dac_nids,
9075 .channel_mode = alc885_mb5_6ch_modes,
9076 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9077 .input_mux = &mb5_capture_source,
9078 .dig_out_nid = ALC882_DIGOUT_NID,
9079 .dig_in_nid = ALC882_DIGIN_NID,
9082 .mixers = { alc882_macpro_mixer },
9083 .init_verbs = { alc882_macpro_init_verbs },
9084 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9085 .dac_nids = alc882_dac_nids,
9086 .dig_out_nid = ALC882_DIGOUT_NID,
9087 .dig_in_nid = ALC882_DIGIN_NID,
9088 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9089 .channel_mode = alc882_ch_modes,
9090 .input_mux = &alc882_capture_source,
9091 .init_hook = alc885_macpro_init_hook,
9094 .mixers = { alc885_imac24_mixer },
9095 .init_verbs = { alc885_imac24_init_verbs },
9096 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9097 .dac_nids = alc882_dac_nids,
9098 .dig_out_nid = ALC882_DIGOUT_NID,
9099 .dig_in_nid = ALC882_DIGIN_NID,
9100 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9101 .channel_mode = alc882_ch_modes,
9102 .input_mux = &alc882_capture_source,
9103 .unsol_event = alc_automute_amp_unsol_event,
9104 .setup = alc885_imac24_setup,
9105 .init_hook = alc885_imac24_init_hook,
9108 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9109 .init_verbs = { alc885_imac91_init_verbs,
9110 alc880_gpio1_init_verbs },
9111 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9112 .dac_nids = alc882_dac_nids,
9113 .channel_mode = alc885_mbp_4ch_modes,
9114 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9115 .input_mux = &alc882_capture_source,
9116 .dig_out_nid = ALC882_DIGOUT_NID,
9117 .dig_in_nid = ALC882_DIGIN_NID,
9118 .unsol_event = alc885_imac91_unsol_event,
9119 .init_hook = alc885_imac91_automute,
9122 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9123 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9124 alc880_gpio3_init_verbs, alc882_targa_verbs},
9125 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9126 .dac_nids = alc882_dac_nids,
9127 .dig_out_nid = ALC882_DIGOUT_NID,
9128 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9129 .adc_nids = alc882_adc_nids,
9130 .capsrc_nids = alc882_capsrc_nids,
9131 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9132 .channel_mode = alc882_3ST_6ch_modes,
9134 .input_mux = &alc882_capture_source,
9135 .unsol_event = alc882_targa_unsol_event,
9136 .setup = alc882_targa_setup,
9137 .init_hook = alc882_targa_automute,
9139 [ALC882_ASUS_A7J] = {
9140 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9141 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9142 alc882_asus_a7j_verbs},
9143 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9144 .dac_nids = alc882_dac_nids,
9145 .dig_out_nid = ALC882_DIGOUT_NID,
9146 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9147 .adc_nids = alc882_adc_nids,
9148 .capsrc_nids = alc882_capsrc_nids,
9149 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9150 .channel_mode = alc882_3ST_6ch_modes,
9152 .input_mux = &alc882_capture_source,
9154 [ALC882_ASUS_A7M] = {
9155 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9156 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9157 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9158 alc882_asus_a7m_verbs },
9159 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9160 .dac_nids = alc882_dac_nids,
9161 .dig_out_nid = ALC882_DIGOUT_NID,
9162 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9163 .channel_mode = alc880_threestack_modes,
9165 .input_mux = &alc882_capture_source,
9167 [ALC883_3ST_2ch_DIG] = {
9168 .mixers = { alc883_3ST_2ch_mixer },
9169 .init_verbs = { alc883_init_verbs },
9170 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9171 .dac_nids = alc883_dac_nids,
9172 .dig_out_nid = ALC883_DIGOUT_NID,
9173 .dig_in_nid = ALC883_DIGIN_NID,
9174 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9175 .channel_mode = alc883_3ST_2ch_modes,
9176 .input_mux = &alc883_capture_source,
9178 [ALC883_3ST_6ch_DIG] = {
9179 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9180 .init_verbs = { alc883_init_verbs },
9181 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9182 .dac_nids = alc883_dac_nids,
9183 .dig_out_nid = ALC883_DIGOUT_NID,
9184 .dig_in_nid = ALC883_DIGIN_NID,
9185 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9186 .channel_mode = alc883_3ST_6ch_modes,
9188 .input_mux = &alc883_capture_source,
9190 [ALC883_3ST_6ch] = {
9191 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9192 .init_verbs = { alc883_init_verbs },
9193 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9194 .dac_nids = alc883_dac_nids,
9195 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9196 .channel_mode = alc883_3ST_6ch_modes,
9198 .input_mux = &alc883_capture_source,
9200 [ALC883_3ST_6ch_INTEL] = {
9201 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9202 .init_verbs = { alc883_init_verbs },
9203 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9204 .dac_nids = alc883_dac_nids,
9205 .dig_out_nid = ALC883_DIGOUT_NID,
9206 .dig_in_nid = ALC883_DIGIN_NID,
9207 .slave_dig_outs = alc883_slave_dig_outs,
9208 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9209 .channel_mode = alc883_3ST_6ch_intel_modes,
9211 .input_mux = &alc883_3stack_6ch_intel,
9214 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9215 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9216 alc_hp15_unsol_verbs },
9217 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9218 .dac_nids = alc883_dac_nids,
9219 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9220 .adc_nids = alc889_adc_nids,
9221 .dig_out_nid = ALC883_DIGOUT_NID,
9222 .dig_in_nid = ALC883_DIGIN_NID,
9223 .slave_dig_outs = alc883_slave_dig_outs,
9224 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9225 .channel_mode = alc889_8ch_intel_modes,
9226 .capsrc_nids = alc889_capsrc_nids,
9227 .input_mux = &alc889_capture_source,
9228 .setup = alc889_automute_setup,
9229 .init_hook = alc_automute_amp,
9230 .unsol_event = alc_automute_amp_unsol_event,
9234 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9235 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9236 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9237 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9238 .dac_nids = alc883_dac_nids,
9239 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9240 .adc_nids = alc889_adc_nids,
9241 .capsrc_nids = alc889_capsrc_nids,
9242 .capsrc_nids = alc889_capsrc_nids,
9243 .dig_out_nid = ALC883_DIGOUT_NID,
9244 .dig_in_nid = ALC883_DIGIN_NID,
9245 .slave_dig_outs = alc883_slave_dig_outs,
9246 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9247 .channel_mode = alc889_8ch_intel_modes,
9248 .capsrc_nids = alc889_capsrc_nids,
9249 .input_mux = &alc889_capture_source,
9250 .setup = alc889_automute_setup,
9251 .init_hook = alc889_intel_init_hook,
9252 .unsol_event = alc_automute_amp_unsol_event,
9255 [ALC883_6ST_DIG] = {
9256 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9257 .init_verbs = { alc883_init_verbs },
9258 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9259 .dac_nids = alc883_dac_nids,
9260 .dig_out_nid = ALC883_DIGOUT_NID,
9261 .dig_in_nid = ALC883_DIGIN_NID,
9262 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9263 .channel_mode = alc883_sixstack_modes,
9264 .input_mux = &alc883_capture_source,
9266 [ALC883_TARGA_DIG] = {
9267 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9268 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9269 alc883_targa_verbs},
9270 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9271 .dac_nids = alc883_dac_nids,
9272 .dig_out_nid = ALC883_DIGOUT_NID,
9273 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9274 .channel_mode = alc883_3ST_6ch_modes,
9276 .input_mux = &alc883_capture_source,
9277 .unsol_event = alc883_targa_unsol_event,
9278 .setup = alc882_targa_setup,
9279 .init_hook = alc882_targa_automute,
9281 [ALC883_TARGA_2ch_DIG] = {
9282 .mixers = { alc883_targa_2ch_mixer},
9283 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9284 alc883_targa_verbs},
9285 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9286 .dac_nids = alc883_dac_nids,
9287 .adc_nids = alc883_adc_nids_alt,
9288 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9289 .capsrc_nids = alc883_capsrc_nids,
9290 .dig_out_nid = ALC883_DIGOUT_NID,
9291 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9292 .channel_mode = alc883_3ST_2ch_modes,
9293 .input_mux = &alc883_capture_source,
9294 .unsol_event = alc883_targa_unsol_event,
9295 .setup = alc882_targa_setup,
9296 .init_hook = alc882_targa_automute,
9298 [ALC883_TARGA_8ch_DIG] = {
9299 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9300 alc883_chmode_mixer },
9301 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9302 alc883_targa_verbs },
9303 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9304 .dac_nids = alc883_dac_nids,
9305 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9306 .adc_nids = alc883_adc_nids_rev,
9307 .capsrc_nids = alc883_capsrc_nids_rev,
9308 .dig_out_nid = ALC883_DIGOUT_NID,
9309 .dig_in_nid = ALC883_DIGIN_NID,
9310 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9311 .channel_mode = alc883_4ST_8ch_modes,
9313 .input_mux = &alc883_capture_source,
9314 .unsol_event = alc883_targa_unsol_event,
9315 .setup = alc882_targa_setup,
9316 .init_hook = alc882_targa_automute,
9319 .mixers = { alc883_base_mixer },
9320 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9321 * and the headphone jack. Turn this on and rely on the
9322 * standard mute methods whenever the user wants to turn
9323 * these outputs off.
9325 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9329 .channel_mode = alc883_3ST_2ch_modes,
9330 .input_mux = &alc883_capture_source,
9332 [ALC883_ACER_ASPIRE] = {
9333 .mixers = { alc883_acer_aspire_mixer },
9334 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9335 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9336 .dac_nids = alc883_dac_nids,
9337 .dig_out_nid = ALC883_DIGOUT_NID,
9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9339 .channel_mode = alc883_3ST_2ch_modes,
9340 .input_mux = &alc883_capture_source,
9341 .unsol_event = alc_automute_amp_unsol_event,
9342 .setup = alc883_acer_aspire_setup,
9343 .init_hook = alc_automute_amp,
9345 [ALC888_ACER_ASPIRE_4930G] = {
9346 .mixers = { alc888_base_mixer,
9347 alc883_chmode_mixer },
9348 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9349 alc888_acer_aspire_4930g_verbs },
9350 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9351 .dac_nids = alc883_dac_nids,
9352 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9353 .adc_nids = alc883_adc_nids_rev,
9354 .capsrc_nids = alc883_capsrc_nids_rev,
9355 .dig_out_nid = ALC883_DIGOUT_NID,
9356 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9357 .channel_mode = alc883_3ST_6ch_modes,
9360 ARRAY_SIZE(alc888_2_capture_sources),
9361 .input_mux = alc888_2_capture_sources,
9362 .unsol_event = alc_automute_amp_unsol_event,
9363 .setup = alc888_acer_aspire_4930g_setup,
9364 .init_hook = alc_automute_amp,
9366 [ALC888_ACER_ASPIRE_6530G] = {
9367 .mixers = { alc888_acer_aspire_6530_mixer },
9368 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9369 alc888_acer_aspire_6530g_verbs },
9370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9371 .dac_nids = alc883_dac_nids,
9372 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9373 .adc_nids = alc883_adc_nids_rev,
9374 .capsrc_nids = alc883_capsrc_nids_rev,
9375 .dig_out_nid = ALC883_DIGOUT_NID,
9376 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9377 .channel_mode = alc883_3ST_2ch_modes,
9379 ARRAY_SIZE(alc888_2_capture_sources),
9380 .input_mux = alc888_acer_aspire_6530_sources,
9381 .unsol_event = alc_automute_amp_unsol_event,
9382 .setup = alc888_acer_aspire_6530g_setup,
9383 .init_hook = alc_automute_amp,
9385 [ALC888_ACER_ASPIRE_8930G] = {
9386 .mixers = { alc888_base_mixer,
9387 alc883_chmode_mixer },
9388 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9389 alc889_acer_aspire_8930g_verbs },
9390 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9391 .dac_nids = alc883_dac_nids,
9392 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9393 .adc_nids = alc889_adc_nids,
9394 .capsrc_nids = alc889_capsrc_nids,
9395 .dig_out_nid = ALC883_DIGOUT_NID,
9396 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9397 .channel_mode = alc883_3ST_6ch_modes,
9399 .const_channel_count = 6,
9401 ARRAY_SIZE(alc889_capture_sources),
9402 .input_mux = alc889_capture_sources,
9403 .unsol_event = alc_automute_amp_unsol_event,
9404 .setup = alc889_acer_aspire_8930g_setup,
9405 .init_hook = alc_automute_amp,
9407 [ALC888_ACER_ASPIRE_7730G] = {
9408 .mixers = { alc883_3ST_6ch_mixer,
9409 alc883_chmode_mixer },
9410 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9411 alc888_acer_aspire_7730G_verbs },
9412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9413 .dac_nids = alc883_dac_nids,
9414 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9415 .adc_nids = alc883_adc_nids_rev,
9416 .capsrc_nids = alc883_capsrc_nids_rev,
9417 .dig_out_nid = ALC883_DIGOUT_NID,
9418 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9419 .channel_mode = alc883_3ST_6ch_modes,
9421 .const_channel_count = 6,
9422 .input_mux = &alc883_capture_source,
9423 .unsol_event = alc_automute_amp_unsol_event,
9424 .setup = alc888_acer_aspire_6530g_setup,
9425 .init_hook = alc_automute_amp,
9428 .mixers = { alc883_fivestack_mixer,
9429 alc883_chmode_mixer },
9430 .init_verbs = { alc883_init_verbs,
9431 alc883_medion_eapd_verbs },
9432 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9433 .dac_nids = alc883_dac_nids,
9434 .adc_nids = alc883_adc_nids_alt,
9435 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9436 .capsrc_nids = alc883_capsrc_nids,
9437 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9438 .channel_mode = alc883_sixstack_modes,
9439 .input_mux = &alc883_capture_source,
9441 [ALC883_MEDION_MD2] = {
9442 .mixers = { alc883_medion_md2_mixer},
9443 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9444 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9445 .dac_nids = alc883_dac_nids,
9446 .dig_out_nid = ALC883_DIGOUT_NID,
9447 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9448 .channel_mode = alc883_3ST_2ch_modes,
9449 .input_mux = &alc883_capture_source,
9450 .unsol_event = alc_automute_amp_unsol_event,
9451 .setup = alc883_medion_md2_setup,
9452 .init_hook = alc_automute_amp,
9454 [ALC883_LAPTOP_EAPD] = {
9455 .mixers = { alc883_base_mixer },
9456 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9458 .dac_nids = alc883_dac_nids,
9459 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9460 .channel_mode = alc883_3ST_2ch_modes,
9461 .input_mux = &alc883_capture_source,
9463 [ALC883_CLEVO_M540R] = {
9464 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9465 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9466 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9467 .dac_nids = alc883_dac_nids,
9468 .dig_out_nid = ALC883_DIGOUT_NID,
9469 .dig_in_nid = ALC883_DIGIN_NID,
9470 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9471 .channel_mode = alc883_3ST_6ch_clevo_modes,
9473 .input_mux = &alc883_capture_source,
9474 /* This machine has the hardware HP auto-muting, thus
9475 * we need no software mute via unsol event
9478 [ALC883_CLEVO_M720] = {
9479 .mixers = { alc883_clevo_m720_mixer },
9480 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9481 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9482 .dac_nids = alc883_dac_nids,
9483 .dig_out_nid = ALC883_DIGOUT_NID,
9484 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9485 .channel_mode = alc883_3ST_2ch_modes,
9486 .input_mux = &alc883_capture_source,
9487 .unsol_event = alc883_clevo_m720_unsol_event,
9488 .setup = alc883_clevo_m720_setup,
9489 .init_hook = alc883_clevo_m720_init_hook,
9491 [ALC883_LENOVO_101E_2ch] = {
9492 .mixers = { alc883_lenovo_101e_2ch_mixer},
9493 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9494 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9495 .dac_nids = alc883_dac_nids,
9496 .adc_nids = alc883_adc_nids_alt,
9497 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9498 .capsrc_nids = alc883_capsrc_nids,
9499 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9500 .channel_mode = alc883_3ST_2ch_modes,
9501 .input_mux = &alc883_lenovo_101e_capture_source,
9502 .unsol_event = alc883_lenovo_101e_unsol_event,
9503 .init_hook = alc883_lenovo_101e_all_automute,
9505 [ALC883_LENOVO_NB0763] = {
9506 .mixers = { alc883_lenovo_nb0763_mixer },
9507 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9508 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9509 .dac_nids = alc883_dac_nids,
9510 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9511 .channel_mode = alc883_3ST_2ch_modes,
9513 .input_mux = &alc883_lenovo_nb0763_capture_source,
9514 .unsol_event = alc_automute_amp_unsol_event,
9515 .setup = alc883_medion_md2_setup,
9516 .init_hook = alc_automute_amp,
9518 [ALC888_LENOVO_MS7195_DIG] = {
9519 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9520 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9521 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9522 .dac_nids = alc883_dac_nids,
9523 .dig_out_nid = ALC883_DIGOUT_NID,
9524 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9525 .channel_mode = alc883_3ST_6ch_modes,
9527 .input_mux = &alc883_capture_source,
9528 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9529 .init_hook = alc888_lenovo_ms7195_front_automute,
9531 [ALC883_HAIER_W66] = {
9532 .mixers = { alc883_targa_2ch_mixer},
9533 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9534 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9535 .dac_nids = alc883_dac_nids,
9536 .dig_out_nid = ALC883_DIGOUT_NID,
9537 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9538 .channel_mode = alc883_3ST_2ch_modes,
9539 .input_mux = &alc883_capture_source,
9540 .unsol_event = alc_automute_amp_unsol_event,
9541 .setup = alc883_haier_w66_setup,
9542 .init_hook = alc_automute_amp,
9545 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9546 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9548 .dac_nids = alc883_dac_nids,
9549 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9550 .channel_mode = alc888_3st_hp_modes,
9552 .input_mux = &alc883_capture_source,
9553 .unsol_event = alc_automute_amp_unsol_event,
9554 .setup = alc888_3st_hp_setup,
9555 .init_hook = alc_automute_amp,
9557 [ALC888_6ST_DELL] = {
9558 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9559 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9560 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9561 .dac_nids = alc883_dac_nids,
9562 .dig_out_nid = ALC883_DIGOUT_NID,
9563 .dig_in_nid = ALC883_DIGIN_NID,
9564 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9565 .channel_mode = alc883_sixstack_modes,
9566 .input_mux = &alc883_capture_source,
9567 .unsol_event = alc_automute_amp_unsol_event,
9568 .setup = alc888_6st_dell_setup,
9569 .init_hook = alc_automute_amp,
9572 .mixers = { alc883_mitac_mixer },
9573 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9575 .dac_nids = alc883_dac_nids,
9576 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9577 .channel_mode = alc883_3ST_2ch_modes,
9578 .input_mux = &alc883_capture_source,
9579 .unsol_event = alc_automute_amp_unsol_event,
9580 .setup = alc883_mitac_setup,
9581 .init_hook = alc_automute_amp,
9583 [ALC883_FUJITSU_PI2515] = {
9584 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9585 .init_verbs = { alc883_init_verbs,
9586 alc883_2ch_fujitsu_pi2515_verbs},
9587 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9588 .dac_nids = alc883_dac_nids,
9589 .dig_out_nid = ALC883_DIGOUT_NID,
9590 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9591 .channel_mode = alc883_3ST_2ch_modes,
9592 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9593 .unsol_event = alc_automute_amp_unsol_event,
9594 .setup = alc883_2ch_fujitsu_pi2515_setup,
9595 .init_hook = alc_automute_amp,
9597 [ALC888_FUJITSU_XA3530] = {
9598 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9599 .init_verbs = { alc883_init_verbs,
9600 alc888_fujitsu_xa3530_verbs },
9601 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9602 .dac_nids = alc883_dac_nids,
9603 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9604 .adc_nids = alc883_adc_nids_rev,
9605 .capsrc_nids = alc883_capsrc_nids_rev,
9606 .dig_out_nid = ALC883_DIGOUT_NID,
9607 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9608 .channel_mode = alc888_4ST_8ch_intel_modes,
9610 ARRAY_SIZE(alc888_2_capture_sources),
9611 .input_mux = alc888_2_capture_sources,
9612 .unsol_event = alc_automute_amp_unsol_event,
9613 .setup = alc888_fujitsu_xa3530_setup,
9614 .init_hook = alc_automute_amp,
9616 [ALC888_LENOVO_SKY] = {
9617 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9618 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9620 .dac_nids = alc883_dac_nids,
9621 .dig_out_nid = ALC883_DIGOUT_NID,
9622 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9623 .channel_mode = alc883_sixstack_modes,
9625 .input_mux = &alc883_lenovo_sky_capture_source,
9626 .unsol_event = alc_automute_amp_unsol_event,
9627 .setup = alc888_lenovo_sky_setup,
9628 .init_hook = alc_automute_amp,
9630 [ALC888_ASUS_M90V] = {
9631 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9632 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9633 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9634 .dac_nids = alc883_dac_nids,
9635 .dig_out_nid = ALC883_DIGOUT_NID,
9636 .dig_in_nid = ALC883_DIGIN_NID,
9637 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9638 .channel_mode = alc883_3ST_6ch_modes,
9640 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9641 .unsol_event = alc_sku_unsol_event,
9642 .setup = alc883_mode2_setup,
9643 .init_hook = alc_inithook,
9645 [ALC888_ASUS_EEE1601] = {
9646 .mixers = { alc883_asus_eee1601_mixer },
9647 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9648 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9649 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9650 .dac_nids = alc883_dac_nids,
9651 .dig_out_nid = ALC883_DIGOUT_NID,
9652 .dig_in_nid = ALC883_DIGIN_NID,
9653 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9654 .channel_mode = alc883_3ST_2ch_modes,
9656 .input_mux = &alc883_asus_eee1601_capture_source,
9657 .unsol_event = alc_sku_unsol_event,
9658 .init_hook = alc883_eee1601_inithook,
9660 [ALC1200_ASUS_P5Q] = {
9661 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9662 .init_verbs = { alc883_init_verbs },
9663 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9664 .dac_nids = alc883_dac_nids,
9665 .dig_out_nid = ALC1200_DIGOUT_NID,
9666 .dig_in_nid = ALC883_DIGIN_NID,
9667 .slave_dig_outs = alc1200_slave_dig_outs,
9668 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9669 .channel_mode = alc883_sixstack_modes,
9670 .input_mux = &alc883_capture_source,
9673 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9674 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9675 alc880_gpio1_init_verbs },
9676 .adc_nids = alc883_adc_nids,
9677 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9678 .capsrc_nids = alc883_capsrc_nids,
9679 .dac_nids = alc883_dac_nids,
9680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9681 .channel_mode = alc889A_mb31_6ch_modes,
9682 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9683 .input_mux = &alc889A_mb31_capture_source,
9684 .dig_out_nid = ALC883_DIGOUT_NID,
9685 .unsol_event = alc889A_mb31_unsol_event,
9686 .init_hook = alc889A_mb31_automute,
9688 [ALC883_SONY_VAIO_TT] = {
9689 .mixers = { alc883_vaiott_mixer },
9690 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9691 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9692 .dac_nids = alc883_dac_nids,
9693 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9694 .channel_mode = alc883_3ST_2ch_modes,
9695 .input_mux = &alc883_capture_source,
9696 .unsol_event = alc_automute_amp_unsol_event,
9697 .setup = alc883_vaiott_setup,
9698 .init_hook = alc_automute_amp,
9707 PINFIX_ABIT_AW9D_MAX
9710 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9711 { 0x15, 0x01080104 }, /* side */
9712 { 0x16, 0x01011012 }, /* rear */
9713 { 0x17, 0x01016011 }, /* clfe */
9717 static const struct alc_fixup alc882_fixups[] = {
9718 [PINFIX_ABIT_AW9D_MAX] = {
9719 .pins = alc882_abit_aw9d_pinfix
9723 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9724 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9729 * BIOS auto configuration
9731 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9732 const struct auto_pin_cfg *cfg)
9734 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9737 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9738 hda_nid_t nid, int pin_type,
9742 struct alc_spec *spec = codec->spec;
9745 alc_set_pin_output(codec, nid, pin_type);
9746 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9749 idx = spec->multiout.dac_nids[dac_idx] - 2;
9750 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9754 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9756 struct alc_spec *spec = codec->spec;
9759 for (i = 0; i <= HDA_SIDE; i++) {
9760 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9761 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9763 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9768 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9770 struct alc_spec *spec = codec->spec;
9773 pin = spec->autocfg.hp_pins[0];
9774 if (pin) /* connect to front */
9776 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9777 pin = spec->autocfg.speaker_pins[0];
9779 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9782 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9784 struct alc_spec *spec = codec->spec;
9787 for (i = 0; i < AUTO_PIN_LAST; i++) {
9788 hda_nid_t nid = spec->autocfg.input_pins[i];
9791 alc_set_input_pin(codec, nid, i);
9792 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9793 snd_hda_codec_write(codec, nid, 0,
9794 AC_VERB_SET_AMP_GAIN_MUTE,
9799 static void alc882_auto_init_input_src(struct hda_codec *codec)
9801 struct alc_spec *spec = codec->spec;
9804 for (c = 0; c < spec->num_adc_nids; c++) {
9805 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9806 hda_nid_t nid = spec->capsrc_nids[c];
9807 unsigned int mux_idx;
9808 const struct hda_input_mux *imux;
9809 int conns, mute, idx, item;
9811 conns = snd_hda_get_connections(codec, nid, conn_list,
9812 ARRAY_SIZE(conn_list));
9815 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9816 imux = &spec->input_mux[mux_idx];
9817 for (idx = 0; idx < conns; idx++) {
9818 /* if the current connection is the selected one,
9819 * unmute it as default - otherwise mute it
9821 mute = AMP_IN_MUTE(idx);
9822 for (item = 0; item < imux->num_items; item++) {
9823 if (imux->items[item].index == idx) {
9824 if (spec->cur_mux[c] == item)
9825 mute = AMP_IN_UNMUTE(idx);
9829 /* check if we have a selector or mixer
9830 * we could check for the widget type instead, but
9831 * just check for Amp-In presence (in case of mixer
9832 * without amp-in there is something wrong, this
9833 * function shouldn't be used or capsrc nid is wrong)
9835 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9836 snd_hda_codec_write(codec, nid, 0,
9837 AC_VERB_SET_AMP_GAIN_MUTE,
9839 else if (mute != AMP_IN_MUTE(idx))
9840 snd_hda_codec_write(codec, nid, 0,
9841 AC_VERB_SET_CONNECT_SEL,
9847 /* add mic boosts if needed */
9848 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9850 struct alc_spec *spec = codec->spec;
9854 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9855 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9856 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9858 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9862 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9863 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9864 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9866 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9873 /* almost identical with ALC880 parser... */
9874 static int alc882_parse_auto_config(struct hda_codec *codec)
9876 struct alc_spec *spec = codec->spec;
9877 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9880 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9884 if (!spec->autocfg.line_outs)
9885 return 0; /* can't find valid BIOS pin config */
9887 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9890 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9893 err = alc880_auto_create_extra_out(spec,
9894 spec->autocfg.speaker_pins[0],
9898 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9902 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9906 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9908 /* check multiple SPDIF-out (for recent codecs) */
9909 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9911 err = snd_hda_get_connections(codec,
9912 spec->autocfg.dig_out_pins[i],
9917 spec->multiout.dig_out_nid = dig_nid;
9919 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9920 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9922 spec->slave_dig_outs[i - 1] = dig_nid;
9925 if (spec->autocfg.dig_in_pin)
9926 spec->dig_in_nid = ALC880_DIGIN_NID;
9928 if (spec->kctls.list)
9929 add_mixer(spec, spec->kctls.list);
9931 add_verb(spec, alc883_auto_init_verbs);
9932 /* if ADC 0x07 is available, initialize it, too */
9933 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
9934 add_verb(spec, alc882_adc1_init_verbs);
9936 spec->num_mux_defs = 1;
9937 spec->input_mux = &spec->private_imux[0];
9939 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
9941 err = alc_auto_add_mic_boost(codec);
9945 return 1; /* config found */
9948 /* additional initialization for auto-configuration model */
9949 static void alc882_auto_init(struct hda_codec *codec)
9951 struct alc_spec *spec = codec->spec;
9952 alc882_auto_init_multi_out(codec);
9953 alc882_auto_init_hp_out(codec);
9954 alc882_auto_init_analog_input(codec);
9955 alc882_auto_init_input_src(codec);
9956 if (spec->unsol_event)
9957 alc_inithook(codec);
9960 static int patch_alc882(struct hda_codec *codec)
9962 struct alc_spec *spec;
9963 int err, board_config;
9965 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9971 switch (codec->vendor_id) {
9976 /* ALC883 and variants */
9977 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9981 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9985 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9986 board_config = snd_hda_check_board_codec_sid_config(codec,
9987 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9989 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9990 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9992 board_config = ALC882_AUTO;
9995 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9997 if (board_config == ALC882_AUTO) {
9998 /* automatic parse from the BIOS config */
9999 err = alc882_parse_auto_config(codec);
10005 "hda_codec: Cannot set up configuration "
10006 "from BIOS. Using base mode...\n");
10007 board_config = ALC882_3ST_DIG;
10011 err = snd_hda_attach_beep_device(codec, 0x1);
10017 if (board_config != ALC882_AUTO)
10018 setup_preset(codec, &alc882_presets[board_config]);
10020 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10021 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10022 /* FIXME: setup DAC5 */
10023 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10024 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10026 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10027 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10029 if (codec->vendor_id == 0x10ec0888)
10030 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10032 if (!spec->adc_nids && spec->input_mux) {
10034 spec->num_adc_nids = 0;
10035 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10036 const struct hda_input_mux *imux = spec->input_mux;
10038 hda_nid_t items[16];
10039 hda_nid_t nid = alc882_adc_nids[i];
10040 unsigned int wcap = get_wcaps(codec, nid);
10042 wcap = get_wcaps_type(wcap);
10043 if (wcap != AC_WID_AUD_IN)
10045 spec->private_adc_nids[spec->num_adc_nids] = nid;
10046 err = snd_hda_get_connections(codec, nid, &cap, 1);
10049 err = snd_hda_get_connections(codec, cap, items,
10050 ARRAY_SIZE(items));
10053 for (j = 0; j < imux->num_items; j++)
10054 if (imux->items[j].index >= err)
10056 if (j < imux->num_items)
10058 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10059 spec->num_adc_nids++;
10061 spec->adc_nids = spec->private_adc_nids;
10062 spec->capsrc_nids = spec->private_capsrc_nids;
10065 set_capture_mixer(codec);
10066 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10068 spec->vmaster_nid = 0x0c;
10070 codec->patch_ops = alc_patch_ops;
10071 if (board_config == ALC882_AUTO)
10072 spec->init_hook = alc882_auto_init;
10073 #ifdef CONFIG_SND_HDA_POWER_SAVE
10074 if (!spec->loopback.amplist)
10075 spec->loopback.amplist = alc882_loopbacks;
10077 codec->proc_widget_hook = print_realtek_coef;
10087 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10088 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10090 #define alc262_dac_nids alc260_dac_nids
10091 #define alc262_adc_nids alc882_adc_nids
10092 #define alc262_adc_nids_alt alc882_adc_nids_alt
10093 #define alc262_capsrc_nids alc882_capsrc_nids
10094 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10096 #define alc262_modes alc260_modes
10097 #define alc262_capture_source alc882_capture_source
10099 static hda_nid_t alc262_dmic_adc_nids[1] = {
10104 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10106 static struct snd_kcontrol_new alc262_base_mixer[] = {
10107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10108 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10118 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10121 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10122 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10126 /* update HP, line and mono-out pins according to the master switch */
10127 static void alc262_hp_master_update(struct hda_codec *codec)
10129 struct alc_spec *spec = codec->spec;
10130 int val = spec->master_sw;
10132 /* HP & line-out */
10133 snd_hda_codec_write_cache(codec, 0x1b, 0,
10134 AC_VERB_SET_PIN_WIDGET_CONTROL,
10136 snd_hda_codec_write_cache(codec, 0x15, 0,
10137 AC_VERB_SET_PIN_WIDGET_CONTROL,
10139 /* mono (speaker) depending on the HP jack sense */
10140 val = val && !spec->jack_present;
10141 snd_hda_codec_write_cache(codec, 0x16, 0,
10142 AC_VERB_SET_PIN_WIDGET_CONTROL,
10143 val ? PIN_OUT : 0);
10146 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10148 struct alc_spec *spec = codec->spec;
10150 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10151 alc262_hp_master_update(codec);
10154 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10156 if ((res >> 26) != ALC880_HP_EVENT)
10158 alc262_hp_bpc_automute(codec);
10161 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10163 struct alc_spec *spec = codec->spec;
10165 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10166 alc262_hp_master_update(codec);
10169 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10172 if ((res >> 26) != ALC880_HP_EVENT)
10174 alc262_hp_wildwest_automute(codec);
10177 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10179 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10180 struct snd_ctl_elem_value *ucontrol)
10182 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10183 struct alc_spec *spec = codec->spec;
10184 int val = !!*ucontrol->value.integer.value;
10186 if (val == spec->master_sw)
10188 spec->master_sw = val;
10189 alc262_hp_master_update(codec);
10193 #define ALC262_HP_MASTER_SWITCH \
10195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10196 .name = "Master Playback Switch", \
10197 .info = snd_ctl_boolean_mono_info, \
10198 .get = alc262_hp_master_sw_get, \
10199 .put = alc262_hp_master_sw_put, \
10202 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10203 ALC262_HP_MASTER_SWITCH,
10204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10205 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10207 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10209 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10216 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10221 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10222 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10226 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10227 ALC262_HP_MASTER_SWITCH,
10228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10229 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10232 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10234 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10238 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10246 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10247 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10248 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10249 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10253 /* mute/unmute internal speaker according to the hp jack and mute state */
10254 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10256 struct alc_spec *spec = codec->spec;
10258 spec->autocfg.hp_pins[0] = 0x15;
10259 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10262 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10263 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10264 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10269 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10273 static struct hda_verb alc262_hp_t5735_verbs[] = {
10274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10281 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10282 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10283 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10285 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10286 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10287 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10291 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10292 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10295 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10297 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10305 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10312 /* bind hp and internal speaker mute (with plug check) as master switch */
10313 static void alc262_hippo_master_update(struct hda_codec *codec)
10315 struct alc_spec *spec = codec->spec;
10316 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10317 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10318 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10322 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10323 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10324 HDA_AMP_MUTE, mute);
10325 /* mute internal speaker per jack sense */
10326 if (spec->jack_present)
10327 mute = HDA_AMP_MUTE;
10329 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10330 HDA_AMP_MUTE, mute);
10331 if (speaker_nid && speaker_nid != line_nid)
10332 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10333 HDA_AMP_MUTE, mute);
10336 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10338 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10339 struct snd_ctl_elem_value *ucontrol)
10341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10342 struct alc_spec *spec = codec->spec;
10343 int val = !!*ucontrol->value.integer.value;
10345 if (val == spec->master_sw)
10347 spec->master_sw = val;
10348 alc262_hippo_master_update(codec);
10352 #define ALC262_HIPPO_MASTER_SWITCH \
10354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10355 .name = "Master Playback Switch", \
10356 .info = snd_ctl_boolean_mono_info, \
10357 .get = alc262_hippo_master_sw_get, \
10358 .put = alc262_hippo_master_sw_put, \
10361 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10362 ALC262_HIPPO_MASTER_SWITCH,
10363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10364 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10365 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10369 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10370 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10371 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10372 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10373 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10374 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10378 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10379 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10380 ALC262_HIPPO_MASTER_SWITCH,
10381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10388 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10389 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10390 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10394 /* mute/unmute internal speaker according to the hp jack and mute state */
10395 static void alc262_hippo_automute(struct hda_codec *codec)
10397 struct alc_spec *spec = codec->spec;
10398 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10400 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10401 alc262_hippo_master_update(codec);
10404 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10406 if ((res >> 26) != ALC880_HP_EVENT)
10408 alc262_hippo_automute(codec);
10411 static void alc262_hippo_setup(struct hda_codec *codec)
10413 struct alc_spec *spec = codec->spec;
10415 spec->autocfg.hp_pins[0] = 0x15;
10416 spec->autocfg.speaker_pins[0] = 0x14;
10419 static void alc262_hippo1_setup(struct hda_codec *codec)
10421 struct alc_spec *spec = codec->spec;
10423 spec->autocfg.hp_pins[0] = 0x1b;
10424 spec->autocfg.speaker_pins[0] = 0x14;
10428 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10429 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10430 ALC262_HIPPO_MASTER_SWITCH,
10431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10433 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10434 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10438 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10439 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10440 ALC262_HIPPO_MASTER_SWITCH,
10441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10442 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10443 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10444 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10445 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10449 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10450 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10451 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10452 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10453 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10455 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10459 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10460 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10461 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10465 static struct hda_verb alc262_tyan_verbs[] = {
10466 /* Headphone automute */
10467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10468 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10471 /* P11 AUX_IN, white 4-pin connector */
10472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10473 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10474 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10475 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10480 /* unsolicited event for HP jack sensing */
10481 static void alc262_tyan_setup(struct hda_codec *codec)
10483 struct alc_spec *spec = codec->spec;
10485 spec->autocfg.hp_pins[0] = 0x1b;
10486 spec->autocfg.speaker_pins[0] = 0x15;
10490 #define alc262_capture_mixer alc882_capture_mixer
10491 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10494 * generic initialization of ADC, input mixers and output mixers
10496 static struct hda_verb alc262_init_verbs[] = {
10498 * Unmute ADC0-2 and set the default input to mic-in
10500 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10502 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10504 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10507 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10509 * Note: PASD motherboards uses the Line In 2 as the input for
10510 * front panel mic (mic 2)
10512 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10520 * Set up output mixers (0x0c - 0x0e)
10522 /* set vol=0 to output mixers */
10523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10526 /* set up input amps for analog loopback */
10527 /* Amp Indices: DAC = 0, mixer = 1 */
10528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10533 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10538 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10540 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10542 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10544 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10545 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10546 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10548 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10549 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10551 /* FIXME: use matrix-type input source selection */
10552 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10553 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10564 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10565 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10572 static struct hda_verb alc262_eapd_verbs[] = {
10573 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10574 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10578 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10579 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10580 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10581 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10583 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10584 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10588 static struct hda_verb alc262_sony_unsol_verbs[] = {
10589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10591 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10598 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10599 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10600 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10607 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10612 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10614 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10615 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10619 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10621 struct alc_spec *spec = codec->spec;
10623 spec->autocfg.hp_pins[0] = 0x15;
10624 spec->autocfg.speaker_pins[0] = 0x14;
10625 spec->ext_mic.pin = 0x18;
10626 spec->ext_mic.mux_idx = 0;
10627 spec->int_mic.pin = 0x12;
10628 spec->int_mic.mux_idx = 9;
10629 spec->auto_mic = 1;
10635 * 0x16 = internal speaker
10636 * 0x18 = external mic
10639 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10640 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10641 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10647 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10652 static struct hda_verb alc262_nec_verbs[] = {
10653 /* Unmute Speaker */
10654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10657 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10660 /* External mic to headphone */
10661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10662 /* External mic to speaker */
10663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10669 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10670 * 0x1b = port replicator headphone out
10673 #define ALC_HP_EVENT 0x37
10675 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10676 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10678 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10683 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10684 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10689 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10690 /* Front Mic pin: input vref at 50% */
10691 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10696 static struct hda_input_mux alc262_fujitsu_capture_source = {
10700 { "Int Mic", 0x1 },
10705 static struct hda_input_mux alc262_HP_capture_source = {
10709 { "Front Mic", 0x1 },
10716 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10720 { "Front Mic", 0x2 },
10726 /* mute/unmute internal speaker according to the hp jacks and mute state */
10727 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10729 struct alc_spec *spec = codec->spec;
10732 if (force || !spec->sense_updated) {
10733 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10734 snd_hda_jack_detect(codec, 0x1b);
10735 spec->sense_updated = 1;
10737 /* unmute internal speaker only if both HPs are unplugged and
10738 * master switch is on
10740 if (spec->jack_present)
10741 mute = HDA_AMP_MUTE;
10743 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10744 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10745 HDA_AMP_MUTE, mute);
10748 /* unsolicited event for HP jack sensing */
10749 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10752 if ((res >> 26) != ALC_HP_EVENT)
10754 alc262_fujitsu_automute(codec, 1);
10757 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10759 alc262_fujitsu_automute(codec, 1);
10762 /* bind volumes of both NID 0x0c and 0x0d */
10763 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10764 .ops = &snd_hda_bind_vol,
10766 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10767 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10772 /* mute/unmute internal speaker according to the hp jack and mute state */
10773 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10775 struct alc_spec *spec = codec->spec;
10778 if (force || !spec->sense_updated) {
10779 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10780 spec->sense_updated = 1;
10782 if (spec->jack_present) {
10783 /* mute internal speaker */
10784 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10785 HDA_AMP_MUTE, HDA_AMP_MUTE);
10786 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10787 HDA_AMP_MUTE, HDA_AMP_MUTE);
10789 /* unmute internal speaker if necessary */
10790 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10791 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10792 HDA_AMP_MUTE, mute);
10793 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10794 HDA_AMP_MUTE, mute);
10798 /* unsolicited event for HP jack sensing */
10799 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10802 if ((res >> 26) != ALC_HP_EVENT)
10804 alc262_lenovo_3000_automute(codec, 1);
10807 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10808 int dir, int idx, long *valp)
10812 for (i = 0; i < 2; i++, valp++)
10813 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10815 *valp ? 0 : HDA_AMP_MUTE);
10819 /* bind hp and internal speaker mute (with plug check) */
10820 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10821 struct snd_ctl_elem_value *ucontrol)
10823 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10824 long *valp = ucontrol->value.integer.value;
10827 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10828 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10830 alc262_fujitsu_automute(codec, 0);
10834 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10835 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10838 .name = "Master Playback Switch",
10839 .info = snd_hda_mixer_amp_switch_info,
10840 .get = snd_hda_mixer_amp_switch_get,
10841 .put = alc262_fujitsu_master_sw_put,
10842 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10846 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10849 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10851 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10855 /* bind hp and internal speaker mute (with plug check) */
10856 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10857 struct snd_ctl_elem_value *ucontrol)
10859 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10860 long *valp = ucontrol->value.integer.value;
10863 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10865 alc262_lenovo_3000_automute(codec, 0);
10869 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10870 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10873 .name = "Master Playback Switch",
10874 .info = snd_hda_mixer_amp_switch_info,
10875 .get = snd_hda_mixer_amp_switch_get,
10876 .put = alc262_lenovo_3000_master_sw_put,
10877 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10879 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10880 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10881 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10884 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10885 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10886 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10890 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10891 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10892 ALC262_HIPPO_MASTER_SWITCH,
10893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10896 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10897 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10898 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10902 /* additional init verbs for Benq laptops */
10903 static struct hda_verb alc262_EAPD_verbs[] = {
10904 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10905 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10909 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10910 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10911 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10913 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10914 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10918 /* Samsung Q1 Ultra Vista model setup */
10919 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10920 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10921 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10924 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10925 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10929 static struct hda_verb alc262_ultra_verbs[] = {
10931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10937 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10938 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10944 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10948 /* ADC, choose mic */
10949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10955 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10957 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10958 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10962 /* mute/unmute internal speaker according to the hp jack and mute state */
10963 static void alc262_ultra_automute(struct hda_codec *codec)
10965 struct alc_spec *spec = codec->spec;
10969 /* auto-mute only when HP is used as HP */
10970 if (!spec->cur_mux[0]) {
10971 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10972 if (spec->jack_present)
10973 mute = HDA_AMP_MUTE;
10975 /* mute/unmute internal speaker */
10976 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10977 HDA_AMP_MUTE, mute);
10978 /* mute/unmute HP */
10979 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10980 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10983 /* unsolicited event for HP jack sensing */
10984 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10987 if ((res >> 26) != ALC880_HP_EVENT)
10989 alc262_ultra_automute(codec);
10992 static struct hda_input_mux alc262_ultra_capture_source = {
10996 { "Headphone", 0x7 },
11000 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11001 struct snd_ctl_elem_value *ucontrol)
11003 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11004 struct alc_spec *spec = codec->spec;
11007 ret = alc_mux_enum_put(kcontrol, ucontrol);
11010 /* reprogram the HP pin as mic or HP according to the input source */
11011 snd_hda_codec_write_cache(codec, 0x15, 0,
11012 AC_VERB_SET_PIN_WIDGET_CONTROL,
11013 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11014 alc262_ultra_automute(codec); /* mute/unmute HP */
11018 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11019 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11020 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11022 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11023 .name = "Capture Source",
11024 .info = alc_mux_enum_info,
11025 .get = alc_mux_enum_get,
11026 .put = alc262_ultra_mux_enum_put,
11031 /* We use two mixers depending on the output pin; 0x16 is a mono output
11032 * and thus it's bound with a different mixer.
11033 * This function returns which mixer amp should be used.
11035 static int alc262_check_volbit(hda_nid_t nid)
11039 else if (nid == 0x16)
11045 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11046 const char *pfx, int *vbits)
11051 vbit = alc262_check_volbit(nid);
11054 if (*vbits & vbit) /* a volume control for this mixer already there */
11058 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11060 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11061 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11064 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11072 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11074 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11075 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11078 /* add playback controls from the parsed DAC table */
11079 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11080 const struct auto_pin_cfg *cfg)
11086 spec->multiout.num_dacs = 1; /* only use one dac */
11087 spec->multiout.dac_nids = spec->private_dac_nids;
11088 spec->multiout.dac_nids[0] = 2;
11090 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11092 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11096 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11099 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11102 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11106 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11107 alc262_check_volbit(cfg->speaker_pins[0]) |
11108 alc262_check_volbit(cfg->hp_pins[0]);
11109 if (vbits == 1 || vbits == 2)
11110 pfx = "Master"; /* only one mixer is used */
11111 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11116 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11119 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11123 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11130 #define alc262_auto_create_input_ctls \
11131 alc880_auto_create_input_ctls
11134 * generic initialization of ADC, input mixers and output mixers
11136 static struct hda_verb alc262_volume_init_verbs[] = {
11138 * Unmute ADC0-2 and set the default input to mic-in
11140 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11142 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11144 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11147 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11149 * Note: PASD motherboards uses the Line In 2 as the input for
11150 * front panel mic (mic 2)
11152 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11160 * Set up output mixers (0x0c - 0x0f)
11162 /* set vol=0 to output mixers */
11163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11164 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11165 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11167 /* set up input amps for analog loopback */
11168 /* Amp Indices: DAC = 0, mixer = 1 */
11169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11173 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11176 /* FIXME: use matrix-type input source selection */
11177 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11178 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11184 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11185 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11189 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11197 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11199 * Unmute ADC0-2 and set the default input to mic-in
11201 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11202 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11203 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11205 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11208 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11210 * Note: PASD motherboards uses the Line In 2 as the input for
11211 * front panel mic (mic 2)
11213 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11223 * Set up output mixers (0x0c - 0x0e)
11225 /* set vol=0 to output mixers */
11226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11227 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11230 /* set up input amps for analog loopback */
11231 /* Amp Indices: DAC = 0, mixer = 1 */
11232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11234 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11239 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11240 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11241 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11246 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11247 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11251 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11253 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11255 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11258 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11259 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11260 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11263 /* FIXME: use matrix-type input source selection */
11264 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11265 /* Input mixer1: only unmute Mic */
11266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11293 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11294 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11296 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11301 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11303 * Unmute ADC0-2 and set the default input to mic-in
11305 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11307 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11309 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11310 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11312 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11314 * Note: PASD motherboards uses the Line In 2 as the input for front
11315 * panel mic (mic 2)
11317 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11327 * Set up output mixers (0x0c - 0x0e)
11329 /* set vol=0 to output mixers */
11330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11334 /* set up input amps for analog loopback */
11335 /* Amp Indices: DAC = 0, mixer = 1 */
11336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11340 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11345 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11347 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11348 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11350 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11352 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11355 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11358 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11359 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11360 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11362 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11363 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11365 /* FIXME: use matrix-type input source selection */
11366 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11367 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11371 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11373 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11381 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11389 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11392 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11397 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11400 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11401 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11403 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11404 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11406 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11409 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11410 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11415 #ifdef CONFIG_SND_HDA_POWER_SAVE
11416 #define alc262_loopbacks alc880_loopbacks
11419 /* pcm configuration: identical with ALC880 */
11420 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11421 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11422 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11423 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11426 * BIOS auto configuration
11428 static int alc262_parse_auto_config(struct hda_codec *codec)
11430 struct alc_spec *spec = codec->spec;
11432 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11434 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11438 if (!spec->autocfg.line_outs) {
11439 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11440 spec->multiout.max_channels = 2;
11441 spec->no_analog = 1;
11444 return 0; /* can't find valid BIOS pin config */
11446 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11449 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11453 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11456 if (spec->autocfg.dig_outs) {
11457 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11458 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11460 if (spec->autocfg.dig_in_pin)
11461 spec->dig_in_nid = ALC262_DIGIN_NID;
11463 if (spec->kctls.list)
11464 add_mixer(spec, spec->kctls.list);
11466 add_verb(spec, alc262_volume_init_verbs);
11467 spec->num_mux_defs = 1;
11468 spec->input_mux = &spec->private_imux[0];
11470 err = alc_auto_add_mic_boost(codec);
11474 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11479 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11480 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11481 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11482 #define alc262_auto_init_input_src alc882_auto_init_input_src
11485 /* init callback for auto-configuration model -- overriding the default init */
11486 static void alc262_auto_init(struct hda_codec *codec)
11488 struct alc_spec *spec = codec->spec;
11489 alc262_auto_init_multi_out(codec);
11490 alc262_auto_init_hp_out(codec);
11491 alc262_auto_init_analog_input(codec);
11492 alc262_auto_init_input_src(codec);
11493 if (spec->unsol_event)
11494 alc_inithook(codec);
11498 * configuration and preset
11500 static const char *alc262_models[ALC262_MODEL_LAST] = {
11501 [ALC262_BASIC] = "basic",
11502 [ALC262_HIPPO] = "hippo",
11503 [ALC262_HIPPO_1] = "hippo_1",
11504 [ALC262_FUJITSU] = "fujitsu",
11505 [ALC262_HP_BPC] = "hp-bpc",
11506 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11507 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11508 [ALC262_HP_RP5700] = "hp-rp5700",
11509 [ALC262_BENQ_ED8] = "benq",
11510 [ALC262_BENQ_T31] = "benq-t31",
11511 [ALC262_SONY_ASSAMD] = "sony-assamd",
11512 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11513 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11514 [ALC262_ULTRA] = "ultra",
11515 [ALC262_LENOVO_3000] = "lenovo-3000",
11516 [ALC262_NEC] = "nec",
11517 [ALC262_TYAN] = "tyan",
11518 [ALC262_AUTO] = "auto",
11521 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11522 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11523 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11524 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11526 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11528 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11530 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11531 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11532 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11533 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11534 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11535 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11536 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11537 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11538 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11539 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11540 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11541 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11542 ALC262_HP_TC_T5735),
11543 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11544 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11545 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11546 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11547 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11548 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11549 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11550 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11551 #if 0 /* disable the quirk since model=auto works better in recent versions */
11552 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11553 ALC262_SONY_ASSAMD),
11555 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11556 ALC262_TOSHIBA_RX1),
11557 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11558 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11559 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11560 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11561 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11563 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11564 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11565 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11566 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11567 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11571 static struct alc_config_preset alc262_presets[] = {
11573 .mixers = { alc262_base_mixer },
11574 .init_verbs = { alc262_init_verbs },
11575 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11576 .dac_nids = alc262_dac_nids,
11578 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11579 .channel_mode = alc262_modes,
11580 .input_mux = &alc262_capture_source,
11583 .mixers = { alc262_hippo_mixer },
11584 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11585 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11586 .dac_nids = alc262_dac_nids,
11588 .dig_out_nid = ALC262_DIGOUT_NID,
11589 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11590 .channel_mode = alc262_modes,
11591 .input_mux = &alc262_capture_source,
11592 .unsol_event = alc262_hippo_unsol_event,
11593 .setup = alc262_hippo_setup,
11594 .init_hook = alc262_hippo_automute,
11596 [ALC262_HIPPO_1] = {
11597 .mixers = { alc262_hippo1_mixer },
11598 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11599 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11600 .dac_nids = alc262_dac_nids,
11602 .dig_out_nid = ALC262_DIGOUT_NID,
11603 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11604 .channel_mode = alc262_modes,
11605 .input_mux = &alc262_capture_source,
11606 .unsol_event = alc262_hippo_unsol_event,
11607 .setup = alc262_hippo1_setup,
11608 .init_hook = alc262_hippo_automute,
11610 [ALC262_FUJITSU] = {
11611 .mixers = { alc262_fujitsu_mixer },
11612 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11613 alc262_fujitsu_unsol_verbs },
11614 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11615 .dac_nids = alc262_dac_nids,
11617 .dig_out_nid = ALC262_DIGOUT_NID,
11618 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11619 .channel_mode = alc262_modes,
11620 .input_mux = &alc262_fujitsu_capture_source,
11621 .unsol_event = alc262_fujitsu_unsol_event,
11622 .init_hook = alc262_fujitsu_init_hook,
11624 [ALC262_HP_BPC] = {
11625 .mixers = { alc262_HP_BPC_mixer },
11626 .init_verbs = { alc262_HP_BPC_init_verbs },
11627 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11628 .dac_nids = alc262_dac_nids,
11630 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11631 .channel_mode = alc262_modes,
11632 .input_mux = &alc262_HP_capture_source,
11633 .unsol_event = alc262_hp_bpc_unsol_event,
11634 .init_hook = alc262_hp_bpc_automute,
11636 [ALC262_HP_BPC_D7000_WF] = {
11637 .mixers = { alc262_HP_BPC_WildWest_mixer },
11638 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11639 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11640 .dac_nids = alc262_dac_nids,
11642 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11643 .channel_mode = alc262_modes,
11644 .input_mux = &alc262_HP_D7000_capture_source,
11645 .unsol_event = alc262_hp_wildwest_unsol_event,
11646 .init_hook = alc262_hp_wildwest_automute,
11648 [ALC262_HP_BPC_D7000_WL] = {
11649 .mixers = { alc262_HP_BPC_WildWest_mixer,
11650 alc262_HP_BPC_WildWest_option_mixer },
11651 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11652 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11653 .dac_nids = alc262_dac_nids,
11655 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11656 .channel_mode = alc262_modes,
11657 .input_mux = &alc262_HP_D7000_capture_source,
11658 .unsol_event = alc262_hp_wildwest_unsol_event,
11659 .init_hook = alc262_hp_wildwest_automute,
11661 [ALC262_HP_TC_T5735] = {
11662 .mixers = { alc262_hp_t5735_mixer },
11663 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11664 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11665 .dac_nids = alc262_dac_nids,
11667 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11668 .channel_mode = alc262_modes,
11669 .input_mux = &alc262_capture_source,
11670 .unsol_event = alc_automute_amp_unsol_event,
11671 .setup = alc262_hp_t5735_setup,
11672 .init_hook = alc_automute_amp,
11674 [ALC262_HP_RP5700] = {
11675 .mixers = { alc262_hp_rp5700_mixer },
11676 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11677 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11678 .dac_nids = alc262_dac_nids,
11679 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11680 .channel_mode = alc262_modes,
11681 .input_mux = &alc262_hp_rp5700_capture_source,
11683 [ALC262_BENQ_ED8] = {
11684 .mixers = { alc262_base_mixer },
11685 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11686 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11687 .dac_nids = alc262_dac_nids,
11689 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11690 .channel_mode = alc262_modes,
11691 .input_mux = &alc262_capture_source,
11693 [ALC262_SONY_ASSAMD] = {
11694 .mixers = { alc262_sony_mixer },
11695 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11696 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11697 .dac_nids = alc262_dac_nids,
11699 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11700 .channel_mode = alc262_modes,
11701 .input_mux = &alc262_capture_source,
11702 .unsol_event = alc262_hippo_unsol_event,
11703 .setup = alc262_hippo_setup,
11704 .init_hook = alc262_hippo_automute,
11706 [ALC262_BENQ_T31] = {
11707 .mixers = { alc262_benq_t31_mixer },
11708 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11709 alc_hp15_unsol_verbs },
11710 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11711 .dac_nids = alc262_dac_nids,
11713 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11714 .channel_mode = alc262_modes,
11715 .input_mux = &alc262_capture_source,
11716 .unsol_event = alc262_hippo_unsol_event,
11717 .setup = alc262_hippo_setup,
11718 .init_hook = alc262_hippo_automute,
11721 .mixers = { alc262_ultra_mixer },
11722 .cap_mixer = alc262_ultra_capture_mixer,
11723 .init_verbs = { alc262_ultra_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .dac_nids = alc262_dac_nids,
11726 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11727 .channel_mode = alc262_modes,
11728 .input_mux = &alc262_ultra_capture_source,
11729 .adc_nids = alc262_adc_nids, /* ADC0 */
11730 .capsrc_nids = alc262_capsrc_nids,
11731 .num_adc_nids = 1, /* single ADC */
11732 .unsol_event = alc262_ultra_unsol_event,
11733 .init_hook = alc262_ultra_automute,
11735 [ALC262_LENOVO_3000] = {
11736 .mixers = { alc262_lenovo_3000_mixer },
11737 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11738 alc262_lenovo_3000_unsol_verbs,
11739 alc262_lenovo_3000_init_verbs },
11740 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11741 .dac_nids = alc262_dac_nids,
11743 .dig_out_nid = ALC262_DIGOUT_NID,
11744 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11745 .channel_mode = alc262_modes,
11746 .input_mux = &alc262_fujitsu_capture_source,
11747 .unsol_event = alc262_lenovo_3000_unsol_event,
11750 .mixers = { alc262_nec_mixer },
11751 .init_verbs = { alc262_nec_verbs },
11752 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11753 .dac_nids = alc262_dac_nids,
11755 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11756 .channel_mode = alc262_modes,
11757 .input_mux = &alc262_capture_source,
11759 [ALC262_TOSHIBA_S06] = {
11760 .mixers = { alc262_toshiba_s06_mixer },
11761 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11762 alc262_eapd_verbs },
11763 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11764 .capsrc_nids = alc262_dmic_capsrc_nids,
11765 .dac_nids = alc262_dac_nids,
11766 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11767 .num_adc_nids = 1, /* single ADC */
11768 .dig_out_nid = ALC262_DIGOUT_NID,
11769 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11770 .channel_mode = alc262_modes,
11771 .unsol_event = alc_sku_unsol_event,
11772 .setup = alc262_toshiba_s06_setup,
11773 .init_hook = alc_inithook,
11775 [ALC262_TOSHIBA_RX1] = {
11776 .mixers = { alc262_toshiba_rx1_mixer },
11777 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11778 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11779 .dac_nids = alc262_dac_nids,
11781 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11782 .channel_mode = alc262_modes,
11783 .input_mux = &alc262_capture_source,
11784 .unsol_event = alc262_hippo_unsol_event,
11785 .setup = alc262_hippo_setup,
11786 .init_hook = alc262_hippo_automute,
11789 .mixers = { alc262_tyan_mixer },
11790 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11792 .dac_nids = alc262_dac_nids,
11794 .dig_out_nid = ALC262_DIGOUT_NID,
11795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11796 .channel_mode = alc262_modes,
11797 .input_mux = &alc262_capture_source,
11798 .unsol_event = alc_automute_amp_unsol_event,
11799 .setup = alc262_tyan_setup,
11800 .init_hook = alc_automute_amp,
11804 static int patch_alc262(struct hda_codec *codec)
11806 struct alc_spec *spec;
11810 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11814 codec->spec = spec;
11816 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11821 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11822 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11823 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11824 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11828 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11830 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11834 if (board_config < 0) {
11835 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11837 board_config = ALC262_AUTO;
11840 if (board_config == ALC262_AUTO) {
11841 /* automatic parse from the BIOS config */
11842 err = alc262_parse_auto_config(codec);
11848 "hda_codec: Cannot set up configuration "
11849 "from BIOS. Using base mode...\n");
11850 board_config = ALC262_BASIC;
11854 if (!spec->no_analog) {
11855 err = snd_hda_attach_beep_device(codec, 0x1);
11862 if (board_config != ALC262_AUTO)
11863 setup_preset(codec, &alc262_presets[board_config]);
11865 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11866 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11868 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11869 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11871 if (!spec->adc_nids && spec->input_mux) {
11873 /* check whether the digital-mic has to be supported */
11874 for (i = 0; i < spec->input_mux->num_items; i++) {
11875 if (spec->input_mux->items[i].index >= 9)
11878 if (i < spec->input_mux->num_items) {
11879 /* use only ADC0 */
11880 spec->adc_nids = alc262_dmic_adc_nids;
11881 spec->num_adc_nids = 1;
11882 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11884 /* all analog inputs */
11885 /* check whether NID 0x07 is valid */
11886 unsigned int wcap = get_wcaps(codec, 0x07);
11889 wcap = get_wcaps_type(wcap);
11890 if (wcap != AC_WID_AUD_IN) {
11891 spec->adc_nids = alc262_adc_nids_alt;
11892 spec->num_adc_nids =
11893 ARRAY_SIZE(alc262_adc_nids_alt);
11894 spec->capsrc_nids = alc262_capsrc_nids_alt;
11896 spec->adc_nids = alc262_adc_nids;
11897 spec->num_adc_nids =
11898 ARRAY_SIZE(alc262_adc_nids);
11899 spec->capsrc_nids = alc262_capsrc_nids;
11903 if (!spec->cap_mixer && !spec->no_analog)
11904 set_capture_mixer(codec);
11905 if (!spec->no_analog)
11906 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11908 spec->vmaster_nid = 0x0c;
11910 codec->patch_ops = alc_patch_ops;
11911 if (board_config == ALC262_AUTO)
11912 spec->init_hook = alc262_auto_init;
11913 #ifdef CONFIG_SND_HDA_POWER_SAVE
11914 if (!spec->loopback.amplist)
11915 spec->loopback.amplist = alc262_loopbacks;
11917 codec->proc_widget_hook = print_realtek_coef;
11923 * ALC268 channel source setting (2 channel)
11925 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11926 #define alc268_modes alc260_modes
11928 static hda_nid_t alc268_dac_nids[2] = {
11933 static hda_nid_t alc268_adc_nids[2] = {
11938 static hda_nid_t alc268_adc_nids_alt[1] = {
11943 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11945 static struct snd_kcontrol_new alc268_base_mixer[] = {
11946 /* output mixer control */
11947 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11948 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11949 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11951 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11952 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11953 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11957 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11958 /* output mixer control */
11959 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11961 ALC262_HIPPO_MASTER_SWITCH,
11962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11963 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11964 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11968 /* bind Beep switches of both NID 0x0f and 0x10 */
11969 static struct hda_bind_ctls alc268_bind_beep_sw = {
11970 .ops = &snd_hda_bind_sw,
11972 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11973 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11978 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11979 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11980 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11984 static struct hda_verb alc268_eapd_verbs[] = {
11985 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11986 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11990 /* Toshiba specific */
11991 static struct hda_verb alc268_toshiba_verbs[] = {
11992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11996 /* Acer specific */
11997 /* bind volumes of both NID 0x02 and 0x03 */
11998 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11999 .ops = &snd_hda_bind_vol,
12001 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12002 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12007 /* mute/unmute internal speaker according to the hp jack and mute state */
12008 static void alc268_acer_automute(struct hda_codec *codec, int force)
12010 struct alc_spec *spec = codec->spec;
12013 if (force || !spec->sense_updated) {
12014 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12015 spec->sense_updated = 1;
12017 if (spec->jack_present)
12018 mute = HDA_AMP_MUTE; /* mute internal speaker */
12019 else /* unmute internal speaker if necessary */
12020 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12021 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12022 HDA_AMP_MUTE, mute);
12026 /* bind hp and internal speaker mute (with plug check) */
12027 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12028 struct snd_ctl_elem_value *ucontrol)
12030 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12031 long *valp = ucontrol->value.integer.value;
12034 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12036 alc268_acer_automute(codec, 0);
12040 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12041 /* output mixer control */
12042 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12044 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12045 .name = "Master Playback Switch",
12046 .info = snd_hda_mixer_amp_switch_info,
12047 .get = snd_hda_mixer_amp_switch_get,
12048 .put = alc268_acer_master_sw_put,
12049 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12051 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12055 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12056 /* output mixer control */
12057 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12060 .name = "Master Playback Switch",
12061 .info = snd_hda_mixer_amp_switch_info,
12062 .get = snd_hda_mixer_amp_switch_get,
12063 .put = alc268_acer_master_sw_put,
12064 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12066 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12067 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12068 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12072 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12073 /* output mixer control */
12074 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12077 .name = "Master Playback Switch",
12078 .info = snd_hda_mixer_amp_switch_info,
12079 .get = snd_hda_mixer_amp_switch_get,
12080 .put = alc268_acer_master_sw_put,
12081 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12084 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12088 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12089 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12093 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12098 static struct hda_verb alc268_acer_verbs[] = {
12099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12100 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12102 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12103 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12104 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12105 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12109 /* unsolicited event for HP jack sensing */
12110 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12111 #define alc268_toshiba_setup alc262_hippo_setup
12112 #define alc268_toshiba_automute alc262_hippo_automute
12114 static void alc268_acer_unsol_event(struct hda_codec *codec,
12117 if ((res >> 26) != ALC880_HP_EVENT)
12119 alc268_acer_automute(codec, 1);
12122 static void alc268_acer_init_hook(struct hda_codec *codec)
12124 alc268_acer_automute(codec, 1);
12127 /* toggle speaker-output according to the hp-jack state */
12128 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12130 unsigned int present;
12131 unsigned char bits;
12133 present = snd_hda_jack_detect(codec, 0x15);
12134 bits = present ? AMP_IN_MUTE(0) : 0;
12135 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12136 AMP_IN_MUTE(0), bits);
12137 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12138 AMP_IN_MUTE(0), bits);
12141 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12144 switch (res >> 26) {
12145 case ALC880_HP_EVENT:
12146 alc268_aspire_one_speaker_automute(codec);
12148 case ALC880_MIC_EVENT:
12149 alc_mic_automute(codec);
12154 static void alc268_acer_lc_setup(struct hda_codec *codec)
12156 struct alc_spec *spec = codec->spec;
12157 spec->ext_mic.pin = 0x18;
12158 spec->ext_mic.mux_idx = 0;
12159 spec->int_mic.pin = 0x12;
12160 spec->int_mic.mux_idx = 6;
12161 spec->auto_mic = 1;
12164 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12166 alc268_aspire_one_speaker_automute(codec);
12167 alc_mic_automute(codec);
12170 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12171 /* output mixer control */
12172 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12173 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12174 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12176 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12177 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12181 static struct hda_verb alc268_dell_verbs[] = {
12182 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12184 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12185 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12189 /* mute/unmute internal speaker according to the hp jack and mute state */
12190 static void alc268_dell_setup(struct hda_codec *codec)
12192 struct alc_spec *spec = codec->spec;
12194 spec->autocfg.hp_pins[0] = 0x15;
12195 spec->autocfg.speaker_pins[0] = 0x14;
12196 spec->ext_mic.pin = 0x18;
12197 spec->ext_mic.mux_idx = 0;
12198 spec->int_mic.pin = 0x19;
12199 spec->int_mic.mux_idx = 1;
12200 spec->auto_mic = 1;
12203 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12204 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12205 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12207 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12208 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12209 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12210 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12211 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12215 static struct hda_verb alc267_quanta_il1_verbs[] = {
12216 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12217 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12221 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12223 struct alc_spec *spec = codec->spec;
12224 spec->autocfg.hp_pins[0] = 0x15;
12225 spec->autocfg.speaker_pins[0] = 0x14;
12226 spec->ext_mic.pin = 0x18;
12227 spec->ext_mic.mux_idx = 0;
12228 spec->int_mic.pin = 0x19;
12229 spec->int_mic.mux_idx = 1;
12230 spec->auto_mic = 1;
12234 * generic initialization of ADC, input mixers and output mixers
12236 static struct hda_verb alc268_base_init_verbs[] = {
12237 /* Unmute DAC0-1 and set vol = 0 */
12238 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12239 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12242 * Set up output mixers (0x0c - 0x0e)
12244 /* set vol=0 to output mixers */
12245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12246 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12249 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12253 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12256 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12258 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12260 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12262 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12264 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12266 /* set PCBEEP vol = 0, mute connections */
12267 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12268 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12269 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12271 /* Unmute Selector 23h,24h and set the default input to mic-in */
12273 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12275 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12282 * generic initialization of ADC, input mixers and output mixers
12284 static struct hda_verb alc268_volume_init_verbs[] = {
12285 /* set output DAC */
12286 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12287 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12289 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12290 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12291 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12292 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12293 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12296 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12297 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12302 /* set PCBEEP vol = 0, mute connections */
12303 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12305 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12310 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12311 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12312 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12316 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12317 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12318 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12323 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12324 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12325 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12326 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12327 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12332 static struct hda_input_mux alc268_capture_source = {
12336 { "Front Mic", 0x1 },
12342 static struct hda_input_mux alc268_acer_capture_source = {
12346 { "Internal Mic", 0x1 },
12351 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12355 { "Internal Mic", 0x6 },
12360 #ifdef CONFIG_SND_DEBUG
12361 static struct snd_kcontrol_new alc268_test_mixer[] = {
12362 /* Volume widgets */
12363 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12364 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12365 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12366 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12367 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12368 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12369 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12370 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12371 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12372 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12373 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12374 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12375 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12376 /* The below appears problematic on some hardwares */
12377 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12378 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12379 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12380 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12381 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12383 /* Modes for retasking pin widgets */
12384 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12385 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12386 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12387 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12389 /* Controls for GPIO pins, assuming they are configured as outputs */
12390 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12391 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12392 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12393 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12395 /* Switches to allow the digital SPDIF output pin to be enabled.
12396 * The ALC268 does not have an SPDIF input.
12398 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12400 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12401 * this output to turn on an external amplifier.
12403 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12404 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12410 /* create input playback/capture controls for the given pin */
12411 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12412 const char *ctlname, int idx)
12428 if (spec->multiout.dac_nids[0] != dac &&
12429 spec->multiout.dac_nids[1] != dac) {
12430 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12431 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12435 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12439 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12440 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12442 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12443 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12449 /* add playback controls from the parsed DAC table */
12450 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12451 const struct auto_pin_cfg *cfg)
12456 spec->multiout.dac_nids = spec->private_dac_nids;
12458 nid = cfg->line_out_pins[0];
12461 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12465 err = alc268_new_analog_output(spec, nid, name, 0);
12470 nid = cfg->speaker_pins[0];
12472 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12473 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12477 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12481 nid = cfg->hp_pins[0];
12483 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12488 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12490 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12491 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12498 /* create playback/capture controls for input pins */
12499 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12500 const struct auto_pin_cfg *cfg)
12502 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12505 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12506 hda_nid_t nid, int pin_type)
12510 alc_set_pin_output(codec, nid, pin_type);
12511 if (nid == 0x14 || nid == 0x16)
12515 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12518 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12520 struct alc_spec *spec = codec->spec;
12521 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12523 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12524 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12528 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12530 struct alc_spec *spec = codec->spec;
12533 pin = spec->autocfg.hp_pins[0];
12535 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12536 pin = spec->autocfg.speaker_pins[0];
12538 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12541 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12543 struct alc_spec *spec = codec->spec;
12544 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12545 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12546 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12547 unsigned int dac_vol1, dac_vol2;
12549 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12550 snd_hda_codec_write(codec, speaker_nid, 0,
12551 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12552 /* mute mixer inputs from 0x1d */
12553 snd_hda_codec_write(codec, 0x0f, 0,
12554 AC_VERB_SET_AMP_GAIN_MUTE,
12556 snd_hda_codec_write(codec, 0x10, 0,
12557 AC_VERB_SET_AMP_GAIN_MUTE,
12560 /* unmute mixer inputs from 0x1d */
12561 snd_hda_codec_write(codec, 0x0f, 0,
12562 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12563 snd_hda_codec_write(codec, 0x10, 0,
12564 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12567 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12568 if (line_nid == 0x14)
12569 dac_vol2 = AMP_OUT_ZERO;
12570 else if (line_nid == 0x15)
12571 dac_vol1 = AMP_OUT_ZERO;
12572 if (hp_nid == 0x14)
12573 dac_vol2 = AMP_OUT_ZERO;
12574 else if (hp_nid == 0x15)
12575 dac_vol1 = AMP_OUT_ZERO;
12576 if (line_nid != 0x16 || hp_nid != 0x16 ||
12577 spec->autocfg.line_out_pins[1] != 0x16 ||
12578 spec->autocfg.line_out_pins[2] != 0x16)
12579 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12581 snd_hda_codec_write(codec, 0x02, 0,
12582 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12583 snd_hda_codec_write(codec, 0x03, 0,
12584 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12587 /* pcm configuration: identical with ALC880 */
12588 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12589 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12590 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12591 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12594 * BIOS auto configuration
12596 static int alc268_parse_auto_config(struct hda_codec *codec)
12598 struct alc_spec *spec = codec->spec;
12600 static hda_nid_t alc268_ignore[] = { 0 };
12602 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12606 if (!spec->autocfg.line_outs) {
12607 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12608 spec->multiout.max_channels = 2;
12609 spec->no_analog = 1;
12612 return 0; /* can't find valid BIOS pin config */
12614 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12617 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12621 spec->multiout.max_channels = 2;
12624 /* digital only support output */
12625 if (spec->autocfg.dig_outs) {
12626 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12627 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12629 if (spec->kctls.list)
12630 add_mixer(spec, spec->kctls.list);
12632 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12633 add_mixer(spec, alc268_beep_mixer);
12635 add_verb(spec, alc268_volume_init_verbs);
12636 spec->num_mux_defs = 2;
12637 spec->input_mux = &spec->private_imux[0];
12639 err = alc_auto_add_mic_boost(codec);
12643 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12648 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12650 /* init callback for auto-configuration model -- overriding the default init */
12651 static void alc268_auto_init(struct hda_codec *codec)
12653 struct alc_spec *spec = codec->spec;
12654 alc268_auto_init_multi_out(codec);
12655 alc268_auto_init_hp_out(codec);
12656 alc268_auto_init_mono_speaker_out(codec);
12657 alc268_auto_init_analog_input(codec);
12658 if (spec->unsol_event)
12659 alc_inithook(codec);
12663 * configuration and preset
12665 static const char *alc268_models[ALC268_MODEL_LAST] = {
12666 [ALC267_QUANTA_IL1] = "quanta-il1",
12667 [ALC268_3ST] = "3stack",
12668 [ALC268_TOSHIBA] = "toshiba",
12669 [ALC268_ACER] = "acer",
12670 [ALC268_ACER_DMIC] = "acer-dmic",
12671 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12672 [ALC268_DELL] = "dell",
12673 [ALC268_ZEPTO] = "zepto",
12674 #ifdef CONFIG_SND_DEBUG
12675 [ALC268_TEST] = "test",
12677 [ALC268_AUTO] = "auto",
12680 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12681 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12682 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12683 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12684 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12685 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12686 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12687 ALC268_ACER_ASPIRE_ONE),
12688 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12689 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12690 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12691 /* almost compatible with toshiba but with optional digital outs;
12692 * auto-probing seems working fine
12694 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12696 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12697 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12698 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12699 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12700 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12701 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12705 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12706 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12707 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12708 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12709 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12714 static struct alc_config_preset alc268_presets[] = {
12715 [ALC267_QUANTA_IL1] = {
12716 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12717 alc268_capture_nosrc_mixer },
12718 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12719 alc267_quanta_il1_verbs },
12720 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12721 .dac_nids = alc268_dac_nids,
12722 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12723 .adc_nids = alc268_adc_nids_alt,
12725 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12726 .channel_mode = alc268_modes,
12727 .unsol_event = alc_sku_unsol_event,
12728 .setup = alc267_quanta_il1_setup,
12729 .init_hook = alc_inithook,
12732 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12733 alc268_beep_mixer },
12734 .init_verbs = { alc268_base_init_verbs },
12735 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12736 .dac_nids = alc268_dac_nids,
12737 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12738 .adc_nids = alc268_adc_nids_alt,
12739 .capsrc_nids = alc268_capsrc_nids,
12741 .dig_out_nid = ALC268_DIGOUT_NID,
12742 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12743 .channel_mode = alc268_modes,
12744 .input_mux = &alc268_capture_source,
12746 [ALC268_TOSHIBA] = {
12747 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12748 alc268_beep_mixer },
12749 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12750 alc268_toshiba_verbs },
12751 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12752 .dac_nids = alc268_dac_nids,
12753 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12754 .adc_nids = alc268_adc_nids_alt,
12755 .capsrc_nids = alc268_capsrc_nids,
12757 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12758 .channel_mode = alc268_modes,
12759 .input_mux = &alc268_capture_source,
12760 .unsol_event = alc268_toshiba_unsol_event,
12761 .setup = alc268_toshiba_setup,
12762 .init_hook = alc268_toshiba_automute,
12765 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12766 alc268_beep_mixer },
12767 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12768 alc268_acer_verbs },
12769 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12770 .dac_nids = alc268_dac_nids,
12771 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12772 .adc_nids = alc268_adc_nids_alt,
12773 .capsrc_nids = alc268_capsrc_nids,
12775 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12776 .channel_mode = alc268_modes,
12777 .input_mux = &alc268_acer_capture_source,
12778 .unsol_event = alc268_acer_unsol_event,
12779 .init_hook = alc268_acer_init_hook,
12781 [ALC268_ACER_DMIC] = {
12782 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12783 alc268_beep_mixer },
12784 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12785 alc268_acer_verbs },
12786 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12787 .dac_nids = alc268_dac_nids,
12788 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12789 .adc_nids = alc268_adc_nids_alt,
12790 .capsrc_nids = alc268_capsrc_nids,
12792 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12793 .channel_mode = alc268_modes,
12794 .input_mux = &alc268_acer_dmic_capture_source,
12795 .unsol_event = alc268_acer_unsol_event,
12796 .init_hook = alc268_acer_init_hook,
12798 [ALC268_ACER_ASPIRE_ONE] = {
12799 .mixers = { alc268_acer_aspire_one_mixer,
12801 alc268_capture_nosrc_mixer },
12802 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12803 alc268_acer_aspire_one_verbs },
12804 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12805 .dac_nids = alc268_dac_nids,
12806 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12807 .adc_nids = alc268_adc_nids_alt,
12808 .capsrc_nids = alc268_capsrc_nids,
12810 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12811 .channel_mode = alc268_modes,
12812 .unsol_event = alc268_acer_lc_unsol_event,
12813 .setup = alc268_acer_lc_setup,
12814 .init_hook = alc268_acer_lc_init_hook,
12817 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12818 alc268_capture_nosrc_mixer },
12819 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12820 alc268_dell_verbs },
12821 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12822 .dac_nids = alc268_dac_nids,
12823 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12824 .adc_nids = alc268_adc_nids_alt,
12825 .capsrc_nids = alc268_capsrc_nids,
12827 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12828 .channel_mode = alc268_modes,
12829 .unsol_event = alc_sku_unsol_event,
12830 .setup = alc268_dell_setup,
12831 .init_hook = alc_inithook,
12834 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12835 alc268_beep_mixer },
12836 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12837 alc268_toshiba_verbs },
12838 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12839 .dac_nids = alc268_dac_nids,
12840 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12841 .adc_nids = alc268_adc_nids_alt,
12842 .capsrc_nids = alc268_capsrc_nids,
12844 .dig_out_nid = ALC268_DIGOUT_NID,
12845 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12846 .channel_mode = alc268_modes,
12847 .input_mux = &alc268_capture_source,
12848 .setup = alc268_toshiba_setup,
12849 .init_hook = alc268_toshiba_automute,
12851 #ifdef CONFIG_SND_DEBUG
12853 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12854 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12855 alc268_volume_init_verbs },
12856 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12857 .dac_nids = alc268_dac_nids,
12858 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12859 .adc_nids = alc268_adc_nids_alt,
12860 .capsrc_nids = alc268_capsrc_nids,
12862 .dig_out_nid = ALC268_DIGOUT_NID,
12863 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12864 .channel_mode = alc268_modes,
12865 .input_mux = &alc268_capture_source,
12870 static int patch_alc268(struct hda_codec *codec)
12872 struct alc_spec *spec;
12874 int i, has_beep, err;
12876 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12880 codec->spec = spec;
12882 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12886 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12887 board_config = snd_hda_check_board_codec_sid_config(codec,
12888 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12890 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12891 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12893 board_config = ALC268_AUTO;
12896 if (board_config == ALC268_AUTO) {
12897 /* automatic parse from the BIOS config */
12898 err = alc268_parse_auto_config(codec);
12904 "hda_codec: Cannot set up configuration "
12905 "from BIOS. Using base mode...\n");
12906 board_config = ALC268_3ST;
12910 if (board_config != ALC268_AUTO)
12911 setup_preset(codec, &alc268_presets[board_config]);
12913 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12914 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12915 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12917 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12920 for (i = 0; i < spec->num_mixers; i++) {
12921 if (spec->mixers[i] == alc268_beep_mixer) {
12928 err = snd_hda_attach_beep_device(codec, 0x1);
12933 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12934 /* override the amp caps for beep generator */
12935 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12936 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12937 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12938 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12939 (0 << AC_AMPCAP_MUTE_SHIFT));
12942 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12943 /* check whether NID 0x07 is valid */
12944 unsigned int wcap = get_wcaps(codec, 0x07);
12947 spec->capsrc_nids = alc268_capsrc_nids;
12949 wcap = get_wcaps_type(wcap);
12950 if (spec->auto_mic ||
12951 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12952 spec->adc_nids = alc268_adc_nids_alt;
12953 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12954 if (spec->auto_mic)
12955 fixup_automic_adc(codec);
12956 if (spec->auto_mic || spec->input_mux->num_items == 1)
12957 add_mixer(spec, alc268_capture_nosrc_mixer);
12959 add_mixer(spec, alc268_capture_alt_mixer);
12961 spec->adc_nids = alc268_adc_nids;
12962 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12963 add_mixer(spec, alc268_capture_mixer);
12965 /* set default input source */
12966 for (i = 0; i < spec->num_adc_nids; i++)
12967 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12968 0, AC_VERB_SET_CONNECT_SEL,
12969 i < spec->num_mux_defs ?
12970 spec->input_mux[i].items[0].index :
12971 spec->input_mux->items[0].index);
12974 spec->vmaster_nid = 0x02;
12976 codec->patch_ops = alc_patch_ops;
12977 if (board_config == ALC268_AUTO)
12978 spec->init_hook = alc268_auto_init;
12980 codec->proc_widget_hook = print_realtek_coef;
12986 * ALC269 channel source setting (2 channel)
12988 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12990 #define alc269_dac_nids alc260_dac_nids
12992 static hda_nid_t alc269_adc_nids[1] = {
12997 static hda_nid_t alc269_capsrc_nids[1] = {
13001 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13005 #define alc269_modes alc260_modes
13006 #define alc269_capture_source alc880_lg_lw_capture_source
13008 static struct snd_kcontrol_new alc269_base_mixer[] = {
13009 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13010 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13011 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13012 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13016 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13018 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13020 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13024 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13025 /* output mixer control */
13026 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13029 .name = "Master Playback Switch",
13030 .info = snd_hda_mixer_amp_switch_info,
13031 .get = snd_hda_mixer_amp_switch_get,
13032 .put = alc268_acer_master_sw_put,
13033 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13038 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13039 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13040 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13044 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13045 /* output mixer control */
13046 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13048 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13049 .name = "Master Playback Switch",
13050 .info = snd_hda_mixer_amp_switch_info,
13051 .get = snd_hda_mixer_amp_switch_get,
13052 .put = alc268_acer_master_sw_put,
13053 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13058 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13059 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13060 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13061 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13062 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13063 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13067 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13068 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13069 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13071 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13075 /* capture mixer elements */
13076 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13077 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13078 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13079 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13084 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13086 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13087 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13088 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13090 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13091 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13092 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13096 static struct hda_verb alc269_lifebook_verbs[] = {
13097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13098 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13100 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13101 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13102 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13104 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13105 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13106 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13110 /* toggle speaker-output according to the hp-jack state */
13111 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13113 unsigned int present;
13114 unsigned char bits;
13116 present = snd_hda_jack_detect(codec, 0x15);
13117 bits = present ? AMP_IN_MUTE(0) : 0;
13118 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13119 AMP_IN_MUTE(0), bits);
13120 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13121 AMP_IN_MUTE(0), bits);
13123 snd_hda_codec_write(codec, 0x20, 0,
13124 AC_VERB_SET_COEF_INDEX, 0x0c);
13125 snd_hda_codec_write(codec, 0x20, 0,
13126 AC_VERB_SET_PROC_COEF, 0x680);
13128 snd_hda_codec_write(codec, 0x20, 0,
13129 AC_VERB_SET_COEF_INDEX, 0x0c);
13130 snd_hda_codec_write(codec, 0x20, 0,
13131 AC_VERB_SET_PROC_COEF, 0x480);
13134 /* toggle speaker-output according to the hp-jacks state */
13135 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13137 unsigned int present;
13138 unsigned char bits;
13140 /* Check laptop headphone socket */
13141 present = snd_hda_jack_detect(codec, 0x15);
13143 /* Check port replicator headphone socket */
13144 present |= snd_hda_jack_detect(codec, 0x1a);
13146 bits = present ? AMP_IN_MUTE(0) : 0;
13147 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13148 AMP_IN_MUTE(0), bits);
13149 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13150 AMP_IN_MUTE(0), bits);
13152 snd_hda_codec_write(codec, 0x20, 0,
13153 AC_VERB_SET_COEF_INDEX, 0x0c);
13154 snd_hda_codec_write(codec, 0x20, 0,
13155 AC_VERB_SET_PROC_COEF, 0x680);
13157 snd_hda_codec_write(codec, 0x20, 0,
13158 AC_VERB_SET_COEF_INDEX, 0x0c);
13159 snd_hda_codec_write(codec, 0x20, 0,
13160 AC_VERB_SET_PROC_COEF, 0x480);
13163 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13165 unsigned int present_laptop;
13166 unsigned int present_dock;
13168 present_laptop = snd_hda_jack_detect(codec, 0x18);
13169 present_dock = snd_hda_jack_detect(codec, 0x1b);
13171 /* Laptop mic port overrides dock mic port, design decision */
13173 snd_hda_codec_write(codec, 0x23, 0,
13174 AC_VERB_SET_CONNECT_SEL, 0x3);
13175 if (present_laptop)
13176 snd_hda_codec_write(codec, 0x23, 0,
13177 AC_VERB_SET_CONNECT_SEL, 0x0);
13178 if (!present_dock && !present_laptop)
13179 snd_hda_codec_write(codec, 0x23, 0,
13180 AC_VERB_SET_CONNECT_SEL, 0x1);
13183 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13186 switch (res >> 26) {
13187 case ALC880_HP_EVENT:
13188 alc269_quanta_fl1_speaker_automute(codec);
13190 case ALC880_MIC_EVENT:
13191 alc_mic_automute(codec);
13196 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13199 if ((res >> 26) == ALC880_HP_EVENT)
13200 alc269_lifebook_speaker_automute(codec);
13201 if ((res >> 26) == ALC880_MIC_EVENT)
13202 alc269_lifebook_mic_autoswitch(codec);
13205 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13207 struct alc_spec *spec = codec->spec;
13208 spec->ext_mic.pin = 0x18;
13209 spec->ext_mic.mux_idx = 0;
13210 spec->int_mic.pin = 0x19;
13211 spec->int_mic.mux_idx = 1;
13212 spec->auto_mic = 1;
13215 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13217 alc269_quanta_fl1_speaker_automute(codec);
13218 alc_mic_automute(codec);
13221 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13223 alc269_lifebook_speaker_automute(codec);
13224 alc269_lifebook_mic_autoswitch(codec);
13227 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13229 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13230 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13231 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13232 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13233 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13234 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13238 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13239 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13240 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13241 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13243 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13244 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13248 /* toggle speaker-output according to the hp-jack state */
13249 static void alc269_speaker_automute(struct hda_codec *codec)
13251 struct alc_spec *spec = codec->spec;
13252 unsigned int nid = spec->autocfg.hp_pins[0];
13253 unsigned int present;
13254 unsigned char bits;
13256 present = snd_hda_jack_detect(codec, nid);
13257 bits = present ? AMP_IN_MUTE(0) : 0;
13258 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13259 AMP_IN_MUTE(0), bits);
13260 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13261 AMP_IN_MUTE(0), bits);
13264 /* unsolicited event for HP jack sensing */
13265 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13268 switch (res >> 26) {
13269 case ALC880_HP_EVENT:
13270 alc269_speaker_automute(codec);
13272 case ALC880_MIC_EVENT:
13273 alc_mic_automute(codec);
13278 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13280 struct alc_spec *spec = codec->spec;
13281 spec->ext_mic.pin = 0x18;
13282 spec->ext_mic.mux_idx = 0;
13283 spec->int_mic.pin = 0x12;
13284 spec->int_mic.mux_idx = 5;
13285 spec->auto_mic = 1;
13288 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13290 struct alc_spec *spec = codec->spec;
13291 spec->ext_mic.pin = 0x18;
13292 spec->ext_mic.mux_idx = 0;
13293 spec->int_mic.pin = 0x19;
13294 spec->int_mic.mux_idx = 1;
13295 spec->auto_mic = 1;
13298 static void alc269_eeepc_inithook(struct hda_codec *codec)
13300 alc269_speaker_automute(codec);
13301 alc_mic_automute(codec);
13305 * generic initialization of ADC, input mixers and output mixers
13307 static struct hda_verb alc269_init_verbs[] = {
13309 * Unmute ADC0 and set the default input to mic-in
13311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13313 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13314 * analog-loopback mixer widget
13315 * Note: PASD motherboards uses the Line In 2 as the input for
13316 * front panel mic (mic 2)
13318 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13326 * Set up output mixers (0x0c - 0x0e)
13328 /* set vol=0 to output mixers */
13329 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13330 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13332 /* set up input amps for analog loopback */
13333 /* Amp Indices: DAC = 0, mixer = 1 */
13334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13351 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13355 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13357 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13360 /* FIXME: use matrix-type input source selection */
13361 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13362 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13369 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13370 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13374 #define alc269_auto_create_multi_out_ctls \
13375 alc268_auto_create_multi_out_ctls
13376 #define alc269_auto_create_input_ctls \
13377 alc268_auto_create_input_ctls
13379 #ifdef CONFIG_SND_HDA_POWER_SAVE
13380 #define alc269_loopbacks alc880_loopbacks
13383 /* pcm configuration: identical with ALC880 */
13384 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13385 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13386 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13387 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13389 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13393 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13394 /* NID is set in alc_build_pcms */
13396 .open = alc880_playback_pcm_open,
13397 .prepare = alc880_playback_pcm_prepare,
13398 .cleanup = alc880_playback_pcm_cleanup
13402 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13406 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13407 /* NID is set in alc_build_pcms */
13411 * BIOS auto configuration
13413 static int alc269_parse_auto_config(struct hda_codec *codec)
13415 struct alc_spec *spec = codec->spec;
13417 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13419 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13424 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13427 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13431 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13433 if (spec->autocfg.dig_outs)
13434 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13436 if (spec->kctls.list)
13437 add_mixer(spec, spec->kctls.list);
13439 add_verb(spec, alc269_init_verbs);
13440 spec->num_mux_defs = 1;
13441 spec->input_mux = &spec->private_imux[0];
13442 /* set default input source */
13443 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13444 0, AC_VERB_SET_CONNECT_SEL,
13445 spec->input_mux->items[0].index);
13447 err = alc_auto_add_mic_boost(codec);
13451 if (!spec->cap_mixer && !spec->no_analog)
13452 set_capture_mixer(codec);
13454 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13459 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13460 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13461 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13464 /* init callback for auto-configuration model -- overriding the default init */
13465 static void alc269_auto_init(struct hda_codec *codec)
13467 struct alc_spec *spec = codec->spec;
13468 alc269_auto_init_multi_out(codec);
13469 alc269_auto_init_hp_out(codec);
13470 alc269_auto_init_analog_input(codec);
13471 if (spec->unsol_event)
13472 alc_inithook(codec);
13476 * configuration and preset
13478 static const char *alc269_models[ALC269_MODEL_LAST] = {
13479 [ALC269_BASIC] = "basic",
13480 [ALC269_QUANTA_FL1] = "quanta",
13481 [ALC269_ASUS_AMIC] = "asus-amic",
13482 [ALC269_ASUS_DMIC] = "asus-dmic",
13483 [ALC269_FUJITSU] = "fujitsu",
13484 [ALC269_LIFEBOOK] = "lifebook",
13485 [ALC269_AUTO] = "auto",
13488 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13489 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13490 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13492 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13493 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13494 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13495 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13496 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13497 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13498 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13499 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13500 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13501 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13502 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13503 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13504 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13505 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13506 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13507 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13508 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13509 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13510 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13511 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13512 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13513 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13514 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13515 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13516 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13517 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13518 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13519 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13520 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13522 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13524 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13525 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13526 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13527 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13531 static struct alc_config_preset alc269_presets[] = {
13533 .mixers = { alc269_base_mixer },
13534 .init_verbs = { alc269_init_verbs },
13535 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13536 .dac_nids = alc269_dac_nids,
13538 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13539 .channel_mode = alc269_modes,
13540 .input_mux = &alc269_capture_source,
13542 [ALC269_QUANTA_FL1] = {
13543 .mixers = { alc269_quanta_fl1_mixer },
13544 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13545 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13546 .dac_nids = alc269_dac_nids,
13548 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13549 .channel_mode = alc269_modes,
13550 .input_mux = &alc269_capture_source,
13551 .unsol_event = alc269_quanta_fl1_unsol_event,
13552 .setup = alc269_quanta_fl1_setup,
13553 .init_hook = alc269_quanta_fl1_init_hook,
13555 [ALC269_ASUS_AMIC] = {
13556 .mixers = { alc269_eeepc_mixer },
13557 .cap_mixer = alc269_epc_capture_mixer,
13558 .init_verbs = { alc269_init_verbs,
13559 alc269_eeepc_amic_init_verbs },
13560 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13561 .dac_nids = alc269_dac_nids,
13563 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13564 .channel_mode = alc269_modes,
13565 .unsol_event = alc269_eeepc_unsol_event,
13566 .setup = alc269_eeepc_amic_setup,
13567 .init_hook = alc269_eeepc_inithook,
13569 [ALC269_ASUS_DMIC] = {
13570 .mixers = { alc269_eeepc_mixer },
13571 .cap_mixer = alc269_epc_capture_mixer,
13572 .init_verbs = { alc269_init_verbs,
13573 alc269_eeepc_dmic_init_verbs },
13574 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13575 .dac_nids = alc269_dac_nids,
13577 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13578 .channel_mode = alc269_modes,
13579 .unsol_event = alc269_eeepc_unsol_event,
13580 .setup = alc269_eeepc_dmic_setup,
13581 .init_hook = alc269_eeepc_inithook,
13583 [ALC269_FUJITSU] = {
13584 .mixers = { alc269_fujitsu_mixer },
13585 .cap_mixer = alc269_epc_capture_mixer,
13586 .init_verbs = { alc269_init_verbs,
13587 alc269_eeepc_dmic_init_verbs },
13588 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13589 .dac_nids = alc269_dac_nids,
13591 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13592 .channel_mode = alc269_modes,
13593 .unsol_event = alc269_eeepc_unsol_event,
13594 .setup = alc269_eeepc_dmic_setup,
13595 .init_hook = alc269_eeepc_inithook,
13597 [ALC269_LIFEBOOK] = {
13598 .mixers = { alc269_lifebook_mixer },
13599 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13600 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13601 .dac_nids = alc269_dac_nids,
13603 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13604 .channel_mode = alc269_modes,
13605 .input_mux = &alc269_capture_source,
13606 .unsol_event = alc269_lifebook_unsol_event,
13607 .init_hook = alc269_lifebook_init_hook,
13611 static int patch_alc269(struct hda_codec *codec)
13613 struct alc_spec *spec;
13617 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13621 codec->spec = spec;
13623 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13625 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13626 kfree(codec->chip_name);
13627 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13628 if (!codec->chip_name) {
13634 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13638 if (board_config < 0) {
13639 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13641 board_config = ALC269_AUTO;
13644 if (board_config == ALC269_AUTO) {
13645 /* automatic parse from the BIOS config */
13646 err = alc269_parse_auto_config(codec);
13652 "hda_codec: Cannot set up configuration "
13653 "from BIOS. Using base mode...\n");
13654 board_config = ALC269_BASIC;
13658 err = snd_hda_attach_beep_device(codec, 0x1);
13664 if (board_config != ALC269_AUTO)
13665 setup_preset(codec, &alc269_presets[board_config]);
13667 if (codec->subsystem_id == 0x17aa3bf8) {
13668 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13669 * fix the sample rate of analog I/O to 44.1kHz
13671 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13672 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13674 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13675 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13677 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13678 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13680 spec->adc_nids = alc269_adc_nids;
13681 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13682 spec->capsrc_nids = alc269_capsrc_nids;
13683 if (!spec->cap_mixer)
13684 set_capture_mixer(codec);
13685 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13687 spec->vmaster_nid = 0x02;
13689 codec->patch_ops = alc_patch_ops;
13690 if (board_config == ALC269_AUTO)
13691 spec->init_hook = alc269_auto_init;
13692 #ifdef CONFIG_SND_HDA_POWER_SAVE
13693 if (!spec->loopback.amplist)
13694 spec->loopback.amplist = alc269_loopbacks;
13696 codec->proc_widget_hook = print_realtek_coef;
13702 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13706 * set the path ways for 2 channel output
13707 * need to set the codec line out and mic 1 pin widgets to inputs
13709 static struct hda_verb alc861_threestack_ch2_init[] = {
13710 /* set pin widget 1Ah (line in) for input */
13711 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13712 /* set pin widget 18h (mic1/2) for input, for mic also enable
13715 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13717 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13719 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13720 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13726 * need to set the codec line out and mic 1 pin widgets to outputs
13728 static struct hda_verb alc861_threestack_ch6_init[] = {
13729 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13730 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13731 /* set pin widget 18h (mic1) for output (CLFE)*/
13732 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13734 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13735 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13737 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13740 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13745 static struct hda_channel_mode alc861_threestack_modes[2] = {
13746 { 2, alc861_threestack_ch2_init },
13747 { 6, alc861_threestack_ch6_init },
13749 /* Set mic1 as input and unmute the mixer */
13750 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13751 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13752 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13755 /* Set mic1 as output and mute mixer */
13756 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13757 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13758 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13762 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13763 { 2, alc861_uniwill_m31_ch2_init },
13764 { 4, alc861_uniwill_m31_ch4_init },
13767 /* Set mic1 and line-in as input and unmute the mixer */
13768 static struct hda_verb alc861_asus_ch2_init[] = {
13769 /* set pin widget 1Ah (line in) for input */
13770 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13771 /* set pin widget 18h (mic1/2) for input, for mic also enable
13774 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13776 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13778 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13779 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13783 /* Set mic1 nad line-in as output and mute mixer */
13784 static struct hda_verb alc861_asus_ch6_init[] = {
13785 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13786 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13787 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13788 /* set pin widget 18h (mic1) for output (CLFE)*/
13789 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13790 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13791 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13792 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13796 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13797 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13802 static struct hda_channel_mode alc861_asus_modes[2] = {
13803 { 2, alc861_asus_ch2_init },
13804 { 6, alc861_asus_ch6_init },
13809 static struct snd_kcontrol_new alc861_base_mixer[] = {
13810 /* output mixer control */
13811 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13812 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13813 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13814 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13815 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13817 /*Input mixer control */
13818 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13819 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13820 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13821 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13822 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13823 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13825 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13832 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13833 /* output mixer control */
13834 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13835 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13836 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13837 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13838 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13840 /* Input mixer control */
13841 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13842 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13843 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13844 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13845 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13846 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13848 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13849 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13854 .name = "Channel Mode",
13855 .info = alc_ch_mode_info,
13856 .get = alc_ch_mode_get,
13857 .put = alc_ch_mode_put,
13858 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13863 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13864 /* output mixer control */
13865 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13866 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13867 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13872 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13873 /* output mixer control */
13874 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13875 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13876 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13877 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13878 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13880 /* Input mixer control */
13881 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13882 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13883 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13884 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13885 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13886 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13888 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13889 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13894 .name = "Channel Mode",
13895 .info = alc_ch_mode_info,
13896 .get = alc_ch_mode_get,
13897 .put = alc_ch_mode_put,
13898 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13903 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13904 /* output mixer control */
13905 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13906 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13907 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13908 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13909 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13911 /* Input mixer control */
13912 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13913 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13914 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13915 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13916 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13917 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13919 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13920 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13924 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13925 .name = "Channel Mode",
13926 .info = alc_ch_mode_info,
13927 .get = alc_ch_mode_get,
13928 .put = alc_ch_mode_put,
13929 .private_value = ARRAY_SIZE(alc861_asus_modes),
13934 /* additional mixer */
13935 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13936 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13937 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13942 * generic initialization of ADC, input mixers and output mixers
13944 static struct hda_verb alc861_base_init_verbs[] = {
13946 * Unmute ADC0 and set the default input to mic-in
13948 /* port-A for surround (rear panel) */
13949 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13950 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13951 /* port-B for mic-in (rear panel) with vref */
13952 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13953 /* port-C for line-in (rear panel) */
13954 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13955 /* port-D for Front */
13956 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13957 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13958 /* port-E for HP out (front panel) */
13959 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13960 /* route front PCM to HP */
13961 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13962 /* port-F for mic-in (front panel) with vref */
13963 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13964 /* port-G for CLFE (rear panel) */
13965 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13966 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13967 /* port-H for side (rear panel) */
13968 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13969 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13971 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13972 /* route front mic to ADC1*/
13973 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 /* Unmute DAC0~3 & spdif out*/
13977 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13978 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13979 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13980 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13983 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13984 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13986 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13989 /* Unmute Stereo Mixer 15 */
13990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13996 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13997 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13998 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14003 /* hp used DAC 3 (Front) */
14004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14010 static struct hda_verb alc861_threestack_init_verbs[] = {
14012 * Unmute ADC0 and set the default input to mic-in
14014 /* port-A for surround (rear panel) */
14015 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14016 /* port-B for mic-in (rear panel) with vref */
14017 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14018 /* port-C for line-in (rear panel) */
14019 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14020 /* port-D for Front */
14021 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14022 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14023 /* port-E for HP out (front panel) */
14024 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14025 /* route front PCM to HP */
14026 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14027 /* port-F for mic-in (front panel) with vref */
14028 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14029 /* port-G for CLFE (rear panel) */
14030 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14031 /* port-H for side (rear panel) */
14032 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14034 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14035 /* route front mic to ADC1*/
14036 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14038 /* Unmute DAC0~3 & spdif out*/
14039 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14040 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14041 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14042 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14045 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14046 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14047 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14048 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14049 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14051 /* Unmute Stereo Mixer 15 */
14052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14059 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14060 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14065 /* hp used DAC 3 (Front) */
14066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14071 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14073 * Unmute ADC0 and set the default input to mic-in
14075 /* port-A for surround (rear panel) */
14076 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14077 /* port-B for mic-in (rear panel) with vref */
14078 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14079 /* port-C for line-in (rear panel) */
14080 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14081 /* port-D for Front */
14082 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14083 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14084 /* port-E for HP out (front panel) */
14085 /* this has to be set to VREF80 */
14086 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14087 /* route front PCM to HP */
14088 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14089 /* port-F for mic-in (front panel) with vref */
14090 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14091 /* port-G for CLFE (rear panel) */
14092 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14093 /* port-H for side (rear panel) */
14094 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14096 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14097 /* route front mic to ADC1*/
14098 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14099 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14100 /* Unmute DAC0~3 & spdif out*/
14101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14104 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14107 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14108 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14109 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14110 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14113 /* Unmute Stereo Mixer 15 */
14114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14119 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14120 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14127 /* hp used DAC 3 (Front) */
14128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14133 static struct hda_verb alc861_asus_init_verbs[] = {
14135 * Unmute ADC0 and set the default input to mic-in
14137 /* port-A for surround (rear panel)
14138 * according to codec#0 this is the HP jack
14140 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14141 /* route front PCM to HP */
14142 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14143 /* port-B for mic-in (rear panel) with vref */
14144 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14145 /* port-C for line-in (rear panel) */
14146 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14147 /* port-D for Front */
14148 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14149 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14150 /* port-E for HP out (front panel) */
14151 /* this has to be set to VREF80 */
14152 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14153 /* route front PCM to HP */
14154 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14155 /* port-F for mic-in (front panel) with vref */
14156 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14157 /* port-G for CLFE (rear panel) */
14158 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14159 /* port-H for side (rear panel) */
14160 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14162 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14163 /* route front mic to ADC1*/
14164 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14166 /* Unmute DAC0~3 & spdif out*/
14167 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14168 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14169 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14170 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14172 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14173 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14174 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14175 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14176 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14178 /* Unmute Stereo Mixer 15 */
14179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14184 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14186 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14187 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14189 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14190 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14192 /* hp used DAC 3 (Front) */
14193 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14198 /* additional init verbs for ASUS laptops */
14199 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14200 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14201 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14206 * generic initialization of ADC, input mixers and output mixers
14208 static struct hda_verb alc861_auto_init_verbs[] = {
14210 * Unmute ADC0 and set the default input to mic-in
14212 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14215 /* Unmute DAC0~3 & spdif out*/
14216 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14217 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14218 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14219 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14222 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14223 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14224 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14225 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14226 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14228 /* Unmute Stereo Mixer 15 */
14229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14230 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14231 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14234 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14235 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14236 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14237 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14238 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14239 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14240 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14241 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14243 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14244 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14245 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14246 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14247 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14249 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14250 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14252 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14257 static struct hda_verb alc861_toshiba_init_verbs[] = {
14258 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14263 /* toggle speaker-output according to the hp-jack state */
14264 static void alc861_toshiba_automute(struct hda_codec *codec)
14266 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14268 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14269 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14270 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14271 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14274 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14277 if ((res >> 26) == ALC880_HP_EVENT)
14278 alc861_toshiba_automute(codec);
14281 /* pcm configuration: identical with ALC880 */
14282 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14283 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14284 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14285 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14288 #define ALC861_DIGOUT_NID 0x07
14290 static struct hda_channel_mode alc861_8ch_modes[1] = {
14294 static hda_nid_t alc861_dac_nids[4] = {
14295 /* front, surround, clfe, side */
14296 0x03, 0x06, 0x05, 0x04
14299 static hda_nid_t alc660_dac_nids[3] = {
14300 /* front, clfe, surround */
14304 static hda_nid_t alc861_adc_nids[1] = {
14309 static struct hda_input_mux alc861_capture_source = {
14313 { "Front Mic", 0x3 },
14320 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14322 struct alc_spec *spec = codec->spec;
14323 hda_nid_t mix, srcs[5];
14326 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14328 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14331 for (i = 0; i < num; i++) {
14333 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14334 if (type != AC_WID_AUD_OUT)
14336 for (j = 0; j < spec->multiout.num_dacs; j++)
14337 if (spec->multiout.dac_nids[j] == srcs[i])
14339 if (j >= spec->multiout.num_dacs)
14345 /* fill in the dac_nids table from the parsed pin configuration */
14346 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14347 const struct auto_pin_cfg *cfg)
14349 struct alc_spec *spec = codec->spec;
14351 hda_nid_t nid, dac;
14353 spec->multiout.dac_nids = spec->private_dac_nids;
14354 for (i = 0; i < cfg->line_outs; i++) {
14355 nid = cfg->line_out_pins[i];
14356 dac = alc861_look_for_dac(codec, nid);
14359 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14364 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14365 hda_nid_t nid, unsigned int chs)
14367 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14368 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14371 /* add playback controls from the parsed DAC table */
14372 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14373 const struct auto_pin_cfg *cfg)
14375 struct alc_spec *spec = codec->spec;
14376 static const char *chname[4] = {
14377 "Front", "Surround", NULL /*CLFE*/, "Side"
14382 if (cfg->line_outs == 1) {
14383 const char *pfx = NULL;
14386 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14389 nid = spec->multiout.dac_nids[0];
14390 return alc861_create_out_sw(codec, pfx, nid, 3);
14394 for (i = 0; i < cfg->line_outs; i++) {
14395 nid = spec->multiout.dac_nids[i];
14400 err = alc861_create_out_sw(codec, "Center", nid, 1);
14403 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14407 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14415 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14417 struct alc_spec *spec = codec->spec;
14424 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14425 nid = alc861_look_for_dac(codec, pin);
14427 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14430 spec->multiout.hp_nid = nid;
14436 /* create playback/capture controls for input pins */
14437 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14438 const struct auto_pin_cfg *cfg)
14440 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14443 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14445 int pin_type, hda_nid_t dac)
14447 hda_nid_t mix, srcs[5];
14450 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14452 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14454 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14456 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14459 for (i = 0; i < num; i++) {
14461 if (srcs[i] == dac || srcs[i] == 0x15)
14462 mute = AMP_IN_UNMUTE(i);
14464 mute = AMP_IN_MUTE(i);
14465 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14470 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14472 struct alc_spec *spec = codec->spec;
14475 for (i = 0; i < spec->autocfg.line_outs; i++) {
14476 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14477 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14479 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14480 spec->multiout.dac_nids[i]);
14484 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14486 struct alc_spec *spec = codec->spec;
14488 if (spec->autocfg.hp_outs)
14489 alc861_auto_set_output_and_unmute(codec,
14490 spec->autocfg.hp_pins[0],
14492 spec->multiout.hp_nid);
14493 if (spec->autocfg.speaker_outs)
14494 alc861_auto_set_output_and_unmute(codec,
14495 spec->autocfg.speaker_pins[0],
14497 spec->multiout.dac_nids[0]);
14500 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14502 struct alc_spec *spec = codec->spec;
14505 for (i = 0; i < AUTO_PIN_LAST; i++) {
14506 hda_nid_t nid = spec->autocfg.input_pins[i];
14507 if (nid >= 0x0c && nid <= 0x11)
14508 alc_set_input_pin(codec, nid, i);
14512 /* parse the BIOS configuration and set up the alc_spec */
14513 /* return 1 if successful, 0 if the proper config is not found,
14514 * or a negative error code
14516 static int alc861_parse_auto_config(struct hda_codec *codec)
14518 struct alc_spec *spec = codec->spec;
14520 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14522 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14526 if (!spec->autocfg.line_outs)
14527 return 0; /* can't find valid BIOS pin config */
14529 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14532 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14535 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14538 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14542 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14544 if (spec->autocfg.dig_outs)
14545 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14547 if (spec->kctls.list)
14548 add_mixer(spec, spec->kctls.list);
14550 add_verb(spec, alc861_auto_init_verbs);
14552 spec->num_mux_defs = 1;
14553 spec->input_mux = &spec->private_imux[0];
14555 spec->adc_nids = alc861_adc_nids;
14556 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14557 set_capture_mixer(codec);
14559 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14564 /* additional initialization for auto-configuration model */
14565 static void alc861_auto_init(struct hda_codec *codec)
14567 struct alc_spec *spec = codec->spec;
14568 alc861_auto_init_multi_out(codec);
14569 alc861_auto_init_hp_out(codec);
14570 alc861_auto_init_analog_input(codec);
14571 if (spec->unsol_event)
14572 alc_inithook(codec);
14575 #ifdef CONFIG_SND_HDA_POWER_SAVE
14576 static struct hda_amp_list alc861_loopbacks[] = {
14577 { 0x15, HDA_INPUT, 0 },
14578 { 0x15, HDA_INPUT, 1 },
14579 { 0x15, HDA_INPUT, 2 },
14580 { 0x15, HDA_INPUT, 3 },
14587 * configuration and preset
14589 static const char *alc861_models[ALC861_MODEL_LAST] = {
14590 [ALC861_3ST] = "3stack",
14591 [ALC660_3ST] = "3stack-660",
14592 [ALC861_3ST_DIG] = "3stack-dig",
14593 [ALC861_6ST_DIG] = "6stack-dig",
14594 [ALC861_UNIWILL_M31] = "uniwill-m31",
14595 [ALC861_TOSHIBA] = "toshiba",
14596 [ALC861_ASUS] = "asus",
14597 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14598 [ALC861_AUTO] = "auto",
14601 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14602 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14603 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14604 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14605 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14606 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14607 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14608 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14609 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14610 * Any other models that need this preset?
14612 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14613 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14614 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14615 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14616 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14617 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14618 /* FIXME: the below seems conflict */
14619 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14620 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14621 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14625 static struct alc_config_preset alc861_presets[] = {
14627 .mixers = { alc861_3ST_mixer },
14628 .init_verbs = { alc861_threestack_init_verbs },
14629 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14630 .dac_nids = alc861_dac_nids,
14631 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14632 .channel_mode = alc861_threestack_modes,
14634 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14635 .adc_nids = alc861_adc_nids,
14636 .input_mux = &alc861_capture_source,
14638 [ALC861_3ST_DIG] = {
14639 .mixers = { alc861_base_mixer },
14640 .init_verbs = { alc861_threestack_init_verbs },
14641 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14642 .dac_nids = alc861_dac_nids,
14643 .dig_out_nid = ALC861_DIGOUT_NID,
14644 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14645 .channel_mode = alc861_threestack_modes,
14647 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14648 .adc_nids = alc861_adc_nids,
14649 .input_mux = &alc861_capture_source,
14651 [ALC861_6ST_DIG] = {
14652 .mixers = { alc861_base_mixer },
14653 .init_verbs = { alc861_base_init_verbs },
14654 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14655 .dac_nids = alc861_dac_nids,
14656 .dig_out_nid = ALC861_DIGOUT_NID,
14657 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14658 .channel_mode = alc861_8ch_modes,
14659 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14660 .adc_nids = alc861_adc_nids,
14661 .input_mux = &alc861_capture_source,
14664 .mixers = { alc861_3ST_mixer },
14665 .init_verbs = { alc861_threestack_init_verbs },
14666 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14667 .dac_nids = alc660_dac_nids,
14668 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14669 .channel_mode = alc861_threestack_modes,
14671 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14672 .adc_nids = alc861_adc_nids,
14673 .input_mux = &alc861_capture_source,
14675 [ALC861_UNIWILL_M31] = {
14676 .mixers = { alc861_uniwill_m31_mixer },
14677 .init_verbs = { alc861_uniwill_m31_init_verbs },
14678 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14679 .dac_nids = alc861_dac_nids,
14680 .dig_out_nid = ALC861_DIGOUT_NID,
14681 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14682 .channel_mode = alc861_uniwill_m31_modes,
14684 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14685 .adc_nids = alc861_adc_nids,
14686 .input_mux = &alc861_capture_source,
14688 [ALC861_TOSHIBA] = {
14689 .mixers = { alc861_toshiba_mixer },
14690 .init_verbs = { alc861_base_init_verbs,
14691 alc861_toshiba_init_verbs },
14692 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14693 .dac_nids = alc861_dac_nids,
14694 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14695 .channel_mode = alc883_3ST_2ch_modes,
14696 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14697 .adc_nids = alc861_adc_nids,
14698 .input_mux = &alc861_capture_source,
14699 .unsol_event = alc861_toshiba_unsol_event,
14700 .init_hook = alc861_toshiba_automute,
14703 .mixers = { alc861_asus_mixer },
14704 .init_verbs = { alc861_asus_init_verbs },
14705 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14706 .dac_nids = alc861_dac_nids,
14707 .dig_out_nid = ALC861_DIGOUT_NID,
14708 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14709 .channel_mode = alc861_asus_modes,
14712 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14713 .adc_nids = alc861_adc_nids,
14714 .input_mux = &alc861_capture_source,
14716 [ALC861_ASUS_LAPTOP] = {
14717 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14718 .init_verbs = { alc861_asus_init_verbs,
14719 alc861_asus_laptop_init_verbs },
14720 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14721 .dac_nids = alc861_dac_nids,
14722 .dig_out_nid = ALC861_DIGOUT_NID,
14723 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14724 .channel_mode = alc883_3ST_2ch_modes,
14726 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14727 .adc_nids = alc861_adc_nids,
14728 .input_mux = &alc861_capture_source,
14732 /* Pin config fixes */
14734 PINFIX_FSC_AMILO_PI1505,
14737 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14738 { 0x0b, 0x0221101f }, /* HP */
14739 { 0x0f, 0x90170310 }, /* speaker */
14743 static const struct alc_fixup alc861_fixups[] = {
14744 [PINFIX_FSC_AMILO_PI1505] = {
14745 .pins = alc861_fsc_amilo_pi1505_pinfix
14749 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14750 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14754 static int patch_alc861(struct hda_codec *codec)
14756 struct alc_spec *spec;
14760 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14764 codec->spec = spec;
14766 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14770 if (board_config < 0) {
14771 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14773 board_config = ALC861_AUTO;
14776 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14778 if (board_config == ALC861_AUTO) {
14779 /* automatic parse from the BIOS config */
14780 err = alc861_parse_auto_config(codec);
14786 "hda_codec: Cannot set up configuration "
14787 "from BIOS. Using base mode...\n");
14788 board_config = ALC861_3ST_DIG;
14792 err = snd_hda_attach_beep_device(codec, 0x23);
14798 if (board_config != ALC861_AUTO)
14799 setup_preset(codec, &alc861_presets[board_config]);
14801 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14802 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14804 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14805 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14807 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14809 spec->vmaster_nid = 0x03;
14811 codec->patch_ops = alc_patch_ops;
14812 if (board_config == ALC861_AUTO)
14813 spec->init_hook = alc861_auto_init;
14814 #ifdef CONFIG_SND_HDA_POWER_SAVE
14815 if (!spec->loopback.amplist)
14816 spec->loopback.amplist = alc861_loopbacks;
14818 codec->proc_widget_hook = print_realtek_coef;
14824 * ALC861-VD support
14828 * In addition, an independent DAC
14830 #define ALC861VD_DIGOUT_NID 0x06
14832 static hda_nid_t alc861vd_dac_nids[4] = {
14833 /* front, surr, clfe, side surr */
14834 0x02, 0x03, 0x04, 0x05
14837 /* dac_nids for ALC660vd are in a different order - according to
14838 * Realtek's driver.
14839 * This should probably result in a different mixer for 6stack models
14840 * of ALC660vd codecs, but for now there is only 3stack mixer
14841 * - and it is the same as in 861vd.
14842 * adc_nids in ALC660vd are (is) the same as in 861vd
14844 static hda_nid_t alc660vd_dac_nids[3] = {
14845 /* front, rear, clfe, rear_surr */
14849 static hda_nid_t alc861vd_adc_nids[1] = {
14854 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14857 /* FIXME: should be a matrix-type input source selection */
14858 static struct hda_input_mux alc861vd_capture_source = {
14862 { "Front Mic", 0x1 },
14868 static struct hda_input_mux alc861vd_dallas_capture_source = {
14871 { "Ext Mic", 0x0 },
14872 { "Int Mic", 0x1 },
14876 static struct hda_input_mux alc861vd_hp_capture_source = {
14879 { "Front Mic", 0x0 },
14880 { "ATAPI Mic", 0x1 },
14887 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14894 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14895 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14896 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14897 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14898 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14905 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14906 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14907 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14908 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14909 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14913 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14914 { 6, alc861vd_6stack_ch6_init },
14915 { 8, alc861vd_6stack_ch8_init },
14918 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14921 .name = "Channel Mode",
14922 .info = alc_ch_mode_info,
14923 .get = alc_ch_mode_get,
14924 .put = alc_ch_mode_put,
14929 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14930 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14932 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14933 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14934 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14937 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14939 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14941 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14943 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14944 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14946 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14947 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14951 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14955 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14956 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14959 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14960 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14962 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14963 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14968 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14969 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14970 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14976 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14978 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14979 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14980 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14982 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14983 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14991 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14992 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14993 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14994 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14998 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15000 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15002 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15003 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15004 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15006 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15007 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15012 /* Pin assignment: Speaker=0x14, HP = 0x15,
15013 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15015 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15016 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15017 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15018 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15019 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15020 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15021 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15022 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15023 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15024 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15025 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15029 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15030 * Front Mic=0x18, ATAPI Mic = 0x19,
15032 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15033 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15036 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15037 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15038 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15039 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15040 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15046 * generic initialization of ADC, input mixers and output mixers
15048 static struct hda_verb alc861vd_volume_init_verbs[] = {
15050 * Unmute ADC0 and set the default input to mic-in
15052 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15053 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15055 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15056 * the analog-loopback mixer widget
15058 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15065 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15066 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15072 * Set up output mixers (0x02 - 0x05)
15074 /* set vol=0 to output mixers */
15075 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15076 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15077 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15078 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15080 /* set up input amps for analog loopback */
15081 /* Amp Indices: DAC = 0, mixer = 1 */
15082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15084 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15086 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15087 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15088 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15095 * 3-stack pin configuration:
15096 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15098 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15100 * Set pin mode and muting
15102 /* set front pin widgets 0x14 for output */
15103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15105 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15107 /* Mic (rear) pin: input vref at 80% */
15108 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15109 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15110 /* Front Mic pin: input vref at 80% */
15111 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15112 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15113 /* Line In pin: input */
15114 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15116 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15117 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15118 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15119 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15120 /* CD pin widget for input */
15121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15127 * 6-stack pin configuration:
15129 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15131 * Set pin mode and muting
15133 /* set front pin widgets 0x14 for output */
15134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15135 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15136 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15138 /* Rear Pin: output 1 (0x0d) */
15139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15141 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15142 /* CLFE Pin: output 2 (0x0e) */
15143 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15145 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15146 /* Side Pin: output 3 (0x0f) */
15147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15148 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15149 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15151 /* Mic (rear) pin: input vref at 80% */
15152 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15153 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15154 /* Front Mic pin: input vref at 80% */
15155 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15156 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15157 /* Line In pin: input */
15158 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15159 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15160 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15161 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15162 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15163 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15164 /* CD pin widget for input */
15165 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15170 static struct hda_verb alc861vd_eapd_verbs[] = {
15171 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15175 static struct hda_verb alc660vd_eapd_verbs[] = {
15176 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15177 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15181 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15185 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15186 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15190 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15192 unsigned int present;
15193 unsigned char bits;
15195 present = snd_hda_jack_detect(codec, 0x18);
15196 bits = present ? HDA_AMP_MUTE : 0;
15198 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15199 HDA_AMP_MUTE, bits);
15202 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15204 struct alc_spec *spec = codec->spec;
15205 spec->autocfg.hp_pins[0] = 0x1b;
15206 spec->autocfg.speaker_pins[0] = 0x14;
15209 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15211 alc_automute_amp(codec);
15212 alc861vd_lenovo_mic_automute(codec);
15215 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15218 switch (res >> 26) {
15219 case ALC880_MIC_EVENT:
15220 alc861vd_lenovo_mic_automute(codec);
15223 alc_automute_amp_unsol_event(codec, res);
15228 static struct hda_verb alc861vd_dallas_verbs[] = {
15229 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15230 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15231 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15232 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15236 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15240 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15241 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15244 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15247 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15249 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15252 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15253 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15254 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15255 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15256 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15258 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15259 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15267 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15273 /* toggle speaker-output according to the hp-jack state */
15274 static void alc861vd_dallas_setup(struct hda_codec *codec)
15276 struct alc_spec *spec = codec->spec;
15278 spec->autocfg.hp_pins[0] = 0x15;
15279 spec->autocfg.speaker_pins[0] = 0x14;
15282 #ifdef CONFIG_SND_HDA_POWER_SAVE
15283 #define alc861vd_loopbacks alc880_loopbacks
15286 /* pcm configuration: identical with ALC880 */
15287 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15288 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15289 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15290 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15293 * configuration and preset
15295 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15296 [ALC660VD_3ST] = "3stack-660",
15297 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15298 [ALC660VD_ASUS_V1S] = "asus-v1s",
15299 [ALC861VD_3ST] = "3stack",
15300 [ALC861VD_3ST_DIG] = "3stack-digout",
15301 [ALC861VD_6ST_DIG] = "6stack-digout",
15302 [ALC861VD_LENOVO] = "lenovo",
15303 [ALC861VD_DALLAS] = "dallas",
15304 [ALC861VD_HP] = "hp",
15305 [ALC861VD_AUTO] = "auto",
15308 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15309 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15310 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15311 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15312 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15313 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15314 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15315 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15316 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15317 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15318 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15319 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15320 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15321 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15322 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15323 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15327 static struct alc_config_preset alc861vd_presets[] = {
15329 .mixers = { alc861vd_3st_mixer },
15330 .init_verbs = { alc861vd_volume_init_verbs,
15331 alc861vd_3stack_init_verbs },
15332 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15333 .dac_nids = alc660vd_dac_nids,
15334 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15335 .channel_mode = alc861vd_3stack_2ch_modes,
15336 .input_mux = &alc861vd_capture_source,
15338 [ALC660VD_3ST_DIG] = {
15339 .mixers = { alc861vd_3st_mixer },
15340 .init_verbs = { alc861vd_volume_init_verbs,
15341 alc861vd_3stack_init_verbs },
15342 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15343 .dac_nids = alc660vd_dac_nids,
15344 .dig_out_nid = ALC861VD_DIGOUT_NID,
15345 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15346 .channel_mode = alc861vd_3stack_2ch_modes,
15347 .input_mux = &alc861vd_capture_source,
15350 .mixers = { alc861vd_3st_mixer },
15351 .init_verbs = { alc861vd_volume_init_verbs,
15352 alc861vd_3stack_init_verbs },
15353 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15354 .dac_nids = alc861vd_dac_nids,
15355 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15356 .channel_mode = alc861vd_3stack_2ch_modes,
15357 .input_mux = &alc861vd_capture_source,
15359 [ALC861VD_3ST_DIG] = {
15360 .mixers = { alc861vd_3st_mixer },
15361 .init_verbs = { alc861vd_volume_init_verbs,
15362 alc861vd_3stack_init_verbs },
15363 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15364 .dac_nids = alc861vd_dac_nids,
15365 .dig_out_nid = ALC861VD_DIGOUT_NID,
15366 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15367 .channel_mode = alc861vd_3stack_2ch_modes,
15368 .input_mux = &alc861vd_capture_source,
15370 [ALC861VD_6ST_DIG] = {
15371 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15372 .init_verbs = { alc861vd_volume_init_verbs,
15373 alc861vd_6stack_init_verbs },
15374 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15375 .dac_nids = alc861vd_dac_nids,
15376 .dig_out_nid = ALC861VD_DIGOUT_NID,
15377 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15378 .channel_mode = alc861vd_6stack_modes,
15379 .input_mux = &alc861vd_capture_source,
15381 [ALC861VD_LENOVO] = {
15382 .mixers = { alc861vd_lenovo_mixer },
15383 .init_verbs = { alc861vd_volume_init_verbs,
15384 alc861vd_3stack_init_verbs,
15385 alc861vd_eapd_verbs,
15386 alc861vd_lenovo_unsol_verbs },
15387 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15388 .dac_nids = alc660vd_dac_nids,
15389 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15390 .channel_mode = alc861vd_3stack_2ch_modes,
15391 .input_mux = &alc861vd_capture_source,
15392 .unsol_event = alc861vd_lenovo_unsol_event,
15393 .setup = alc861vd_lenovo_setup,
15394 .init_hook = alc861vd_lenovo_init_hook,
15396 [ALC861VD_DALLAS] = {
15397 .mixers = { alc861vd_dallas_mixer },
15398 .init_verbs = { alc861vd_dallas_verbs },
15399 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15400 .dac_nids = alc861vd_dac_nids,
15401 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15402 .channel_mode = alc861vd_3stack_2ch_modes,
15403 .input_mux = &alc861vd_dallas_capture_source,
15404 .unsol_event = alc_automute_amp_unsol_event,
15405 .setup = alc861vd_dallas_setup,
15406 .init_hook = alc_automute_amp,
15409 .mixers = { alc861vd_hp_mixer },
15410 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15411 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15412 .dac_nids = alc861vd_dac_nids,
15413 .dig_out_nid = ALC861VD_DIGOUT_NID,
15414 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15415 .channel_mode = alc861vd_3stack_2ch_modes,
15416 .input_mux = &alc861vd_hp_capture_source,
15417 .unsol_event = alc_automute_amp_unsol_event,
15418 .setup = alc861vd_dallas_setup,
15419 .init_hook = alc_automute_amp,
15421 [ALC660VD_ASUS_V1S] = {
15422 .mixers = { alc861vd_lenovo_mixer },
15423 .init_verbs = { alc861vd_volume_init_verbs,
15424 alc861vd_3stack_init_verbs,
15425 alc861vd_eapd_verbs,
15426 alc861vd_lenovo_unsol_verbs },
15427 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15428 .dac_nids = alc660vd_dac_nids,
15429 .dig_out_nid = ALC861VD_DIGOUT_NID,
15430 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15431 .channel_mode = alc861vd_3stack_2ch_modes,
15432 .input_mux = &alc861vd_capture_source,
15433 .unsol_event = alc861vd_lenovo_unsol_event,
15434 .setup = alc861vd_lenovo_setup,
15435 .init_hook = alc861vd_lenovo_init_hook,
15440 * BIOS auto configuration
15442 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15443 const struct auto_pin_cfg *cfg)
15445 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15449 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15450 hda_nid_t nid, int pin_type, int dac_idx)
15452 alc_set_pin_output(codec, nid, pin_type);
15455 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15457 struct alc_spec *spec = codec->spec;
15460 for (i = 0; i <= HDA_SIDE; i++) {
15461 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15462 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15464 alc861vd_auto_set_output_and_unmute(codec, nid,
15470 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15472 struct alc_spec *spec = codec->spec;
15475 pin = spec->autocfg.hp_pins[0];
15476 if (pin) /* connect to front and use dac 0 */
15477 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15478 pin = spec->autocfg.speaker_pins[0];
15480 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15483 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15485 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15487 struct alc_spec *spec = codec->spec;
15490 for (i = 0; i < AUTO_PIN_LAST; i++) {
15491 hda_nid_t nid = spec->autocfg.input_pins[i];
15492 if (alc_is_input_pin(codec, nid)) {
15493 alc_set_input_pin(codec, nid, i);
15494 if (nid != ALC861VD_PIN_CD_NID &&
15495 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15496 snd_hda_codec_write(codec, nid, 0,
15497 AC_VERB_SET_AMP_GAIN_MUTE,
15503 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15505 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15506 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15508 /* add playback controls from the parsed DAC table */
15509 /* Based on ALC880 version. But ALC861VD has separate,
15510 * different NIDs for mute/unmute switch and volume control */
15511 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15512 const struct auto_pin_cfg *cfg)
15514 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15515 hda_nid_t nid_v, nid_s;
15518 for (i = 0; i < cfg->line_outs; i++) {
15519 if (!spec->multiout.dac_nids[i])
15521 nid_v = alc861vd_idx_to_mixer_vol(
15523 spec->multiout.dac_nids[i]));
15524 nid_s = alc861vd_idx_to_mixer_switch(
15526 spec->multiout.dac_nids[i]));
15530 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15532 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15536 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15538 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15542 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15544 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15548 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15550 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15556 if (cfg->line_outs == 1 &&
15557 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15564 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15565 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15569 if (cfg->line_outs == 1 &&
15570 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15572 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15573 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15582 /* add playback controls for speaker and HP outputs */
15583 /* Based on ALC880 version. But ALC861VD has separate,
15584 * different NIDs for mute/unmute switch and volume control */
15585 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15586 hda_nid_t pin, const char *pfx)
15588 hda_nid_t nid_v, nid_s;
15594 if (alc880_is_fixed_pin(pin)) {
15595 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15596 /* specify the DAC as the extra output */
15597 if (!spec->multiout.hp_nid)
15598 spec->multiout.hp_nid = nid_v;
15600 spec->multiout.extra_out_nid[0] = nid_v;
15601 /* control HP volume/switch on the output mixer amp */
15602 nid_v = alc861vd_idx_to_mixer_vol(
15603 alc880_fixed_pin_idx(pin));
15604 nid_s = alc861vd_idx_to_mixer_switch(
15605 alc880_fixed_pin_idx(pin));
15607 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15608 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15611 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15612 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15615 } else if (alc880_is_multi_pin(pin)) {
15616 /* set manual connection */
15617 /* we have only a switch on HP-out PIN */
15618 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15619 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15626 /* parse the BIOS configuration and set up the alc_spec
15627 * return 1 if successful, 0 if the proper config is not found,
15628 * or a negative error code
15629 * Based on ALC880 version - had to change it to override
15630 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15631 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15633 struct alc_spec *spec = codec->spec;
15635 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15637 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15641 if (!spec->autocfg.line_outs)
15642 return 0; /* can't find valid BIOS pin config */
15644 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15647 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15650 err = alc861vd_auto_create_extra_out(spec,
15651 spec->autocfg.speaker_pins[0],
15655 err = alc861vd_auto_create_extra_out(spec,
15656 spec->autocfg.hp_pins[0],
15660 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15664 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15666 if (spec->autocfg.dig_outs)
15667 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15669 if (spec->kctls.list)
15670 add_mixer(spec, spec->kctls.list);
15672 add_verb(spec, alc861vd_volume_init_verbs);
15674 spec->num_mux_defs = 1;
15675 spec->input_mux = &spec->private_imux[0];
15677 err = alc_auto_add_mic_boost(codec);
15681 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15686 /* additional initialization for auto-configuration model */
15687 static void alc861vd_auto_init(struct hda_codec *codec)
15689 struct alc_spec *spec = codec->spec;
15690 alc861vd_auto_init_multi_out(codec);
15691 alc861vd_auto_init_hp_out(codec);
15692 alc861vd_auto_init_analog_input(codec);
15693 alc861vd_auto_init_input_src(codec);
15694 if (spec->unsol_event)
15695 alc_inithook(codec);
15699 ALC660VD_FIX_ASUS_GPIO1
15703 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15704 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15705 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15706 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15710 static const struct alc_fixup alc861vd_fixups[] = {
15711 [ALC660VD_FIX_ASUS_GPIO1] = {
15712 .verbs = alc660vd_fix_asus_gpio1_verbs,
15716 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15717 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15721 static int patch_alc861vd(struct hda_codec *codec)
15723 struct alc_spec *spec;
15724 int err, board_config;
15726 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15730 codec->spec = spec;
15732 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15736 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15737 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15739 board_config = ALC861VD_AUTO;
15742 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15744 if (board_config == ALC861VD_AUTO) {
15745 /* automatic parse from the BIOS config */
15746 err = alc861vd_parse_auto_config(codec);
15752 "hda_codec: Cannot set up configuration "
15753 "from BIOS. Using base mode...\n");
15754 board_config = ALC861VD_3ST;
15758 err = snd_hda_attach_beep_device(codec, 0x23);
15764 if (board_config != ALC861VD_AUTO)
15765 setup_preset(codec, &alc861vd_presets[board_config]);
15767 if (codec->vendor_id == 0x10ec0660) {
15768 /* always turn on EAPD */
15769 add_verb(spec, alc660vd_eapd_verbs);
15772 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15773 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15775 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15776 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15778 if (!spec->adc_nids) {
15779 spec->adc_nids = alc861vd_adc_nids;
15780 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15782 if (!spec->capsrc_nids)
15783 spec->capsrc_nids = alc861vd_capsrc_nids;
15785 set_capture_mixer(codec);
15786 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15788 spec->vmaster_nid = 0x02;
15790 codec->patch_ops = alc_patch_ops;
15792 if (board_config == ALC861VD_AUTO)
15793 spec->init_hook = alc861vd_auto_init;
15794 #ifdef CONFIG_SND_HDA_POWER_SAVE
15795 if (!spec->loopback.amplist)
15796 spec->loopback.amplist = alc861vd_loopbacks;
15798 codec->proc_widget_hook = print_realtek_coef;
15806 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15807 * configuration. Each pin widget can choose any input DACs and a mixer.
15808 * Each ADC is connected from a mixer of all inputs. This makes possible
15809 * 6-channel independent captures.
15811 * In addition, an independent DAC for the multi-playback (not used in this
15814 #define ALC662_DIGOUT_NID 0x06
15815 #define ALC662_DIGIN_NID 0x0a
15817 static hda_nid_t alc662_dac_nids[4] = {
15818 /* front, rear, clfe, rear_surr */
15822 static hda_nid_t alc272_dac_nids[2] = {
15826 static hda_nid_t alc662_adc_nids[2] = {
15831 static hda_nid_t alc272_adc_nids[1] = {
15836 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15837 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15841 /* FIXME: should be a matrix-type input source selection */
15842 static struct hda_input_mux alc662_capture_source = {
15846 { "Front Mic", 0x1 },
15852 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15860 static struct hda_input_mux alc663_capture_source = {
15864 { "Front Mic", 0x1 },
15869 #if 0 /* set to 1 for testing other input sources below */
15870 static struct hda_input_mux alc272_nc10_capture_source = {
15873 { "Autoselect Mic", 0x0 },
15874 { "Internal Mic", 0x1 },
15875 { "In-0x02", 0x2 },
15876 { "In-0x03", 0x3 },
15877 { "In-0x04", 0x4 },
15878 { "In-0x05", 0x5 },
15879 { "In-0x06", 0x6 },
15880 { "In-0x07", 0x7 },
15881 { "In-0x08", 0x8 },
15882 { "In-0x09", 0x9 },
15883 { "In-0x0a", 0x0a },
15884 { "In-0x0b", 0x0b },
15885 { "In-0x0c", 0x0c },
15886 { "In-0x0d", 0x0d },
15887 { "In-0x0e", 0x0e },
15888 { "In-0x0f", 0x0f },
15896 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15903 static struct hda_verb alc662_3ST_ch2_init[] = {
15904 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15905 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15906 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15907 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15914 static struct hda_verb alc662_3ST_ch6_init[] = {
15915 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15916 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15917 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15918 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15919 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15920 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15924 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15925 { 2, alc662_3ST_ch2_init },
15926 { 6, alc662_3ST_ch6_init },
15932 static struct hda_verb alc662_sixstack_ch6_init[] = {
15933 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15934 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15935 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15942 static struct hda_verb alc662_sixstack_ch8_init[] = {
15943 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15944 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15945 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15949 static struct hda_channel_mode alc662_5stack_modes[2] = {
15950 { 2, alc662_sixstack_ch6_init },
15951 { 6, alc662_sixstack_ch8_init },
15954 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15955 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15958 static struct snd_kcontrol_new alc662_base_mixer[] = {
15959 /* output mixer control */
15960 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15961 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15963 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15966 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15967 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15970 /*Input mixer control */
15971 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15972 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15973 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15974 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15975 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15976 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15982 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15983 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15984 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15992 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15997 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15998 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15999 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16001 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16002 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16003 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16004 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16005 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16007 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16008 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16009 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16010 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16013 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16014 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16018 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16019 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16020 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16021 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16022 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16027 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16031 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16032 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16033 ALC262_HIPPO_MASTER_SWITCH,
16035 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16036 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16037 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16039 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16040 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16041 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16045 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16046 ALC262_HIPPO_MASTER_SWITCH,
16047 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16048 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16051 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16059 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16060 .ops = &snd_hda_bind_vol,
16062 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16063 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16068 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16069 .ops = &snd_hda_bind_sw,
16071 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16072 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16077 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16078 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16079 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16085 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16086 .ops = &snd_hda_bind_sw,
16088 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16089 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16090 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16095 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16096 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16097 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16100 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16101 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16106 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16107 .ops = &snd_hda_bind_sw,
16109 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16110 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16111 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16116 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16117 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16118 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16121 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16122 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16126 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16128 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16132 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16133 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16137 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16138 .ops = &snd_hda_bind_vol,
16140 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16141 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16146 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16147 .ops = &snd_hda_bind_sw,
16149 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16150 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16155 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16156 HDA_BIND_VOL("Master Playback Volume",
16157 &alc663_asus_two_bind_master_vol),
16158 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16166 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16167 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16168 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16170 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16176 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16177 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16178 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16179 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16180 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16185 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16186 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16190 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16192 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16197 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16198 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16204 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16205 .ops = &snd_hda_bind_sw,
16207 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16208 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16209 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16210 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16211 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16216 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16217 .ops = &snd_hda_bind_sw,
16219 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16220 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16225 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16226 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16227 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16228 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16229 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16230 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16231 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16232 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16238 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16239 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16240 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16241 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16242 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16243 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16250 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16252 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16253 .name = "Channel Mode",
16254 .info = alc_ch_mode_info,
16255 .get = alc_ch_mode_get,
16256 .put = alc_ch_mode_put,
16261 static struct hda_verb alc662_init_verbs[] = {
16262 /* ADC: mute amp left and right */
16263 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16264 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16265 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16273 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16275 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16280 /* Front Pin: output 0 (0x0c) */
16281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16284 /* Rear Pin: output 1 (0x0d) */
16285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16288 /* CLFE Pin: output 2 (0x0e) */
16289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16292 /* Mic (rear) pin: input vref at 80% */
16293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16295 /* Front Mic pin: input vref at 80% */
16296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16298 /* Line In pin: input */
16299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16301 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16302 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16303 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16304 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16305 /* CD pin widget for input */
16306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16308 /* FIXME: use matrix-type input source selection */
16309 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16314 /* always trun on EAPD */
16315 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16316 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16321 static struct hda_verb alc662_sue_init_verbs[] = {
16322 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16323 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16327 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16329 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16333 /* Set Unsolicited Event*/
16334 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16335 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16336 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16341 * generic initialization of ADC, input mixers and output mixers
16343 static struct hda_verb alc662_auto_init_verbs[] = {
16345 * Unmute ADC and set the default input to mic-in
16347 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16350 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16352 * Note: PASD motherboards uses the Line In 2 as the input for front
16353 * panel mic (mic 2)
16355 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16358 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16359 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16363 * Set up output mixers (0x0c - 0x0f)
16365 /* set vol=0 to output mixers */
16366 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16367 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16368 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16370 /* set up input amps for analog loopback */
16371 /* Amp Indices: DAC = 0, mixer = 1 */
16372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16380 /* FIXME: use matrix-type input source selection */
16381 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16388 /* additional verbs for ALC663 */
16389 static struct hda_verb alc663_auto_init_verbs[] = {
16390 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16391 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16395 static struct hda_verb alc663_m51va_init_verbs[] = {
16396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16397 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16398 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16399 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16400 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16403 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16404 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16408 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16409 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16410 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16411 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16414 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16415 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16419 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16422 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16423 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16426 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16427 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16431 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16434 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16437 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16442 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16443 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16444 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16445 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16446 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16449 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16453 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16454 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16458 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16459 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16460 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16461 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16462 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16468 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16469 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16470 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16474 static struct hda_verb alc663_g71v_init_verbs[] = {
16475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16476 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16477 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16479 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16480 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16481 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16483 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16484 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16485 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16489 static struct hda_verb alc663_g50v_init_verbs[] = {
16490 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16491 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16492 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16494 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16495 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16499 static struct hda_verb alc662_ecs_init_verbs[] = {
16500 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16502 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16503 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16507 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16508 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16509 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16512 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16513 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16514 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16518 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16522 static struct hda_verb alc272_dell_init_verbs[] = {
16523 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16524 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16526 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16527 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16528 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16529 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16532 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16533 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16537 static struct hda_verb alc663_mode7_init_verbs[] = {
16538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16539 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16540 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16541 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16542 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16545 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16546 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16547 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16550 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16551 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16552 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16556 static struct hda_verb alc663_mode8_init_verbs[] = {
16557 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16560 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16561 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16562 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16563 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16565 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16566 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16567 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16571 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16572 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16576 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16577 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16578 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16582 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16583 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16584 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16588 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16590 unsigned int present;
16591 unsigned char bits;
16593 present = snd_hda_jack_detect(codec, 0x14);
16594 bits = present ? HDA_AMP_MUTE : 0;
16596 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16597 HDA_AMP_MUTE, bits);
16600 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16602 unsigned int present;
16603 unsigned char bits;
16605 present = snd_hda_jack_detect(codec, 0x1b);
16606 bits = present ? HDA_AMP_MUTE : 0;
16608 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16609 HDA_AMP_MUTE, bits);
16610 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16611 HDA_AMP_MUTE, bits);
16614 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16617 if ((res >> 26) == ALC880_HP_EVENT)
16618 alc662_lenovo_101e_all_automute(codec);
16619 if ((res >> 26) == ALC880_FRONT_EVENT)
16620 alc662_lenovo_101e_ispeaker_automute(codec);
16623 /* unsolicited event for HP jack sensing */
16624 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16627 if ((res >> 26) == ALC880_MIC_EVENT)
16628 alc_mic_automute(codec);
16630 alc262_hippo_unsol_event(codec, res);
16633 static void alc662_eeepc_setup(struct hda_codec *codec)
16635 struct alc_spec *spec = codec->spec;
16637 alc262_hippo1_setup(codec);
16638 spec->ext_mic.pin = 0x18;
16639 spec->ext_mic.mux_idx = 0;
16640 spec->int_mic.pin = 0x19;
16641 spec->int_mic.mux_idx = 1;
16642 spec->auto_mic = 1;
16645 static void alc662_eeepc_inithook(struct hda_codec *codec)
16647 alc262_hippo_automute(codec);
16648 alc_mic_automute(codec);
16651 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16653 struct alc_spec *spec = codec->spec;
16655 spec->autocfg.hp_pins[0] = 0x14;
16656 spec->autocfg.speaker_pins[0] = 0x1b;
16659 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16661 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16663 unsigned int present;
16664 unsigned char bits;
16666 present = snd_hda_jack_detect(codec, 0x21);
16667 bits = present ? HDA_AMP_MUTE : 0;
16668 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16669 AMP_IN_MUTE(0), bits);
16670 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16671 AMP_IN_MUTE(0), bits);
16674 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16676 unsigned int present;
16677 unsigned char bits;
16679 present = snd_hda_jack_detect(codec, 0x21);
16680 bits = present ? HDA_AMP_MUTE : 0;
16681 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16682 AMP_IN_MUTE(0), bits);
16683 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16684 AMP_IN_MUTE(0), bits);
16685 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16686 AMP_IN_MUTE(0), bits);
16687 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16688 AMP_IN_MUTE(0), bits);
16691 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16693 unsigned int present;
16694 unsigned char bits;
16696 present = snd_hda_jack_detect(codec, 0x15);
16697 bits = present ? HDA_AMP_MUTE : 0;
16698 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16699 AMP_IN_MUTE(0), bits);
16700 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16701 AMP_IN_MUTE(0), bits);
16702 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16703 AMP_IN_MUTE(0), bits);
16704 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16705 AMP_IN_MUTE(0), bits);
16708 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16710 unsigned int present;
16711 unsigned char bits;
16713 present = snd_hda_jack_detect(codec, 0x1b);
16714 bits = present ? 0 : PIN_OUT;
16715 snd_hda_codec_write(codec, 0x14, 0,
16716 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16719 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16721 unsigned int present1, present2;
16723 present1 = snd_hda_jack_detect(codec, 0x21);
16724 present2 = snd_hda_jack_detect(codec, 0x15);
16726 if (present1 || present2) {
16727 snd_hda_codec_write_cache(codec, 0x14, 0,
16728 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16730 snd_hda_codec_write_cache(codec, 0x14, 0,
16731 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16735 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16737 unsigned int present1, present2;
16739 present1 = snd_hda_jack_detect(codec, 0x1b);
16740 present2 = snd_hda_jack_detect(codec, 0x15);
16742 if (present1 || present2) {
16743 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16744 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16745 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16746 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16748 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16749 AMP_IN_MUTE(0), 0);
16750 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16751 AMP_IN_MUTE(0), 0);
16755 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16757 unsigned int present1, present2;
16759 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16760 AC_VERB_GET_PIN_SENSE, 0)
16761 & AC_PINSENSE_PRESENCE;
16762 present2 = snd_hda_codec_read(codec, 0x21, 0,
16763 AC_VERB_GET_PIN_SENSE, 0)
16764 & AC_PINSENSE_PRESENCE;
16766 if (present1 || present2) {
16767 snd_hda_codec_write_cache(codec, 0x14, 0,
16768 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16769 snd_hda_codec_write_cache(codec, 0x17, 0,
16770 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16772 snd_hda_codec_write_cache(codec, 0x14, 0,
16773 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16774 snd_hda_codec_write_cache(codec, 0x17, 0,
16775 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16779 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16781 unsigned int present1, present2;
16783 present1 = snd_hda_codec_read(codec, 0x21, 0,
16784 AC_VERB_GET_PIN_SENSE, 0)
16785 & AC_PINSENSE_PRESENCE;
16786 present2 = snd_hda_codec_read(codec, 0x15, 0,
16787 AC_VERB_GET_PIN_SENSE, 0)
16788 & AC_PINSENSE_PRESENCE;
16790 if (present1 || present2) {
16791 snd_hda_codec_write_cache(codec, 0x14, 0,
16792 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16793 snd_hda_codec_write_cache(codec, 0x17, 0,
16794 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16796 snd_hda_codec_write_cache(codec, 0x14, 0,
16797 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16798 snd_hda_codec_write_cache(codec, 0x17, 0,
16799 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16803 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16806 switch (res >> 26) {
16807 case ALC880_HP_EVENT:
16808 alc663_m51va_speaker_automute(codec);
16810 case ALC880_MIC_EVENT:
16811 alc_mic_automute(codec);
16816 static void alc663_m51va_setup(struct hda_codec *codec)
16818 struct alc_spec *spec = codec->spec;
16819 spec->ext_mic.pin = 0x18;
16820 spec->ext_mic.mux_idx = 0;
16821 spec->int_mic.pin = 0x12;
16822 spec->int_mic.mux_idx = 9;
16823 spec->auto_mic = 1;
16826 static void alc663_m51va_inithook(struct hda_codec *codec)
16828 alc663_m51va_speaker_automute(codec);
16829 alc_mic_automute(codec);
16832 /* ***************** Mode1 ******************************/
16833 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16835 static void alc663_mode1_setup(struct hda_codec *codec)
16837 struct alc_spec *spec = codec->spec;
16838 spec->ext_mic.pin = 0x18;
16839 spec->ext_mic.mux_idx = 0;
16840 spec->int_mic.pin = 0x19;
16841 spec->int_mic.mux_idx = 1;
16842 spec->auto_mic = 1;
16845 #define alc663_mode1_inithook alc663_m51va_inithook
16847 /* ***************** Mode2 ******************************/
16848 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16851 switch (res >> 26) {
16852 case ALC880_HP_EVENT:
16853 alc662_f5z_speaker_automute(codec);
16855 case ALC880_MIC_EVENT:
16856 alc_mic_automute(codec);
16861 #define alc662_mode2_setup alc663_mode1_setup
16863 static void alc662_mode2_inithook(struct hda_codec *codec)
16865 alc662_f5z_speaker_automute(codec);
16866 alc_mic_automute(codec);
16868 /* ***************** Mode3 ******************************/
16869 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16872 switch (res >> 26) {
16873 case ALC880_HP_EVENT:
16874 alc663_two_hp_m1_speaker_automute(codec);
16876 case ALC880_MIC_EVENT:
16877 alc_mic_automute(codec);
16882 #define alc663_mode3_setup alc663_mode1_setup
16884 static void alc663_mode3_inithook(struct hda_codec *codec)
16886 alc663_two_hp_m1_speaker_automute(codec);
16887 alc_mic_automute(codec);
16889 /* ***************** Mode4 ******************************/
16890 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16893 switch (res >> 26) {
16894 case ALC880_HP_EVENT:
16895 alc663_21jd_two_speaker_automute(codec);
16897 case ALC880_MIC_EVENT:
16898 alc_mic_automute(codec);
16903 #define alc663_mode4_setup alc663_mode1_setup
16905 static void alc663_mode4_inithook(struct hda_codec *codec)
16907 alc663_21jd_two_speaker_automute(codec);
16908 alc_mic_automute(codec);
16910 /* ***************** Mode5 ******************************/
16911 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16914 switch (res >> 26) {
16915 case ALC880_HP_EVENT:
16916 alc663_15jd_two_speaker_automute(codec);
16918 case ALC880_MIC_EVENT:
16919 alc_mic_automute(codec);
16924 #define alc663_mode5_setup alc663_mode1_setup
16926 static void alc663_mode5_inithook(struct hda_codec *codec)
16928 alc663_15jd_two_speaker_automute(codec);
16929 alc_mic_automute(codec);
16931 /* ***************** Mode6 ******************************/
16932 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16935 switch (res >> 26) {
16936 case ALC880_HP_EVENT:
16937 alc663_two_hp_m2_speaker_automute(codec);
16939 case ALC880_MIC_EVENT:
16940 alc_mic_automute(codec);
16945 #define alc663_mode6_setup alc663_mode1_setup
16947 static void alc663_mode6_inithook(struct hda_codec *codec)
16949 alc663_two_hp_m2_speaker_automute(codec);
16950 alc_mic_automute(codec);
16953 /* ***************** Mode7 ******************************/
16954 static void alc663_mode7_unsol_event(struct hda_codec *codec,
16957 switch (res >> 26) {
16958 case ALC880_HP_EVENT:
16959 alc663_two_hp_m7_speaker_automute(codec);
16961 case ALC880_MIC_EVENT:
16962 alc_mic_automute(codec);
16967 #define alc663_mode7_setup alc663_mode1_setup
16969 static void alc663_mode7_inithook(struct hda_codec *codec)
16971 alc663_two_hp_m7_speaker_automute(codec);
16972 alc_mic_automute(codec);
16975 /* ***************** Mode8 ******************************/
16976 static void alc663_mode8_unsol_event(struct hda_codec *codec,
16979 switch (res >> 26) {
16980 case ALC880_HP_EVENT:
16981 alc663_two_hp_m8_speaker_automute(codec);
16983 case ALC880_MIC_EVENT:
16984 alc_mic_automute(codec);
16989 #define alc663_mode8_setup alc663_m51va_setup
16991 static void alc663_mode8_inithook(struct hda_codec *codec)
16993 alc663_two_hp_m8_speaker_automute(codec);
16994 alc_mic_automute(codec);
16997 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16999 unsigned int present;
17000 unsigned char bits;
17002 present = snd_hda_jack_detect(codec, 0x21);
17003 bits = present ? HDA_AMP_MUTE : 0;
17004 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17005 HDA_AMP_MUTE, bits);
17006 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17007 HDA_AMP_MUTE, bits);
17010 static void alc663_g71v_front_automute(struct hda_codec *codec)
17012 unsigned int present;
17013 unsigned char bits;
17015 present = snd_hda_jack_detect(codec, 0x15);
17016 bits = present ? HDA_AMP_MUTE : 0;
17017 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17018 HDA_AMP_MUTE, bits);
17021 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17024 switch (res >> 26) {
17025 case ALC880_HP_EVENT:
17026 alc663_g71v_hp_automute(codec);
17028 case ALC880_FRONT_EVENT:
17029 alc663_g71v_front_automute(codec);
17031 case ALC880_MIC_EVENT:
17032 alc_mic_automute(codec);
17037 #define alc663_g71v_setup alc663_m51va_setup
17039 static void alc663_g71v_inithook(struct hda_codec *codec)
17041 alc663_g71v_front_automute(codec);
17042 alc663_g71v_hp_automute(codec);
17043 alc_mic_automute(codec);
17046 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17049 switch (res >> 26) {
17050 case ALC880_HP_EVENT:
17051 alc663_m51va_speaker_automute(codec);
17053 case ALC880_MIC_EVENT:
17054 alc_mic_automute(codec);
17059 #define alc663_g50v_setup alc663_m51va_setup
17061 static void alc663_g50v_inithook(struct hda_codec *codec)
17063 alc663_m51va_speaker_automute(codec);
17064 alc_mic_automute(codec);
17067 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17068 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17069 ALC262_HIPPO_MASTER_SWITCH,
17071 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17072 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17073 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17075 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17076 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17077 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17081 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17082 /* Master Playback automatically created from Speaker and Headphone */
17083 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17084 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17085 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17088 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17089 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17090 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17092 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17093 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17094 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17098 #ifdef CONFIG_SND_HDA_POWER_SAVE
17099 #define alc662_loopbacks alc880_loopbacks
17103 /* pcm configuration: identical with ALC880 */
17104 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17105 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17106 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17107 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17110 * configuration and preset
17112 static const char *alc662_models[ALC662_MODEL_LAST] = {
17113 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17114 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17115 [ALC662_3ST_6ch] = "3stack-6ch",
17116 [ALC662_5ST_DIG] = "6stack-dig",
17117 [ALC662_LENOVO_101E] = "lenovo-101e",
17118 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17119 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17120 [ALC662_ECS] = "ecs",
17121 [ALC663_ASUS_M51VA] = "m51va",
17122 [ALC663_ASUS_G71V] = "g71v",
17123 [ALC663_ASUS_H13] = "h13",
17124 [ALC663_ASUS_G50V] = "g50v",
17125 [ALC663_ASUS_MODE1] = "asus-mode1",
17126 [ALC662_ASUS_MODE2] = "asus-mode2",
17127 [ALC663_ASUS_MODE3] = "asus-mode3",
17128 [ALC663_ASUS_MODE4] = "asus-mode4",
17129 [ALC663_ASUS_MODE5] = "asus-mode5",
17130 [ALC663_ASUS_MODE6] = "asus-mode6",
17131 [ALC663_ASUS_MODE7] = "asus-mode7",
17132 [ALC663_ASUS_MODE8] = "asus-mode8",
17133 [ALC272_DELL] = "dell",
17134 [ALC272_DELL_ZM1] = "dell-zm1",
17135 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17136 [ALC662_AUTO] = "auto",
17139 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17140 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17141 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17142 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17143 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17144 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17145 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17146 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17147 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17148 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17149 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17150 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17151 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17152 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17153 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17154 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17155 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17156 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17157 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17158 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17159 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17160 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17161 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17162 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17163 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17164 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17165 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17166 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17167 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17168 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17169 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17170 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17171 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17172 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17173 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17174 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17175 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17176 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17177 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17178 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17179 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17180 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17181 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17182 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17183 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17184 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17185 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17186 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17187 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17188 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17189 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17190 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17191 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17192 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17193 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17194 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17195 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17196 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17197 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17198 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17199 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17200 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17201 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17202 ALC662_3ST_6ch_DIG),
17203 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17204 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17205 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17206 ALC662_3ST_6ch_DIG),
17207 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17208 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17209 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17210 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17211 ALC662_3ST_6ch_DIG),
17212 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17214 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17218 static struct alc_config_preset alc662_presets[] = {
17219 [ALC662_3ST_2ch_DIG] = {
17220 .mixers = { alc662_3ST_2ch_mixer },
17221 .init_verbs = { alc662_init_verbs },
17222 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17223 .dac_nids = alc662_dac_nids,
17224 .dig_out_nid = ALC662_DIGOUT_NID,
17225 .dig_in_nid = ALC662_DIGIN_NID,
17226 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17227 .channel_mode = alc662_3ST_2ch_modes,
17228 .input_mux = &alc662_capture_source,
17230 [ALC662_3ST_6ch_DIG] = {
17231 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17232 .init_verbs = { alc662_init_verbs },
17233 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17234 .dac_nids = alc662_dac_nids,
17235 .dig_out_nid = ALC662_DIGOUT_NID,
17236 .dig_in_nid = ALC662_DIGIN_NID,
17237 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17238 .channel_mode = alc662_3ST_6ch_modes,
17240 .input_mux = &alc662_capture_source,
17242 [ALC662_3ST_6ch] = {
17243 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17244 .init_verbs = { alc662_init_verbs },
17245 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17246 .dac_nids = alc662_dac_nids,
17247 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17248 .channel_mode = alc662_3ST_6ch_modes,
17250 .input_mux = &alc662_capture_source,
17252 [ALC662_5ST_DIG] = {
17253 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17254 .init_verbs = { alc662_init_verbs },
17255 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17256 .dac_nids = alc662_dac_nids,
17257 .dig_out_nid = ALC662_DIGOUT_NID,
17258 .dig_in_nid = ALC662_DIGIN_NID,
17259 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17260 .channel_mode = alc662_5stack_modes,
17261 .input_mux = &alc662_capture_source,
17263 [ALC662_LENOVO_101E] = {
17264 .mixers = { alc662_lenovo_101e_mixer },
17265 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17266 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17267 .dac_nids = alc662_dac_nids,
17268 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17269 .channel_mode = alc662_3ST_2ch_modes,
17270 .input_mux = &alc662_lenovo_101e_capture_source,
17271 .unsol_event = alc662_lenovo_101e_unsol_event,
17272 .init_hook = alc662_lenovo_101e_all_automute,
17274 [ALC662_ASUS_EEEPC_P701] = {
17275 .mixers = { alc662_eeepc_p701_mixer },
17276 .init_verbs = { alc662_init_verbs,
17277 alc662_eeepc_sue_init_verbs },
17278 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17279 .dac_nids = alc662_dac_nids,
17280 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17281 .channel_mode = alc662_3ST_2ch_modes,
17282 .unsol_event = alc662_eeepc_unsol_event,
17283 .setup = alc662_eeepc_setup,
17284 .init_hook = alc662_eeepc_inithook,
17286 [ALC662_ASUS_EEEPC_EP20] = {
17287 .mixers = { alc662_eeepc_ep20_mixer,
17288 alc662_chmode_mixer },
17289 .init_verbs = { alc662_init_verbs,
17290 alc662_eeepc_ep20_sue_init_verbs },
17291 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17292 .dac_nids = alc662_dac_nids,
17293 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17294 .channel_mode = alc662_3ST_6ch_modes,
17295 .input_mux = &alc662_lenovo_101e_capture_source,
17296 .unsol_event = alc662_eeepc_unsol_event,
17297 .setup = alc662_eeepc_ep20_setup,
17298 .init_hook = alc662_eeepc_ep20_inithook,
17301 .mixers = { alc662_ecs_mixer },
17302 .init_verbs = { alc662_init_verbs,
17303 alc662_ecs_init_verbs },
17304 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17305 .dac_nids = alc662_dac_nids,
17306 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17307 .channel_mode = alc662_3ST_2ch_modes,
17308 .unsol_event = alc662_eeepc_unsol_event,
17309 .setup = alc662_eeepc_setup,
17310 .init_hook = alc662_eeepc_inithook,
17312 [ALC663_ASUS_M51VA] = {
17313 .mixers = { alc663_m51va_mixer },
17314 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17315 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17316 .dac_nids = alc662_dac_nids,
17317 .dig_out_nid = ALC662_DIGOUT_NID,
17318 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17319 .channel_mode = alc662_3ST_2ch_modes,
17320 .unsol_event = alc663_m51va_unsol_event,
17321 .setup = alc663_m51va_setup,
17322 .init_hook = alc663_m51va_inithook,
17324 [ALC663_ASUS_G71V] = {
17325 .mixers = { alc663_g71v_mixer },
17326 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17327 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17328 .dac_nids = alc662_dac_nids,
17329 .dig_out_nid = ALC662_DIGOUT_NID,
17330 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17331 .channel_mode = alc662_3ST_2ch_modes,
17332 .unsol_event = alc663_g71v_unsol_event,
17333 .setup = alc663_g71v_setup,
17334 .init_hook = alc663_g71v_inithook,
17336 [ALC663_ASUS_H13] = {
17337 .mixers = { alc663_m51va_mixer },
17338 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17339 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17340 .dac_nids = alc662_dac_nids,
17341 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17342 .channel_mode = alc662_3ST_2ch_modes,
17343 .unsol_event = alc663_m51va_unsol_event,
17344 .init_hook = alc663_m51va_inithook,
17346 [ALC663_ASUS_G50V] = {
17347 .mixers = { alc663_g50v_mixer },
17348 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17349 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17350 .dac_nids = alc662_dac_nids,
17351 .dig_out_nid = ALC662_DIGOUT_NID,
17352 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17353 .channel_mode = alc662_3ST_6ch_modes,
17354 .input_mux = &alc663_capture_source,
17355 .unsol_event = alc663_g50v_unsol_event,
17356 .setup = alc663_g50v_setup,
17357 .init_hook = alc663_g50v_inithook,
17359 [ALC663_ASUS_MODE1] = {
17360 .mixers = { alc663_m51va_mixer },
17361 .cap_mixer = alc662_auto_capture_mixer,
17362 .init_verbs = { alc662_init_verbs,
17363 alc663_21jd_amic_init_verbs },
17364 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17366 .dac_nids = alc662_dac_nids,
17367 .dig_out_nid = ALC662_DIGOUT_NID,
17368 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17369 .channel_mode = alc662_3ST_2ch_modes,
17370 .unsol_event = alc663_mode1_unsol_event,
17371 .setup = alc663_mode1_setup,
17372 .init_hook = alc663_mode1_inithook,
17374 [ALC662_ASUS_MODE2] = {
17375 .mixers = { alc662_1bjd_mixer },
17376 .cap_mixer = alc662_auto_capture_mixer,
17377 .init_verbs = { alc662_init_verbs,
17378 alc662_1bjd_amic_init_verbs },
17379 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17380 .dac_nids = alc662_dac_nids,
17381 .dig_out_nid = ALC662_DIGOUT_NID,
17382 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17383 .channel_mode = alc662_3ST_2ch_modes,
17384 .unsol_event = alc662_mode2_unsol_event,
17385 .setup = alc662_mode2_setup,
17386 .init_hook = alc662_mode2_inithook,
17388 [ALC663_ASUS_MODE3] = {
17389 .mixers = { alc663_two_hp_m1_mixer },
17390 .cap_mixer = alc662_auto_capture_mixer,
17391 .init_verbs = { alc662_init_verbs,
17392 alc663_two_hp_amic_m1_init_verbs },
17393 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17395 .dac_nids = alc662_dac_nids,
17396 .dig_out_nid = ALC662_DIGOUT_NID,
17397 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17398 .channel_mode = alc662_3ST_2ch_modes,
17399 .unsol_event = alc663_mode3_unsol_event,
17400 .setup = alc663_mode3_setup,
17401 .init_hook = alc663_mode3_inithook,
17403 [ALC663_ASUS_MODE4] = {
17404 .mixers = { alc663_asus_21jd_clfe_mixer },
17405 .cap_mixer = alc662_auto_capture_mixer,
17406 .init_verbs = { alc662_init_verbs,
17407 alc663_21jd_amic_init_verbs},
17408 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17410 .dac_nids = alc662_dac_nids,
17411 .dig_out_nid = ALC662_DIGOUT_NID,
17412 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17413 .channel_mode = alc662_3ST_2ch_modes,
17414 .unsol_event = alc663_mode4_unsol_event,
17415 .setup = alc663_mode4_setup,
17416 .init_hook = alc663_mode4_inithook,
17418 [ALC663_ASUS_MODE5] = {
17419 .mixers = { alc663_asus_15jd_clfe_mixer },
17420 .cap_mixer = alc662_auto_capture_mixer,
17421 .init_verbs = { alc662_init_verbs,
17422 alc663_15jd_amic_init_verbs },
17423 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17425 .dac_nids = alc662_dac_nids,
17426 .dig_out_nid = ALC662_DIGOUT_NID,
17427 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17428 .channel_mode = alc662_3ST_2ch_modes,
17429 .unsol_event = alc663_mode5_unsol_event,
17430 .setup = alc663_mode5_setup,
17431 .init_hook = alc663_mode5_inithook,
17433 [ALC663_ASUS_MODE6] = {
17434 .mixers = { alc663_two_hp_m2_mixer },
17435 .cap_mixer = alc662_auto_capture_mixer,
17436 .init_verbs = { alc662_init_verbs,
17437 alc663_two_hp_amic_m2_init_verbs },
17438 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17440 .dac_nids = alc662_dac_nids,
17441 .dig_out_nid = ALC662_DIGOUT_NID,
17442 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17443 .channel_mode = alc662_3ST_2ch_modes,
17444 .unsol_event = alc663_mode6_unsol_event,
17445 .setup = alc663_mode6_setup,
17446 .init_hook = alc663_mode6_inithook,
17448 [ALC663_ASUS_MODE7] = {
17449 .mixers = { alc663_mode7_mixer },
17450 .cap_mixer = alc662_auto_capture_mixer,
17451 .init_verbs = { alc662_init_verbs,
17452 alc663_mode7_init_verbs },
17453 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17455 .dac_nids = alc662_dac_nids,
17456 .dig_out_nid = ALC662_DIGOUT_NID,
17457 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17458 .channel_mode = alc662_3ST_2ch_modes,
17459 .unsol_event = alc663_mode7_unsol_event,
17460 .setup = alc663_mode7_setup,
17461 .init_hook = alc663_mode7_inithook,
17463 [ALC663_ASUS_MODE8] = {
17464 .mixers = { alc663_mode8_mixer },
17465 .cap_mixer = alc662_auto_capture_mixer,
17466 .init_verbs = { alc662_init_verbs,
17467 alc663_mode8_init_verbs },
17468 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17470 .dac_nids = alc662_dac_nids,
17471 .dig_out_nid = ALC662_DIGOUT_NID,
17472 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17473 .channel_mode = alc662_3ST_2ch_modes,
17474 .unsol_event = alc663_mode8_unsol_event,
17475 .setup = alc663_mode8_setup,
17476 .init_hook = alc663_mode8_inithook,
17479 .mixers = { alc663_m51va_mixer },
17480 .cap_mixer = alc272_auto_capture_mixer,
17481 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17482 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17483 .dac_nids = alc662_dac_nids,
17484 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17485 .adc_nids = alc272_adc_nids,
17486 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17487 .capsrc_nids = alc272_capsrc_nids,
17488 .channel_mode = alc662_3ST_2ch_modes,
17489 .unsol_event = alc663_m51va_unsol_event,
17490 .setup = alc663_m51va_setup,
17491 .init_hook = alc663_m51va_inithook,
17493 [ALC272_DELL_ZM1] = {
17494 .mixers = { alc663_m51va_mixer },
17495 .cap_mixer = alc662_auto_capture_mixer,
17496 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17497 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17498 .dac_nids = alc662_dac_nids,
17499 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17500 .adc_nids = alc662_adc_nids,
17502 .capsrc_nids = alc662_capsrc_nids,
17503 .channel_mode = alc662_3ST_2ch_modes,
17504 .unsol_event = alc663_m51va_unsol_event,
17505 .setup = alc663_m51va_setup,
17506 .init_hook = alc663_m51va_inithook,
17508 [ALC272_SAMSUNG_NC10] = {
17509 .mixers = { alc272_nc10_mixer },
17510 .init_verbs = { alc662_init_verbs,
17511 alc663_21jd_amic_init_verbs },
17512 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17513 .dac_nids = alc272_dac_nids,
17514 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17515 .channel_mode = alc662_3ST_2ch_modes,
17516 /*.input_mux = &alc272_nc10_capture_source,*/
17517 .unsol_event = alc663_mode4_unsol_event,
17518 .setup = alc663_mode4_setup,
17519 .init_hook = alc663_mode4_inithook,
17525 * BIOS auto configuration
17528 /* convert from MIX nid to DAC */
17529 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17533 else if (nid >= 0x0c && nid <= 0x0e)
17534 return nid - 0x0c + 0x02;
17539 /* get MIX nid connected to the given pin targeted to DAC */
17540 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17546 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17547 for (i = 0; i < num; i++) {
17548 if (alc662_mix_to_dac(mix[i]) == dac)
17554 /* look for an empty DAC slot */
17555 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17557 struct alc_spec *spec = codec->spec;
17561 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17564 for (i = 0; i < num; i++) {
17565 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17568 for (j = 0; j < spec->multiout.num_dacs; j++)
17569 if (spec->multiout.dac_nids[j] == nid)
17571 if (j >= spec->multiout.num_dacs)
17577 /* fill in the dac_nids table from the parsed pin configuration */
17578 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17579 const struct auto_pin_cfg *cfg)
17581 struct alc_spec *spec = codec->spec;
17585 spec->multiout.dac_nids = spec->private_dac_nids;
17586 for (i = 0; i < cfg->line_outs; i++) {
17587 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17590 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17595 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17596 hda_nid_t nid, unsigned int chs)
17598 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17599 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17602 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17603 hda_nid_t nid, unsigned int chs)
17605 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17606 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17609 #define alc662_add_stereo_vol(spec, pfx, nid) \
17610 alc662_add_vol_ctl(spec, pfx, nid, 3)
17611 #define alc662_add_stereo_sw(spec, pfx, nid) \
17612 alc662_add_sw_ctl(spec, pfx, nid, 3)
17614 /* add playback controls from the parsed DAC table */
17615 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17616 const struct auto_pin_cfg *cfg)
17618 struct alc_spec *spec = codec->spec;
17619 static const char *chname[4] = {
17620 "Front", "Surround", NULL /*CLFE*/, "Side"
17622 hda_nid_t nid, mix;
17625 for (i = 0; i < cfg->line_outs; i++) {
17626 nid = spec->multiout.dac_nids[i];
17629 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17634 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17637 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17640 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17643 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17648 if (cfg->line_outs == 1 &&
17649 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17656 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17659 if (cfg->line_outs == 1 &&
17660 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17662 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17670 /* add playback controls for speaker and HP outputs */
17671 /* return DAC nid if any new DAC is assigned */
17672 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17675 struct alc_spec *spec = codec->spec;
17676 hda_nid_t nid, mix;
17681 nid = alc662_look_for_dac(codec, pin);
17683 /* the corresponding DAC is already occupied */
17684 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17685 return 0; /* no way */
17686 /* create a switch only */
17687 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17688 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17691 mix = alc662_dac_to_mix(codec, pin, nid);
17694 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17697 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17703 /* create playback/capture controls for input pins */
17704 #define alc662_auto_create_input_ctls \
17705 alc882_auto_create_input_ctls
17707 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17708 hda_nid_t nid, int pin_type,
17714 alc_set_pin_output(codec, nid, pin_type);
17715 /* need the manual connection? */
17716 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17719 for (i = 0; i < num; i++) {
17720 if (alc662_mix_to_dac(srcs[i]) != dac)
17722 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17727 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17729 struct alc_spec *spec = codec->spec;
17730 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17733 for (i = 0; i <= HDA_SIDE; i++) {
17734 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17736 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17737 spec->multiout.dac_nids[i]);
17741 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17743 struct alc_spec *spec = codec->spec;
17746 pin = spec->autocfg.hp_pins[0];
17748 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17749 spec->multiout.hp_nid);
17750 pin = spec->autocfg.speaker_pins[0];
17752 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17753 spec->multiout.extra_out_nid[0]);
17756 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17758 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17760 struct alc_spec *spec = codec->spec;
17763 for (i = 0; i < AUTO_PIN_LAST; i++) {
17764 hda_nid_t nid = spec->autocfg.input_pins[i];
17765 if (alc_is_input_pin(codec, nid)) {
17766 alc_set_input_pin(codec, nid, i);
17767 if (nid != ALC662_PIN_CD_NID &&
17768 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17769 snd_hda_codec_write(codec, nid, 0,
17770 AC_VERB_SET_AMP_GAIN_MUTE,
17776 #define alc662_auto_init_input_src alc882_auto_init_input_src
17778 static int alc662_parse_auto_config(struct hda_codec *codec)
17780 struct alc_spec *spec = codec->spec;
17782 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17784 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17788 if (!spec->autocfg.line_outs)
17789 return 0; /* can't find valid BIOS pin config */
17791 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17794 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17797 err = alc662_auto_create_extra_out(codec,
17798 spec->autocfg.speaker_pins[0],
17803 spec->multiout.extra_out_nid[0] = err;
17804 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17809 spec->multiout.hp_nid = err;
17810 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17814 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17816 if (spec->autocfg.dig_outs)
17817 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17819 if (spec->kctls.list)
17820 add_mixer(spec, spec->kctls.list);
17822 spec->num_mux_defs = 1;
17823 spec->input_mux = &spec->private_imux[0];
17825 add_verb(spec, alc662_auto_init_verbs);
17826 if (codec->vendor_id == 0x10ec0663)
17827 add_verb(spec, alc663_auto_init_verbs);
17829 err = alc_auto_add_mic_boost(codec);
17833 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17838 /* additional initialization for auto-configuration model */
17839 static void alc662_auto_init(struct hda_codec *codec)
17841 struct alc_spec *spec = codec->spec;
17842 alc662_auto_init_multi_out(codec);
17843 alc662_auto_init_hp_out(codec);
17844 alc662_auto_init_analog_input(codec);
17845 alc662_auto_init_input_src(codec);
17846 if (spec->unsol_event)
17847 alc_inithook(codec);
17850 static int patch_alc662(struct hda_codec *codec)
17852 struct alc_spec *spec;
17853 int err, board_config;
17855 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17859 codec->spec = spec;
17861 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17863 if (alc_read_coef_idx(codec, 0)==0x8020){
17864 kfree(codec->chip_name);
17865 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17866 if (!codec->chip_name) {
17872 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17875 if (board_config < 0) {
17876 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17878 board_config = ALC662_AUTO;
17881 if (board_config == ALC662_AUTO) {
17882 /* automatic parse from the BIOS config */
17883 err = alc662_parse_auto_config(codec);
17889 "hda_codec: Cannot set up configuration "
17890 "from BIOS. Using base mode...\n");
17891 board_config = ALC662_3ST_2ch_DIG;
17895 err = snd_hda_attach_beep_device(codec, 0x1);
17901 if (board_config != ALC662_AUTO)
17902 setup_preset(codec, &alc662_presets[board_config]);
17904 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17905 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17907 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17908 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17910 if (!spec->adc_nids) {
17911 spec->adc_nids = alc662_adc_nids;
17912 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17914 if (!spec->capsrc_nids)
17915 spec->capsrc_nids = alc662_capsrc_nids;
17917 if (!spec->cap_mixer)
17918 set_capture_mixer(codec);
17919 if (codec->vendor_id == 0x10ec0662)
17920 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17922 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17924 spec->vmaster_nid = 0x02;
17926 codec->patch_ops = alc_patch_ops;
17927 if (board_config == ALC662_AUTO)
17928 spec->init_hook = alc662_auto_init;
17929 #ifdef CONFIG_SND_HDA_POWER_SAVE
17930 if (!spec->loopback.amplist)
17931 spec->loopback.amplist = alc662_loopbacks;
17933 codec->proc_widget_hook = print_realtek_coef;
17938 static int patch_alc888(struct hda_codec *codec)
17940 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17941 kfree(codec->chip_name);
17942 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17943 if (!codec->chip_name) {
17947 return patch_alc662(codec);
17949 return patch_alc882(codec);
17955 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17956 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17957 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17958 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17959 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17960 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17961 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17962 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17963 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17964 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17965 .patch = patch_alc861 },
17966 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17967 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17968 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17969 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17970 .patch = patch_alc882 },
17971 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17972 .patch = patch_alc662 },
17973 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17974 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17975 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17976 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17977 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17978 .patch = patch_alc882 },
17979 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17980 .patch = patch_alc882 },
17981 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17982 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17983 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17984 .patch = patch_alc882 },
17985 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
17986 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17987 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
17988 {} /* terminator */
17991 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17993 MODULE_LICENSE("GPL");
17994 MODULE_DESCRIPTION("Realtek HD-audio codec");
17996 static struct hda_codec_preset_list realtek_list = {
17997 .preset = snd_hda_preset_realtek,
17998 .owner = THIS_MODULE,
18001 static int __init patch_realtek_init(void)
18003 return snd_hda_add_codec_preset(&realtek_list);
18006 static void __exit patch_realtek_exit(void)
18008 snd_hda_delete_codec_preset(&realtek_list);
18011 module_init(patch_realtek_init)
18012 module_exit(patch_realtek_exit)