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"
33 #include "hda_patch.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 */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST /* last tag */
95 ALC262_HP_BPC_D7000_WL,
96 ALC262_HP_BPC_D7000_WF,
108 ALC262_MODEL_LAST /* last tag */
117 ALC268_ACER_ASPIRE_ONE,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST /* last tag */
131 ALC269_ASUS_EEEPC_P703,
132 ALC269_ASUS_EEEPC_P901,
135 ALC269_MODEL_LAST /* last tag */
152 /* ALC861-VD models */
174 ALC662_ASUS_EEEPC_P701,
175 ALC662_ASUS_EEEPC_EP20,
214 ALC883_TARGA_2ch_DIG,
220 ALC883_LENOVO_101E_2ch,
221 ALC883_LENOVO_NB0763,
222 ALC888_LENOVO_MS7195_DIG,
229 ALC883_FUJITSU_PI2515,
230 ALC883_3ST_6ch_INTEL,
238 #define GPIO_MASK 0x03
241 /* codec parameterization */
242 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
243 unsigned int num_mixers;
244 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
246 const struct hda_verb *init_verbs[5]; /* initialization verbs
250 unsigned int num_init_verbs;
252 char *stream_name_analog; /* analog PCM stream */
253 struct hda_pcm_stream *stream_analog_playback;
254 struct hda_pcm_stream *stream_analog_capture;
255 struct hda_pcm_stream *stream_analog_alt_playback;
256 struct hda_pcm_stream *stream_analog_alt_capture;
258 char *stream_name_digital; /* digital PCM stream */
259 struct hda_pcm_stream *stream_digital_playback;
260 struct hda_pcm_stream *stream_digital_capture;
263 struct hda_multi_out multiout; /* playback set-up
264 * max_channels, dacs must be set
265 * dig_out_nid and hp_nid are optional
267 hda_nid_t alt_dac_nid;
270 unsigned int num_adc_nids;
272 hda_nid_t *capsrc_nids;
273 hda_nid_t dig_in_nid; /* digital-in NID; optional */
274 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
277 unsigned int num_mux_defs;
278 const struct hda_input_mux *input_mux;
279 unsigned int cur_mux[3];
282 const struct hda_channel_mode *channel_mode;
283 int num_channel_mode;
286 /* PCM information */
287 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
289 /* dynamic controls, init_verbs and input_mux */
290 struct auto_pin_cfg autocfg;
291 struct snd_array kctls;
292 struct hda_input_mux private_imux;
293 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
296 void (*init_hook)(struct hda_codec *codec);
297 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
299 /* for pin sensing */
300 unsigned int sense_updated: 1;
301 unsigned int jack_present: 1;
302 unsigned int master_sw: 1;
304 /* for virtual master */
305 hda_nid_t vmaster_nid;
306 #ifdef CONFIG_SND_HDA_POWER_SAVE
307 struct hda_loopback_check loopback;
312 unsigned int pll_coef_idx, pll_coef_bit;
314 #ifdef SND_HDA_NEEDS_RESUME
315 #define ALC_MAX_PINS 16
316 unsigned int num_pins;
317 hda_nid_t pin_nids[ALC_MAX_PINS];
318 unsigned int pin_cfgs[ALC_MAX_PINS];
323 * configuration template - to be copied to the spec instance
325 struct alc_config_preset {
326 struct snd_kcontrol_new *mixers[5]; /* should be identical size
329 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
330 const struct hda_verb *init_verbs[5];
331 unsigned int num_dacs;
333 hda_nid_t dig_out_nid; /* optional */
334 hda_nid_t hp_nid; /* optional */
335 unsigned int num_adc_nids;
337 hda_nid_t *capsrc_nids;
338 hda_nid_t dig_in_nid;
339 unsigned int num_channel_mode;
340 const struct hda_channel_mode *channel_mode;
342 unsigned int num_mux_defs;
343 const struct hda_input_mux *input_mux;
344 void (*unsol_event)(struct hda_codec *, unsigned int);
345 void (*init_hook)(struct hda_codec *);
346 #ifdef CONFIG_SND_HDA_POWER_SAVE
347 struct hda_amp_list *loopbacks;
355 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_info *uinfo)
358 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
359 struct alc_spec *spec = codec->spec;
360 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
361 if (mux_idx >= spec->num_mux_defs)
363 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
366 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
367 struct snd_ctl_elem_value *ucontrol)
369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
370 struct alc_spec *spec = codec->spec;
371 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
373 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
377 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
378 struct snd_ctl_elem_value *ucontrol)
380 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
381 struct alc_spec *spec = codec->spec;
382 const struct hda_input_mux *imux = spec->input_mux;
383 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
384 hda_nid_t nid = spec->capsrc_nids ?
385 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
387 if (spec->is_mix_capture) {
388 /* Matrix-mixer style (e.g. ALC882) */
389 unsigned int *cur_val = &spec->cur_mux[adc_idx];
392 idx = ucontrol->value.enumerated.item[0];
393 if (idx >= imux->num_items)
394 idx = imux->num_items - 1;
397 for (i = 0; i < imux->num_items; i++) {
398 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
399 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
400 imux->items[i].index,
406 /* MUX style (e.g. ALC880) */
407 unsigned int mux_idx;
408 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
409 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
411 &spec->cur_mux[adc_idx]);
416 * channel mode setting
418 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
419 struct snd_ctl_elem_info *uinfo)
421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
422 struct alc_spec *spec = codec->spec;
423 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
424 spec->num_channel_mode);
427 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
428 struct snd_ctl_elem_value *ucontrol)
430 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
431 struct alc_spec *spec = codec->spec;
432 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
433 spec->num_channel_mode,
434 spec->multiout.max_channels);
437 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
438 struct snd_ctl_elem_value *ucontrol)
440 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
441 struct alc_spec *spec = codec->spec;
442 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
443 spec->num_channel_mode,
444 &spec->multiout.max_channels);
445 if (err >= 0 && spec->need_dac_fix)
446 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
451 * Control the mode of pin widget settings via the mixer. "pc" is used
452 * instead of "%" to avoid consequences of accidently treating the % as
453 * being part of a format specifier. Maximum allowed length of a value is
454 * 63 characters plus NULL terminator.
456 * Note: some retasking pin complexes seem to ignore requests for input
457 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
458 * are requested. Therefore order this list so that this behaviour will not
459 * cause problems when mixer clients move through the enum sequentially.
460 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
463 static char *alc_pin_mode_names[] = {
464 "Mic 50pc bias", "Mic 80pc bias",
465 "Line in", "Line out", "Headphone out",
467 static unsigned char alc_pin_mode_values[] = {
468 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
470 /* The control can present all 5 options, or it can limit the options based
471 * in the pin being assumed to be exclusively an input or an output pin. In
472 * addition, "input" pins may or may not process the mic bias option
473 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
474 * accept requests for bias as of chip versions up to March 2006) and/or
475 * wiring in the computer.
477 #define ALC_PIN_DIR_IN 0x00
478 #define ALC_PIN_DIR_OUT 0x01
479 #define ALC_PIN_DIR_INOUT 0x02
480 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
481 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
483 /* Info about the pin modes supported by the different pin direction modes.
484 * For each direction the minimum and maximum values are given.
486 static signed char alc_pin_mode_dir_info[5][2] = {
487 { 0, 2 }, /* ALC_PIN_DIR_IN */
488 { 3, 4 }, /* ALC_PIN_DIR_OUT */
489 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
490 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
491 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
493 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
494 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
495 #define alc_pin_mode_n_items(_dir) \
496 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
498 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_info *uinfo)
501 unsigned int item_num = uinfo->value.enumerated.item;
502 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
504 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
506 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
508 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
509 item_num = alc_pin_mode_min(dir);
510 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
514 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_value *ucontrol)
518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
519 hda_nid_t nid = kcontrol->private_value & 0xffff;
520 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
521 long *valp = ucontrol->value.integer.value;
522 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
523 AC_VERB_GET_PIN_WIDGET_CONTROL,
526 /* Find enumerated value for current pinctl setting */
527 i = alc_pin_mode_min(dir);
528 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
530 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
534 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
535 struct snd_ctl_elem_value *ucontrol)
538 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
539 hda_nid_t nid = kcontrol->private_value & 0xffff;
540 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
541 long val = *ucontrol->value.integer.value;
542 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
543 AC_VERB_GET_PIN_WIDGET_CONTROL,
546 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
547 val = alc_pin_mode_min(dir);
549 change = pinctl != alc_pin_mode_values[val];
551 /* Set pin mode to that requested */
552 snd_hda_codec_write_cache(codec, nid, 0,
553 AC_VERB_SET_PIN_WIDGET_CONTROL,
554 alc_pin_mode_values[val]);
556 /* Also enable the retasking pin's input/output as required
557 * for the requested pin mode. Enum values of 2 or less are
560 * Dynamically switching the input/output buffers probably
561 * reduces noise slightly (particularly on input) so we'll
562 * do it. However, having both input and output buffers
563 * enabled simultaneously doesn't seem to be problematic if
564 * this turns out to be necessary in the future.
567 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
568 HDA_AMP_MUTE, HDA_AMP_MUTE);
569 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
572 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
573 HDA_AMP_MUTE, HDA_AMP_MUTE);
574 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
581 #define ALC_PIN_MODE(xname, nid, dir) \
582 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
583 .info = alc_pin_mode_info, \
584 .get = alc_pin_mode_get, \
585 .put = alc_pin_mode_put, \
586 .private_value = nid | (dir<<16) }
588 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
589 * together using a mask with more than one bit set. This control is
590 * currently used only by the ALC260 test model. At this stage they are not
591 * needed for any "production" models.
593 #ifdef CONFIG_SND_DEBUG
594 #define alc_gpio_data_info snd_ctl_boolean_mono_info
596 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
597 struct snd_ctl_elem_value *ucontrol)
599 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
600 hda_nid_t nid = kcontrol->private_value & 0xffff;
601 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
602 long *valp = ucontrol->value.integer.value;
603 unsigned int val = snd_hda_codec_read(codec, nid, 0,
604 AC_VERB_GET_GPIO_DATA, 0x00);
606 *valp = (val & mask) != 0;
609 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
610 struct snd_ctl_elem_value *ucontrol)
613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
614 hda_nid_t nid = kcontrol->private_value & 0xffff;
615 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
616 long val = *ucontrol->value.integer.value;
617 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
618 AC_VERB_GET_GPIO_DATA,
621 /* Set/unset the masked GPIO bit(s) as needed */
622 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
627 snd_hda_codec_write_cache(codec, nid, 0,
628 AC_VERB_SET_GPIO_DATA, gpio_data);
632 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
633 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
634 .info = alc_gpio_data_info, \
635 .get = alc_gpio_data_get, \
636 .put = alc_gpio_data_put, \
637 .private_value = nid | (mask<<16) }
638 #endif /* CONFIG_SND_DEBUG */
640 /* A switch control to allow the enabling of the digital IO pins on the
641 * ALC260. This is incredibly simplistic; the intention of this control is
642 * to provide something in the test model allowing digital outputs to be
643 * identified if present. If models are found which can utilise these
644 * outputs a more complete mixer control can be devised for those models if
647 #ifdef CONFIG_SND_DEBUG
648 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
650 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long *valp = ucontrol->value.integer.value;
657 unsigned int val = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
660 *valp = (val & mask) != 0;
663 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 hda_nid_t nid = kcontrol->private_value & 0xffff;
669 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
670 long val = *ucontrol->value.integer.value;
671 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
672 AC_VERB_GET_DIGI_CONVERT_1,
675 /* Set/unset the masked control bit(s) as needed */
676 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
681 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
686 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .info = alc_spdif_ctrl_info, \
689 .get = alc_spdif_ctrl_get, \
690 .put = alc_spdif_ctrl_put, \
691 .private_value = nid | (mask<<16) }
692 #endif /* CONFIG_SND_DEBUG */
694 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
695 * Again, this is only used in the ALC26x test models to help identify when
696 * the EAPD line must be asserted for features to work.
698 #ifdef CONFIG_SND_DEBUG
699 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
701 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
702 struct snd_ctl_elem_value *ucontrol)
704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
705 hda_nid_t nid = kcontrol->private_value & 0xffff;
706 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
707 long *valp = ucontrol->value.integer.value;
708 unsigned int val = snd_hda_codec_read(codec, nid, 0,
709 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
711 *valp = (val & mask) != 0;
715 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
716 struct snd_ctl_elem_value *ucontrol)
719 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
720 hda_nid_t nid = kcontrol->private_value & 0xffff;
721 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
722 long val = *ucontrol->value.integer.value;
723 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
724 AC_VERB_GET_EAPD_BTLENABLE,
727 /* Set/unset the masked control bit(s) as needed */
728 change = (!val ? 0 : mask) != (ctrl_data & mask);
733 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
739 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
740 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
741 .info = alc_eapd_ctrl_info, \
742 .get = alc_eapd_ctrl_get, \
743 .put = alc_eapd_ctrl_put, \
744 .private_value = nid | (mask<<16) }
745 #endif /* CONFIG_SND_DEBUG */
749 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
751 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
753 spec->mixers[spec->num_mixers++] = mix;
756 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
758 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
760 spec->init_verbs[spec->num_init_verbs++] = verb;
764 * set up from the preset table
766 static void setup_preset(struct alc_spec *spec,
767 const struct alc_config_preset *preset)
771 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
772 add_mixer(spec, preset->mixers[i]);
773 spec->cap_mixer = preset->cap_mixer;
774 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
776 add_verb(spec, preset->init_verbs[i]);
778 spec->channel_mode = preset->channel_mode;
779 spec->num_channel_mode = preset->num_channel_mode;
780 spec->need_dac_fix = preset->need_dac_fix;
782 spec->multiout.max_channels = spec->channel_mode[0].channels;
784 spec->multiout.num_dacs = preset->num_dacs;
785 spec->multiout.dac_nids = preset->dac_nids;
786 spec->multiout.dig_out_nid = preset->dig_out_nid;
787 spec->multiout.hp_nid = preset->hp_nid;
789 spec->num_mux_defs = preset->num_mux_defs;
790 if (!spec->num_mux_defs)
791 spec->num_mux_defs = 1;
792 spec->input_mux = preset->input_mux;
794 spec->num_adc_nids = preset->num_adc_nids;
795 spec->adc_nids = preset->adc_nids;
796 spec->capsrc_nids = preset->capsrc_nids;
797 spec->dig_in_nid = preset->dig_in_nid;
799 spec->unsol_event = preset->unsol_event;
800 spec->init_hook = preset->init_hook;
801 #ifdef CONFIG_SND_HDA_POWER_SAVE
802 spec->loopback.amplist = preset->loopbacks;
806 /* Enable GPIO mask and set output */
807 static struct hda_verb alc_gpio1_init_verbs[] = {
808 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
809 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
810 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
814 static struct hda_verb alc_gpio2_init_verbs[] = {
815 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
816 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
817 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
821 static struct hda_verb alc_gpio3_init_verbs[] = {
822 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
823 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
824 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
829 * Fix hardware PLL issue
830 * On some codecs, the analog PLL gating control must be off while
831 * the default value is 1.
833 static void alc_fix_pll(struct hda_codec *codec)
835 struct alc_spec *spec = codec->spec;
840 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
842 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
843 AC_VERB_GET_PROC_COEF, 0);
844 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
846 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
847 val & ~(1 << spec->pll_coef_bit));
850 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
851 unsigned int coef_idx, unsigned int coef_bit)
853 struct alc_spec *spec = codec->spec;
855 spec->pll_coef_idx = coef_idx;
856 spec->pll_coef_bit = coef_bit;
860 static void alc_sku_automute(struct hda_codec *codec)
862 struct alc_spec *spec = codec->spec;
863 unsigned int present;
864 unsigned int hp_nid = spec->autocfg.hp_pins[0];
865 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
867 /* need to execute and sync at first */
868 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
869 present = snd_hda_codec_read(codec, hp_nid, 0,
870 AC_VERB_GET_PIN_SENSE, 0);
871 spec->jack_present = (present & 0x80000000) != 0;
872 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
873 spec->jack_present ? 0 : PIN_OUT);
876 #if 0 /* it's broken in some acses -- temporarily disabled */
877 static void alc_mic_automute(struct hda_codec *codec)
879 struct alc_spec *spec = codec->spec;
880 unsigned int present;
881 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
882 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
883 unsigned int mix_nid = spec->capsrc_nids[0];
884 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
886 capsrc_idx_mic = mic_nid - 0x18;
887 capsrc_idx_fmic = fmic_nid - 0x18;
888 present = snd_hda_codec_read(codec, mic_nid, 0,
889 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
890 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
891 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
892 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
893 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
894 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
895 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
898 #define alc_mic_automute(codec) /* NOP */
899 #endif /* disabled */
901 /* unsolicited event for HP jack sensing */
902 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
904 if (codec->vendor_id == 0x10ec0880)
908 if (res == ALC880_HP_EVENT)
909 alc_sku_automute(codec);
911 if (res == ALC880_MIC_EVENT)
912 alc_mic_automute(codec);
915 static void alc_inithook(struct hda_codec *codec)
917 alc_sku_automute(codec);
918 alc_mic_automute(codec);
921 /* additional initialization for ALC888 variants */
922 static void alc888_coef_init(struct hda_codec *codec)
926 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
927 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
928 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
929 if ((tmp & 0xf0) == 2)
931 snd_hda_codec_read(codec, 0x20, 0,
932 AC_VERB_SET_PROC_COEF, 0x830);
935 snd_hda_codec_read(codec, 0x20, 0,
936 AC_VERB_SET_PROC_COEF, 0x3030);
939 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
940 * 31 ~ 16 : Manufacture ID
942 * 7 ~ 0 : Assembly ID
943 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
945 static void alc_subsystem_id(struct hda_codec *codec,
946 unsigned int porta, unsigned int porte,
949 unsigned int ass, tmp, i;
951 struct alc_spec *spec = codec->spec;
953 ass = codec->subsystem_id & 0xffff;
954 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
958 * 31~30 : port conetcivity
961 * 19~16 : Check sum (15:1)
966 if (codec->vendor_id == 0x10ec0260)
968 ass = snd_hda_codec_read(codec, nid, 0,
969 AC_VERB_GET_CONFIG_DEFAULT, 0);
970 if (!(ass & 1) && !(ass & 0x100000))
972 if ((ass >> 30) != 1) /* no physical connection */
977 for (i = 1; i < 16; i++) {
981 if (((ass >> 16) & 0xf) != tmp)
987 * 2 : 0 --> Desktop, 1 --> Laptop
988 * 3~5 : External Amplifier control
991 tmp = (ass & 0x38) >> 3; /* external Amp control */
994 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
997 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1000 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1002 case 5: /* set EAPD output high */
1003 switch (codec->vendor_id) {
1005 snd_hda_codec_write(codec, 0x0f, 0,
1006 AC_VERB_SET_EAPD_BTLENABLE, 2);
1007 snd_hda_codec_write(codec, 0x10, 0,
1008 AC_VERB_SET_EAPD_BTLENABLE, 2);
1019 snd_hda_codec_write(codec, 0x14, 0,
1020 AC_VERB_SET_EAPD_BTLENABLE, 2);
1021 snd_hda_codec_write(codec, 0x15, 0,
1022 AC_VERB_SET_EAPD_BTLENABLE, 2);
1025 switch (codec->vendor_id) {
1027 snd_hda_codec_write(codec, 0x1a, 0,
1028 AC_VERB_SET_COEF_INDEX, 7);
1029 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1030 AC_VERB_GET_PROC_COEF, 0);
1031 snd_hda_codec_write(codec, 0x1a, 0,
1032 AC_VERB_SET_COEF_INDEX, 7);
1033 snd_hda_codec_write(codec, 0x1a, 0,
1034 AC_VERB_SET_PROC_COEF,
1043 snd_hda_codec_write(codec, 0x20, 0,
1044 AC_VERB_SET_COEF_INDEX, 7);
1045 tmp = snd_hda_codec_read(codec, 0x20, 0,
1046 AC_VERB_GET_PROC_COEF, 0);
1047 snd_hda_codec_write(codec, 0x20, 0,
1048 AC_VERB_SET_COEF_INDEX, 7);
1049 snd_hda_codec_write(codec, 0x20, 0,
1050 AC_VERB_SET_PROC_COEF,
1054 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1058 snd_hda_codec_write(codec, 0x20, 0,
1059 AC_VERB_SET_COEF_INDEX, 7);
1060 tmp = snd_hda_codec_read(codec, 0x20, 0,
1061 AC_VERB_GET_PROC_COEF, 0);
1062 snd_hda_codec_write(codec, 0x20, 0,
1063 AC_VERB_SET_COEF_INDEX, 7);
1064 snd_hda_codec_write(codec, 0x20, 0,
1065 AC_VERB_SET_PROC_COEF,
1073 /* is laptop or Desktop and enable the function "Mute internal speaker
1074 * when the external headphone out jack is plugged"
1076 if (!(ass & 0x8000))
1079 * 10~8 : Jack location
1080 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1082 * 15 : 1 --> enable the function "Mute internal speaker
1083 * when the external headphone out jack is plugged"
1085 if (!spec->autocfg.speaker_pins[0]) {
1086 if (spec->autocfg.line_out_pins[0])
1087 spec->autocfg.speaker_pins[0] =
1088 spec->autocfg.line_out_pins[0];
1093 if (!spec->autocfg.hp_pins[0]) {
1094 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1096 spec->autocfg.hp_pins[0] = porta;
1098 spec->autocfg.hp_pins[0] = porte;
1100 spec->autocfg.hp_pins[0] = portd;
1104 if (spec->autocfg.hp_pins[0])
1105 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1106 AC_VERB_SET_UNSOLICITED_ENABLE,
1107 AC_USRSP_EN | ALC880_HP_EVENT);
1109 #if 0 /* it's broken in some acses -- temporarily disabled */
1110 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1111 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1112 snd_hda_codec_write(codec,
1113 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1114 AC_VERB_SET_UNSOLICITED_ENABLE,
1115 AC_USRSP_EN | ALC880_MIC_EVENT);
1116 #endif /* disabled */
1118 spec->unsol_event = alc_sku_unsol_event;
1122 * Fix-up pin default configurations
1130 static void alc_fix_pincfg(struct hda_codec *codec,
1131 const struct snd_pci_quirk *quirk,
1132 const struct alc_pincfg **pinfix)
1134 const struct alc_pincfg *cfg;
1136 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1140 cfg = pinfix[quirk->value];
1141 for (; cfg->nid; cfg++) {
1144 for (i = 0; i < 4; i++) {
1145 snd_hda_codec_write(codec, cfg->nid, 0,
1146 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1154 * ALC880 3-stack model
1156 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1157 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1158 * F-Mic = 0x1b, HP = 0x19
1161 static hda_nid_t alc880_dac_nids[4] = {
1162 /* front, rear, clfe, rear_surr */
1163 0x02, 0x05, 0x04, 0x03
1166 static hda_nid_t alc880_adc_nids[3] = {
1171 /* The datasheet says the node 0x07 is connected from inputs,
1172 * but it shows zero connection in the real implementation on some devices.
1173 * Note: this is a 915GAV bug, fixed on 915GLV
1175 static hda_nid_t alc880_adc_nids_alt[2] = {
1180 #define ALC880_DIGOUT_NID 0x06
1181 #define ALC880_DIGIN_NID 0x0a
1183 static struct hda_input_mux alc880_capture_source = {
1187 { "Front Mic", 0x3 },
1193 /* channel source setting (2/6 channel selection for 3-stack) */
1195 static struct hda_verb alc880_threestack_ch2_init[] = {
1196 /* set line-in to input, mute it */
1197 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1198 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1199 /* set mic-in to input vref 80%, mute it */
1200 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1201 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1206 static struct hda_verb alc880_threestack_ch6_init[] = {
1207 /* set line-in to output, unmute it */
1208 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1209 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1210 /* set mic-in to output, unmute it */
1211 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1212 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1216 static struct hda_channel_mode alc880_threestack_modes[2] = {
1217 { 2, alc880_threestack_ch2_init },
1218 { 6, alc880_threestack_ch6_init },
1221 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1225 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1233 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1238 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1239 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1240 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1242 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1243 .name = "Channel Mode",
1244 .info = alc_ch_mode_info,
1245 .get = alc_ch_mode_get,
1246 .put = alc_ch_mode_put,
1251 /* capture mixer elements */
1252 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1253 struct snd_ctl_elem_info *uinfo)
1255 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1256 struct alc_spec *spec = codec->spec;
1259 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1260 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1262 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1263 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1267 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1268 unsigned int size, unsigned int __user *tlv)
1270 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1271 struct alc_spec *spec = codec->spec;
1274 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1275 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1277 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1278 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1282 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1283 struct snd_ctl_elem_value *ucontrol);
1285 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1286 struct snd_ctl_elem_value *ucontrol,
1289 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1290 struct alc_spec *spec = codec->spec;
1291 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1294 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1295 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1297 err = func(kcontrol, ucontrol);
1298 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */
1302 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1303 struct snd_ctl_elem_value *ucontrol)
1305 return alc_cap_getput_caller(kcontrol, ucontrol,
1306 snd_hda_mixer_amp_volume_get);
1309 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1310 struct snd_ctl_elem_value *ucontrol)
1312 return alc_cap_getput_caller(kcontrol, ucontrol,
1313 snd_hda_mixer_amp_volume_put);
1316 /* capture mixer elements */
1317 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1319 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1320 struct snd_ctl_elem_value *ucontrol)
1322 return alc_cap_getput_caller(kcontrol, ucontrol,
1323 snd_hda_mixer_amp_switch_get);
1326 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1327 struct snd_ctl_elem_value *ucontrol)
1329 return alc_cap_getput_caller(kcontrol, ucontrol,
1330 snd_hda_mixer_amp_switch_put);
1333 #define DEFINE_CAPMIX(num) \
1334 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1337 .name = "Capture Switch", \
1338 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1340 .info = alc_cap_sw_info, \
1341 .get = alc_cap_sw_get, \
1342 .put = alc_cap_sw_put, \
1345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1346 .name = "Capture Volume", \
1347 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1348 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1349 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1351 .info = alc_cap_vol_info, \
1352 .get = alc_cap_vol_get, \
1353 .put = alc_cap_vol_put, \
1354 .tlv = { .c = alc_cap_vol_tlv }, \
1357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1358 /* .name = "Capture Source", */ \
1359 .name = "Input Source", \
1361 .info = alc_mux_enum_info, \
1362 .get = alc_mux_enum_get, \
1363 .put = alc_mux_enum_put, \
1368 /* up to three ADCs */
1375 * ALC880 5-stack model
1377 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1379 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1380 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1383 /* additional mixers to alc880_three_stack_mixer */
1384 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1385 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1386 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1390 /* channel source setting (6/8 channel selection for 5-stack) */
1392 static struct hda_verb alc880_fivestack_ch6_init[] = {
1393 /* set line-in to input, mute it */
1394 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1395 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1400 static struct hda_verb alc880_fivestack_ch8_init[] = {
1401 /* set line-in to output, unmute it */
1402 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1403 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1407 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1408 { 6, alc880_fivestack_ch6_init },
1409 { 8, alc880_fivestack_ch8_init },
1414 * ALC880 6-stack model
1416 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1417 * Side = 0x05 (0x0f)
1418 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1419 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1422 static hda_nid_t alc880_6st_dac_nids[4] = {
1423 /* front, rear, clfe, rear_surr */
1424 0x02, 0x03, 0x04, 0x05
1427 static struct hda_input_mux alc880_6stack_capture_source = {
1431 { "Front Mic", 0x1 },
1437 /* fixed 8-channels */
1438 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1442 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1443 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1444 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1446 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1447 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1449 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1450 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1451 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1452 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1453 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1454 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1459 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1460 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1461 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1462 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1464 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1465 .name = "Channel Mode",
1466 .info = alc_ch_mode_info,
1467 .get = alc_ch_mode_get,
1468 .put = alc_ch_mode_put,
1477 * W810 has rear IO for:
1480 * Center/LFE (DAC 04)
1483 * The system also has a pair of internal speakers, and a headphone jack.
1484 * These are both connected to Line2 on the codec, hence to DAC 02.
1486 * There is a variable resistor to control the speaker or headphone
1487 * volume. This is a hardware-only device without a software API.
1489 * Plugging headphones in will disable the internal speakers. This is
1490 * implemented in hardware, not via the driver using jack sense. In
1491 * a similar fashion, plugging into the rear socket marked "front" will
1492 * disable both the speakers and headphones.
1494 * For input, there's a microphone jack, and an "audio in" jack.
1495 * These may not do anything useful with this driver yet, because I
1496 * haven't setup any initialization verbs for these yet...
1499 static hda_nid_t alc880_w810_dac_nids[3] = {
1500 /* front, rear/surround, clfe */
1504 /* fixed 6 channels */
1505 static struct hda_channel_mode alc880_w810_modes[1] = {
1509 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1510 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1511 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1512 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1513 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1514 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1515 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1516 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1517 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1518 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1519 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1527 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1528 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1532 static hda_nid_t alc880_z71v_dac_nids[1] = {
1535 #define ALC880_Z71V_HP_DAC 0x03
1537 /* fixed 2 channels */
1538 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1542 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1545 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1546 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1556 * ALC880 F1734 model
1558 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1559 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1562 static hda_nid_t alc880_f1734_dac_nids[1] = {
1565 #define ALC880_F1734_HP_DAC 0x02
1567 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1568 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1569 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1571 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1572 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1573 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1579 static struct hda_input_mux alc880_f1734_capture_source = {
1591 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1592 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1593 * Mic = 0x18, Line = 0x1a
1596 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1597 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1599 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1600 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1601 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1602 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1603 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1604 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1606 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1607 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1608 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1609 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1610 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1611 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1615 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1616 .name = "Channel Mode",
1617 .info = alc_ch_mode_info,
1618 .get = alc_ch_mode_get,
1619 .put = alc_ch_mode_put,
1625 * ALC880 ASUS W1V model
1627 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1628 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1629 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1632 /* additional mixers to alc880_asus_mixer */
1633 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1634 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1635 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1639 /* additional mixers to alc880_asus_mixer */
1640 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1641 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1642 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1647 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1648 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1649 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1651 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1652 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1655 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1656 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1661 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1662 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1663 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1664 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1665 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1666 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1667 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1668 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1669 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1675 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1677 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1678 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1679 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1682 .name = "Channel Mode",
1683 .info = alc_ch_mode_info,
1684 .get = alc_ch_mode_get,
1685 .put = alc_ch_mode_put,
1690 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1692 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1693 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1694 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1695 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1696 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1697 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1698 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1699 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1700 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1704 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1706 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1707 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1708 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1710 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1715 * virtual master controls
1719 * slave controls for virtual master
1721 static const char *alc_slave_vols[] = {
1722 "Front Playback Volume",
1723 "Surround Playback Volume",
1724 "Center Playback Volume",
1725 "LFE Playback Volume",
1726 "Side Playback Volume",
1727 "Headphone Playback Volume",
1728 "Speaker Playback Volume",
1729 "Mono Playback Volume",
1730 "Line-Out Playback Volume",
1731 "PCM Playback Volume",
1735 static const char *alc_slave_sws[] = {
1736 "Front Playback Switch",
1737 "Surround Playback Switch",
1738 "Center Playback Switch",
1739 "LFE Playback Switch",
1740 "Side Playback Switch",
1741 "Headphone Playback Switch",
1742 "Speaker Playback Switch",
1743 "Mono Playback Switch",
1744 "IEC958 Playback Switch",
1749 * build control elements
1752 static void alc_free_kctls(struct hda_codec *codec);
1754 static int alc_build_controls(struct hda_codec *codec)
1756 struct alc_spec *spec = codec->spec;
1760 for (i = 0; i < spec->num_mixers; i++) {
1761 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1765 if (spec->cap_mixer) {
1766 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
1770 if (spec->multiout.dig_out_nid) {
1771 err = snd_hda_create_spdif_out_ctls(codec,
1772 spec->multiout.dig_out_nid);
1775 err = snd_hda_create_spdif_share_sw(codec,
1779 spec->multiout.share_spdif = 1;
1781 if (spec->dig_in_nid) {
1782 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1787 /* if we have no master control, let's create it */
1788 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1789 unsigned int vmaster_tlv[4];
1790 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1791 HDA_OUTPUT, vmaster_tlv);
1792 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1793 vmaster_tlv, alc_slave_vols);
1797 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1798 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1799 NULL, alc_slave_sws);
1804 alc_free_kctls(codec); /* no longer needed */
1810 * initialize the codec volumes, etc
1814 * generic initialization of ADC, input mixers and output mixers
1816 static struct hda_verb alc880_volume_init_verbs[] = {
1818 * Unmute ADC0-2 and set the default input to mic-in
1820 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1822 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1824 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1827 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1829 * Note: PASD motherboards uses the Line In 2 as the input for front
1832 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1842 * Set up output mixers (0x0c - 0x0f)
1844 /* set vol=0 to output mixers */
1845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1849 /* set up input amps for analog loopback */
1850 /* Amp Indices: DAC = 0, mixer = 1 */
1851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1855 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1857 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1858 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1864 * 3-stack pin configuration:
1865 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1867 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1869 * preset connection lists of input pins
1870 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1872 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1873 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1874 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1877 * Set pin mode and muting
1879 /* set front pin widgets 0x14 for output */
1880 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1881 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1882 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1885 /* Mic2 (as headphone out) for HP output */
1886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1887 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1888 /* Line In pin widget for input */
1889 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1891 /* Line2 (as front mic) pin widget for input and vref at 80% */
1892 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1893 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1894 /* CD pin widget for input */
1895 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1901 * 5-stack pin configuration:
1902 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1903 * line-in/side = 0x1a, f-mic = 0x1b
1905 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1907 * preset connection lists of input pins
1908 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1910 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1911 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1914 * Set pin mode and muting
1916 /* set pin widgets 0x14-0x17 for output */
1917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1919 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1920 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1921 /* unmute pins for output (no gain on this amp) */
1922 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1924 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1925 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1927 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1930 /* Mic2 (as headphone out) for HP output */
1931 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1932 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 /* Line In pin widget for input */
1934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1936 /* Line2 (as front mic) pin widget for input and vref at 80% */
1937 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1938 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1939 /* CD pin widget for input */
1940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1946 * W810 pin configuration:
1947 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1949 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1950 /* hphone/speaker input selector: front DAC */
1951 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1955 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1957 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1958 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1961 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1967 * Z71V pin configuration:
1968 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1970 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1971 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1976 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1978 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1979 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1985 * 6-stack pin configuration:
1986 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1987 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1989 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1990 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1992 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1993 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1997 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1998 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1999 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2001 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2005 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2006 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2007 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2008 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2009 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2015 * Uniwill pin configuration:
2016 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2019 static struct hda_verb alc880_uniwill_init_verbs[] = {
2020 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2024 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2026 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2027 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2028 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2029 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2030 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2032 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2035 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2037 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2039 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2040 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2041 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2042 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2043 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2044 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2045 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2047 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2048 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2055 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2057 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2058 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2060 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2061 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2062 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2064 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2065 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2066 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2068 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2070 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2075 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2077 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2080 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2081 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2086 static struct hda_verb alc880_beep_init_verbs[] = {
2087 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2091 /* toggle speaker-output according to the hp-jack state */
2092 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2094 unsigned int present;
2097 present = snd_hda_codec_read(codec, 0x14, 0,
2098 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2099 bits = present ? HDA_AMP_MUTE : 0;
2100 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2101 HDA_AMP_MUTE, bits);
2102 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2103 HDA_AMP_MUTE, bits);
2106 /* auto-toggle front mic */
2107 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2109 unsigned int present;
2112 present = snd_hda_codec_read(codec, 0x18, 0,
2113 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2114 bits = present ? HDA_AMP_MUTE : 0;
2115 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2118 static void alc880_uniwill_automute(struct hda_codec *codec)
2120 alc880_uniwill_hp_automute(codec);
2121 alc880_uniwill_mic_automute(codec);
2124 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2127 /* Looks like the unsol event is incompatible with the standard
2128 * definition. 4bit tag is placed at 28 bit!
2130 switch (res >> 28) {
2131 case ALC880_HP_EVENT:
2132 alc880_uniwill_hp_automute(codec);
2134 case ALC880_MIC_EVENT:
2135 alc880_uniwill_mic_automute(codec);
2140 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
2142 unsigned int present;
2145 present = snd_hda_codec_read(codec, 0x14, 0,
2146 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2147 bits = present ? HDA_AMP_MUTE : 0;
2148 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2151 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2153 unsigned int present;
2155 present = snd_hda_codec_read(codec, 0x21, 0,
2156 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2157 present &= HDA_AMP_VOLMASK;
2158 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2159 HDA_AMP_VOLMASK, present);
2160 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2161 HDA_AMP_VOLMASK, present);
2164 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2167 /* Looks like the unsol event is incompatible with the standard
2168 * definition. 4bit tag is placed at 28 bit!
2170 if ((res >> 28) == ALC880_HP_EVENT)
2171 alc880_uniwill_p53_hp_automute(codec);
2172 if ((res >> 28) == ALC880_DCVOL_EVENT)
2173 alc880_uniwill_p53_dcvol_automute(codec);
2177 * F1734 pin configuration:
2178 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2180 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2181 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2182 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2183 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2184 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2185 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2194 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2195 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2197 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2198 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2199 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2202 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2203 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2209 * ASUS pin configuration:
2210 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2212 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2213 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2214 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2215 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2216 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2222 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2223 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2224 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2227 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2228 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2229 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2234 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2240 /* Enable GPIO mask and set output */
2241 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2242 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2244 /* Clevo m520g init */
2245 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2246 /* headphone output */
2247 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2255 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2256 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2257 /* Mic1 (rear panel) */
2258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2259 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2260 /* Mic2 (front panel) */
2261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2262 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2266 /* change to EAPD mode */
2267 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2268 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2273 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2274 /* change to EAPD mode */
2275 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2276 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2278 /* Headphone output */
2279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2281 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2284 /* Line In pin widget for input */
2285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2286 /* CD pin widget for input */
2287 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2288 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2289 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2291 /* change to EAPD mode */
2292 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2293 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2299 * LG m1 express dual
2302 * Rear Line-In/Out (blue): 0x14
2303 * Build-in Mic-In: 0x15
2305 * HP-Out (green): 0x1b
2306 * Mic-In/Out (red): 0x19
2310 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2311 static hda_nid_t alc880_lg_dac_nids[3] = {
2315 /* seems analog CD is not working */
2316 static struct hda_input_mux alc880_lg_capture_source = {
2321 { "Internal Mic", 0x6 },
2325 /* 2,4,6 channel modes */
2326 static struct hda_verb alc880_lg_ch2_init[] = {
2327 /* set line-in and mic-in to input */
2328 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2329 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2333 static struct hda_verb alc880_lg_ch4_init[] = {
2334 /* set line-in to out and mic-in to input */
2335 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2336 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2340 static struct hda_verb alc880_lg_ch6_init[] = {
2341 /* set line-in and mic-in to output */
2342 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2343 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2347 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2348 { 2, alc880_lg_ch2_init },
2349 { 4, alc880_lg_ch4_init },
2350 { 6, alc880_lg_ch6_init },
2353 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2355 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2359 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2360 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2361 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2366 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2367 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2370 .name = "Channel Mode",
2371 .info = alc_ch_mode_info,
2372 .get = alc_ch_mode_get,
2373 .put = alc_ch_mode_put,
2378 static struct hda_verb alc880_lg_init_verbs[] = {
2379 /* set capture source to mic-in */
2380 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2383 /* mute all amp mixer inputs */
2384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2387 /* line-in to input */
2388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2389 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2394 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2395 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2396 /* mic-in to input */
2397 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2398 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2399 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2401 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2403 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2405 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2409 /* toggle speaker-output according to the hp-jack state */
2410 static void alc880_lg_automute(struct hda_codec *codec)
2412 unsigned int present;
2415 present = snd_hda_codec_read(codec, 0x1b, 0,
2416 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2417 bits = present ? HDA_AMP_MUTE : 0;
2418 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2419 HDA_AMP_MUTE, bits);
2422 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2424 /* Looks like the unsol event is incompatible with the standard
2425 * definition. 4bit tag is placed at 28 bit!
2427 if ((res >> 28) == 0x01)
2428 alc880_lg_automute(codec);
2437 * Built-in Mic-In: 0x19
2443 static struct hda_input_mux alc880_lg_lw_capture_source = {
2447 { "Internal Mic", 0x1 },
2452 #define alc880_lg_lw_modes alc880_threestack_modes
2454 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2455 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2456 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2457 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2459 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2460 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2461 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2462 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2467 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2468 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2471 .name = "Channel Mode",
2472 .info = alc_ch_mode_info,
2473 .get = alc_ch_mode_get,
2474 .put = alc_ch_mode_put,
2479 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2480 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2481 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2482 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2484 /* set capture source to mic-in */
2485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2491 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2493 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2494 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2495 /* mic-in to input */
2496 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2499 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2500 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2506 /* toggle speaker-output according to the hp-jack state */
2507 static void alc880_lg_lw_automute(struct hda_codec *codec)
2509 unsigned int present;
2512 present = snd_hda_codec_read(codec, 0x1b, 0,
2513 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2514 bits = present ? HDA_AMP_MUTE : 0;
2515 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2516 HDA_AMP_MUTE, bits);
2519 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2521 /* Looks like the unsol event is incompatible with the standard
2522 * definition. 4bit tag is placed at 28 bit!
2524 if ((res >> 28) == 0x01)
2525 alc880_lg_lw_automute(codec);
2528 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2529 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2530 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2533 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2534 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2538 static struct hda_input_mux alc880_medion_rim_capture_source = {
2542 { "Internal Mic", 0x1 },
2546 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2547 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2552 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2554 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2555 /* Mic2 (as headphone out) for HP output */
2556 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2557 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2558 /* Internal Speaker */
2559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2560 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2562 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2563 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2565 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2569 /* toggle speaker-output according to the hp-jack state */
2570 static void alc880_medion_rim_automute(struct hda_codec *codec)
2572 unsigned int present;
2575 present = snd_hda_codec_read(codec, 0x14, 0,
2576 AC_VERB_GET_PIN_SENSE, 0)
2577 & AC_PINSENSE_PRESENCE;
2578 bits = present ? HDA_AMP_MUTE : 0;
2579 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2580 HDA_AMP_MUTE, bits);
2582 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2584 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2587 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2590 /* Looks like the unsol event is incompatible with the standard
2591 * definition. 4bit tag is placed at 28 bit!
2593 if ((res >> 28) == ALC880_HP_EVENT)
2594 alc880_medion_rim_automute(codec);
2597 #ifdef CONFIG_SND_HDA_POWER_SAVE
2598 static struct hda_amp_list alc880_loopbacks[] = {
2599 { 0x0b, HDA_INPUT, 0 },
2600 { 0x0b, HDA_INPUT, 1 },
2601 { 0x0b, HDA_INPUT, 2 },
2602 { 0x0b, HDA_INPUT, 3 },
2603 { 0x0b, HDA_INPUT, 4 },
2607 static struct hda_amp_list alc880_lg_loopbacks[] = {
2608 { 0x0b, HDA_INPUT, 1 },
2609 { 0x0b, HDA_INPUT, 6 },
2610 { 0x0b, HDA_INPUT, 7 },
2619 static int alc_init(struct hda_codec *codec)
2621 struct alc_spec *spec = codec->spec;
2625 if (codec->vendor_id == 0x10ec0888)
2626 alc888_coef_init(codec);
2628 for (i = 0; i < spec->num_init_verbs; i++)
2629 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2631 if (spec->init_hook)
2632 spec->init_hook(codec);
2637 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2639 struct alc_spec *spec = codec->spec;
2641 if (spec->unsol_event)
2642 spec->unsol_event(codec, res);
2645 #ifdef CONFIG_SND_HDA_POWER_SAVE
2646 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2648 struct alc_spec *spec = codec->spec;
2649 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2654 * Analog playback callbacks
2656 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2657 struct hda_codec *codec,
2658 struct snd_pcm_substream *substream)
2660 struct alc_spec *spec = codec->spec;
2661 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2665 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2666 struct hda_codec *codec,
2667 unsigned int stream_tag,
2668 unsigned int format,
2669 struct snd_pcm_substream *substream)
2671 struct alc_spec *spec = codec->spec;
2672 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2673 stream_tag, format, substream);
2676 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2677 struct hda_codec *codec,
2678 struct snd_pcm_substream *substream)
2680 struct alc_spec *spec = codec->spec;
2681 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2687 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2688 struct hda_codec *codec,
2689 struct snd_pcm_substream *substream)
2691 struct alc_spec *spec = codec->spec;
2692 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2695 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2696 struct hda_codec *codec,
2697 unsigned int stream_tag,
2698 unsigned int format,
2699 struct snd_pcm_substream *substream)
2701 struct alc_spec *spec = codec->spec;
2702 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2703 stream_tag, format, substream);
2706 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2707 struct hda_codec *codec,
2708 struct snd_pcm_substream *substream)
2710 struct alc_spec *spec = codec->spec;
2711 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2717 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2718 struct hda_codec *codec,
2719 unsigned int stream_tag,
2720 unsigned int format,
2721 struct snd_pcm_substream *substream)
2723 struct alc_spec *spec = codec->spec;
2725 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2726 stream_tag, 0, format);
2730 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2731 struct hda_codec *codec,
2732 struct snd_pcm_substream *substream)
2734 struct alc_spec *spec = codec->spec;
2736 snd_hda_codec_cleanup_stream(codec,
2737 spec->adc_nids[substream->number + 1]);
2744 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2748 /* NID is set in alc_build_pcms */
2750 .open = alc880_playback_pcm_open,
2751 .prepare = alc880_playback_pcm_prepare,
2752 .cleanup = alc880_playback_pcm_cleanup
2756 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2760 /* NID is set in alc_build_pcms */
2763 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2767 /* NID is set in alc_build_pcms */
2770 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2771 .substreams = 2, /* can be overridden */
2774 /* NID is set in alc_build_pcms */
2776 .prepare = alc880_alt_capture_pcm_prepare,
2777 .cleanup = alc880_alt_capture_pcm_cleanup
2781 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2785 /* NID is set in alc_build_pcms */
2787 .open = alc880_dig_playback_pcm_open,
2788 .close = alc880_dig_playback_pcm_close,
2789 .prepare = alc880_dig_playback_pcm_prepare
2793 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2797 /* NID is set in alc_build_pcms */
2800 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2801 static struct hda_pcm_stream alc_pcm_null_stream = {
2807 static int alc_build_pcms(struct hda_codec *codec)
2809 struct alc_spec *spec = codec->spec;
2810 struct hda_pcm *info = spec->pcm_rec;
2813 codec->num_pcms = 1;
2814 codec->pcm_info = info;
2816 info->name = spec->stream_name_analog;
2817 if (spec->stream_analog_playback) {
2818 if (snd_BUG_ON(!spec->multiout.dac_nids))
2820 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2821 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2823 if (spec->stream_analog_capture) {
2824 if (snd_BUG_ON(!spec->adc_nids))
2826 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2827 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2830 if (spec->channel_mode) {
2831 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2832 for (i = 0; i < spec->num_channel_mode; i++) {
2833 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2834 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2839 /* SPDIF for stream index #1 */
2840 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2841 codec->num_pcms = 2;
2842 info = spec->pcm_rec + 1;
2843 info->name = spec->stream_name_digital;
2844 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2845 if (spec->multiout.dig_out_nid &&
2846 spec->stream_digital_playback) {
2847 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2848 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2850 if (spec->dig_in_nid &&
2851 spec->stream_digital_capture) {
2852 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2853 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2855 /* FIXME: do we need this for all Realtek codec models? */
2856 codec->spdif_status_reset = 1;
2859 /* If the use of more than one ADC is requested for the current
2860 * model, configure a second analog capture-only PCM.
2862 /* Additional Analaog capture for index #2 */
2863 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2864 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2865 codec->num_pcms = 3;
2866 info = spec->pcm_rec + 2;
2867 info->name = spec->stream_name_analog;
2868 if (spec->alt_dac_nid) {
2869 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2870 *spec->stream_analog_alt_playback;
2871 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2874 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2875 alc_pcm_null_stream;
2876 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2878 if (spec->num_adc_nids > 1) {
2879 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2880 *spec->stream_analog_alt_capture;
2881 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2883 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2884 spec->num_adc_nids - 1;
2886 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2887 alc_pcm_null_stream;
2888 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2895 static void alc_free_kctls(struct hda_codec *codec)
2897 struct alc_spec *spec = codec->spec;
2899 if (spec->kctls.list) {
2900 struct snd_kcontrol_new *kctl = spec->kctls.list;
2902 for (i = 0; i < spec->kctls.used; i++)
2903 kfree(kctl[i].name);
2905 snd_array_free(&spec->kctls);
2908 static void alc_free(struct hda_codec *codec)
2910 struct alc_spec *spec = codec->spec;
2915 alc_free_kctls(codec);
2917 codec->spec = NULL; /* to be sure */
2920 #ifdef SND_HDA_NEEDS_RESUME
2921 static void store_pin_configs(struct hda_codec *codec)
2923 struct alc_spec *spec = codec->spec;
2924 hda_nid_t nid, end_nid;
2926 end_nid = codec->start_nid + codec->num_nodes;
2927 for (nid = codec->start_nid; nid < end_nid; nid++) {
2928 unsigned int wid_caps = get_wcaps(codec, nid);
2929 unsigned int wid_type =
2930 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2931 if (wid_type != AC_WID_PIN)
2933 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2935 spec->pin_nids[spec->num_pins] = nid;
2936 spec->pin_cfgs[spec->num_pins] =
2937 snd_hda_codec_read(codec, nid, 0,
2938 AC_VERB_GET_CONFIG_DEFAULT, 0);
2943 static void resume_pin_configs(struct hda_codec *codec)
2945 struct alc_spec *spec = codec->spec;
2948 for (i = 0; i < spec->num_pins; i++) {
2949 hda_nid_t pin_nid = spec->pin_nids[i];
2950 unsigned int pin_config = spec->pin_cfgs[i];
2951 snd_hda_codec_write(codec, pin_nid, 0,
2952 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2953 pin_config & 0x000000ff);
2954 snd_hda_codec_write(codec, pin_nid, 0,
2955 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2956 (pin_config & 0x0000ff00) >> 8);
2957 snd_hda_codec_write(codec, pin_nid, 0,
2958 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2959 (pin_config & 0x00ff0000) >> 16);
2960 snd_hda_codec_write(codec, pin_nid, 0,
2961 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2966 static int alc_resume(struct hda_codec *codec)
2968 resume_pin_configs(codec);
2969 codec->patch_ops.init(codec);
2970 snd_hda_codec_resume_amp(codec);
2971 snd_hda_codec_resume_cache(codec);
2975 #define store_pin_configs(codec)
2980 static struct hda_codec_ops alc_patch_ops = {
2981 .build_controls = alc_build_controls,
2982 .build_pcms = alc_build_pcms,
2985 .unsol_event = alc_unsol_event,
2986 #ifdef SND_HDA_NEEDS_RESUME
2987 .resume = alc_resume,
2989 #ifdef CONFIG_SND_HDA_POWER_SAVE
2990 .check_power_status = alc_check_power_status,
2996 * Test configuration for debugging
2998 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3001 #ifdef CONFIG_SND_DEBUG
3002 static hda_nid_t alc880_test_dac_nids[4] = {
3003 0x02, 0x03, 0x04, 0x05
3006 static struct hda_input_mux alc880_test_capture_source = {
3015 { "Surround", 0x6 },
3019 static struct hda_channel_mode alc880_test_modes[4] = {
3026 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3027 struct snd_ctl_elem_info *uinfo)
3029 static char *texts[] = {
3030 "N/A", "Line Out", "HP Out",
3031 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3033 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3035 uinfo->value.enumerated.items = 8;
3036 if (uinfo->value.enumerated.item >= 8)
3037 uinfo->value.enumerated.item = 7;
3038 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3042 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3043 struct snd_ctl_elem_value *ucontrol)
3045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3046 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3047 unsigned int pin_ctl, item = 0;
3049 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3050 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3051 if (pin_ctl & AC_PINCTL_OUT_EN) {
3052 if (pin_ctl & AC_PINCTL_HP_EN)
3056 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3057 switch (pin_ctl & AC_PINCTL_VREFEN) {
3058 case AC_PINCTL_VREF_HIZ: item = 3; break;
3059 case AC_PINCTL_VREF_50: item = 4; break;
3060 case AC_PINCTL_VREF_GRD: item = 5; break;
3061 case AC_PINCTL_VREF_80: item = 6; break;
3062 case AC_PINCTL_VREF_100: item = 7; break;
3065 ucontrol->value.enumerated.item[0] = item;
3069 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3070 struct snd_ctl_elem_value *ucontrol)
3072 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3073 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3074 static unsigned int ctls[] = {
3075 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3076 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3077 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3078 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3079 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3080 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3082 unsigned int old_ctl, new_ctl;
3084 old_ctl = snd_hda_codec_read(codec, nid, 0,
3085 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3086 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3087 if (old_ctl != new_ctl) {
3089 snd_hda_codec_write_cache(codec, nid, 0,
3090 AC_VERB_SET_PIN_WIDGET_CONTROL,
3092 val = ucontrol->value.enumerated.item[0] >= 3 ?
3094 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3101 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3102 struct snd_ctl_elem_info *uinfo)
3104 static char *texts[] = {
3105 "Front", "Surround", "CLFE", "Side"
3107 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3109 uinfo->value.enumerated.items = 4;
3110 if (uinfo->value.enumerated.item >= 4)
3111 uinfo->value.enumerated.item = 3;
3112 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3116 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3117 struct snd_ctl_elem_value *ucontrol)
3119 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3120 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3123 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3124 ucontrol->value.enumerated.item[0] = sel & 3;
3128 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3129 struct snd_ctl_elem_value *ucontrol)
3131 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3132 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3135 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3136 if (ucontrol->value.enumerated.item[0] != sel) {
3137 sel = ucontrol->value.enumerated.item[0] & 3;
3138 snd_hda_codec_write_cache(codec, nid, 0,
3139 AC_VERB_SET_CONNECT_SEL, sel);
3145 #define PIN_CTL_TEST(xname,nid) { \
3146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3148 .info = alc_test_pin_ctl_info, \
3149 .get = alc_test_pin_ctl_get, \
3150 .put = alc_test_pin_ctl_put, \
3151 .private_value = nid \
3154 #define PIN_SRC_TEST(xname,nid) { \
3155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3157 .info = alc_test_pin_src_info, \
3158 .get = alc_test_pin_src_get, \
3159 .put = alc_test_pin_src_put, \
3160 .private_value = nid \
3163 static struct snd_kcontrol_new alc880_test_mixer[] = {
3164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3165 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3166 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3167 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3168 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3169 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3170 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3171 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3172 PIN_CTL_TEST("Front Pin Mode", 0x14),
3173 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3174 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3175 PIN_CTL_TEST("Side Pin Mode", 0x17),
3176 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3177 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3178 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3179 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3180 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3181 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3182 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3183 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3184 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3185 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3186 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3187 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3188 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3189 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3190 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3191 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3196 .name = "Channel Mode",
3197 .info = alc_ch_mode_info,
3198 .get = alc_ch_mode_get,
3199 .put = alc_ch_mode_put,
3204 static struct hda_verb alc880_test_init_verbs[] = {
3205 /* Unmute inputs of 0x0c - 0x0f */
3206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3212 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3214 /* Vol output for 0x0c-0x0f */
3215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3217 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3218 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3219 /* Set output pins 0x14-0x17 */
3220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3222 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3223 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3224 /* Unmute output pins 0x14-0x17 */
3225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3226 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3228 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3229 /* Set input pins 0x18-0x1c */
3230 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3234 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3235 /* Mute input pins 0x18-0x1b */
3236 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3237 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3238 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3239 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3242 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3243 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3244 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3246 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3247 /* Analog input/passthru */
3248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3260 static const char *alc880_models[ALC880_MODEL_LAST] = {
3261 [ALC880_3ST] = "3stack",
3262 [ALC880_TCL_S700] = "tcl",
3263 [ALC880_3ST_DIG] = "3stack-digout",
3264 [ALC880_CLEVO] = "clevo",
3265 [ALC880_5ST] = "5stack",
3266 [ALC880_5ST_DIG] = "5stack-digout",
3267 [ALC880_W810] = "w810",
3268 [ALC880_Z71V] = "z71v",
3269 [ALC880_6ST] = "6stack",
3270 [ALC880_6ST_DIG] = "6stack-digout",
3271 [ALC880_ASUS] = "asus",
3272 [ALC880_ASUS_W1V] = "asus-w1v",
3273 [ALC880_ASUS_DIG] = "asus-dig",
3274 [ALC880_ASUS_DIG2] = "asus-dig2",
3275 [ALC880_UNIWILL_DIG] = "uniwill",
3276 [ALC880_UNIWILL_P53] = "uniwill-p53",
3277 [ALC880_FUJITSU] = "fujitsu",
3278 [ALC880_F1734] = "F1734",
3280 [ALC880_LG_LW] = "lg-lw",
3281 [ALC880_MEDION_RIM] = "medion",
3282 #ifdef CONFIG_SND_DEBUG
3283 [ALC880_TEST] = "test",
3285 [ALC880_AUTO] = "auto",
3288 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3289 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3290 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3291 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3292 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3293 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3294 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3295 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3296 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3297 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3298 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3299 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3300 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3301 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3302 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3303 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3304 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3305 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3306 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3307 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3308 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3309 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3310 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3311 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3312 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3313 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3314 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
3315 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3316 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3317 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3318 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3319 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3320 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3321 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3322 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3323 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3324 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3325 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3326 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3327 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3328 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3329 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3330 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3331 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3332 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3333 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3334 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3335 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3336 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3337 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3338 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3339 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3340 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3341 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3342 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3343 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3344 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3345 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3346 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3347 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3348 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3349 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3350 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3351 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3352 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3353 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3354 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3355 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3356 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3357 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3358 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3359 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3364 * ALC880 codec presets
3366 static struct alc_config_preset alc880_presets[] = {
3368 .mixers = { alc880_three_stack_mixer },
3369 .init_verbs = { alc880_volume_init_verbs,
3370 alc880_pin_3stack_init_verbs },
3371 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3372 .dac_nids = alc880_dac_nids,
3373 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3374 .channel_mode = alc880_threestack_modes,
3376 .input_mux = &alc880_capture_source,
3378 [ALC880_3ST_DIG] = {
3379 .mixers = { alc880_three_stack_mixer },
3380 .init_verbs = { alc880_volume_init_verbs,
3381 alc880_pin_3stack_init_verbs },
3382 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3383 .dac_nids = alc880_dac_nids,
3384 .dig_out_nid = ALC880_DIGOUT_NID,
3385 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3386 .channel_mode = alc880_threestack_modes,
3388 .input_mux = &alc880_capture_source,
3390 [ALC880_TCL_S700] = {
3391 .mixers = { alc880_tcl_s700_mixer },
3392 .init_verbs = { alc880_volume_init_verbs,
3393 alc880_pin_tcl_S700_init_verbs,
3394 alc880_gpio2_init_verbs },
3395 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3396 .dac_nids = alc880_dac_nids,
3397 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3398 .num_adc_nids = 1, /* single ADC */
3400 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3401 .channel_mode = alc880_2_jack_modes,
3402 .input_mux = &alc880_capture_source,
3405 .mixers = { alc880_three_stack_mixer,
3406 alc880_five_stack_mixer},
3407 .init_verbs = { alc880_volume_init_verbs,
3408 alc880_pin_5stack_init_verbs },
3409 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3410 .dac_nids = alc880_dac_nids,
3411 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3412 .channel_mode = alc880_fivestack_modes,
3413 .input_mux = &alc880_capture_source,
3415 [ALC880_5ST_DIG] = {
3416 .mixers = { alc880_three_stack_mixer,
3417 alc880_five_stack_mixer },
3418 .init_verbs = { alc880_volume_init_verbs,
3419 alc880_pin_5stack_init_verbs },
3420 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3421 .dac_nids = alc880_dac_nids,
3422 .dig_out_nid = ALC880_DIGOUT_NID,
3423 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3424 .channel_mode = alc880_fivestack_modes,
3425 .input_mux = &alc880_capture_source,
3428 .mixers = { alc880_six_stack_mixer },
3429 .init_verbs = { alc880_volume_init_verbs,
3430 alc880_pin_6stack_init_verbs },
3431 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3432 .dac_nids = alc880_6st_dac_nids,
3433 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3434 .channel_mode = alc880_sixstack_modes,
3435 .input_mux = &alc880_6stack_capture_source,
3437 [ALC880_6ST_DIG] = {
3438 .mixers = { alc880_six_stack_mixer },
3439 .init_verbs = { alc880_volume_init_verbs,
3440 alc880_pin_6stack_init_verbs },
3441 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3442 .dac_nids = alc880_6st_dac_nids,
3443 .dig_out_nid = ALC880_DIGOUT_NID,
3444 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3445 .channel_mode = alc880_sixstack_modes,
3446 .input_mux = &alc880_6stack_capture_source,
3449 .mixers = { alc880_w810_base_mixer },
3450 .init_verbs = { alc880_volume_init_verbs,
3451 alc880_pin_w810_init_verbs,
3452 alc880_gpio2_init_verbs },
3453 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3454 .dac_nids = alc880_w810_dac_nids,
3455 .dig_out_nid = ALC880_DIGOUT_NID,
3456 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3457 .channel_mode = alc880_w810_modes,
3458 .input_mux = &alc880_capture_source,
3461 .mixers = { alc880_z71v_mixer },
3462 .init_verbs = { alc880_volume_init_verbs,
3463 alc880_pin_z71v_init_verbs },
3464 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3465 .dac_nids = alc880_z71v_dac_nids,
3466 .dig_out_nid = ALC880_DIGOUT_NID,
3468 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3469 .channel_mode = alc880_2_jack_modes,
3470 .input_mux = &alc880_capture_source,
3473 .mixers = { alc880_f1734_mixer },
3474 .init_verbs = { alc880_volume_init_verbs,
3475 alc880_pin_f1734_init_verbs },
3476 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3477 .dac_nids = alc880_f1734_dac_nids,
3479 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3480 .channel_mode = alc880_2_jack_modes,
3481 .input_mux = &alc880_f1734_capture_source,
3482 .unsol_event = alc880_uniwill_p53_unsol_event,
3483 .init_hook = alc880_uniwill_p53_hp_automute,
3486 .mixers = { alc880_asus_mixer },
3487 .init_verbs = { alc880_volume_init_verbs,
3488 alc880_pin_asus_init_verbs,
3489 alc880_gpio1_init_verbs },
3490 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3491 .dac_nids = alc880_asus_dac_nids,
3492 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3493 .channel_mode = alc880_asus_modes,
3495 .input_mux = &alc880_capture_source,
3497 [ALC880_ASUS_DIG] = {
3498 .mixers = { alc880_asus_mixer },
3499 .init_verbs = { alc880_volume_init_verbs,
3500 alc880_pin_asus_init_verbs,
3501 alc880_gpio1_init_verbs },
3502 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3503 .dac_nids = alc880_asus_dac_nids,
3504 .dig_out_nid = ALC880_DIGOUT_NID,
3505 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3506 .channel_mode = alc880_asus_modes,
3508 .input_mux = &alc880_capture_source,
3510 [ALC880_ASUS_DIG2] = {
3511 .mixers = { alc880_asus_mixer },
3512 .init_verbs = { alc880_volume_init_verbs,
3513 alc880_pin_asus_init_verbs,
3514 alc880_gpio2_init_verbs }, /* use GPIO2 */
3515 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3516 .dac_nids = alc880_asus_dac_nids,
3517 .dig_out_nid = ALC880_DIGOUT_NID,
3518 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3519 .channel_mode = alc880_asus_modes,
3521 .input_mux = &alc880_capture_source,
3523 [ALC880_ASUS_W1V] = {
3524 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3525 .init_verbs = { alc880_volume_init_verbs,
3526 alc880_pin_asus_init_verbs,
3527 alc880_gpio1_init_verbs },
3528 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3529 .dac_nids = alc880_asus_dac_nids,
3530 .dig_out_nid = ALC880_DIGOUT_NID,
3531 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3532 .channel_mode = alc880_asus_modes,
3534 .input_mux = &alc880_capture_source,
3536 [ALC880_UNIWILL_DIG] = {
3537 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3538 .init_verbs = { alc880_volume_init_verbs,
3539 alc880_pin_asus_init_verbs },
3540 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3541 .dac_nids = alc880_asus_dac_nids,
3542 .dig_out_nid = ALC880_DIGOUT_NID,
3543 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3544 .channel_mode = alc880_asus_modes,
3546 .input_mux = &alc880_capture_source,
3548 [ALC880_UNIWILL] = {
3549 .mixers = { alc880_uniwill_mixer },
3550 .init_verbs = { alc880_volume_init_verbs,
3551 alc880_uniwill_init_verbs },
3552 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3553 .dac_nids = alc880_asus_dac_nids,
3554 .dig_out_nid = ALC880_DIGOUT_NID,
3555 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3556 .channel_mode = alc880_threestack_modes,
3558 .input_mux = &alc880_capture_source,
3559 .unsol_event = alc880_uniwill_unsol_event,
3560 .init_hook = alc880_uniwill_automute,
3562 [ALC880_UNIWILL_P53] = {
3563 .mixers = { alc880_uniwill_p53_mixer },
3564 .init_verbs = { alc880_volume_init_verbs,
3565 alc880_uniwill_p53_init_verbs },
3566 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3567 .dac_nids = alc880_asus_dac_nids,
3568 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3569 .channel_mode = alc880_threestack_modes,
3570 .input_mux = &alc880_capture_source,
3571 .unsol_event = alc880_uniwill_p53_unsol_event,
3572 .init_hook = alc880_uniwill_p53_hp_automute,
3574 [ALC880_FUJITSU] = {
3575 .mixers = { alc880_fujitsu_mixer,
3576 alc880_pcbeep_mixer, },
3577 .init_verbs = { alc880_volume_init_verbs,
3578 alc880_uniwill_p53_init_verbs,
3579 alc880_beep_init_verbs },
3580 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3581 .dac_nids = alc880_dac_nids,
3582 .dig_out_nid = ALC880_DIGOUT_NID,
3583 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3584 .channel_mode = alc880_2_jack_modes,
3585 .input_mux = &alc880_capture_source,
3586 .unsol_event = alc880_uniwill_p53_unsol_event,
3587 .init_hook = alc880_uniwill_p53_hp_automute,
3590 .mixers = { alc880_three_stack_mixer },
3591 .init_verbs = { alc880_volume_init_verbs,
3592 alc880_pin_clevo_init_verbs },
3593 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3594 .dac_nids = alc880_dac_nids,
3596 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3597 .channel_mode = alc880_threestack_modes,
3599 .input_mux = &alc880_capture_source,
3602 .mixers = { alc880_lg_mixer },
3603 .init_verbs = { alc880_volume_init_verbs,
3604 alc880_lg_init_verbs },
3605 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3606 .dac_nids = alc880_lg_dac_nids,
3607 .dig_out_nid = ALC880_DIGOUT_NID,
3608 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3609 .channel_mode = alc880_lg_ch_modes,
3611 .input_mux = &alc880_lg_capture_source,
3612 .unsol_event = alc880_lg_unsol_event,
3613 .init_hook = alc880_lg_automute,
3614 #ifdef CONFIG_SND_HDA_POWER_SAVE
3615 .loopbacks = alc880_lg_loopbacks,
3619 .mixers = { alc880_lg_lw_mixer },
3620 .init_verbs = { alc880_volume_init_verbs,
3621 alc880_lg_lw_init_verbs },
3622 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3623 .dac_nids = alc880_dac_nids,
3624 .dig_out_nid = ALC880_DIGOUT_NID,
3625 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3626 .channel_mode = alc880_lg_lw_modes,
3627 .input_mux = &alc880_lg_lw_capture_source,
3628 .unsol_event = alc880_lg_lw_unsol_event,
3629 .init_hook = alc880_lg_lw_automute,
3631 [ALC880_MEDION_RIM] = {
3632 .mixers = { alc880_medion_rim_mixer },
3633 .init_verbs = { alc880_volume_init_verbs,
3634 alc880_medion_rim_init_verbs,
3635 alc_gpio2_init_verbs },
3636 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3637 .dac_nids = alc880_dac_nids,
3638 .dig_out_nid = ALC880_DIGOUT_NID,
3639 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3640 .channel_mode = alc880_2_jack_modes,
3641 .input_mux = &alc880_medion_rim_capture_source,
3642 .unsol_event = alc880_medion_rim_unsol_event,
3643 .init_hook = alc880_medion_rim_automute,
3645 #ifdef CONFIG_SND_DEBUG
3647 .mixers = { alc880_test_mixer },
3648 .init_verbs = { alc880_test_init_verbs },
3649 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3650 .dac_nids = alc880_test_dac_nids,
3651 .dig_out_nid = ALC880_DIGOUT_NID,
3652 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3653 .channel_mode = alc880_test_modes,
3654 .input_mux = &alc880_test_capture_source,
3660 * Automatic parse of I/O pins from the BIOS configuration
3665 ALC_CTL_WIDGET_MUTE,
3668 static struct snd_kcontrol_new alc880_control_templates[] = {
3669 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3670 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3671 HDA_BIND_MUTE(NULL, 0, 0, 0),
3674 /* add dynamic controls */
3675 static int add_control(struct alc_spec *spec, int type, const char *name,
3678 struct snd_kcontrol_new *knew;
3680 snd_array_init(&spec->kctls, sizeof(*knew), 32);
3681 knew = snd_array_new(&spec->kctls);
3684 *knew = alc880_control_templates[type];
3685 knew->name = kstrdup(name, GFP_KERNEL);
3688 knew->private_value = val;
3692 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3693 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3694 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3695 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3696 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3697 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3698 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3699 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3700 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3701 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3702 #define ALC880_PIN_CD_NID 0x1c
3704 /* fill in the dac_nids table from the parsed pin configuration */
3705 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3706 const struct auto_pin_cfg *cfg)
3712 memset(assigned, 0, sizeof(assigned));
3713 spec->multiout.dac_nids = spec->private_dac_nids;
3715 /* check the pins hardwired to audio widget */
3716 for (i = 0; i < cfg->line_outs; i++) {
3717 nid = cfg->line_out_pins[i];
3718 if (alc880_is_fixed_pin(nid)) {
3719 int idx = alc880_fixed_pin_idx(nid);
3720 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3724 /* left pins can be connect to any audio widget */
3725 for (i = 0; i < cfg->line_outs; i++) {
3726 nid = cfg->line_out_pins[i];
3727 if (alc880_is_fixed_pin(nid))
3729 /* search for an empty channel */
3730 for (j = 0; j < cfg->line_outs; j++) {
3732 spec->multiout.dac_nids[i] =
3733 alc880_idx_to_dac(j);
3739 spec->multiout.num_dacs = cfg->line_outs;
3743 /* add playback controls from the parsed DAC table */
3744 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3745 const struct auto_pin_cfg *cfg)
3748 static const char *chname[4] = {
3749 "Front", "Surround", NULL /*CLFE*/, "Side"
3754 for (i = 0; i < cfg->line_outs; i++) {
3755 if (!spec->multiout.dac_nids[i])
3757 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3760 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3761 "Center Playback Volume",
3762 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3766 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3767 "LFE Playback Volume",
3768 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3772 err = add_control(spec, ALC_CTL_BIND_MUTE,
3773 "Center Playback Switch",
3774 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3778 err = add_control(spec, ALC_CTL_BIND_MUTE,
3779 "LFE Playback Switch",
3780 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3785 sprintf(name, "%s Playback Volume", chname[i]);
3786 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3787 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3791 sprintf(name, "%s Playback Switch", chname[i]);
3792 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3793 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3802 /* add playback controls for speaker and HP outputs */
3803 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3813 if (alc880_is_fixed_pin(pin)) {
3814 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3815 /* specify the DAC as the extra output */
3816 if (!spec->multiout.hp_nid)
3817 spec->multiout.hp_nid = nid;
3819 spec->multiout.extra_out_nid[0] = nid;
3820 /* control HP volume/switch on the output mixer amp */
3821 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3822 sprintf(name, "%s Playback Volume", pfx);
3823 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3824 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3827 sprintf(name, "%s Playback Switch", pfx);
3828 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3829 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3832 } else if (alc880_is_multi_pin(pin)) {
3833 /* set manual connection */
3834 /* we have only a switch on HP-out PIN */
3835 sprintf(name, "%s Playback Switch", pfx);
3836 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3837 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3844 /* create input playback/capture controls for the given pin */
3845 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3846 const char *ctlname,
3847 int idx, hda_nid_t mix_nid)
3852 sprintf(name, "%s Playback Volume", ctlname);
3853 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3854 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3857 sprintf(name, "%s Playback Switch", ctlname);
3858 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3859 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3865 /* create playback/capture controls for input pins */
3866 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3867 const struct auto_pin_cfg *cfg)
3869 struct hda_input_mux *imux = &spec->private_imux;
3872 for (i = 0; i < AUTO_PIN_LAST; i++) {
3873 if (alc880_is_input_pin(cfg->input_pins[i])) {
3874 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3875 err = new_analog_input(spec, cfg->input_pins[i],
3876 auto_pin_cfg_labels[i],
3880 imux->items[imux->num_items].label =
3881 auto_pin_cfg_labels[i];
3882 imux->items[imux->num_items].index =
3883 alc880_input_pin_idx(cfg->input_pins[i]);
3890 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3891 unsigned int pin_type)
3893 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3896 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3900 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3901 hda_nid_t nid, int pin_type,
3904 alc_set_pin_output(codec, nid, pin_type);
3905 /* need the manual connection? */
3906 if (alc880_is_multi_pin(nid)) {
3907 struct alc_spec *spec = codec->spec;
3908 int idx = alc880_multi_pin_idx(nid);
3909 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3910 AC_VERB_SET_CONNECT_SEL,
3911 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3915 static int get_pin_type(int line_out_type)
3917 if (line_out_type == AUTO_PIN_HP_OUT)
3923 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3925 struct alc_spec *spec = codec->spec;
3928 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3929 for (i = 0; i < spec->autocfg.line_outs; i++) {
3930 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3931 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3932 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3936 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3938 struct alc_spec *spec = codec->spec;
3941 pin = spec->autocfg.speaker_pins[0];
3942 if (pin) /* connect to front */
3943 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3944 pin = spec->autocfg.hp_pins[0];
3945 if (pin) /* connect to front */
3946 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3949 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3951 struct alc_spec *spec = codec->spec;
3954 for (i = 0; i < AUTO_PIN_LAST; i++) {
3955 hda_nid_t nid = spec->autocfg.input_pins[i];
3956 if (alc880_is_input_pin(nid)) {
3957 snd_hda_codec_write(codec, nid, 0,
3958 AC_VERB_SET_PIN_WIDGET_CONTROL,
3959 i <= AUTO_PIN_FRONT_MIC ?
3960 PIN_VREF80 : PIN_IN);
3961 if (nid != ALC880_PIN_CD_NID)
3962 snd_hda_codec_write(codec, nid, 0,
3963 AC_VERB_SET_AMP_GAIN_MUTE,
3969 /* parse the BIOS configuration and set up the alc_spec */
3970 /* return 1 if successful, 0 if the proper config is not found,
3971 * or a negative error code
3973 static int alc880_parse_auto_config(struct hda_codec *codec)
3975 struct alc_spec *spec = codec->spec;
3977 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3979 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3983 if (!spec->autocfg.line_outs)
3984 return 0; /* can't find valid BIOS pin config */
3986 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3989 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3992 err = alc880_auto_create_extra_out(spec,
3993 spec->autocfg.speaker_pins[0],
3997 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4001 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4005 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4007 if (spec->autocfg.dig_out_pin)
4008 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
4009 if (spec->autocfg.dig_in_pin)
4010 spec->dig_in_nid = ALC880_DIGIN_NID;
4012 if (spec->kctls.list)
4013 add_mixer(spec, spec->kctls.list);
4015 add_verb(spec, alc880_volume_init_verbs);
4017 spec->num_mux_defs = 1;
4018 spec->input_mux = &spec->private_imux;
4020 store_pin_configs(codec);
4024 /* additional initialization for auto-configuration model */
4025 static void alc880_auto_init(struct hda_codec *codec)
4027 struct alc_spec *spec = codec->spec;
4028 alc880_auto_init_multi_out(codec);
4029 alc880_auto_init_extra_out(codec);
4030 alc880_auto_init_analog_input(codec);
4031 if (spec->unsol_event)
4032 alc_inithook(codec);
4036 * OK, here we have finally the patch for ALC880
4039 static void set_capture_mixer(struct alc_spec *spec)
4041 static struct snd_kcontrol_new *caps[3] = {
4046 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3)
4047 spec->cap_mixer = caps[spec->num_adc_nids - 1];
4050 static int patch_alc880(struct hda_codec *codec)
4052 struct alc_spec *spec;
4056 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4062 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4065 if (board_config < 0) {
4066 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
4067 "trying auto-probe from BIOS...\n");
4068 board_config = ALC880_AUTO;
4071 if (board_config == ALC880_AUTO) {
4072 /* automatic parse from the BIOS config */
4073 err = alc880_parse_auto_config(codec);
4079 "hda_codec: Cannot set up configuration "
4080 "from BIOS. Using 3-stack mode...\n");
4081 board_config = ALC880_3ST;
4085 if (board_config != ALC880_AUTO)
4086 setup_preset(spec, &alc880_presets[board_config]);
4088 spec->stream_name_analog = "ALC880 Analog";
4089 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4090 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4091 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4093 spec->stream_name_digital = "ALC880 Digital";
4094 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4095 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4097 if (!spec->adc_nids && spec->input_mux) {
4098 /* check whether NID 0x07 is valid */
4099 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4101 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4102 if (wcap != AC_WID_AUD_IN) {
4103 spec->adc_nids = alc880_adc_nids_alt;
4104 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4106 spec->adc_nids = alc880_adc_nids;
4107 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4110 set_capture_mixer(spec);
4112 spec->vmaster_nid = 0x0c;
4114 codec->patch_ops = alc_patch_ops;
4115 if (board_config == ALC880_AUTO)
4116 spec->init_hook = alc880_auto_init;
4117 #ifdef CONFIG_SND_HDA_POWER_SAVE
4118 if (!spec->loopback.amplist)
4119 spec->loopback.amplist = alc880_loopbacks;
4130 static hda_nid_t alc260_dac_nids[1] = {
4135 static hda_nid_t alc260_adc_nids[1] = {
4140 static hda_nid_t alc260_adc_nids_alt[1] = {
4145 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4146 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4148 static hda_nid_t alc260_dual_adc_nids[2] = {
4153 #define ALC260_DIGOUT_NID 0x03
4154 #define ALC260_DIGIN_NID 0x06
4156 static struct hda_input_mux alc260_capture_source = {
4160 { "Front Mic", 0x1 },
4166 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4167 * headphone jack and the internal CD lines since these are the only pins at
4168 * which audio can appear. For flexibility, also allow the option of
4169 * recording the mixer output on the second ADC (ADC0 doesn't have a
4170 * connection to the mixer output).
4172 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4176 { "Mic/Line", 0x0 },
4178 { "Headphone", 0x2 },
4184 { "Mic/Line", 0x0 },
4186 { "Headphone", 0x2 },
4193 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4194 * the Fujitsu S702x, but jacks are marked differently.
4196 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4203 { "Headphone", 0x5 },
4212 { "Headphone", 0x6 },
4218 * This is just place-holder, so there's something for alc_build_pcms to look
4219 * at when it calculates the maximum number of channels. ALC260 has no mixer
4220 * element which allows changing the channel mode, so the verb list is
4223 static struct hda_channel_mode alc260_modes[1] = {
4228 /* Mixer combinations
4230 * basic: base_output + input + pc_beep + capture
4231 * HP: base_output + input + capture_alt
4232 * HP_3013: hp_3013 + input + capture
4233 * fujitsu: fujitsu + capture
4234 * acer: acer + capture
4237 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4238 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4239 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4241 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4242 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4243 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4247 static struct snd_kcontrol_new alc260_input_mixer[] = {
4248 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4249 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4250 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4251 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4253 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4254 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4259 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
4260 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
4261 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
4265 /* update HP, line and mono out pins according to the master switch */
4266 static void alc260_hp_master_update(struct hda_codec *codec,
4267 hda_nid_t hp, hda_nid_t line,
4270 struct alc_spec *spec = codec->spec;
4271 unsigned int val = spec->master_sw ? PIN_HP : 0;
4272 /* change HP and line-out pins */
4273 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4275 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4277 /* mono (speaker) depending on the HP jack sense */
4278 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4279 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4283 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4284 struct snd_ctl_elem_value *ucontrol)
4286 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4287 struct alc_spec *spec = codec->spec;
4288 *ucontrol->value.integer.value = spec->master_sw;
4292 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4293 struct snd_ctl_elem_value *ucontrol)
4295 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4296 struct alc_spec *spec = codec->spec;
4297 int val = !!*ucontrol->value.integer.value;
4298 hda_nid_t hp, line, mono;
4300 if (val == spec->master_sw)
4302 spec->master_sw = val;
4303 hp = (kcontrol->private_value >> 16) & 0xff;
4304 line = (kcontrol->private_value >> 8) & 0xff;
4305 mono = kcontrol->private_value & 0xff;
4306 alc260_hp_master_update(codec, hp, line, mono);
4310 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4312 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4313 .name = "Master Playback Switch",
4314 .info = snd_ctl_boolean_mono_info,
4315 .get = alc260_hp_master_sw_get,
4316 .put = alc260_hp_master_sw_put,
4317 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4319 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4320 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4321 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4322 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4323 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4325 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4329 static struct hda_verb alc260_hp_unsol_verbs[] = {
4330 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4334 static void alc260_hp_automute(struct hda_codec *codec)
4336 struct alc_spec *spec = codec->spec;
4337 unsigned int present;
4339 present = snd_hda_codec_read(codec, 0x10, 0,
4340 AC_VERB_GET_PIN_SENSE, 0);
4341 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4342 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4345 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4347 if ((res >> 26) == ALC880_HP_EVENT)
4348 alc260_hp_automute(codec);
4351 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4354 .name = "Master Playback Switch",
4355 .info = snd_ctl_boolean_mono_info,
4356 .get = alc260_hp_master_sw_get,
4357 .put = alc260_hp_master_sw_put,
4358 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4360 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4361 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4362 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4363 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4364 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4366 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4367 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4371 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4372 .ops = &snd_hda_bind_vol,
4374 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4375 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4376 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4381 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4382 .ops = &snd_hda_bind_sw,
4384 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4385 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4390 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4391 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4392 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4393 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4398 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4399 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4403 static void alc260_hp_3013_automute(struct hda_codec *codec)
4405 struct alc_spec *spec = codec->spec;
4406 unsigned int present;
4408 present = snd_hda_codec_read(codec, 0x15, 0,
4409 AC_VERB_GET_PIN_SENSE, 0);
4410 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4411 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4414 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4417 if ((res >> 26) == ALC880_HP_EVENT)
4418 alc260_hp_3013_automute(codec);
4421 static void alc260_hp_3012_automute(struct hda_codec *codec)
4423 unsigned int present, bits;
4425 present = snd_hda_codec_read(codec, 0x10, 0,
4426 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4428 bits = present ? 0 : PIN_OUT;
4429 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4431 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4433 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4437 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4440 if ((res >> 26) == ALC880_HP_EVENT)
4441 alc260_hp_3012_automute(codec);
4444 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4445 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4447 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4448 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4449 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4450 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4451 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4452 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4453 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4454 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4455 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4456 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4457 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4459 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4463 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4464 * versions of the ALC260 don't act on requests to enable mic bias from NID
4465 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4466 * datasheet doesn't mention this restriction. At this stage it's not clear
4467 * whether this behaviour is intentional or is a hardware bug in chip
4468 * revisions available in early 2006. Therefore for now allow the
4469 * "Headphone Jack Mode" control to span all choices, but if it turns out
4470 * that the lack of mic bias for this NID is intentional we could change the
4471 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4473 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4474 * don't appear to make the mic bias available from the "line" jack, even
4475 * though the NID used for this jack (0x14) can supply it. The theory is
4476 * that perhaps Acer have included blocking capacitors between the ALC260
4477 * and the output jack. If this turns out to be the case for all such
4478 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4479 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4481 * The C20x Tablet series have a mono internal speaker which is controlled
4482 * via the chip's Mono sum widget and pin complex, so include the necessary
4483 * controls for such models. On models without a "mono speaker" the control
4484 * won't do anything.
4486 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4487 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4488 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4489 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4490 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4492 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4494 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4495 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4497 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4498 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4499 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4500 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4501 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4502 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4503 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4507 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4508 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4510 static struct snd_kcontrol_new alc260_will_mixer[] = {
4511 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4512 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4514 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4515 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4516 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4517 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4518 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4519 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4520 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4521 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4522 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4526 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4527 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4529 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4530 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4531 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4533 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4534 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4535 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4536 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4537 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4538 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4539 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4544 * initialization verbs
4546 static struct hda_verb alc260_init_verbs[] = {
4547 /* Line In pin widget for input */
4548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4549 /* CD pin widget for input */
4550 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4551 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4552 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4553 /* Mic2 (front panel) pin widget for input and vref at 80% */
4554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4555 /* LINE-2 is used for line-out in rear */
4556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4557 /* select line-out */
4558 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4560 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4562 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4564 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4565 /* mute capture amp left and right */
4566 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4567 /* set connection select to line in (default select for this ADC) */
4568 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4569 /* mute capture amp left and right */
4570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4571 /* set connection select to line in (default select for this ADC) */
4572 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4573 /* set vol=0 Line-Out mixer amp left and right */
4574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4575 /* unmute pin widget amp left and right (no gain on this amp) */
4576 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4577 /* set vol=0 HP mixer amp left and right */
4578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4579 /* unmute pin widget amp left and right (no gain on this amp) */
4580 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4581 /* set vol=0 Mono mixer amp left and right */
4582 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4583 /* unmute pin widget amp left and right (no gain on this amp) */
4584 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4585 /* unmute LINE-2 out pin */
4586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4587 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4590 /* mute analog inputs */
4591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4596 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4597 /* mute Front out path */
4598 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4600 /* mute Headphone out path */
4601 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4602 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4603 /* mute Mono out path */
4604 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4605 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4609 #if 0 /* should be identical with alc260_init_verbs? */
4610 static struct hda_verb alc260_hp_init_verbs[] = {
4611 /* Headphone and output */
4612 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4614 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4615 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4616 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4617 /* Mic2 (front panel) pin widget for input and vref at 80% */
4618 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4619 /* Line In pin widget for input */
4620 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4621 /* Line-2 pin widget for output */
4622 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4623 /* CD pin widget for input */
4624 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4625 /* unmute amp left and right */
4626 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4627 /* set connection select to line in (default select for this ADC) */
4628 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4629 /* unmute Line-Out mixer amp left and right (volume = 0) */
4630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4631 /* mute pin widget amp left and right (no gain on this amp) */
4632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4633 /* unmute HP mixer amp left and right (volume = 0) */
4634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4635 /* mute pin widget amp left and right (no gain on this amp) */
4636 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4637 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4640 /* mute analog inputs */
4641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4642 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4646 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4647 /* Unmute Front out path */
4648 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4650 /* Unmute Headphone out path */
4651 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4653 /* Unmute Mono out path */
4654 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4655 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4660 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4661 /* Line out and output */
4662 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4664 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4665 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4666 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4667 /* Mic2 (front panel) pin widget for input and vref at 80% */
4668 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4669 /* Line In pin widget for input */
4670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4671 /* Headphone pin widget for output */
4672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4673 /* CD pin widget for input */
4674 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4675 /* unmute amp left and right */
4676 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4677 /* set connection select to line in (default select for this ADC) */
4678 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4679 /* unmute Line-Out mixer amp left and right (volume = 0) */
4680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4681 /* mute pin widget amp left and right (no gain on this amp) */
4682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4683 /* unmute HP mixer amp left and right (volume = 0) */
4684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4685 /* mute pin widget amp left and right (no gain on this amp) */
4686 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4687 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4690 /* mute analog inputs */
4691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4696 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4697 /* Unmute Front out path */
4698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4700 /* Unmute Headphone out path */
4701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4703 /* Unmute Mono out path */
4704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4709 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4710 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4711 * audio = 0x16, internal speaker = 0x10.
4713 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4714 /* Disable all GPIOs */
4715 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4716 /* Internal speaker is connected to headphone pin */
4717 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4718 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4720 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4721 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4722 /* Ensure all other unused pins are disabled and muted. */
4723 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4724 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4725 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4726 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4727 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4728 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4732 /* Disable digital (SPDIF) pins */
4733 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4734 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4736 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4737 * when acting as an output.
4739 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4741 /* Start with output sum widgets muted and their output gains at min */
4742 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4743 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4744 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4745 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4746 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4747 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4748 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4749 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4750 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4752 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4753 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4754 /* Unmute Line1 pin widget output buffer since it starts as an output.
4755 * If the pin mode is changed by the user the pin mode control will
4756 * take care of enabling the pin's input/output buffers as needed.
4757 * Therefore there's no need to enable the input buffer at this
4760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4761 /* Unmute input buffer of pin widget used for Line-in (no equiv
4764 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4766 /* Mute capture amp left and right */
4767 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4768 /* Set ADC connection select to match default mixer setting - line
4771 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4773 /* Do the same for the second ADC: mute capture input amp and
4774 * set ADC connection to line in (on mic1 pin)
4776 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4777 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4779 /* Mute all inputs to mixer widget (even unconnected ones) */
4780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4792 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4793 * similar laptops (adapted from Fujitsu init verbs).
4795 static struct hda_verb alc260_acer_init_verbs[] = {
4796 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4797 * the headphone jack. Turn this on and rely on the standard mute
4798 * methods whenever the user wants to turn these outputs off.
4800 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4801 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4802 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4803 /* Internal speaker/Headphone jack is connected to Line-out pin */
4804 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4805 /* Internal microphone/Mic jack is connected to Mic1 pin */
4806 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4807 /* Line In jack is connected to Line1 pin */
4808 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4809 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4810 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4811 /* Ensure all other unused pins are disabled and muted. */
4812 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4813 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4814 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4815 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4818 /* Disable digital (SPDIF) pins */
4819 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4820 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4822 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4823 * bus when acting as outputs.
4825 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4826 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4828 /* Start with output sum widgets muted and their output gains at min */
4829 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4830 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4831 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4832 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4833 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4835 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4836 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4837 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4839 /* Unmute Line-out pin widget amp left and right
4840 * (no equiv mixer ctrl)
4842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4843 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4844 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4845 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4846 * inputs. If the pin mode is changed by the user the pin mode control
4847 * will take care of enabling the pin's input/output buffers as needed.
4848 * Therefore there's no need to enable the input buffer at this
4851 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4854 /* Mute capture amp left and right */
4855 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4856 /* Set ADC connection select to match default mixer setting - mic
4859 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4861 /* Do similar with the second ADC: mute capture input amp and
4862 * set ADC connection to mic to match ALSA's default state.
4864 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4865 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4867 /* Mute all inputs to mixer widget (even unconnected ones) */
4868 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4869 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4872 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4873 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4880 static struct hda_verb alc260_will_verbs[] = {
4881 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4882 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4883 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4884 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4885 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4886 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4890 static struct hda_verb alc260_replacer_672v_verbs[] = {
4891 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4892 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4893 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4895 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4896 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4897 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4899 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4903 /* toggle speaker-output according to the hp-jack state */
4904 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4906 unsigned int present;
4908 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4909 present = snd_hda_codec_read(codec, 0x0f, 0,
4910 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4912 snd_hda_codec_write_cache(codec, 0x01, 0,
4913 AC_VERB_SET_GPIO_DATA, 1);
4914 snd_hda_codec_write_cache(codec, 0x0f, 0,
4915 AC_VERB_SET_PIN_WIDGET_CONTROL,
4918 snd_hda_codec_write_cache(codec, 0x01, 0,
4919 AC_VERB_SET_GPIO_DATA, 0);
4920 snd_hda_codec_write_cache(codec, 0x0f, 0,
4921 AC_VERB_SET_PIN_WIDGET_CONTROL,
4926 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4929 if ((res >> 26) == ALC880_HP_EVENT)
4930 alc260_replacer_672v_automute(codec);
4933 static struct hda_verb alc260_hp_dc7600_verbs[] = {
4934 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
4935 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4936 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4937 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4938 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4940 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4941 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4942 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4943 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4947 /* Test configuration for debugging, modelled after the ALC880 test
4950 #ifdef CONFIG_SND_DEBUG
4951 static hda_nid_t alc260_test_dac_nids[1] = {
4954 static hda_nid_t alc260_test_adc_nids[2] = {
4957 /* For testing the ALC260, each input MUX needs its own definition since
4958 * the signal assignments are different. This assumes that the first ADC
4961 static struct hda_input_mux alc260_test_capture_sources[2] = {
4965 { "MIC1 pin", 0x0 },
4966 { "MIC2 pin", 0x1 },
4967 { "LINE1 pin", 0x2 },
4968 { "LINE2 pin", 0x3 },
4970 { "LINE-OUT pin", 0x5 },
4971 { "HP-OUT pin", 0x6 },
4977 { "MIC1 pin", 0x0 },
4978 { "MIC2 pin", 0x1 },
4979 { "LINE1 pin", 0x2 },
4980 { "LINE2 pin", 0x3 },
4983 { "LINE-OUT pin", 0x6 },
4984 { "HP-OUT pin", 0x7 },
4988 static struct snd_kcontrol_new alc260_test_mixer[] = {
4989 /* Output driver widgets */
4990 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4991 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4992 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4993 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4994 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4995 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4997 /* Modes for retasking pin widgets
4998 * Note: the ALC260 doesn't seem to act on requests to enable mic
4999 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5000 * mention this restriction. At this stage it's not clear whether
5001 * this behaviour is intentional or is a hardware bug in chip
5002 * revisions available at least up until early 2006. Therefore for
5003 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5004 * choices, but if it turns out that the lack of mic bias for these
5005 * NIDs is intentional we could change their modes from
5006 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5008 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5009 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5010 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5011 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5012 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5013 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5015 /* Loopback mixer controls */
5016 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5017 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5018 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5019 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5020 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5021 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5022 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5023 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5024 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5025 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5026 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
5027 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
5028 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5029 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5030 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5031 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5033 /* Controls for GPIO pins, assuming they are configured as outputs */
5034 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5035 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5036 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5037 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5039 /* Switches to allow the digital IO pins to be enabled. The datasheet
5040 * is ambigious as to which NID is which; testing on laptops which
5041 * make this output available should provide clarification.
5043 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5044 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5046 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5047 * this output to turn on an external amplifier.
5049 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5050 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5054 static struct hda_verb alc260_test_init_verbs[] = {
5055 /* Enable all GPIOs as outputs with an initial value of 0 */
5056 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5057 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5058 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5060 /* Enable retasking pins as output, initially without power amp */
5061 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5062 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5065 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5066 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5068 /* Disable digital (SPDIF) pins initially, but users can enable
5069 * them via a mixer switch. In the case of SPDIF-out, this initverb
5070 * payload also sets the generation to 0, output to be in "consumer"
5071 * PCM format, copyright asserted, no pre-emphasis and no validity
5074 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5075 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5077 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5078 * OUT1 sum bus when acting as an output.
5080 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5081 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5082 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5083 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5085 /* Start with output sum widgets muted and their output gains at min */
5086 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5087 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5089 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5092 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5093 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5094 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5096 /* Unmute retasking pin widget output buffers since the default
5097 * state appears to be output. As the pin mode is changed by the
5098 * user the pin mode control will take care of enabling the pin's
5099 * input/output buffers as needed.
5101 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5102 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5103 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5105 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5106 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5107 /* Also unmute the mono-out pin widget */
5108 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5110 /* Mute capture amp left and right */
5111 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 /* Set ADC connection select to match default mixer setting (mic1
5115 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5117 /* Do the same for the second ADC: mute capture input amp and
5118 * set ADC connection to mic1 pin
5120 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5121 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5123 /* Mute all inputs to mixer widget (even unconnected ones) */
5124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5137 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5138 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5140 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5141 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5144 * for BIOS auto-configuration
5147 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5148 const char *pfx, int *vol_bits)
5151 unsigned long vol_val, sw_val;
5155 if (nid >= 0x0f && nid < 0x11) {
5156 nid_vol = nid - 0x7;
5157 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5158 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5159 } else if (nid == 0x11) {
5160 nid_vol = nid - 0x7;
5161 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5162 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5163 } else if (nid >= 0x12 && nid <= 0x15) {
5165 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5166 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5170 if (!(*vol_bits & (1 << nid_vol))) {
5171 /* first control for the volume widget */
5172 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5173 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5176 *vol_bits |= (1 << nid_vol);
5178 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5179 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5185 /* add playback controls from the parsed DAC table */
5186 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5187 const struct auto_pin_cfg *cfg)
5193 spec->multiout.num_dacs = 1;
5194 spec->multiout.dac_nids = spec->private_dac_nids;
5195 spec->multiout.dac_nids[0] = 0x02;
5197 nid = cfg->line_out_pins[0];
5199 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5204 nid = cfg->speaker_pins[0];
5206 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5211 nid = cfg->hp_pins[0];
5213 err = alc260_add_playback_controls(spec, nid, "Headphone",
5221 /* create playback/capture controls for input pins */
5222 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5223 const struct auto_pin_cfg *cfg)
5225 struct hda_input_mux *imux = &spec->private_imux;
5228 for (i = 0; i < AUTO_PIN_LAST; i++) {
5229 if (cfg->input_pins[i] >= 0x12) {
5230 idx = cfg->input_pins[i] - 0x12;
5231 err = new_analog_input(spec, cfg->input_pins[i],
5232 auto_pin_cfg_labels[i], idx,
5236 imux->items[imux->num_items].label =
5237 auto_pin_cfg_labels[i];
5238 imux->items[imux->num_items].index = idx;
5241 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5242 idx = cfg->input_pins[i] - 0x09;
5243 err = new_analog_input(spec, cfg->input_pins[i],
5244 auto_pin_cfg_labels[i], idx,
5248 imux->items[imux->num_items].label =
5249 auto_pin_cfg_labels[i];
5250 imux->items[imux->num_items].index = idx;
5257 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5258 hda_nid_t nid, int pin_type,
5261 alc_set_pin_output(codec, nid, pin_type);
5262 /* need the manual connection? */
5264 int idx = nid - 0x12;
5265 snd_hda_codec_write(codec, idx + 0x0b, 0,
5266 AC_VERB_SET_CONNECT_SEL, sel_idx);
5270 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5272 struct alc_spec *spec = codec->spec;
5275 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5276 nid = spec->autocfg.line_out_pins[0];
5278 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5279 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5282 nid = spec->autocfg.speaker_pins[0];
5284 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5286 nid = spec->autocfg.hp_pins[0];
5288 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5291 #define ALC260_PIN_CD_NID 0x16
5292 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5294 struct alc_spec *spec = codec->spec;
5297 for (i = 0; i < AUTO_PIN_LAST; i++) {
5298 hda_nid_t nid = spec->autocfg.input_pins[i];
5300 snd_hda_codec_write(codec, nid, 0,
5301 AC_VERB_SET_PIN_WIDGET_CONTROL,
5302 i <= AUTO_PIN_FRONT_MIC ?
5303 PIN_VREF80 : PIN_IN);
5304 if (nid != ALC260_PIN_CD_NID)
5305 snd_hda_codec_write(codec, nid, 0,
5306 AC_VERB_SET_AMP_GAIN_MUTE,
5313 * generic initialization of ADC, input mixers and output mixers
5315 static struct hda_verb alc260_volume_init_verbs[] = {
5317 * Unmute ADC0-1 and set the default input to mic-in
5319 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5320 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5321 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5322 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5324 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5326 * Note: PASD motherboards uses the Line In 2 as the input for
5327 * front panel mic (mic 2)
5329 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5330 /* mute analog inputs */
5331 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5338 * Set up output mixers (0x08 - 0x0a)
5340 /* set vol=0 to output mixers */
5341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5343 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5344 /* set up input amps for analog loopback */
5345 /* Amp Indices: DAC = 0, mixer = 1 */
5346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5349 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5350 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5351 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5356 static int alc260_parse_auto_config(struct hda_codec *codec)
5358 struct alc_spec *spec = codec->spec;
5360 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5362 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5366 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5369 if (!spec->kctls.list)
5370 return 0; /* can't find valid BIOS pin config */
5371 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5375 spec->multiout.max_channels = 2;
5377 if (spec->autocfg.dig_out_pin)
5378 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5379 if (spec->kctls.list)
5380 add_mixer(spec, spec->kctls.list);
5382 add_verb(spec, alc260_volume_init_verbs);
5384 spec->num_mux_defs = 1;
5385 spec->input_mux = &spec->private_imux;
5387 store_pin_configs(codec);
5391 /* additional initialization for auto-configuration model */
5392 static void alc260_auto_init(struct hda_codec *codec)
5394 struct alc_spec *spec = codec->spec;
5395 alc260_auto_init_multi_out(codec);
5396 alc260_auto_init_analog_input(codec);
5397 if (spec->unsol_event)
5398 alc_inithook(codec);
5401 #ifdef CONFIG_SND_HDA_POWER_SAVE
5402 static struct hda_amp_list alc260_loopbacks[] = {
5403 { 0x07, HDA_INPUT, 0 },
5404 { 0x07, HDA_INPUT, 1 },
5405 { 0x07, HDA_INPUT, 2 },
5406 { 0x07, HDA_INPUT, 3 },
5407 { 0x07, HDA_INPUT, 4 },
5413 * ALC260 configurations
5415 static const char *alc260_models[ALC260_MODEL_LAST] = {
5416 [ALC260_BASIC] = "basic",
5418 [ALC260_HP_3013] = "hp-3013",
5419 [ALC260_HP_DC7600] = "hp-dc7600",
5420 [ALC260_FUJITSU_S702X] = "fujitsu",
5421 [ALC260_ACER] = "acer",
5422 [ALC260_WILL] = "will",
5423 [ALC260_REPLACER_672V] = "replacer",
5424 #ifdef CONFIG_SND_DEBUG
5425 [ALC260_TEST] = "test",
5427 [ALC260_AUTO] = "auto",
5430 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5431 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5432 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5433 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5434 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5435 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5436 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
5437 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
5438 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5439 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5440 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5441 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5442 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5443 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5444 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5445 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5446 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5447 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5448 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5452 static struct alc_config_preset alc260_presets[] = {
5454 .mixers = { alc260_base_output_mixer,
5456 alc260_pc_beep_mixer },
5457 .init_verbs = { alc260_init_verbs },
5458 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5459 .dac_nids = alc260_dac_nids,
5460 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5461 .adc_nids = alc260_adc_nids,
5462 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5463 .channel_mode = alc260_modes,
5464 .input_mux = &alc260_capture_source,
5467 .mixers = { alc260_hp_output_mixer,
5468 alc260_input_mixer },
5469 .init_verbs = { alc260_init_verbs,
5470 alc260_hp_unsol_verbs },
5471 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5472 .dac_nids = alc260_dac_nids,
5473 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5474 .adc_nids = alc260_adc_nids_alt,
5475 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5476 .channel_mode = alc260_modes,
5477 .input_mux = &alc260_capture_source,
5478 .unsol_event = alc260_hp_unsol_event,
5479 .init_hook = alc260_hp_automute,
5481 [ALC260_HP_DC7600] = {
5482 .mixers = { alc260_hp_dc7600_mixer,
5483 alc260_input_mixer },
5484 .init_verbs = { alc260_init_verbs,
5485 alc260_hp_dc7600_verbs },
5486 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5487 .dac_nids = alc260_dac_nids,
5488 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5489 .adc_nids = alc260_adc_nids_alt,
5490 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5491 .channel_mode = alc260_modes,
5492 .input_mux = &alc260_capture_source,
5493 .unsol_event = alc260_hp_3012_unsol_event,
5494 .init_hook = alc260_hp_3012_automute,
5496 [ALC260_HP_3013] = {
5497 .mixers = { alc260_hp_3013_mixer,
5498 alc260_input_mixer },
5499 .init_verbs = { alc260_hp_3013_init_verbs,
5500 alc260_hp_3013_unsol_verbs },
5501 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5502 .dac_nids = alc260_dac_nids,
5503 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
5504 .adc_nids = alc260_adc_nids_alt,
5505 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5506 .channel_mode = alc260_modes,
5507 .input_mux = &alc260_capture_source,
5508 .unsol_event = alc260_hp_3013_unsol_event,
5509 .init_hook = alc260_hp_3013_automute,
5511 [ALC260_FUJITSU_S702X] = {
5512 .mixers = { alc260_fujitsu_mixer },
5513 .init_verbs = { alc260_fujitsu_init_verbs },
5514 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5515 .dac_nids = alc260_dac_nids,
5516 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5517 .adc_nids = alc260_dual_adc_nids,
5518 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5519 .channel_mode = alc260_modes,
5520 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5521 .input_mux = alc260_fujitsu_capture_sources,
5524 .mixers = { alc260_acer_mixer },
5525 .init_verbs = { alc260_acer_init_verbs },
5526 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5527 .dac_nids = alc260_dac_nids,
5528 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5529 .adc_nids = alc260_dual_adc_nids,
5530 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5531 .channel_mode = alc260_modes,
5532 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5533 .input_mux = alc260_acer_capture_sources,
5536 .mixers = { alc260_will_mixer },
5537 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5538 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5539 .dac_nids = alc260_dac_nids,
5540 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5541 .adc_nids = alc260_adc_nids,
5542 .dig_out_nid = ALC260_DIGOUT_NID,
5543 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5544 .channel_mode = alc260_modes,
5545 .input_mux = &alc260_capture_source,
5547 [ALC260_REPLACER_672V] = {
5548 .mixers = { alc260_replacer_672v_mixer },
5549 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5550 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5551 .dac_nids = alc260_dac_nids,
5552 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5553 .adc_nids = alc260_adc_nids,
5554 .dig_out_nid = ALC260_DIGOUT_NID,
5555 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5556 .channel_mode = alc260_modes,
5557 .input_mux = &alc260_capture_source,
5558 .unsol_event = alc260_replacer_672v_unsol_event,
5559 .init_hook = alc260_replacer_672v_automute,
5561 #ifdef CONFIG_SND_DEBUG
5563 .mixers = { alc260_test_mixer },
5564 .init_verbs = { alc260_test_init_verbs },
5565 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5566 .dac_nids = alc260_test_dac_nids,
5567 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5568 .adc_nids = alc260_test_adc_nids,
5569 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5570 .channel_mode = alc260_modes,
5571 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5572 .input_mux = alc260_test_capture_sources,
5577 static int patch_alc260(struct hda_codec *codec)
5579 struct alc_spec *spec;
5580 int err, board_config;
5582 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5588 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5591 if (board_config < 0) {
5592 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5593 "trying auto-probe from BIOS...\n");
5594 board_config = ALC260_AUTO;
5597 if (board_config == ALC260_AUTO) {
5598 /* automatic parse from the BIOS config */
5599 err = alc260_parse_auto_config(codec);
5605 "hda_codec: Cannot set up configuration "
5606 "from BIOS. Using base mode...\n");
5607 board_config = ALC260_BASIC;
5611 if (board_config != ALC260_AUTO)
5612 setup_preset(spec, &alc260_presets[board_config]);
5614 spec->stream_name_analog = "ALC260 Analog";
5615 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5616 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5618 spec->stream_name_digital = "ALC260 Digital";
5619 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5620 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5622 if (!spec->adc_nids && spec->input_mux) {
5623 /* check whether NID 0x04 is valid */
5624 unsigned int wcap = get_wcaps(codec, 0x04);
5625 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5627 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5628 spec->adc_nids = alc260_adc_nids_alt;
5629 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5631 spec->adc_nids = alc260_adc_nids;
5632 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5635 set_capture_mixer(spec);
5637 spec->vmaster_nid = 0x08;
5639 codec->patch_ops = alc_patch_ops;
5640 if (board_config == ALC260_AUTO)
5641 spec->init_hook = alc260_auto_init;
5642 #ifdef CONFIG_SND_HDA_POWER_SAVE
5643 if (!spec->loopback.amplist)
5644 spec->loopback.amplist = alc260_loopbacks;
5654 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5655 * configuration. Each pin widget can choose any input DACs and a mixer.
5656 * Each ADC is connected from a mixer of all inputs. This makes possible
5657 * 6-channel independent captures.
5659 * In addition, an independent DAC for the multi-playback (not used in this
5662 #define ALC882_DIGOUT_NID 0x06
5663 #define ALC882_DIGIN_NID 0x0a
5665 static struct hda_channel_mode alc882_ch_modes[1] = {
5669 static hda_nid_t alc882_dac_nids[4] = {
5670 /* front, rear, clfe, rear_surr */
5671 0x02, 0x03, 0x04, 0x05
5674 /* identical with ALC880 */
5675 #define alc882_adc_nids alc880_adc_nids
5676 #define alc882_adc_nids_alt alc880_adc_nids_alt
5678 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5679 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5682 /* FIXME: should be a matrix-type input source selection */
5684 static struct hda_input_mux alc882_capture_source = {
5688 { "Front Mic", 0x1 },
5696 static struct hda_verb alc882_3ST_ch2_init[] = {
5697 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5698 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5699 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5700 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5707 static struct hda_verb alc882_3ST_ch6_init[] = {
5708 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5709 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5710 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5711 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5712 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5713 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5717 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5718 { 2, alc882_3ST_ch2_init },
5719 { 6, alc882_3ST_ch6_init },
5725 static struct hda_verb alc882_sixstack_ch6_init[] = {
5726 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5727 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5728 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5729 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5736 static struct hda_verb alc882_sixstack_ch8_init[] = {
5737 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5738 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5739 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5740 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5744 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5745 { 6, alc882_sixstack_ch6_init },
5746 { 8, alc882_sixstack_ch8_init },
5750 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5756 static struct hda_verb alc885_mbp_ch2_init[] = {
5757 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5758 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5766 static struct hda_verb alc885_mbp_ch6_init[] = {
5767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5768 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5769 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5770 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5771 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5775 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5776 { 2, alc885_mbp_ch2_init },
5777 { 6, alc885_mbp_ch6_init },
5781 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5782 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5784 static struct snd_kcontrol_new alc882_base_mixer[] = {
5785 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5786 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5787 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5788 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5789 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5790 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5791 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5792 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5793 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5794 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5796 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5797 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5801 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5802 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5803 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5804 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5806 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5807 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5811 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5812 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5813 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5814 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5815 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5817 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5819 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5820 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5821 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5824 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5827 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5828 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5829 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5830 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5832 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5834 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5835 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5839 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5840 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5841 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5850 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5851 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5852 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5856 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5857 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5859 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5860 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5861 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5862 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5863 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5864 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5865 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5866 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5867 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5868 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5869 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5872 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5876 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5880 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5881 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5882 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5883 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5885 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5887 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5888 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5892 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5895 .name = "Channel Mode",
5896 .info = alc_ch_mode_info,
5897 .get = alc_ch_mode_get,
5898 .put = alc_ch_mode_put,
5903 static struct hda_verb alc882_init_verbs[] = {
5904 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5905 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5906 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5911 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5913 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5918 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5919 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5921 /* Front Pin: output 0 (0x0c) */
5922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5925 /* Rear Pin: output 1 (0x0d) */
5926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5928 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5929 /* CLFE Pin: output 2 (0x0e) */
5930 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5932 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5933 /* Side Pin: output 3 (0x0f) */
5934 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5935 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5936 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5937 /* Mic (rear) pin: input vref at 80% */
5938 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5940 /* Front Mic pin: input vref at 80% */
5941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5943 /* Line In pin: input */
5944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5946 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5947 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5949 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5950 /* CD pin widget for input */
5951 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5953 /* FIXME: use matrix-type input source selection */
5954 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5955 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5957 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5958 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5959 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5970 /* ADC1: mute amp left and right */
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5972 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5973 /* ADC2: mute amp left and right */
5974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5975 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5976 /* ADC3: mute amp left and right */
5977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5978 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5983 static struct hda_verb alc882_eapd_verbs[] = {
5984 /* change to EAPD mode */
5985 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5986 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5991 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5992 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5993 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5997 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5998 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6002 static struct hda_verb alc882_macpro_init_verbs[] = {
6003 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6007 /* Front Pin: output 0 (0x0c) */
6008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6010 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6011 /* Front Mic pin: input vref at 80% */
6012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6014 /* Speaker: output */
6015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6016 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6017 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6018 /* Headphone output (output 0 - 0x0c) */
6019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6021 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6023 /* FIXME: use matrix-type input source selection */
6024 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6025 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6040 /* ADC1: mute amp left and right */
6041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6042 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6043 /* ADC2: mute amp left and right */
6044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6045 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6046 /* ADC3: mute amp left and right */
6047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6053 /* Macbook Pro rev3 */
6054 static struct hda_verb alc885_mbp3_init_verbs[] = {
6055 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6060 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6063 /* Front Pin: output 0 (0x0c) */
6064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6066 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6067 /* HP Pin: output 0 (0x0d) */
6068 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6070 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6072 /* Mic (rear) pin: input vref at 80% */
6073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6075 /* Front Mic pin: input vref at 80% */
6076 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6078 /* Line In pin: use output 1 when in LineOut mode */
6079 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6080 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6081 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6083 /* FIXME: use matrix-type input source selection */
6084 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6085 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6100 /* ADC1: mute amp left and right */
6101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6102 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6103 /* ADC2: mute amp left and right */
6104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6105 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6106 /* ADC3: mute amp left and right */
6107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6108 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6113 /* iMac 24 mixer. */
6114 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6115 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6116 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6120 /* iMac 24 init verbs. */
6121 static struct hda_verb alc885_imac24_init_verbs[] = {
6122 /* Internal speakers: output 0 (0x0c) */
6123 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6125 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6126 /* Internal speakers: output 0 (0x0c) */
6127 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6128 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6129 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6130 /* Headphone: output 0 (0x0c) */
6131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6132 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6134 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6135 /* Front Mic: input vref at 80% */
6136 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6141 /* Toggle speaker-output according to the hp-jack state */
6142 static void alc885_imac24_automute(struct hda_codec *codec)
6144 unsigned int present;
6146 present = snd_hda_codec_read(codec, 0x14, 0,
6147 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6148 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6149 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6150 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6151 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6154 /* Processes unsolicited events. */
6155 static void alc885_imac24_unsol_event(struct hda_codec *codec,
6158 /* Headphone insertion or removal. */
6159 if ((res >> 26) == ALC880_HP_EVENT)
6160 alc885_imac24_automute(codec);
6163 static void alc885_mbp3_automute(struct hda_codec *codec)
6165 unsigned int present;
6167 present = snd_hda_codec_read(codec, 0x15, 0,
6168 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6169 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6170 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6171 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6172 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6175 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
6178 /* Headphone insertion or removal. */
6179 if ((res >> 26) == ALC880_HP_EVENT)
6180 alc885_mbp3_automute(codec);
6184 static struct hda_verb alc882_targa_verbs[] = {
6185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6191 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6192 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6193 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6195 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6196 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6197 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6198 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6202 /* toggle speaker-output according to the hp-jack state */
6203 static void alc882_targa_automute(struct hda_codec *codec)
6205 unsigned int present;
6207 present = snd_hda_codec_read(codec, 0x14, 0,
6208 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6209 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6210 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6211 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6215 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6217 /* Looks like the unsol event is incompatible with the standard
6218 * definition. 4bit tag is placed at 26 bit!
6220 if (((res >> 26) == ALC880_HP_EVENT)) {
6221 alc882_targa_automute(codec);
6225 static struct hda_verb alc882_asus_a7j_verbs[] = {
6226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6229 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6231 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6233 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6234 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6235 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6237 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6238 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6239 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6243 static struct hda_verb alc882_asus_a7m_verbs[] = {
6244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6249 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6251 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6252 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6253 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6255 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6256 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6257 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6261 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6263 unsigned int gpiostate, gpiomask, gpiodir;
6265 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6266 AC_VERB_GET_GPIO_DATA, 0);
6269 gpiostate |= (1 << pin);
6271 gpiostate &= ~(1 << pin);
6273 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6274 AC_VERB_GET_GPIO_MASK, 0);
6275 gpiomask |= (1 << pin);
6277 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6278 AC_VERB_GET_GPIO_DIRECTION, 0);
6279 gpiodir |= (1 << pin);
6282 snd_hda_codec_write(codec, codec->afg, 0,
6283 AC_VERB_SET_GPIO_MASK, gpiomask);
6284 snd_hda_codec_write(codec, codec->afg, 0,
6285 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6289 snd_hda_codec_write(codec, codec->afg, 0,
6290 AC_VERB_SET_GPIO_DATA, gpiostate);
6293 /* set up GPIO at initialization */
6294 static void alc885_macpro_init_hook(struct hda_codec *codec)
6296 alc882_gpio_mute(codec, 0, 0);
6297 alc882_gpio_mute(codec, 1, 0);
6300 /* set up GPIO and update auto-muting at initialization */
6301 static void alc885_imac24_init_hook(struct hda_codec *codec)
6303 alc885_macpro_init_hook(codec);
6304 alc885_imac24_automute(codec);
6308 * generic initialization of ADC, input mixers and output mixers
6310 static struct hda_verb alc882_auto_init_verbs[] = {
6312 * Unmute ADC0-2 and set the default input to mic-in
6314 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6316 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6317 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6318 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6321 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6323 * Note: PASD motherboards uses the Line In 2 as the input for
6324 * front panel mic (mic 2)
6326 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6334 * Set up output mixers (0x0c - 0x0f)
6336 /* set vol=0 to output mixers */
6337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6341 /* set up input amps for analog loopback */
6342 /* Amp Indices: DAC = 0, mixer = 1 */
6343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6345 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6351 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6352 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6354 /* FIXME: use matrix-type input source selection */
6355 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6356 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6375 #ifdef CONFIG_SND_HDA_POWER_SAVE
6376 #define alc882_loopbacks alc880_loopbacks
6379 /* pcm configuration: identiacal with ALC880 */
6380 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6381 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6382 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6383 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6386 * configuration and preset
6388 static const char *alc882_models[ALC882_MODEL_LAST] = {
6389 [ALC882_3ST_DIG] = "3stack-dig",
6390 [ALC882_6ST_DIG] = "6stack-dig",
6391 [ALC882_ARIMA] = "arima",
6392 [ALC882_W2JC] = "w2jc",
6393 [ALC882_TARGA] = "targa",
6394 [ALC882_ASUS_A7J] = "asus-a7j",
6395 [ALC882_ASUS_A7M] = "asus-a7m",
6396 [ALC885_MACPRO] = "macpro",
6397 [ALC885_MBP3] = "mbp3",
6398 [ALC885_IMAC24] = "imac24",
6399 [ALC882_AUTO] = "auto",
6402 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6403 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6404 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6405 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6406 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6407 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6408 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6409 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6410 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6411 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6412 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6413 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6414 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6418 static struct alc_config_preset alc882_presets[] = {
6419 [ALC882_3ST_DIG] = {
6420 .mixers = { alc882_base_mixer },
6421 .init_verbs = { alc882_init_verbs },
6422 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6423 .dac_nids = alc882_dac_nids,
6424 .dig_out_nid = ALC882_DIGOUT_NID,
6425 .dig_in_nid = ALC882_DIGIN_NID,
6426 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6427 .channel_mode = alc882_ch_modes,
6429 .input_mux = &alc882_capture_source,
6431 [ALC882_6ST_DIG] = {
6432 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6433 .init_verbs = { alc882_init_verbs },
6434 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6435 .dac_nids = alc882_dac_nids,
6436 .dig_out_nid = ALC882_DIGOUT_NID,
6437 .dig_in_nid = ALC882_DIGIN_NID,
6438 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6439 .channel_mode = alc882_sixstack_modes,
6440 .input_mux = &alc882_capture_source,
6443 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6444 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6445 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6446 .dac_nids = alc882_dac_nids,
6447 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6448 .channel_mode = alc882_sixstack_modes,
6449 .input_mux = &alc882_capture_source,
6452 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6453 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6454 alc880_gpio1_init_verbs },
6455 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6456 .dac_nids = alc882_dac_nids,
6457 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6458 .channel_mode = alc880_threestack_modes,
6460 .input_mux = &alc882_capture_source,
6461 .dig_out_nid = ALC882_DIGOUT_NID,
6464 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6465 .init_verbs = { alc885_mbp3_init_verbs,
6466 alc880_gpio1_init_verbs },
6467 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6468 .dac_nids = alc882_dac_nids,
6469 .channel_mode = alc885_mbp_6ch_modes,
6470 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6471 .input_mux = &alc882_capture_source,
6472 .dig_out_nid = ALC882_DIGOUT_NID,
6473 .dig_in_nid = ALC882_DIGIN_NID,
6474 .unsol_event = alc885_mbp3_unsol_event,
6475 .init_hook = alc885_mbp3_automute,
6478 .mixers = { alc882_macpro_mixer },
6479 .init_verbs = { alc882_macpro_init_verbs },
6480 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6481 .dac_nids = alc882_dac_nids,
6482 .dig_out_nid = ALC882_DIGOUT_NID,
6483 .dig_in_nid = ALC882_DIGIN_NID,
6484 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6485 .channel_mode = alc882_ch_modes,
6486 .input_mux = &alc882_capture_source,
6487 .init_hook = alc885_macpro_init_hook,
6490 .mixers = { alc885_imac24_mixer },
6491 .init_verbs = { alc885_imac24_init_verbs },
6492 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6493 .dac_nids = alc882_dac_nids,
6494 .dig_out_nid = ALC882_DIGOUT_NID,
6495 .dig_in_nid = ALC882_DIGIN_NID,
6496 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6497 .channel_mode = alc882_ch_modes,
6498 .input_mux = &alc882_capture_source,
6499 .unsol_event = alc885_imac24_unsol_event,
6500 .init_hook = alc885_imac24_init_hook,
6503 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
6504 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6505 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6506 .dac_nids = alc882_dac_nids,
6507 .dig_out_nid = ALC882_DIGOUT_NID,
6508 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6509 .adc_nids = alc882_adc_nids,
6510 .capsrc_nids = alc882_capsrc_nids,
6511 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6512 .channel_mode = alc882_3ST_6ch_modes,
6514 .input_mux = &alc882_capture_source,
6515 .unsol_event = alc882_targa_unsol_event,
6516 .init_hook = alc882_targa_automute,
6518 [ALC882_ASUS_A7J] = {
6519 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
6520 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6521 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6522 .dac_nids = alc882_dac_nids,
6523 .dig_out_nid = ALC882_DIGOUT_NID,
6524 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6525 .adc_nids = alc882_adc_nids,
6526 .capsrc_nids = alc882_capsrc_nids,
6527 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6528 .channel_mode = alc882_3ST_6ch_modes,
6530 .input_mux = &alc882_capture_source,
6532 [ALC882_ASUS_A7M] = {
6533 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6534 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6535 alc880_gpio1_init_verbs,
6536 alc882_asus_a7m_verbs },
6537 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6538 .dac_nids = alc882_dac_nids,
6539 .dig_out_nid = ALC882_DIGOUT_NID,
6540 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6541 .channel_mode = alc880_threestack_modes,
6543 .input_mux = &alc882_capture_source,
6552 PINFIX_ABIT_AW9D_MAX
6555 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6556 { 0x15, 0x01080104 }, /* side */
6557 { 0x16, 0x01011012 }, /* rear */
6558 { 0x17, 0x01016011 }, /* clfe */
6562 static const struct alc_pincfg *alc882_pin_fixes[] = {
6563 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6566 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6567 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6572 * BIOS auto configuration
6574 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6575 hda_nid_t nid, int pin_type,
6579 struct alc_spec *spec = codec->spec;
6582 alc_set_pin_output(codec, nid, pin_type);
6583 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6586 idx = spec->multiout.dac_nids[dac_idx] - 2;
6587 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6591 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6593 struct alc_spec *spec = codec->spec;
6596 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6597 for (i = 0; i <= HDA_SIDE; i++) {
6598 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6599 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6601 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6606 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6608 struct alc_spec *spec = codec->spec;
6611 pin = spec->autocfg.hp_pins[0];
6612 if (pin) /* connect to front */
6614 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6615 pin = spec->autocfg.speaker_pins[0];
6617 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6620 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6621 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6623 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6625 struct alc_spec *spec = codec->spec;
6628 for (i = 0; i < AUTO_PIN_LAST; i++) {
6629 hda_nid_t nid = spec->autocfg.input_pins[i];
6634 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6635 unsigned int pincap;
6636 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
6637 if ((pincap >> AC_PINCAP_VREF_SHIFT) &
6641 snd_hda_codec_write(codec, nid, 0,
6642 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6643 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6644 snd_hda_codec_write(codec, nid, 0,
6645 AC_VERB_SET_AMP_GAIN_MUTE,
6650 static void alc882_auto_init_input_src(struct hda_codec *codec)
6652 struct alc_spec *spec = codec->spec;
6653 const struct hda_input_mux *imux = spec->input_mux;
6656 for (c = 0; c < spec->num_adc_nids; c++) {
6657 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
6658 hda_nid_t nid = spec->capsrc_nids[c];
6659 int conns, mute, idx, item;
6661 conns = snd_hda_get_connections(codec, nid, conn_list,
6662 ARRAY_SIZE(conn_list));
6665 for (idx = 0; idx < conns; idx++) {
6666 /* if the current connection is the selected one,
6667 * unmute it as default - otherwise mute it
6669 mute = AMP_IN_MUTE(idx);
6670 for (item = 0; item < imux->num_items; item++) {
6671 if (imux->items[item].index == idx) {
6672 if (spec->cur_mux[c] == item)
6673 mute = AMP_IN_UNMUTE(idx);
6677 snd_hda_codec_write(codec, nid, 0,
6678 AC_VERB_SET_AMP_GAIN_MUTE, mute);
6683 /* add mic boosts if needed */
6684 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6686 struct alc_spec *spec = codec->spec;
6690 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6691 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6692 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6694 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6698 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6699 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6700 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6702 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6709 /* almost identical with ALC880 parser... */
6710 static int alc882_parse_auto_config(struct hda_codec *codec)
6712 struct alc_spec *spec = codec->spec;
6713 int err = alc880_parse_auto_config(codec);
6718 return 0; /* no config found */
6720 err = alc_auto_add_mic_boost(codec);
6724 /* hack - override the init verbs */
6725 spec->init_verbs[0] = alc882_auto_init_verbs;
6727 return 1; /* config found */
6730 /* additional initialization for auto-configuration model */
6731 static void alc882_auto_init(struct hda_codec *codec)
6733 struct alc_spec *spec = codec->spec;
6734 alc882_auto_init_multi_out(codec);
6735 alc882_auto_init_hp_out(codec);
6736 alc882_auto_init_analog_input(codec);
6737 alc882_auto_init_input_src(codec);
6738 if (spec->unsol_event)
6739 alc_inithook(codec);
6742 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6744 static int patch_alc882(struct hda_codec *codec)
6746 struct alc_spec *spec;
6747 int err, board_config;
6749 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6755 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6759 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6760 /* Pick up systems that don't supply PCI SSID */
6761 switch (codec->subsystem_id) {
6762 case 0x106b0c00: /* Mac Pro */
6763 board_config = ALC885_MACPRO;
6765 case 0x106b1000: /* iMac 24 */
6766 case 0x106b2800: /* AppleTV */
6767 board_config = ALC885_IMAC24;
6769 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6770 case 0x106b00a4: /* MacbookPro4,1 */
6771 case 0x106b2c00: /* Macbook Pro rev3 */
6772 case 0x106b3600: /* Macbook 3.1 */
6773 board_config = ALC885_MBP3;
6776 /* ALC889A is handled better as ALC888-compatible */
6777 if (codec->revision_id == 0x100101 ||
6778 codec->revision_id == 0x100103) {
6780 return patch_alc883(codec);
6782 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6783 "trying auto-probe from BIOS...\n");
6784 board_config = ALC882_AUTO;
6788 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6790 if (board_config == ALC882_AUTO) {
6791 /* automatic parse from the BIOS config */
6792 err = alc882_parse_auto_config(codec);
6798 "hda_codec: Cannot set up configuration "
6799 "from BIOS. Using base mode...\n");
6800 board_config = ALC882_3ST_DIG;
6804 if (board_config != ALC882_AUTO)
6805 setup_preset(spec, &alc882_presets[board_config]);
6807 if (codec->vendor_id == 0x10ec0885) {
6808 spec->stream_name_analog = "ALC885 Analog";
6809 spec->stream_name_digital = "ALC885 Digital";
6811 spec->stream_name_analog = "ALC882 Analog";
6812 spec->stream_name_digital = "ALC882 Digital";
6815 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6816 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6817 /* FIXME: setup DAC5 */
6818 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6819 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6821 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6822 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6824 spec->is_mix_capture = 1; /* matrix-style capture */
6825 if (!spec->adc_nids && spec->input_mux) {
6826 /* check whether NID 0x07 is valid */
6827 unsigned int wcap = get_wcaps(codec, 0x07);
6829 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6830 if (wcap != AC_WID_AUD_IN) {
6831 spec->adc_nids = alc882_adc_nids_alt;
6832 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6833 spec->capsrc_nids = alc882_capsrc_nids_alt;
6835 spec->adc_nids = alc882_adc_nids;
6836 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6837 spec->capsrc_nids = alc882_capsrc_nids;
6840 set_capture_mixer(spec);
6842 spec->vmaster_nid = 0x0c;
6844 codec->patch_ops = alc_patch_ops;
6845 if (board_config == ALC882_AUTO)
6846 spec->init_hook = alc882_auto_init;
6847 #ifdef CONFIG_SND_HDA_POWER_SAVE
6848 if (!spec->loopback.amplist)
6849 spec->loopback.amplist = alc882_loopbacks;
6858 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6859 * configuration. Each pin widget can choose any input DACs and a mixer.
6860 * Each ADC is connected from a mixer of all inputs. This makes possible
6861 * 6-channel independent captures.
6863 * In addition, an independent DAC for the multi-playback (not used in this
6866 #define ALC883_DIGOUT_NID 0x06
6867 #define ALC883_DIGIN_NID 0x0a
6869 static hda_nid_t alc883_dac_nids[4] = {
6870 /* front, rear, clfe, rear_surr */
6871 0x02, 0x03, 0x04, 0x05
6874 static hda_nid_t alc883_adc_nids[2] = {
6879 static hda_nid_t alc883_adc_nids_alt[1] = {
6884 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6887 /* FIXME: should be a matrix-type input source selection */
6889 static struct hda_input_mux alc883_capture_source = {
6893 { "Front Mic", 0x1 },
6899 static struct hda_input_mux alc883_3stack_6ch_intel = {
6903 { "Front Mic", 0x0 },
6909 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6917 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6927 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6935 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6939 { "Front Mic", 0x1 },
6944 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6955 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6962 static struct hda_verb alc883_3ST_ch2_init[] = {
6963 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6964 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6965 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6966 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6973 static struct hda_verb alc883_3ST_ch4_init[] = {
6974 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6975 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6976 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6977 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6978 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6985 static struct hda_verb alc883_3ST_ch6_init[] = {
6986 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6987 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6988 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6989 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6991 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6995 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6996 { 2, alc883_3ST_ch2_init },
6997 { 4, alc883_3ST_ch4_init },
6998 { 6, alc883_3ST_ch6_init },
7004 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7005 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7006 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7007 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7008 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7015 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7016 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7017 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7018 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7020 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7027 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7028 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7029 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7030 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7033 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7037 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7038 { 2, alc883_3ST_ch2_intel_init },
7039 { 4, alc883_3ST_ch4_intel_init },
7040 { 6, alc883_3ST_ch6_intel_init },
7046 static struct hda_verb alc883_sixstack_ch6_init[] = {
7047 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7048 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7049 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7057 static struct hda_verb alc883_sixstack_ch8_init[] = {
7058 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7059 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7060 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7061 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7065 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7066 { 6, alc883_sixstack_ch6_init },
7067 { 8, alc883_sixstack_ch8_init },
7070 static struct hda_verb alc883_medion_eapd_verbs[] = {
7071 /* eanable EAPD on medion laptop */
7072 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7073 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7077 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7078 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7081 static struct snd_kcontrol_new alc883_base_mixer[] = {
7082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7084 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7085 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7086 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7087 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7088 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7089 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7090 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7091 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7103 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7104 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7108 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7110 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7111 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7112 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7113 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7114 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7118 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7125 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7127 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7128 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7129 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7133 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7134 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7135 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7139 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7140 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7141 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7143 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7149 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7153 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7155 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7157 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7158 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7159 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7160 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7162 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7165 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7166 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7167 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7168 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7172 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7174 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7176 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7177 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7178 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7179 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7180 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7182 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7183 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7186 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7192 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7193 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7197 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7207 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7208 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7209 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7218 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7219 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7223 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7227 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7228 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7229 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7230 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7231 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7240 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7241 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7242 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7243 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
7244 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
7248 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7251 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7252 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7253 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7254 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7255 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7256 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7257 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7258 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7259 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7263 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7268 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7271 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7272 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7273 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7277 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7278 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7279 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7283 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7284 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7285 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7286 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7287 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7288 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7290 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7295 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7296 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7297 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7299 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7300 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7303 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7304 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7308 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7311 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7316 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7317 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7321 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7322 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7323 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7333 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7334 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7335 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7336 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7337 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7338 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7339 0x0d, 1, 0x0, HDA_OUTPUT),
7340 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7341 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7342 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7343 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7344 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7345 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7346 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7355 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7360 static struct hda_bind_ctls alc883_bind_cap_vol = {
7361 .ops = &snd_hda_bind_vol,
7363 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7364 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7369 static struct hda_bind_ctls alc883_bind_cap_switch = {
7370 .ops = &snd_hda_bind_sw,
7372 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7373 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7378 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7379 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7380 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7385 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7390 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7391 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7392 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7395 /* .name = "Capture Source", */
7396 .name = "Input Source",
7398 .info = alc_mux_enum_info,
7399 .get = alc_mux_enum_get,
7400 .put = alc_mux_enum_put,
7405 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7408 .name = "Channel Mode",
7409 .info = alc_ch_mode_info,
7410 .get = alc_ch_mode_get,
7411 .put = alc_ch_mode_put,
7416 static struct hda_verb alc883_init_verbs[] = {
7417 /* ADC1: mute amp left and right */
7418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7419 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7420 /* ADC2: mute amp left and right */
7421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7422 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7423 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7433 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7436 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7437 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7440 /* mute analog input loopbacks */
7441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7447 /* Front Pin: output 0 (0x0c) */
7448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7450 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7451 /* Rear Pin: output 1 (0x0d) */
7452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7453 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7454 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7455 /* CLFE Pin: output 2 (0x0e) */
7456 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7457 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7458 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7459 /* Side Pin: output 3 (0x0f) */
7460 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7461 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7462 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7463 /* Mic (rear) pin: input vref at 80% */
7464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7466 /* Front Mic pin: input vref at 80% */
7467 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7469 /* Line In pin: input */
7470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7472 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7474 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7475 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7476 /* CD pin widget for input */
7477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7479 /* FIXME: use matrix-type input source selection */
7480 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7494 /* toggle speaker-output according to the hp-jack state */
7495 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7497 unsigned int present;
7499 present = snd_hda_codec_read(codec, 0x15, 0,
7500 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7501 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7502 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7503 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7504 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7507 /* auto-toggle front mic */
7509 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7511 unsigned int present;
7514 present = snd_hda_codec_read(codec, 0x18, 0,
7515 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7516 bits = present ? HDA_AMP_MUTE : 0;
7517 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7521 static void alc883_mitac_automute(struct hda_codec *codec)
7523 alc883_mitac_hp_automute(codec);
7524 /* alc883_mitac_mic_automute(codec); */
7527 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7530 switch (res >> 26) {
7531 case ALC880_HP_EVENT:
7532 alc883_mitac_hp_automute(codec);
7534 case ALC880_MIC_EVENT:
7535 /* alc883_mitac_mic_automute(codec); */
7540 static struct hda_verb alc883_mitac_verbs[] = {
7542 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7545 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7546 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7548 /* enable unsolicited event */
7549 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7550 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7555 static struct hda_verb alc883_clevo_m720_verbs[] = {
7557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7560 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7563 /* enable unsolicited event */
7564 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7565 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7570 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7572 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7575 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7578 /* enable unsolicited event */
7579 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7584 static struct hda_verb alc883_tagra_verbs[] = {
7585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7589 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7591 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7592 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7593 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7595 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7596 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7597 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7598 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7603 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7605 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7606 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7610 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7613 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7618 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7623 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7627 static struct hda_verb alc883_haier_w66_verbs[] = {
7628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7631 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7633 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7635 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7640 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7646 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7647 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7648 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7652 static struct hda_verb alc888_3st_hp_verbs[] = {
7653 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7654 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7655 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7659 static struct hda_verb alc888_6st_dell_verbs[] = {
7660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7664 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7665 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7666 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7667 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7668 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7672 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7673 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7674 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7675 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7676 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7680 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7681 { 2, alc888_3st_hp_2ch_init },
7682 { 6, alc888_3st_hp_6ch_init },
7685 /* toggle front-jack and RCA according to the hp-jack state */
7686 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7688 unsigned int present;
7690 present = snd_hda_codec_read(codec, 0x1b, 0,
7691 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7692 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7693 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7694 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7695 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7698 /* toggle RCA according to the front-jack state */
7699 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7701 unsigned int present;
7703 present = snd_hda_codec_read(codec, 0x14, 0,
7704 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7705 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7706 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7709 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7712 if ((res >> 26) == ALC880_HP_EVENT)
7713 alc888_lenovo_ms7195_front_automute(codec);
7714 if ((res >> 26) == ALC880_FRONT_EVENT)
7715 alc888_lenovo_ms7195_rca_automute(codec);
7718 static struct hda_verb alc883_medion_md2_verbs[] = {
7719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7724 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7728 /* toggle speaker-output according to the hp-jack state */
7729 static void alc883_medion_md2_automute(struct hda_codec *codec)
7731 unsigned int present;
7733 present = snd_hda_codec_read(codec, 0x14, 0,
7734 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7735 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7736 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7739 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7742 if ((res >> 26) == ALC880_HP_EVENT)
7743 alc883_medion_md2_automute(codec);
7746 /* toggle speaker-output according to the hp-jack state */
7747 static void alc883_tagra_automute(struct hda_codec *codec)
7749 unsigned int present;
7752 present = snd_hda_codec_read(codec, 0x14, 0,
7753 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7754 bits = present ? HDA_AMP_MUTE : 0;
7755 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7756 HDA_AMP_MUTE, bits);
7757 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7761 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7763 if ((res >> 26) == ALC880_HP_EVENT)
7764 alc883_tagra_automute(codec);
7767 /* toggle speaker-output according to the hp-jack state */
7768 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7770 unsigned int present;
7773 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7774 & AC_PINSENSE_PRESENCE;
7775 bits = present ? HDA_AMP_MUTE : 0;
7776 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7777 HDA_AMP_MUTE, bits);
7780 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7782 unsigned int present;
7784 present = snd_hda_codec_read(codec, 0x18, 0,
7785 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7786 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7787 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7790 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7792 alc883_clevo_m720_hp_automute(codec);
7793 alc883_clevo_m720_mic_automute(codec);
7796 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7799 switch (res >> 26) {
7800 case ALC880_HP_EVENT:
7801 alc883_clevo_m720_hp_automute(codec);
7803 case ALC880_MIC_EVENT:
7804 alc883_clevo_m720_mic_automute(codec);
7809 /* toggle speaker-output according to the hp-jack state */
7810 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7812 unsigned int present;
7815 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7816 & AC_PINSENSE_PRESENCE;
7817 bits = present ? HDA_AMP_MUTE : 0;
7818 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7819 HDA_AMP_MUTE, bits);
7822 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7825 if ((res >> 26) == ALC880_HP_EVENT)
7826 alc883_2ch_fujitsu_pi2515_automute(codec);
7829 static void alc883_haier_w66_automute(struct hda_codec *codec)
7831 unsigned int present;
7834 present = snd_hda_codec_read(codec, 0x1b, 0,
7835 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7836 bits = present ? 0x80 : 0;
7837 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7841 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7844 if ((res >> 26) == ALC880_HP_EVENT)
7845 alc883_haier_w66_automute(codec);
7848 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7850 unsigned int present;
7853 present = snd_hda_codec_read(codec, 0x14, 0,
7854 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7855 bits = present ? HDA_AMP_MUTE : 0;
7856 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7857 HDA_AMP_MUTE, bits);
7860 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7862 unsigned int present;
7865 present = snd_hda_codec_read(codec, 0x1b, 0,
7866 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7867 bits = present ? HDA_AMP_MUTE : 0;
7868 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7869 HDA_AMP_MUTE, bits);
7870 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7871 HDA_AMP_MUTE, bits);
7874 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7877 if ((res >> 26) == ALC880_HP_EVENT)
7878 alc883_lenovo_101e_all_automute(codec);
7879 if ((res >> 26) == ALC880_FRONT_EVENT)
7880 alc883_lenovo_101e_ispeaker_automute(codec);
7883 /* toggle speaker-output according to the hp-jack state */
7884 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7886 unsigned int present;
7888 present = snd_hda_codec_read(codec, 0x14, 0,
7889 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7890 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7891 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7892 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7893 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7896 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7899 if ((res >> 26) == ALC880_HP_EVENT)
7900 alc883_acer_aspire_automute(codec);
7903 static struct hda_verb alc883_acer_eapd_verbs[] = {
7904 /* HP Pin: output 0 (0x0c) */
7905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7906 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7907 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7908 /* Front Pin: output 0 (0x0c) */
7909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7910 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7911 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7912 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 /* eanable EAPD on medion laptop */
7914 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7915 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7916 /* enable unsolicited event */
7917 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7921 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7923 unsigned int present;
7925 present = snd_hda_codec_read(codec, 0x1b, 0,
7926 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7927 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7928 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7929 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7930 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7931 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7932 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7933 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7934 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7937 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7940 switch (res >> 26) {
7941 case ALC880_HP_EVENT:
7942 printk("hp_event\n");
7943 alc888_6st_dell_front_automute(codec);
7948 static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
7951 unsigned int present;
7953 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7954 present = snd_hda_codec_read(codec, 0x1b, 0,
7955 AC_VERB_GET_PIN_SENSE, 0);
7956 present = (present & 0x80000000) != 0;
7958 /* mute internal speaker */
7959 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7960 HDA_AMP_MUTE, HDA_AMP_MUTE);
7961 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7962 HDA_AMP_MUTE, HDA_AMP_MUTE);
7963 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7964 HDA_AMP_MUTE, HDA_AMP_MUTE);
7965 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7966 HDA_AMP_MUTE, HDA_AMP_MUTE);
7967 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7968 HDA_AMP_MUTE, HDA_AMP_MUTE);
7970 /* unmute internal speaker if necessary */
7971 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7972 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7973 HDA_AMP_MUTE, mute);
7974 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7975 HDA_AMP_MUTE, mute);
7976 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7977 HDA_AMP_MUTE, mute);
7978 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7979 HDA_AMP_MUTE, mute);
7980 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7981 HDA_AMP_MUTE, mute);
7985 static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec,
7988 if ((res >> 26) == ALC880_HP_EVENT)
7989 alc888_lenovo_sky_front_automute(codec);
7993 * generic initialization of ADC, input mixers and output mixers
7995 static struct hda_verb alc883_auto_init_verbs[] = {
7997 * Unmute ADC0-2 and set the default input to mic-in
7999 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8001 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8004 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8006 * Note: PASD motherboards uses the Line In 2 as the input for
8007 * front panel mic (mic 2)
8009 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8017 * Set up output mixers (0x0c - 0x0f)
8019 /* set vol=0 to output mixers */
8020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8024 /* set up input amps for analog loopback */
8025 /* Amp Indices: DAC = 0, mixer = 1 */
8026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8029 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8032 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8033 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8034 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8035 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8037 /* FIXME: use matrix-type input source selection */
8038 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8043 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8046 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8048 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8049 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8055 static struct hda_verb alc888_asus_m90v_verbs[] = {
8056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8059 /* enable unsolicited event */
8060 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8065 static void alc883_nb_mic_automute(struct hda_codec *codec)
8067 unsigned int present;
8069 present = snd_hda_codec_read(codec, 0x18, 0,
8070 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8071 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8072 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8073 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8074 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8077 static void alc883_M90V_speaker_automute(struct hda_codec *codec)
8079 unsigned int present;
8082 present = snd_hda_codec_read(codec, 0x1b, 0,
8083 AC_VERB_GET_PIN_SENSE, 0)
8084 & AC_PINSENSE_PRESENCE;
8085 bits = present ? 0 : PIN_OUT;
8086 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8088 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8090 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8094 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8097 switch (res >> 26) {
8098 case ALC880_HP_EVENT:
8099 alc883_M90V_speaker_automute(codec);
8101 case ALC880_MIC_EVENT:
8102 alc883_nb_mic_automute(codec);
8107 static void alc883_mode2_inithook(struct hda_codec *codec)
8109 alc883_M90V_speaker_automute(codec);
8110 alc883_nb_mic_automute(codec);
8113 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8114 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8115 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8119 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8120 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8121 /* enable unsolicited event */
8122 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8126 static void alc883_eee1601_speaker_automute(struct hda_codec *codec)
8128 unsigned int present;
8131 present = snd_hda_codec_read(codec, 0x14, 0,
8132 AC_VERB_GET_PIN_SENSE, 0)
8133 & AC_PINSENSE_PRESENCE;
8134 bits = present ? 0 : PIN_OUT;
8135 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8139 static void alc883_eee1601_unsol_event(struct hda_codec *codec,
8142 switch (res >> 26) {
8143 case ALC880_HP_EVENT:
8144 alc883_eee1601_speaker_automute(codec);
8149 static void alc883_eee1601_inithook(struct hda_codec *codec)
8151 alc883_eee1601_speaker_automute(codec);
8154 #ifdef CONFIG_SND_HDA_POWER_SAVE
8155 #define alc883_loopbacks alc880_loopbacks
8158 /* pcm configuration: identiacal with ALC880 */
8159 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8160 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8161 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8162 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8163 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8166 * configuration and preset
8168 static const char *alc883_models[ALC883_MODEL_LAST] = {
8169 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8170 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8171 [ALC883_3ST_6ch] = "3stack-6ch",
8172 [ALC883_6ST_DIG] = "6stack-dig",
8173 [ALC883_TARGA_DIG] = "targa-dig",
8174 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8175 [ALC883_ACER] = "acer",
8176 [ALC883_ACER_ASPIRE] = "acer-aspire",
8177 [ALC883_MEDION] = "medion",
8178 [ALC883_MEDION_MD2] = "medion-md2",
8179 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8180 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8181 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8182 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8183 [ALC888_LENOVO_SKY] = "lenovo-sky",
8184 [ALC883_HAIER_W66] = "haier-w66",
8185 [ALC888_3ST_HP] = "3stack-hp",
8186 [ALC888_6ST_DELL] = "6stack-dell",
8187 [ALC883_MITAC] = "mitac",
8188 [ALC883_CLEVO_M720] = "clevo-m720",
8189 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8190 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8191 [ALC883_AUTO] = "auto",
8194 static struct snd_pci_quirk alc883_cfg_tbl[] = {
8195 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
8196 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8197 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8198 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8199 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8200 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
8201 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8202 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8203 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8204 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8205 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8206 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8207 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8208 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8209 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8210 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
8211 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8212 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8213 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8214 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8215 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
8216 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8217 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8218 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8219 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8220 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8221 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8222 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8223 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8224 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8225 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8226 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8227 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8228 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8229 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8230 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8231 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8232 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8233 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8234 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8235 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8236 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8237 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8238 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8239 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8240 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8241 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
8242 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8243 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8244 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
8245 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8246 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8247 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8248 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8249 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8250 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8251 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8252 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8253 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8254 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8255 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8259 static struct alc_config_preset alc883_presets[] = {
8260 [ALC883_3ST_2ch_DIG] = {
8261 .mixers = { alc883_3ST_2ch_mixer },
8262 .init_verbs = { alc883_init_verbs },
8263 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8264 .dac_nids = alc883_dac_nids,
8265 .dig_out_nid = ALC883_DIGOUT_NID,
8266 .dig_in_nid = ALC883_DIGIN_NID,
8267 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8268 .channel_mode = alc883_3ST_2ch_modes,
8269 .input_mux = &alc883_capture_source,
8271 [ALC883_3ST_6ch_DIG] = {
8272 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8273 .init_verbs = { alc883_init_verbs },
8274 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8275 .dac_nids = alc883_dac_nids,
8276 .dig_out_nid = ALC883_DIGOUT_NID,
8277 .dig_in_nid = ALC883_DIGIN_NID,
8278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8279 .channel_mode = alc883_3ST_6ch_modes,
8281 .input_mux = &alc883_capture_source,
8283 [ALC883_3ST_6ch] = {
8284 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8285 .init_verbs = { alc883_init_verbs },
8286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8287 .dac_nids = alc883_dac_nids,
8288 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8289 .channel_mode = alc883_3ST_6ch_modes,
8291 .input_mux = &alc883_capture_source,
8293 [ALC883_3ST_6ch_INTEL] = {
8294 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8295 .init_verbs = { alc883_init_verbs },
8296 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8297 .dac_nids = alc883_dac_nids,
8298 .dig_out_nid = ALC883_DIGOUT_NID,
8299 .dig_in_nid = ALC883_DIGIN_NID,
8300 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8301 .channel_mode = alc883_3ST_6ch_intel_modes,
8303 .input_mux = &alc883_3stack_6ch_intel,
8305 [ALC883_6ST_DIG] = {
8306 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8307 .init_verbs = { alc883_init_verbs },
8308 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8309 .dac_nids = alc883_dac_nids,
8310 .dig_out_nid = ALC883_DIGOUT_NID,
8311 .dig_in_nid = ALC883_DIGIN_NID,
8312 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8313 .channel_mode = alc883_sixstack_modes,
8314 .input_mux = &alc883_capture_source,
8316 [ALC883_TARGA_DIG] = {
8317 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
8318 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8320 .dac_nids = alc883_dac_nids,
8321 .dig_out_nid = ALC883_DIGOUT_NID,
8322 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8323 .channel_mode = alc883_3ST_6ch_modes,
8325 .input_mux = &alc883_capture_source,
8326 .unsol_event = alc883_tagra_unsol_event,
8327 .init_hook = alc883_tagra_automute,
8329 [ALC883_TARGA_2ch_DIG] = {
8330 .mixers = { alc883_tagra_2ch_mixer},
8331 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
8332 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8333 .dac_nids = alc883_dac_nids,
8334 .adc_nids = alc883_adc_nids_alt,
8335 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8336 .dig_out_nid = ALC883_DIGOUT_NID,
8337 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8338 .channel_mode = alc883_3ST_2ch_modes,
8339 .input_mux = &alc883_capture_source,
8340 .unsol_event = alc883_tagra_unsol_event,
8341 .init_hook = alc883_tagra_automute,
8344 .mixers = { alc883_base_mixer },
8345 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8346 * and the headphone jack. Turn this on and rely on the
8347 * standard mute methods whenever the user wants to turn
8348 * these outputs off.
8350 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8352 .dac_nids = alc883_dac_nids,
8353 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8354 .channel_mode = alc883_3ST_2ch_modes,
8355 .input_mux = &alc883_capture_source,
8357 [ALC883_ACER_ASPIRE] = {
8358 .mixers = { alc883_acer_aspire_mixer },
8359 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8360 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8361 .dac_nids = alc883_dac_nids,
8362 .dig_out_nid = ALC883_DIGOUT_NID,
8363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8364 .channel_mode = alc883_3ST_2ch_modes,
8365 .input_mux = &alc883_capture_source,
8366 .unsol_event = alc883_acer_aspire_unsol_event,
8367 .init_hook = alc883_acer_aspire_automute,
8370 .mixers = { alc883_fivestack_mixer,
8371 alc883_chmode_mixer },
8372 .init_verbs = { alc883_init_verbs,
8373 alc883_medion_eapd_verbs },
8374 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8375 .dac_nids = alc883_dac_nids,
8376 .adc_nids = alc883_adc_nids_alt,
8377 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8378 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8379 .channel_mode = alc883_sixstack_modes,
8380 .input_mux = &alc883_capture_source,
8382 [ALC883_MEDION_MD2] = {
8383 .mixers = { alc883_medion_md2_mixer},
8384 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8385 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8386 .dac_nids = alc883_dac_nids,
8387 .dig_out_nid = ALC883_DIGOUT_NID,
8388 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8389 .channel_mode = alc883_3ST_2ch_modes,
8390 .input_mux = &alc883_capture_source,
8391 .unsol_event = alc883_medion_md2_unsol_event,
8392 .init_hook = alc883_medion_md2_automute,
8394 [ALC883_LAPTOP_EAPD] = {
8395 .mixers = { alc883_base_mixer },
8396 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8398 .dac_nids = alc883_dac_nids,
8399 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8400 .channel_mode = alc883_3ST_2ch_modes,
8401 .input_mux = &alc883_capture_source,
8403 [ALC883_CLEVO_M720] = {
8404 .mixers = { alc883_clevo_m720_mixer },
8405 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8407 .dac_nids = alc883_dac_nids,
8408 .dig_out_nid = ALC883_DIGOUT_NID,
8409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8410 .channel_mode = alc883_3ST_2ch_modes,
8411 .input_mux = &alc883_capture_source,
8412 .unsol_event = alc883_clevo_m720_unsol_event,
8413 .init_hook = alc883_clevo_m720_automute,
8415 [ALC883_LENOVO_101E_2ch] = {
8416 .mixers = { alc883_lenovo_101e_2ch_mixer},
8417 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8419 .dac_nids = alc883_dac_nids,
8420 .adc_nids = alc883_adc_nids_alt,
8421 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8422 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8423 .channel_mode = alc883_3ST_2ch_modes,
8424 .input_mux = &alc883_lenovo_101e_capture_source,
8425 .unsol_event = alc883_lenovo_101e_unsol_event,
8426 .init_hook = alc883_lenovo_101e_all_automute,
8428 [ALC883_LENOVO_NB0763] = {
8429 .mixers = { alc883_lenovo_nb0763_mixer },
8430 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8431 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8432 .dac_nids = alc883_dac_nids,
8433 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8434 .channel_mode = alc883_3ST_2ch_modes,
8436 .input_mux = &alc883_lenovo_nb0763_capture_source,
8437 .unsol_event = alc883_medion_md2_unsol_event,
8438 .init_hook = alc883_medion_md2_automute,
8440 [ALC888_LENOVO_MS7195_DIG] = {
8441 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8442 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8444 .dac_nids = alc883_dac_nids,
8445 .dig_out_nid = ALC883_DIGOUT_NID,
8446 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8447 .channel_mode = alc883_3ST_6ch_modes,
8449 .input_mux = &alc883_capture_source,
8450 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8451 .init_hook = alc888_lenovo_ms7195_front_automute,
8453 [ALC883_HAIER_W66] = {
8454 .mixers = { alc883_tagra_2ch_mixer},
8455 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8456 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8457 .dac_nids = alc883_dac_nids,
8458 .dig_out_nid = ALC883_DIGOUT_NID,
8459 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8460 .channel_mode = alc883_3ST_2ch_modes,
8461 .input_mux = &alc883_capture_source,
8462 .unsol_event = alc883_haier_w66_unsol_event,
8463 .init_hook = alc883_haier_w66_automute,
8466 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8467 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8468 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8469 .dac_nids = alc883_dac_nids,
8470 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8471 .channel_mode = alc888_3st_hp_modes,
8473 .input_mux = &alc883_capture_source,
8475 [ALC888_6ST_DELL] = {
8476 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8477 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8478 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8479 .dac_nids = alc883_dac_nids,
8480 .dig_out_nid = ALC883_DIGOUT_NID,
8481 .dig_in_nid = ALC883_DIGIN_NID,
8482 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8483 .channel_mode = alc883_sixstack_modes,
8484 .input_mux = &alc883_capture_source,
8485 .unsol_event = alc888_6st_dell_unsol_event,
8486 .init_hook = alc888_6st_dell_front_automute,
8489 .mixers = { alc883_mitac_mixer },
8490 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8491 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8492 .dac_nids = alc883_dac_nids,
8493 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8494 .channel_mode = alc883_3ST_2ch_modes,
8495 .input_mux = &alc883_capture_source,
8496 .unsol_event = alc883_mitac_unsol_event,
8497 .init_hook = alc883_mitac_automute,
8499 [ALC883_FUJITSU_PI2515] = {
8500 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8501 .init_verbs = { alc883_init_verbs,
8502 alc883_2ch_fujitsu_pi2515_verbs},
8503 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8504 .dac_nids = alc883_dac_nids,
8505 .dig_out_nid = ALC883_DIGOUT_NID,
8506 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8507 .channel_mode = alc883_3ST_2ch_modes,
8508 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8509 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8510 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8512 [ALC888_LENOVO_SKY] = {
8513 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8514 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8515 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8516 .dac_nids = alc883_dac_nids,
8517 .dig_out_nid = ALC883_DIGOUT_NID,
8518 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8519 .channel_mode = alc883_sixstack_modes,
8521 .input_mux = &alc883_lenovo_sky_capture_source,
8522 .unsol_event = alc883_lenovo_sky_unsol_event,
8523 .init_hook = alc888_lenovo_sky_front_automute,
8525 [ALC888_ASUS_M90V] = {
8526 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8527 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8528 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8529 .dac_nids = alc883_dac_nids,
8530 .dig_out_nid = ALC883_DIGOUT_NID,
8531 .dig_in_nid = ALC883_DIGIN_NID,
8532 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8533 .channel_mode = alc883_3ST_6ch_modes,
8535 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8536 .unsol_event = alc883_mode2_unsol_event,
8537 .init_hook = alc883_mode2_inithook,
8539 [ALC888_ASUS_EEE1601] = {
8540 .mixers = { alc883_asus_eee1601_mixer },
8541 .cap_mixer = alc883_asus_eee1601_cap_mixer,
8542 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
8543 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8544 .dac_nids = alc883_dac_nids,
8545 .dig_out_nid = ALC883_DIGOUT_NID,
8546 .dig_in_nid = ALC883_DIGIN_NID,
8547 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8548 .channel_mode = alc883_3ST_2ch_modes,
8550 .input_mux = &alc883_asus_eee1601_capture_source,
8551 .unsol_event = alc883_eee1601_unsol_event,
8552 .init_hook = alc883_eee1601_inithook,
8558 * BIOS auto configuration
8560 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8561 hda_nid_t nid, int pin_type,
8565 struct alc_spec *spec = codec->spec;
8568 alc_set_pin_output(codec, nid, pin_type);
8569 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8572 idx = spec->multiout.dac_nids[dac_idx] - 2;
8573 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8577 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8579 struct alc_spec *spec = codec->spec;
8582 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8583 for (i = 0; i <= HDA_SIDE; i++) {
8584 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8585 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8587 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8592 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8594 struct alc_spec *spec = codec->spec;
8597 pin = spec->autocfg.hp_pins[0];
8598 if (pin) /* connect to front */
8600 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8601 pin = spec->autocfg.speaker_pins[0];
8603 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8606 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8607 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8609 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8611 struct alc_spec *spec = codec->spec;
8614 for (i = 0; i < AUTO_PIN_LAST; i++) {
8615 hda_nid_t nid = spec->autocfg.input_pins[i];
8616 if (alc883_is_input_pin(nid)) {
8617 snd_hda_codec_write(codec, nid, 0,
8618 AC_VERB_SET_PIN_WIDGET_CONTROL,
8619 (i <= AUTO_PIN_FRONT_MIC ?
8620 PIN_VREF80 : PIN_IN));
8621 if (nid != ALC883_PIN_CD_NID)
8622 snd_hda_codec_write(codec, nid, 0,
8623 AC_VERB_SET_AMP_GAIN_MUTE,
8629 #define alc883_auto_init_input_src alc882_auto_init_input_src
8631 /* almost identical with ALC880 parser... */
8632 static int alc883_parse_auto_config(struct hda_codec *codec)
8634 struct alc_spec *spec = codec->spec;
8635 int err = alc880_parse_auto_config(codec);
8640 return 0; /* no config found */
8642 err = alc_auto_add_mic_boost(codec);
8646 /* hack - override the init verbs */
8647 spec->init_verbs[0] = alc883_auto_init_verbs;
8649 return 1; /* config found */
8652 /* additional initialization for auto-configuration model */
8653 static void alc883_auto_init(struct hda_codec *codec)
8655 struct alc_spec *spec = codec->spec;
8656 alc883_auto_init_multi_out(codec);
8657 alc883_auto_init_hp_out(codec);
8658 alc883_auto_init_analog_input(codec);
8659 alc883_auto_init_input_src(codec);
8660 if (spec->unsol_event)
8661 alc_inithook(codec);
8664 static int patch_alc883(struct hda_codec *codec)
8666 struct alc_spec *spec;
8667 int err, board_config;
8669 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8675 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
8677 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8680 if (board_config < 0) {
8681 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8682 "trying auto-probe from BIOS...\n");
8683 board_config = ALC883_AUTO;
8686 if (board_config == ALC883_AUTO) {
8687 /* automatic parse from the BIOS config */
8688 err = alc883_parse_auto_config(codec);
8694 "hda_codec: Cannot set up configuration "
8695 "from BIOS. Using base mode...\n");
8696 board_config = ALC883_3ST_2ch_DIG;
8700 if (board_config != ALC883_AUTO)
8701 setup_preset(spec, &alc883_presets[board_config]);
8703 switch (codec->vendor_id) {
8705 if (codec->revision_id == 0x100101) {
8706 spec->stream_name_analog = "ALC1200 Analog";
8707 spec->stream_name_digital = "ALC1200 Digital";
8709 spec->stream_name_analog = "ALC888 Analog";
8710 spec->stream_name_digital = "ALC888 Digital";
8714 spec->stream_name_analog = "ALC889 Analog";
8715 spec->stream_name_digital = "ALC889 Digital";
8718 spec->stream_name_analog = "ALC883 Analog";
8719 spec->stream_name_digital = "ALC883 Digital";
8723 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8724 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8725 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8727 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8728 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8730 if (!spec->num_adc_nids) {
8731 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8732 spec->adc_nids = alc883_adc_nids;
8734 if (!spec->capsrc_nids)
8735 spec->capsrc_nids = alc883_capsrc_nids;
8736 spec->is_mix_capture = 1; /* matrix-style capture */
8737 if (!spec->cap_mixer)
8738 set_capture_mixer(spec);
8740 spec->vmaster_nid = 0x0c;
8742 codec->patch_ops = alc_patch_ops;
8743 if (board_config == ALC883_AUTO)
8744 spec->init_hook = alc883_auto_init;
8746 #ifdef CONFIG_SND_HDA_POWER_SAVE
8747 if (!spec->loopback.amplist)
8748 spec->loopback.amplist = alc883_loopbacks;
8758 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8759 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8761 #define alc262_dac_nids alc260_dac_nids
8762 #define alc262_adc_nids alc882_adc_nids
8763 #define alc262_adc_nids_alt alc882_adc_nids_alt
8764 #define alc262_capsrc_nids alc882_capsrc_nids
8765 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8767 #define alc262_modes alc260_modes
8768 #define alc262_capture_source alc882_capture_source
8770 static hda_nid_t alc262_dmic_adc_nids[1] = {
8775 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
8777 static struct snd_kcontrol_new alc262_base_mixer[] = {
8778 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8779 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8780 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8781 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8786 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8787 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8788 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8789 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8790 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8791 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8792 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8794 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8795 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8799 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8801 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8807 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8810 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8811 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8812 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8813 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8814 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8819 /* update HP, line and mono-out pins according to the master switch */
8820 static void alc262_hp_master_update(struct hda_codec *codec)
8822 struct alc_spec *spec = codec->spec;
8823 int val = spec->master_sw;
8826 snd_hda_codec_write_cache(codec, 0x1b, 0,
8827 AC_VERB_SET_PIN_WIDGET_CONTROL,
8829 snd_hda_codec_write_cache(codec, 0x15, 0,
8830 AC_VERB_SET_PIN_WIDGET_CONTROL,
8832 /* mono (speaker) depending on the HP jack sense */
8833 val = val && !spec->jack_present;
8834 snd_hda_codec_write_cache(codec, 0x16, 0,
8835 AC_VERB_SET_PIN_WIDGET_CONTROL,
8839 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8841 struct alc_spec *spec = codec->spec;
8842 unsigned int presence;
8843 presence = snd_hda_codec_read(codec, 0x1b, 0,
8844 AC_VERB_GET_PIN_SENSE, 0);
8845 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8846 alc262_hp_master_update(codec);
8849 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8851 if ((res >> 26) != ALC880_HP_EVENT)
8853 alc262_hp_bpc_automute(codec);
8856 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8858 struct alc_spec *spec = codec->spec;
8859 unsigned int presence;
8860 presence = snd_hda_codec_read(codec, 0x15, 0,
8861 AC_VERB_GET_PIN_SENSE, 0);
8862 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8863 alc262_hp_master_update(codec);
8866 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8869 if ((res >> 26) != ALC880_HP_EVENT)
8871 alc262_hp_wildwest_automute(codec);
8874 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8875 struct snd_ctl_elem_value *ucontrol)
8877 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8878 struct alc_spec *spec = codec->spec;
8879 *ucontrol->value.integer.value = spec->master_sw;
8883 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8884 struct snd_ctl_elem_value *ucontrol)
8886 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8887 struct alc_spec *spec = codec->spec;
8888 int val = !!*ucontrol->value.integer.value;
8890 if (val == spec->master_sw)
8892 spec->master_sw = val;
8893 alc262_hp_master_update(codec);
8897 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8899 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8900 .name = "Master Playback Switch",
8901 .info = snd_ctl_boolean_mono_info,
8902 .get = alc262_hp_master_sw_get,
8903 .put = alc262_hp_master_sw_put,
8905 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8906 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8908 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8910 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8914 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8915 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8916 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8917 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8922 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8923 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8924 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8925 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8929 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8932 .name = "Master Playback Switch",
8933 .info = snd_ctl_boolean_mono_info,
8934 .get = alc262_hp_master_sw_get,
8935 .put = alc262_hp_master_sw_put,
8937 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8938 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8941 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8943 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8945 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8946 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8947 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8949 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8950 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8951 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8952 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8953 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8957 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8958 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8959 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8960 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8964 /* mute/unmute internal speaker according to the hp jack and mute state */
8965 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8967 struct alc_spec *spec = codec->spec;
8969 if (force || !spec->sense_updated) {
8970 unsigned int present;
8971 present = snd_hda_codec_read(codec, 0x15, 0,
8972 AC_VERB_GET_PIN_SENSE, 0);
8973 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8974 spec->sense_updated = 1;
8976 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8977 spec->jack_present ? HDA_AMP_MUTE : 0);
8980 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8983 if ((res >> 26) != ALC880_HP_EVENT)
8985 alc262_hp_t5735_automute(codec, 1);
8988 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8990 alc262_hp_t5735_automute(codec, 1);
8993 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8994 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8995 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8996 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9004 static struct hda_verb alc262_hp_t5735_verbs[] = {
9005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9006 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9008 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9012 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9013 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9015 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9016 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9017 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9018 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9022 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9023 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9024 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9025 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9028 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9036 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9043 /* bind hp and internal speaker mute (with plug check) */
9044 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
9045 struct snd_ctl_elem_value *ucontrol)
9047 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9048 long *valp = ucontrol->value.integer.value;
9051 /* change hp mute */
9052 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
9054 valp[0] ? 0 : HDA_AMP_MUTE);
9055 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
9057 valp[1] ? 0 : HDA_AMP_MUTE);
9059 /* change speaker according to HP jack state */
9060 struct alc_spec *spec = codec->spec;
9062 if (spec->jack_present)
9063 mute = HDA_AMP_MUTE;
9065 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9067 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9068 HDA_AMP_MUTE, mute);
9073 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9074 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9077 .name = "Master Playback Switch",
9078 .info = snd_hda_mixer_amp_switch_info,
9079 .get = snd_hda_mixer_amp_switch_get,
9080 .put = alc262_sony_master_sw_put,
9081 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9085 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9086 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9090 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9092 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9096 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9097 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9101 #define alc262_capture_mixer alc882_capture_mixer
9102 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9105 * generic initialization of ADC, input mixers and output mixers
9107 static struct hda_verb alc262_init_verbs[] = {
9109 * Unmute ADC0-2 and set the default input to mic-in
9111 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9115 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9116 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9118 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9120 * Note: PASD motherboards uses the Line In 2 as the input for
9121 * front panel mic (mic 2)
9123 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9131 * Set up output mixers (0x0c - 0x0e)
9133 /* set vol=0 to output mixers */
9134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9137 /* set up input amps for analog loopback */
9138 /* Amp Indices: DAC = 0, mixer = 1 */
9139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9140 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9141 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9146 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9148 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9150 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9151 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9153 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9154 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9155 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9159 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9160 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9162 /* FIXME: use matrix-type input source selection */
9163 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9164 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9165 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9170 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9183 static struct hda_verb alc262_eapd_verbs[] = {
9184 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9185 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9189 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9195 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9197 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9198 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9200 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9205 static struct hda_verb alc262_sony_unsol_verbs[] = {
9206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9210 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9215 static struct hda_input_mux alc262_dmic_capture_source = {
9218 { "Int DMic", 0x9 },
9223 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9232 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9233 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9237 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9239 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9240 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9244 static void alc262_dmic_automute(struct hda_codec *codec)
9246 unsigned int present;
9248 present = snd_hda_codec_read(codec, 0x18, 0,
9249 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9250 snd_hda_codec_write(codec, 0x22, 0,
9251 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9254 /* toggle speaker-output according to the hp-jack state */
9255 static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9257 unsigned int present;
9260 present = snd_hda_codec_read(codec, 0x15, 0,
9261 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9262 bits = present ? 0 : PIN_OUT;
9263 snd_hda_codec_write(codec, 0x14, 0,
9264 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9269 /* unsolicited event for HP jack sensing */
9270 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9273 if ((res >> 26) == ALC880_HP_EVENT)
9274 alc262_toshiba_s06_speaker_automute(codec);
9275 if ((res >> 26) == ALC880_MIC_EVENT)
9276 alc262_dmic_automute(codec);
9280 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9282 alc262_toshiba_s06_speaker_automute(codec);
9283 alc262_dmic_automute(codec);
9286 /* mute/unmute internal speaker according to the hp jack and mute state */
9287 static void alc262_hippo_automute(struct hda_codec *codec)
9289 struct alc_spec *spec = codec->spec;
9291 unsigned int present;
9293 /* need to execute and sync at first */
9294 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9295 present = snd_hda_codec_read(codec, 0x15, 0,
9296 AC_VERB_GET_PIN_SENSE, 0);
9297 spec->jack_present = (present & 0x80000000) != 0;
9298 if (spec->jack_present) {
9299 /* mute internal speaker */
9300 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9301 HDA_AMP_MUTE, HDA_AMP_MUTE);
9303 /* unmute internal speaker if necessary */
9304 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9305 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9306 HDA_AMP_MUTE, mute);
9310 /* unsolicited event for HP jack sensing */
9311 static void alc262_hippo_unsol_event(struct hda_codec *codec,
9314 if ((res >> 26) != ALC880_HP_EVENT)
9316 alc262_hippo_automute(codec);
9319 static void alc262_hippo1_automute(struct hda_codec *codec)
9322 unsigned int present;
9324 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9325 present = snd_hda_codec_read(codec, 0x1b, 0,
9326 AC_VERB_GET_PIN_SENSE, 0);
9327 present = (present & 0x80000000) != 0;
9329 /* mute internal speaker */
9330 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9331 HDA_AMP_MUTE, HDA_AMP_MUTE);
9333 /* unmute internal speaker if necessary */
9334 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9335 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9336 HDA_AMP_MUTE, mute);
9340 /* unsolicited event for HP jack sensing */
9341 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
9344 if ((res >> 26) != ALC880_HP_EVENT)
9346 alc262_hippo1_automute(codec);
9352 * 0x16 = internal speaker
9353 * 0x18 = external mic
9356 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9357 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9358 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9362 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9364 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9369 static struct hda_verb alc262_nec_verbs[] = {
9370 /* Unmute Speaker */
9371 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9374 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9377 /* External mic to headphone */
9378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9379 /* External mic to speaker */
9380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9386 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9387 * 0x1b = port replicator headphone out
9390 #define ALC_HP_EVENT 0x37
9392 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
9393 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9394 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9395 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9396 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9400 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
9401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
9402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9406 static struct hda_input_mux alc262_fujitsu_capture_source = {
9415 static struct hda_input_mux alc262_HP_capture_source = {
9419 { "Front Mic", 0x1 },
9426 static struct hda_input_mux alc262_HP_D7000_capture_source = {
9430 { "Front Mic", 0x2 },
9436 /* mute/unmute internal speaker according to the hp jacks and mute state */
9437 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
9439 struct alc_spec *spec = codec->spec;
9442 if (force || !spec->sense_updated) {
9443 unsigned int present;
9444 /* need to execute and sync at first */
9445 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
9446 /* check laptop HP jack */
9447 present = snd_hda_codec_read(codec, 0x14, 0,
9448 AC_VERB_GET_PIN_SENSE, 0);
9449 /* need to execute and sync at first */
9450 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9451 /* check docking HP jack */
9452 present |= snd_hda_codec_read(codec, 0x1b, 0,
9453 AC_VERB_GET_PIN_SENSE, 0);
9454 if (present & AC_PINSENSE_PRESENCE)
9455 spec->jack_present = 1;
9457 spec->jack_present = 0;
9458 spec->sense_updated = 1;
9460 /* unmute internal speaker only if both HPs are unplugged and
9461 * master switch is on
9463 if (spec->jack_present)
9464 mute = HDA_AMP_MUTE;
9466 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9467 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9468 HDA_AMP_MUTE, mute);
9471 /* unsolicited event for HP jack sensing */
9472 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
9475 if ((res >> 26) != ALC_HP_EVENT)
9477 alc262_fujitsu_automute(codec, 1);
9480 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
9482 alc262_fujitsu_automute(codec, 1);
9485 /* bind volumes of both NID 0x0c and 0x0d */
9486 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
9487 .ops = &snd_hda_bind_vol,
9489 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
9490 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
9495 /* mute/unmute internal speaker according to the hp jack and mute state */
9496 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
9498 struct alc_spec *spec = codec->spec;
9501 if (force || !spec->sense_updated) {
9502 unsigned int present_int_hp;
9503 /* need to execute and sync at first */
9504 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9505 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
9506 AC_VERB_GET_PIN_SENSE, 0);
9507 spec->jack_present = (present_int_hp & 0x80000000) != 0;
9508 spec->sense_updated = 1;
9510 if (spec->jack_present) {
9511 /* mute internal speaker */
9512 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9513 HDA_AMP_MUTE, HDA_AMP_MUTE);
9514 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9515 HDA_AMP_MUTE, HDA_AMP_MUTE);
9517 /* unmute internal speaker if necessary */
9518 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9519 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9520 HDA_AMP_MUTE, mute);
9521 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9522 HDA_AMP_MUTE, mute);
9526 /* unsolicited event for HP jack sensing */
9527 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
9530 if ((res >> 26) != ALC_HP_EVENT)
9532 alc262_lenovo_3000_automute(codec, 1);
9535 /* bind hp and internal speaker mute (with plug check) */
9536 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
9537 struct snd_ctl_elem_value *ucontrol)
9539 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9540 long *valp = ucontrol->value.integer.value;
9543 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9545 valp ? 0 : HDA_AMP_MUTE);
9546 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9548 valp ? 0 : HDA_AMP_MUTE);
9551 alc262_fujitsu_automute(codec, 0);
9555 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
9556 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9558 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9559 .name = "Master Playback Switch",
9560 .info = snd_hda_mixer_amp_switch_info,
9561 .get = snd_hda_mixer_amp_switch_get,
9562 .put = alc262_fujitsu_master_sw_put,
9563 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9565 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9566 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9567 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
9568 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
9569 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9572 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9573 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9574 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9578 /* bind hp and internal speaker mute (with plug check) */
9579 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
9580 struct snd_ctl_elem_value *ucontrol)
9582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9583 long *valp = ucontrol->value.integer.value;
9586 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
9588 valp ? 0 : HDA_AMP_MUTE);
9591 alc262_lenovo_3000_automute(codec, 0);
9595 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
9596 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9598 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9599 .name = "Master Playback Switch",
9600 .info = snd_hda_mixer_amp_switch_info,
9601 .get = snd_hda_mixer_amp_switch_get,
9602 .put = alc262_lenovo_3000_master_sw_put,
9603 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
9605 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9606 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9610 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9611 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9612 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9616 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
9617 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
9619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9620 .name = "Master Playback Switch",
9621 .info = snd_hda_mixer_amp_switch_info,
9622 .get = snd_hda_mixer_amp_switch_get,
9623 .put = alc262_sony_master_sw_put,
9624 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9628 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9631 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9635 /* additional init verbs for Benq laptops */
9636 static struct hda_verb alc262_EAPD_verbs[] = {
9637 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9638 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9642 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
9643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9644 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9646 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9647 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9651 /* Samsung Q1 Ultra Vista model setup */
9652 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
9653 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9654 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9657 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9658 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
9662 static struct hda_verb alc262_ultra_verbs[] = {
9664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9670 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9671 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9679 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9681 /* ADC, choose mic */
9682 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9686 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9690 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
9695 /* mute/unmute internal speaker according to the hp jack and mute state */
9696 static void alc262_ultra_automute(struct hda_codec *codec)
9698 struct alc_spec *spec = codec->spec;
9702 /* auto-mute only when HP is used as HP */
9703 if (!spec->cur_mux[0]) {
9704 unsigned int present;
9705 /* need to execute and sync at first */
9706 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9707 present = snd_hda_codec_read(codec, 0x15, 0,
9708 AC_VERB_GET_PIN_SENSE, 0);
9709 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9710 if (spec->jack_present)
9711 mute = HDA_AMP_MUTE;
9713 /* mute/unmute internal speaker */
9714 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9715 HDA_AMP_MUTE, mute);
9716 /* mute/unmute HP */
9717 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9718 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9721 /* unsolicited event for HP jack sensing */
9722 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9725 if ((res >> 26) != ALC880_HP_EVENT)
9727 alc262_ultra_automute(codec);
9730 static struct hda_input_mux alc262_ultra_capture_source = {
9734 { "Headphone", 0x7 },
9738 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9739 struct snd_ctl_elem_value *ucontrol)
9741 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9742 struct alc_spec *spec = codec->spec;
9745 ret = alc_mux_enum_put(kcontrol, ucontrol);
9748 /* reprogram the HP pin as mic or HP according to the input source */
9749 snd_hda_codec_write_cache(codec, 0x15, 0,
9750 AC_VERB_SET_PIN_WIDGET_CONTROL,
9751 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9752 alc262_ultra_automute(codec); /* mute/unmute HP */
9756 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9757 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9758 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9761 .name = "Capture Source",
9762 .info = alc_mux_enum_info,
9763 .get = alc_mux_enum_get,
9764 .put = alc262_ultra_mux_enum_put,
9769 /* add playback controls from the parsed DAC table */
9770 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9771 const struct auto_pin_cfg *cfg)
9776 spec->multiout.num_dacs = 1; /* only use one dac */
9777 spec->multiout.dac_nids = spec->private_dac_nids;
9778 spec->multiout.dac_nids[0] = 2;
9780 nid = cfg->line_out_pins[0];
9782 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9783 "Front Playback Volume",
9784 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9787 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9788 "Front Playback Switch",
9789 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9794 nid = cfg->speaker_pins[0];
9797 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9798 "Speaker Playback Volume",
9799 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9803 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9804 "Speaker Playback Switch",
9805 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9810 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9811 "Speaker Playback Switch",
9812 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9818 nid = cfg->hp_pins[0];
9820 /* spec->multiout.hp_nid = 2; */
9822 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9823 "Headphone Playback Volume",
9824 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9828 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9829 "Headphone Playback Switch",
9830 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9835 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9836 "Headphone Playback Switch",
9837 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9846 /* identical with ALC880 */
9847 #define alc262_auto_create_analog_input_ctls \
9848 alc880_auto_create_analog_input_ctls
9851 * generic initialization of ADC, input mixers and output mixers
9853 static struct hda_verb alc262_volume_init_verbs[] = {
9855 * Unmute ADC0-2 and set the default input to mic-in
9857 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9859 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9860 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9861 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9864 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9866 * Note: PASD motherboards uses the Line In 2 as the input for
9867 * front panel mic (mic 2)
9869 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9877 * Set up output mixers (0x0c - 0x0f)
9879 /* set vol=0 to output mixers */
9880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9881 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9882 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9884 /* set up input amps for analog loopback */
9885 /* Amp Indices: DAC = 0, mixer = 1 */
9886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9893 /* FIXME: use matrix-type input source selection */
9894 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9895 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9898 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9904 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9914 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9916 * Unmute ADC0-2 and set the default input to mic-in
9918 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9920 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9922 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9925 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9927 * Note: PASD motherboards uses the Line In 2 as the input for
9928 * front panel mic (mic 2)
9930 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9940 * Set up output mixers (0x0c - 0x0e)
9942 /* set vol=0 to output mixers */
9943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9947 /* set up input amps for analog loopback */
9948 /* Amp Indices: DAC = 0, mixer = 1 */
9949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9956 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9960 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9963 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9964 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9967 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9968 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9969 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9970 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9976 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9977 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9980 /* FIXME: use matrix-type input source selection */
9981 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9982 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10003 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10005 * Unmute ADC0-2 and set the default input to mic-in
10007 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10009 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10011 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10014 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10016 * Note: PASD motherboards uses the Line In 2 as the input for front
10017 * panel mic (mic 2)
10019 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10029 * Set up output mixers (0x0c - 0x0e)
10031 /* set vol=0 to output mixers */
10032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10036 /* set up input amps for analog loopback */
10037 /* Amp Indices: DAC = 0, mixer = 1 */
10038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10043 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10052 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10054 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10057 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10060 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10063 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10064 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10065 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10067 /* FIXME: use matrix-type input source selection */
10068 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10069 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10075 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10079 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10083 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10091 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10099 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10103 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10105 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10106 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10107 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10108 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10111 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10112 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10117 #ifdef CONFIG_SND_HDA_POWER_SAVE
10118 #define alc262_loopbacks alc880_loopbacks
10121 /* pcm configuration: identiacal with ALC880 */
10122 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10123 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10124 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10125 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10128 * BIOS auto configuration
10130 static int alc262_parse_auto_config(struct hda_codec *codec)
10132 struct alc_spec *spec = codec->spec;
10134 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10136 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10140 if (!spec->autocfg.line_outs)
10141 return 0; /* can't find valid BIOS pin config */
10142 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10145 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10149 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10151 if (spec->autocfg.dig_out_pin)
10152 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10153 if (spec->autocfg.dig_in_pin)
10154 spec->dig_in_nid = ALC262_DIGIN_NID;
10156 if (spec->kctls.list)
10157 add_mixer(spec, spec->kctls.list);
10159 add_verb(spec, alc262_volume_init_verbs);
10160 spec->num_mux_defs = 1;
10161 spec->input_mux = &spec->private_imux;
10163 err = alc_auto_add_mic_boost(codec);
10167 store_pin_configs(codec);
10171 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10172 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10173 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10174 #define alc262_auto_init_input_src alc882_auto_init_input_src
10177 /* init callback for auto-configuration model -- overriding the default init */
10178 static void alc262_auto_init(struct hda_codec *codec)
10180 struct alc_spec *spec = codec->spec;
10181 alc262_auto_init_multi_out(codec);
10182 alc262_auto_init_hp_out(codec);
10183 alc262_auto_init_analog_input(codec);
10184 alc262_auto_init_input_src(codec);
10185 if (spec->unsol_event)
10186 alc_inithook(codec);
10190 * configuration and preset
10192 static const char *alc262_models[ALC262_MODEL_LAST] = {
10193 [ALC262_BASIC] = "basic",
10194 [ALC262_HIPPO] = "hippo",
10195 [ALC262_HIPPO_1] = "hippo_1",
10196 [ALC262_FUJITSU] = "fujitsu",
10197 [ALC262_HP_BPC] = "hp-bpc",
10198 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10199 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10200 [ALC262_HP_RP5700] = "hp-rp5700",
10201 [ALC262_BENQ_ED8] = "benq",
10202 [ALC262_BENQ_T31] = "benq-t31",
10203 [ALC262_SONY_ASSAMD] = "sony-assamd",
10204 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10205 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10206 [ALC262_ULTRA] = "ultra",
10207 [ALC262_LENOVO_3000] = "lenovo-3000",
10208 [ALC262_NEC] = "nec",
10209 [ALC262_AUTO] = "auto",
10212 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10213 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10214 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10215 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
10216 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
10217 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
10218 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
10219 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
10220 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
10221 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
10222 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
10223 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10224 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10225 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10226 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10227 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10228 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10229 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10230 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10231 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10232 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10233 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10234 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10235 ALC262_HP_TC_T5735),
10236 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10237 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10238 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10239 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10240 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10241 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
10242 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10243 ALC262_TOSHIBA_RX1),
10244 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10245 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10246 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10247 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10248 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10249 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10250 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10251 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10252 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10256 static struct alc_config_preset alc262_presets[] = {
10258 .mixers = { alc262_base_mixer },
10259 .init_verbs = { alc262_init_verbs },
10260 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10261 .dac_nids = alc262_dac_nids,
10263 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10264 .channel_mode = alc262_modes,
10265 .input_mux = &alc262_capture_source,
10268 .mixers = { alc262_base_mixer },
10269 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10270 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10271 .dac_nids = alc262_dac_nids,
10273 .dig_out_nid = ALC262_DIGOUT_NID,
10274 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10275 .channel_mode = alc262_modes,
10276 .input_mux = &alc262_capture_source,
10277 .unsol_event = alc262_hippo_unsol_event,
10278 .init_hook = alc262_hippo_automute,
10280 [ALC262_HIPPO_1] = {
10281 .mixers = { alc262_hippo1_mixer },
10282 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10283 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10284 .dac_nids = alc262_dac_nids,
10286 .dig_out_nid = ALC262_DIGOUT_NID,
10287 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10288 .channel_mode = alc262_modes,
10289 .input_mux = &alc262_capture_source,
10290 .unsol_event = alc262_hippo1_unsol_event,
10291 .init_hook = alc262_hippo1_automute,
10293 [ALC262_FUJITSU] = {
10294 .mixers = { alc262_fujitsu_mixer },
10295 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10296 alc262_fujitsu_unsol_verbs },
10297 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10298 .dac_nids = alc262_dac_nids,
10300 .dig_out_nid = ALC262_DIGOUT_NID,
10301 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10302 .channel_mode = alc262_modes,
10303 .input_mux = &alc262_fujitsu_capture_source,
10304 .unsol_event = alc262_fujitsu_unsol_event,
10305 .init_hook = alc262_fujitsu_init_hook,
10307 [ALC262_HP_BPC] = {
10308 .mixers = { alc262_HP_BPC_mixer },
10309 .init_verbs = { alc262_HP_BPC_init_verbs },
10310 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10311 .dac_nids = alc262_dac_nids,
10313 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10314 .channel_mode = alc262_modes,
10315 .input_mux = &alc262_HP_capture_source,
10316 .unsol_event = alc262_hp_bpc_unsol_event,
10317 .init_hook = alc262_hp_bpc_automute,
10319 [ALC262_HP_BPC_D7000_WF] = {
10320 .mixers = { alc262_HP_BPC_WildWest_mixer },
10321 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10322 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10323 .dac_nids = alc262_dac_nids,
10325 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10326 .channel_mode = alc262_modes,
10327 .input_mux = &alc262_HP_D7000_capture_source,
10328 .unsol_event = alc262_hp_wildwest_unsol_event,
10329 .init_hook = alc262_hp_wildwest_automute,
10331 [ALC262_HP_BPC_D7000_WL] = {
10332 .mixers = { alc262_HP_BPC_WildWest_mixer,
10333 alc262_HP_BPC_WildWest_option_mixer },
10334 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10335 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10336 .dac_nids = alc262_dac_nids,
10338 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10339 .channel_mode = alc262_modes,
10340 .input_mux = &alc262_HP_D7000_capture_source,
10341 .unsol_event = alc262_hp_wildwest_unsol_event,
10342 .init_hook = alc262_hp_wildwest_automute,
10344 [ALC262_HP_TC_T5735] = {
10345 .mixers = { alc262_hp_t5735_mixer },
10346 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
10347 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10348 .dac_nids = alc262_dac_nids,
10350 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10351 .channel_mode = alc262_modes,
10352 .input_mux = &alc262_capture_source,
10353 .unsol_event = alc262_hp_t5735_unsol_event,
10354 .init_hook = alc262_hp_t5735_init_hook,
10356 [ALC262_HP_RP5700] = {
10357 .mixers = { alc262_hp_rp5700_mixer },
10358 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
10359 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10360 .dac_nids = alc262_dac_nids,
10361 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10362 .channel_mode = alc262_modes,
10363 .input_mux = &alc262_hp_rp5700_capture_source,
10365 [ALC262_BENQ_ED8] = {
10366 .mixers = { alc262_base_mixer },
10367 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
10368 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10369 .dac_nids = alc262_dac_nids,
10371 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10372 .channel_mode = alc262_modes,
10373 .input_mux = &alc262_capture_source,
10375 [ALC262_SONY_ASSAMD] = {
10376 .mixers = { alc262_sony_mixer },
10377 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
10378 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10379 .dac_nids = alc262_dac_nids,
10381 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10382 .channel_mode = alc262_modes,
10383 .input_mux = &alc262_capture_source,
10384 .unsol_event = alc262_hippo_unsol_event,
10385 .init_hook = alc262_hippo_automute,
10387 [ALC262_BENQ_T31] = {
10388 .mixers = { alc262_benq_t31_mixer },
10389 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
10390 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10391 .dac_nids = alc262_dac_nids,
10393 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10394 .channel_mode = alc262_modes,
10395 .input_mux = &alc262_capture_source,
10396 .unsol_event = alc262_hippo_unsol_event,
10397 .init_hook = alc262_hippo_automute,
10400 .mixers = { alc262_ultra_mixer },
10401 .cap_mixer = alc262_ultra_capture_mixer,
10402 .init_verbs = { alc262_ultra_verbs },
10403 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10404 .dac_nids = alc262_dac_nids,
10405 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10406 .channel_mode = alc262_modes,
10407 .input_mux = &alc262_ultra_capture_source,
10408 .adc_nids = alc262_adc_nids, /* ADC0 */
10409 .capsrc_nids = alc262_capsrc_nids,
10410 .num_adc_nids = 1, /* single ADC */
10411 .unsol_event = alc262_ultra_unsol_event,
10412 .init_hook = alc262_ultra_automute,
10414 [ALC262_LENOVO_3000] = {
10415 .mixers = { alc262_lenovo_3000_mixer },
10416 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10417 alc262_lenovo_3000_unsol_verbs },
10418 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10419 .dac_nids = alc262_dac_nids,
10421 .dig_out_nid = ALC262_DIGOUT_NID,
10422 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10423 .channel_mode = alc262_modes,
10424 .input_mux = &alc262_fujitsu_capture_source,
10425 .unsol_event = alc262_lenovo_3000_unsol_event,
10428 .mixers = { alc262_nec_mixer },
10429 .init_verbs = { alc262_nec_verbs },
10430 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10431 .dac_nids = alc262_dac_nids,
10433 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10434 .channel_mode = alc262_modes,
10435 .input_mux = &alc262_capture_source,
10437 [ALC262_TOSHIBA_S06] = {
10438 .mixers = { alc262_toshiba_s06_mixer },
10439 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
10440 alc262_eapd_verbs },
10441 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10442 .capsrc_nids = alc262_dmic_capsrc_nids,
10443 .dac_nids = alc262_dac_nids,
10444 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
10445 .dig_out_nid = ALC262_DIGOUT_NID,
10446 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10447 .channel_mode = alc262_modes,
10448 .input_mux = &alc262_dmic_capture_source,
10449 .unsol_event = alc262_toshiba_s06_unsol_event,
10450 .init_hook = alc262_toshiba_s06_init_hook,
10452 [ALC262_TOSHIBA_RX1] = {
10453 .mixers = { alc262_toshiba_rx1_mixer },
10454 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
10455 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10456 .dac_nids = alc262_dac_nids,
10458 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10459 .channel_mode = alc262_modes,
10460 .input_mux = &alc262_capture_source,
10461 .unsol_event = alc262_hippo_unsol_event,
10462 .init_hook = alc262_hippo_automute,
10466 static int patch_alc262(struct hda_codec *codec)
10468 struct alc_spec *spec;
10472 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10476 codec->spec = spec;
10478 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10483 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10484 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
10485 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
10486 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
10490 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10492 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
10496 if (board_config < 0) {
10497 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
10498 "trying auto-probe from BIOS...\n");
10499 board_config = ALC262_AUTO;
10502 if (board_config == ALC262_AUTO) {
10503 /* automatic parse from the BIOS config */
10504 err = alc262_parse_auto_config(codec);
10510 "hda_codec: Cannot set up configuration "
10511 "from BIOS. Using base mode...\n");
10512 board_config = ALC262_BASIC;
10516 if (board_config != ALC262_AUTO)
10517 setup_preset(spec, &alc262_presets[board_config]);
10519 spec->stream_name_analog = "ALC262 Analog";
10520 spec->stream_analog_playback = &alc262_pcm_analog_playback;
10521 spec->stream_analog_capture = &alc262_pcm_analog_capture;
10523 spec->stream_name_digital = "ALC262 Digital";
10524 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10525 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10527 spec->is_mix_capture = 1;
10528 if (!spec->adc_nids && spec->input_mux) {
10529 /* check whether NID 0x07 is valid */
10530 unsigned int wcap = get_wcaps(codec, 0x07);
10533 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10534 if (wcap != AC_WID_AUD_IN) {
10535 spec->adc_nids = alc262_adc_nids_alt;
10536 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
10537 spec->capsrc_nids = alc262_capsrc_nids_alt;
10539 spec->adc_nids = alc262_adc_nids;
10540 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
10541 spec->capsrc_nids = alc262_capsrc_nids;
10544 if (!spec->cap_mixer)
10545 set_capture_mixer(spec);
10547 spec->vmaster_nid = 0x0c;
10549 codec->patch_ops = alc_patch_ops;
10550 if (board_config == ALC262_AUTO)
10551 spec->init_hook = alc262_auto_init;
10552 #ifdef CONFIG_SND_HDA_POWER_SAVE
10553 if (!spec->loopback.amplist)
10554 spec->loopback.amplist = alc262_loopbacks;
10561 * ALC268 channel source setting (2 channel)
10563 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10564 #define alc268_modes alc260_modes
10566 static hda_nid_t alc268_dac_nids[2] = {
10571 static hda_nid_t alc268_adc_nids[2] = {
10576 static hda_nid_t alc268_adc_nids_alt[1] = {
10581 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
10583 static struct snd_kcontrol_new alc268_base_mixer[] = {
10584 /* output mixer control */
10585 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10586 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10587 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10589 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10590 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10591 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10595 /* bind Beep switches of both NID 0x0f and 0x10 */
10596 static struct hda_bind_ctls alc268_bind_beep_sw = {
10597 .ops = &snd_hda_bind_sw,
10599 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
10600 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
10605 static struct snd_kcontrol_new alc268_beep_mixer[] = {
10606 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
10607 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
10611 static struct hda_verb alc268_eapd_verbs[] = {
10612 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10613 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10617 /* Toshiba specific */
10618 #define alc268_toshiba_automute alc262_hippo_automute
10620 static struct hda_verb alc268_toshiba_verbs[] = {
10621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10625 static struct hda_input_mux alc268_acer_lc_capture_source = {
10633 /* Acer specific */
10634 /* bind volumes of both NID 0x02 and 0x03 */
10635 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
10636 .ops = &snd_hda_bind_vol,
10638 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
10639 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
10644 /* mute/unmute internal speaker according to the hp jack and mute state */
10645 static void alc268_acer_automute(struct hda_codec *codec, int force)
10647 struct alc_spec *spec = codec->spec;
10650 if (force || !spec->sense_updated) {
10651 unsigned int present;
10652 present = snd_hda_codec_read(codec, 0x14, 0,
10653 AC_VERB_GET_PIN_SENSE, 0);
10654 spec->jack_present = (present & 0x80000000) != 0;
10655 spec->sense_updated = 1;
10657 if (spec->jack_present)
10658 mute = HDA_AMP_MUTE; /* mute internal speaker */
10659 else /* unmute internal speaker if necessary */
10660 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10661 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10662 HDA_AMP_MUTE, mute);
10666 /* bind hp and internal speaker mute (with plug check) */
10667 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10668 struct snd_ctl_elem_value *ucontrol)
10670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10671 long *valp = ucontrol->value.integer.value;
10674 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10676 valp[0] ? 0 : HDA_AMP_MUTE);
10677 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10679 valp[1] ? 0 : HDA_AMP_MUTE);
10681 alc268_acer_automute(codec, 0);
10685 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10686 /* output mixer control */
10687 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10690 .name = "Master Playback Switch",
10691 .info = snd_hda_mixer_amp_switch_info,
10692 .get = snd_hda_mixer_amp_switch_get,
10693 .put = alc268_acer_master_sw_put,
10694 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10696 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10700 static struct snd_kcontrol_new alc268_acer_mixer[] = {
10701 /* output mixer control */
10702 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10705 .name = "Master Playback Switch",
10706 .info = snd_hda_mixer_amp_switch_info,
10707 .get = snd_hda_mixer_amp_switch_get,
10708 .put = alc268_acer_master_sw_put,
10709 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10711 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10712 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10713 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
10717 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10718 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10722 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10727 static struct hda_verb alc268_acer_verbs[] = {
10728 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10729 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10732 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10733 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10734 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10738 /* unsolicited event for HP jack sensing */
10739 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
10742 if ((res >> 26) != ALC880_HP_EVENT)
10744 alc268_toshiba_automute(codec);
10747 static void alc268_acer_unsol_event(struct hda_codec *codec,
10750 if ((res >> 26) != ALC880_HP_EVENT)
10752 alc268_acer_automute(codec, 1);
10755 static void alc268_acer_init_hook(struct hda_codec *codec)
10757 alc268_acer_automute(codec, 1);
10760 /* toggle speaker-output according to the hp-jack state */
10761 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10763 unsigned int present;
10764 unsigned char bits;
10766 present = snd_hda_codec_read(codec, 0x15, 0,
10767 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10768 bits = present ? AMP_IN_MUTE(0) : 0;
10769 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10770 AMP_IN_MUTE(0), bits);
10771 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10772 AMP_IN_MUTE(0), bits);
10776 static void alc268_acer_mic_automute(struct hda_codec *codec)
10778 unsigned int present;
10780 present = snd_hda_codec_read(codec, 0x18, 0,
10781 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10782 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10783 present ? 0x0 : 0x6);
10786 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10789 if ((res >> 26) == ALC880_HP_EVENT)
10790 alc268_aspire_one_speaker_automute(codec);
10791 if ((res >> 26) == ALC880_MIC_EVENT)
10792 alc268_acer_mic_automute(codec);
10795 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10797 alc268_aspire_one_speaker_automute(codec);
10798 alc268_acer_mic_automute(codec);
10801 static struct snd_kcontrol_new alc268_dell_mixer[] = {
10802 /* output mixer control */
10803 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10804 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10805 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10808 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
10812 static struct hda_verb alc268_dell_verbs[] = {
10813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10819 /* mute/unmute internal speaker according to the hp jack and mute state */
10820 static void alc268_dell_automute(struct hda_codec *codec)
10822 unsigned int present;
10825 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
10826 if (present & 0x80000000)
10827 mute = HDA_AMP_MUTE;
10829 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
10830 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10831 HDA_AMP_MUTE, mute);
10834 static void alc268_dell_unsol_event(struct hda_codec *codec,
10837 if ((res >> 26) != ALC880_HP_EVENT)
10839 alc268_dell_automute(codec);
10842 #define alc268_dell_init_hook alc268_dell_automute
10844 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10845 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10846 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10847 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10849 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10850 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10851 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10856 static struct hda_verb alc267_quanta_il1_verbs[] = {
10857 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10858 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10862 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10864 unsigned int present;
10866 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10867 & AC_PINSENSE_PRESENCE;
10868 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10869 present ? 0 : PIN_OUT);
10872 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10874 unsigned int present;
10876 present = snd_hda_codec_read(codec, 0x18, 0,
10877 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10878 snd_hda_codec_write(codec, 0x23, 0,
10879 AC_VERB_SET_CONNECT_SEL,
10880 present ? 0x00 : 0x01);
10883 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10885 alc267_quanta_il1_hp_automute(codec);
10886 alc267_quanta_il1_mic_automute(codec);
10889 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10892 switch (res >> 26) {
10893 case ALC880_HP_EVENT:
10894 alc267_quanta_il1_hp_automute(codec);
10896 case ALC880_MIC_EVENT:
10897 alc267_quanta_il1_mic_automute(codec);
10903 * generic initialization of ADC, input mixers and output mixers
10905 static struct hda_verb alc268_base_init_verbs[] = {
10906 /* Unmute DAC0-1 and set vol = 0 */
10907 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10908 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10909 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10910 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10911 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10912 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10915 * Set up output mixers (0x0c - 0x0e)
10917 /* set vol=0 to output mixers */
10918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10921 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10923 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10924 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10932 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10933 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10937 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10939 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10941 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10943 /* set PCBEEP vol = 0, mute connections */
10944 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10945 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10946 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10948 /* Unmute Selector 23h,24h and set the default input to mic-in */
10950 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10952 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10959 * generic initialization of ADC, input mixers and output mixers
10961 static struct hda_verb alc268_volume_init_verbs[] = {
10962 /* set output DAC */
10963 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10964 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10965 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10966 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10968 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10969 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10970 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10971 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10972 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10974 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10975 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10976 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10977 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10978 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10980 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10981 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10982 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10983 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10985 /* set PCBEEP vol = 0, mute connections */
10986 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10988 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10993 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10994 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10995 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10998 /* The multiple "Capture Source" controls confuse alsamixer
10999 * So call somewhat different..
11001 /* .name = "Capture Source", */
11002 .name = "Input Source",
11004 .info = alc_mux_enum_info,
11005 .get = alc_mux_enum_get,
11006 .put = alc_mux_enum_put,
11011 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11012 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11013 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11014 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11015 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11018 /* The multiple "Capture Source" controls confuse alsamixer
11019 * So call somewhat different..
11021 /* .name = "Capture Source", */
11022 .name = "Input Source",
11024 .info = alc_mux_enum_info,
11025 .get = alc_mux_enum_get,
11026 .put = alc_mux_enum_put,
11031 static struct hda_input_mux alc268_capture_source = {
11035 { "Front Mic", 0x1 },
11041 static struct hda_input_mux alc268_acer_capture_source = {
11045 { "Internal Mic", 0x6 },
11050 #ifdef CONFIG_SND_DEBUG
11051 static struct snd_kcontrol_new alc268_test_mixer[] = {
11052 /* Volume widgets */
11053 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11054 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11055 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11056 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11057 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11058 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11059 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11060 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11061 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11062 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11063 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11064 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11065 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11066 /* The below appears problematic on some hardwares */
11067 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11068 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11069 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11070 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11071 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11073 /* Modes for retasking pin widgets */
11074 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11075 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11076 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11077 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11079 /* Controls for GPIO pins, assuming they are configured as outputs */
11080 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11081 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11082 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11083 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11085 /* Switches to allow the digital SPDIF output pin to be enabled.
11086 * The ALC268 does not have an SPDIF input.
11088 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11090 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11091 * this output to turn on an external amplifier.
11093 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11094 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11100 /* create input playback/capture controls for the given pin */
11101 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11102 const char *ctlname, int idx)
11107 sprintf(name, "%s Playback Volume", ctlname);
11109 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11110 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11114 } else if (nid == 0x15) {
11115 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11116 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11122 sprintf(name, "%s Playback Switch", ctlname);
11123 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11124 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11130 /* add playback controls from the parsed DAC table */
11131 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11132 const struct auto_pin_cfg *cfg)
11137 spec->multiout.num_dacs = 2; /* only use one dac */
11138 spec->multiout.dac_nids = spec->private_dac_nids;
11139 spec->multiout.dac_nids[0] = 2;
11140 spec->multiout.dac_nids[1] = 3;
11142 nid = cfg->line_out_pins[0];
11144 alc268_new_analog_output(spec, nid, "Front", 0);
11146 nid = cfg->speaker_pins[0];
11148 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11149 "Speaker Playback Volume",
11150 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11154 nid = cfg->hp_pins[0];
11156 alc268_new_analog_output(spec, nid, "Headphone", 0);
11158 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11160 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11161 "Mono Playback Switch",
11162 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11169 /* create playback/capture controls for input pins */
11170 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11171 const struct auto_pin_cfg *cfg)
11173 struct hda_input_mux *imux = &spec->private_imux;
11176 for (i = 0; i < AUTO_PIN_LAST; i++) {
11177 switch(cfg->input_pins[i]) {
11179 idx1 = 0; /* Mic 1 */
11182 idx1 = 1; /* Mic 2 */
11185 idx1 = 2; /* Line In */
11192 idx1 = 6; /* digital mics */
11197 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11198 imux->items[imux->num_items].index = idx1;
11204 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11206 struct alc_spec *spec = codec->spec;
11207 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11208 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11209 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11210 unsigned int dac_vol1, dac_vol2;
11213 snd_hda_codec_write(codec, speaker_nid, 0,
11214 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11215 snd_hda_codec_write(codec, 0x0f, 0,
11216 AC_VERB_SET_AMP_GAIN_MUTE,
11218 snd_hda_codec_write(codec, 0x10, 0,
11219 AC_VERB_SET_AMP_GAIN_MUTE,
11222 snd_hda_codec_write(codec, 0x0f, 0,
11223 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11224 snd_hda_codec_write(codec, 0x10, 0,
11225 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11228 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11229 if (line_nid == 0x14)
11230 dac_vol2 = AMP_OUT_ZERO;
11231 else if (line_nid == 0x15)
11232 dac_vol1 = AMP_OUT_ZERO;
11233 if (hp_nid == 0x14)
11234 dac_vol2 = AMP_OUT_ZERO;
11235 else if (hp_nid == 0x15)
11236 dac_vol1 = AMP_OUT_ZERO;
11237 if (line_nid != 0x16 || hp_nid != 0x16 ||
11238 spec->autocfg.line_out_pins[1] != 0x16 ||
11239 spec->autocfg.line_out_pins[2] != 0x16)
11240 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11242 snd_hda_codec_write(codec, 0x02, 0,
11243 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11244 snd_hda_codec_write(codec, 0x03, 0,
11245 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11248 /* pcm configuration: identiacal with ALC880 */
11249 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11250 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11251 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11252 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11255 * BIOS auto configuration
11257 static int alc268_parse_auto_config(struct hda_codec *codec)
11259 struct alc_spec *spec = codec->spec;
11261 static hda_nid_t alc268_ignore[] = { 0 };
11263 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11267 if (!spec->autocfg.line_outs)
11268 return 0; /* can't find valid BIOS pin config */
11270 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11273 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11277 spec->multiout.max_channels = 2;
11279 /* digital only support output */
11280 if (spec->autocfg.dig_out_pin)
11281 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11283 if (spec->kctls.list)
11284 add_mixer(spec, spec->kctls.list);
11286 if (spec->autocfg.speaker_pins[0] != 0x1d)
11287 add_mixer(spec, alc268_beep_mixer);
11289 add_verb(spec, alc268_volume_init_verbs);
11290 spec->num_mux_defs = 1;
11291 spec->input_mux = &spec->private_imux;
11293 err = alc_auto_add_mic_boost(codec);
11297 store_pin_configs(codec);
11301 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11302 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11303 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11305 /* init callback for auto-configuration model -- overriding the default init */
11306 static void alc268_auto_init(struct hda_codec *codec)
11308 struct alc_spec *spec = codec->spec;
11309 alc268_auto_init_multi_out(codec);
11310 alc268_auto_init_hp_out(codec);
11311 alc268_auto_init_mono_speaker_out(codec);
11312 alc268_auto_init_analog_input(codec);
11313 if (spec->unsol_event)
11314 alc_inithook(codec);
11318 * configuration and preset
11320 static const char *alc268_models[ALC268_MODEL_LAST] = {
11321 [ALC267_QUANTA_IL1] = "quanta-il1",
11322 [ALC268_3ST] = "3stack",
11323 [ALC268_TOSHIBA] = "toshiba",
11324 [ALC268_ACER] = "acer",
11325 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
11326 [ALC268_DELL] = "dell",
11327 [ALC268_ZEPTO] = "zepto",
11328 #ifdef CONFIG_SND_DEBUG
11329 [ALC268_TEST] = "test",
11331 [ALC268_AUTO] = "auto",
11334 static struct snd_pci_quirk alc268_cfg_tbl[] = {
11335 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
11336 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
11337 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11338 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11339 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11340 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11341 ALC268_ACER_ASPIRE_ONE),
11342 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11343 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11344 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
11345 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
11346 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
11347 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
11348 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
11349 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
11350 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
11351 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
11355 static struct alc_config_preset alc268_presets[] = {
11356 [ALC267_QUANTA_IL1] = {
11357 .mixers = { alc267_quanta_il1_mixer },
11358 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11359 alc267_quanta_il1_verbs },
11360 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11361 .dac_nids = alc268_dac_nids,
11362 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11363 .adc_nids = alc268_adc_nids_alt,
11365 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11366 .channel_mode = alc268_modes,
11367 .input_mux = &alc268_capture_source,
11368 .unsol_event = alc267_quanta_il1_unsol_event,
11369 .init_hook = alc267_quanta_il1_automute,
11372 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11373 alc268_beep_mixer },
11374 .init_verbs = { alc268_base_init_verbs },
11375 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11376 .dac_nids = alc268_dac_nids,
11377 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11378 .adc_nids = alc268_adc_nids_alt,
11379 .capsrc_nids = alc268_capsrc_nids,
11381 .dig_out_nid = ALC268_DIGOUT_NID,
11382 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11383 .channel_mode = alc268_modes,
11384 .input_mux = &alc268_capture_source,
11386 [ALC268_TOSHIBA] = {
11387 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11388 alc268_beep_mixer },
11389 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11390 alc268_toshiba_verbs },
11391 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11392 .dac_nids = alc268_dac_nids,
11393 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11394 .adc_nids = alc268_adc_nids_alt,
11395 .capsrc_nids = alc268_capsrc_nids,
11397 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11398 .channel_mode = alc268_modes,
11399 .input_mux = &alc268_capture_source,
11400 .unsol_event = alc268_toshiba_unsol_event,
11401 .init_hook = alc268_toshiba_automute,
11404 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
11405 alc268_beep_mixer },
11406 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11407 alc268_acer_verbs },
11408 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11409 .dac_nids = alc268_dac_nids,
11410 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11411 .adc_nids = alc268_adc_nids_alt,
11412 .capsrc_nids = alc268_capsrc_nids,
11414 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11415 .channel_mode = alc268_modes,
11416 .input_mux = &alc268_acer_capture_source,
11417 .unsol_event = alc268_acer_unsol_event,
11418 .init_hook = alc268_acer_init_hook,
11420 [ALC268_ACER_ASPIRE_ONE] = {
11421 .mixers = { alc268_acer_aspire_one_mixer,
11422 alc268_capture_alt_mixer },
11423 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11424 alc268_acer_aspire_one_verbs },
11425 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11426 .dac_nids = alc268_dac_nids,
11427 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11428 .adc_nids = alc268_adc_nids_alt,
11429 .capsrc_nids = alc268_capsrc_nids,
11431 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11432 .channel_mode = alc268_modes,
11433 .input_mux = &alc268_acer_lc_capture_source,
11434 .unsol_event = alc268_acer_lc_unsol_event,
11435 .init_hook = alc268_acer_lc_init_hook,
11438 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11439 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11440 alc268_dell_verbs },
11441 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11442 .dac_nids = alc268_dac_nids,
11444 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11445 .channel_mode = alc268_modes,
11446 .unsol_event = alc268_dell_unsol_event,
11447 .init_hook = alc268_dell_init_hook,
11448 .input_mux = &alc268_capture_source,
11451 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
11452 alc268_beep_mixer },
11453 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11454 alc268_toshiba_verbs },
11455 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11456 .dac_nids = alc268_dac_nids,
11457 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11458 .adc_nids = alc268_adc_nids_alt,
11459 .capsrc_nids = alc268_capsrc_nids,
11461 .dig_out_nid = ALC268_DIGOUT_NID,
11462 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11463 .channel_mode = alc268_modes,
11464 .input_mux = &alc268_capture_source,
11465 .unsol_event = alc268_toshiba_unsol_event,
11466 .init_hook = alc268_toshiba_automute
11468 #ifdef CONFIG_SND_DEBUG
11470 .mixers = { alc268_test_mixer, alc268_capture_mixer },
11471 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11472 alc268_volume_init_verbs },
11473 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11474 .dac_nids = alc268_dac_nids,
11475 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11476 .adc_nids = alc268_adc_nids_alt,
11477 .capsrc_nids = alc268_capsrc_nids,
11479 .dig_out_nid = ALC268_DIGOUT_NID,
11480 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11481 .channel_mode = alc268_modes,
11482 .input_mux = &alc268_capture_source,
11487 static int patch_alc268(struct hda_codec *codec)
11489 struct alc_spec *spec;
11493 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
11497 codec->spec = spec;
11499 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
11503 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
11504 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
11505 "trying auto-probe from BIOS...\n");
11506 board_config = ALC268_AUTO;
11509 if (board_config == ALC268_AUTO) {
11510 /* automatic parse from the BIOS config */
11511 err = alc268_parse_auto_config(codec);
11517 "hda_codec: Cannot set up configuration "
11518 "from BIOS. Using base mode...\n");
11519 board_config = ALC268_3ST;
11523 if (board_config != ALC268_AUTO)
11524 setup_preset(spec, &alc268_presets[board_config]);
11526 if (codec->vendor_id == 0x10ec0267) {
11527 spec->stream_name_analog = "ALC267 Analog";
11528 spec->stream_name_digital = "ALC267 Digital";
11530 spec->stream_name_analog = "ALC268 Analog";
11531 spec->stream_name_digital = "ALC268 Digital";
11534 spec->stream_analog_playback = &alc268_pcm_analog_playback;
11535 spec->stream_analog_capture = &alc268_pcm_analog_capture;
11536 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
11538 spec->stream_digital_playback = &alc268_pcm_digital_playback;
11540 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
11541 /* override the amp caps for beep generator */
11542 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
11543 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
11544 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
11545 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11546 (0 << AC_AMPCAP_MUTE_SHIFT));
11548 if (!spec->adc_nids && spec->input_mux) {
11549 /* check whether NID 0x07 is valid */
11550 unsigned int wcap = get_wcaps(codec, 0x07);
11554 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11555 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
11556 spec->adc_nids = alc268_adc_nids_alt;
11557 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
11558 add_mixer(spec, alc268_capture_alt_mixer);
11560 spec->adc_nids = alc268_adc_nids;
11561 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
11562 add_mixer(spec, alc268_capture_mixer);
11564 spec->capsrc_nids = alc268_capsrc_nids;
11565 /* set default input source */
11566 for (i = 0; i < spec->num_adc_nids; i++)
11567 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
11568 0, AC_VERB_SET_CONNECT_SEL,
11569 spec->input_mux->items[0].index);
11572 spec->vmaster_nid = 0x02;
11574 codec->patch_ops = alc_patch_ops;
11575 if (board_config == ALC268_AUTO)
11576 spec->init_hook = alc268_auto_init;
11582 * ALC269 channel source setting (2 channel)
11584 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11586 #define alc269_dac_nids alc260_dac_nids
11588 static hda_nid_t alc269_adc_nids[1] = {
11593 static hda_nid_t alc269_capsrc_nids[1] = {
11597 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11601 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
11609 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
11617 #define alc269_modes alc260_modes
11618 #define alc269_capture_source alc880_lg_lw_capture_source
11620 static struct snd_kcontrol_new alc269_base_mixer[] = {
11621 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11622 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11623 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11624 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11627 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11628 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11629 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11630 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11632 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11634 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11638 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
11639 /* output mixer control */
11640 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11643 .name = "Master Playback Switch",
11644 .info = snd_hda_mixer_amp_switch_info,
11645 .get = snd_hda_mixer_amp_switch_get,
11646 .put = alc268_acer_master_sw_put,
11647 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11651 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11652 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11653 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11654 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11655 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),
11656 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),
11660 /* bind volumes of both NID 0x0c and 0x0d */
11661 static struct hda_bind_ctls alc269_epc_bind_vol = {
11662 .ops = &snd_hda_bind_vol,
11664 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11665 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11670 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
11671 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11672 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
11673 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11677 /* capture mixer elements */
11678 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
11679 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11680 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11686 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
11687 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11689 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
11694 static struct snd_kcontrol_new alc269_beep_mixer[] = {
11695 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),
11696 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),
11700 static struct hda_verb alc269_quanta_fl1_verbs[] = {
11701 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11702 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11704 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11705 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11706 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11710 /* toggle speaker-output according to the hp-jack state */
11711 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
11713 unsigned int present;
11714 unsigned char bits;
11716 present = snd_hda_codec_read(codec, 0x15, 0,
11717 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11718 bits = present ? AMP_IN_MUTE(0) : 0;
11719 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11720 AMP_IN_MUTE(0), bits);
11721 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11722 AMP_IN_MUTE(0), bits);
11724 snd_hda_codec_write(codec, 0x20, 0,
11725 AC_VERB_SET_COEF_INDEX, 0x0c);
11726 snd_hda_codec_write(codec, 0x20, 0,
11727 AC_VERB_SET_PROC_COEF, 0x680);
11729 snd_hda_codec_write(codec, 0x20, 0,
11730 AC_VERB_SET_COEF_INDEX, 0x0c);
11731 snd_hda_codec_write(codec, 0x20, 0,
11732 AC_VERB_SET_PROC_COEF, 0x480);
11735 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
11737 unsigned int present;
11739 present = snd_hda_codec_read(codec, 0x18, 0,
11740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11741 snd_hda_codec_write(codec, 0x23, 0,
11742 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
11745 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
11748 if ((res >> 26) == ALC880_HP_EVENT)
11749 alc269_quanta_fl1_speaker_automute(codec);
11750 if ((res >> 26) == ALC880_MIC_EVENT)
11751 alc269_quanta_fl1_mic_automute(codec);
11754 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
11756 alc269_quanta_fl1_speaker_automute(codec);
11757 alc269_quanta_fl1_mic_automute(codec);
11760 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
11761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11762 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
11763 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11764 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
11765 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11766 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11771 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
11772 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11773 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
11774 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
11775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
11776 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11777 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11781 /* toggle speaker-output according to the hp-jack state */
11782 static void alc269_speaker_automute(struct hda_codec *codec)
11784 unsigned int present;
11785 unsigned char bits;
11787 present = snd_hda_codec_read(codec, 0x15, 0,
11788 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11789 bits = present ? AMP_IN_MUTE(0) : 0;
11790 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
11791 AMP_IN_MUTE(0), bits);
11792 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
11793 AMP_IN_MUTE(0), bits);
11796 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
11798 unsigned int present;
11800 present = snd_hda_codec_read(codec, 0x18, 0,
11801 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11802 snd_hda_codec_write(codec, 0x23, 0,
11803 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
11806 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
11808 unsigned int present;
11810 present = snd_hda_codec_read(codec, 0x18, 0,
11811 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11812 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11813 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
11814 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11815 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
11818 /* unsolicited event for HP jack sensing */
11819 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
11822 if ((res >> 26) == ALC880_HP_EVENT)
11823 alc269_speaker_automute(codec);
11825 if ((res >> 26) == ALC880_MIC_EVENT)
11826 alc269_eeepc_dmic_automute(codec);
11829 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
11831 alc269_speaker_automute(codec);
11832 alc269_eeepc_dmic_automute(codec);
11835 /* unsolicited event for HP jack sensing */
11836 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
11839 if ((res >> 26) == ALC880_HP_EVENT)
11840 alc269_speaker_automute(codec);
11842 if ((res >> 26) == ALC880_MIC_EVENT)
11843 alc269_eeepc_amic_automute(codec);
11846 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
11848 alc269_speaker_automute(codec);
11849 alc269_eeepc_amic_automute(codec);
11853 * generic initialization of ADC, input mixers and output mixers
11855 static struct hda_verb alc269_init_verbs[] = {
11857 * Unmute ADC0 and set the default input to mic-in
11859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11861 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11862 * analog-loopback mixer widget
11863 * Note: PASD motherboards uses the Line In 2 as the input for
11864 * front panel mic (mic 2)
11866 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11874 * Set up output mixers (0x0c - 0x0e)
11876 /* set vol=0 to output mixers */
11877 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11878 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11880 /* set up input amps for analog loopback */
11881 /* Amp Indices: DAC = 0, mixer = 1 */
11882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11885 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11887 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11889 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11892 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11893 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11894 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11897 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11899 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11902 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11905 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11906 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11908 /* FIXME: use matrix-type input source selection */
11909 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11910 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11917 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11918 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11922 /* add playback controls from the parsed DAC table */
11923 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
11924 const struct auto_pin_cfg *cfg)
11929 spec->multiout.num_dacs = 1; /* only use one dac */
11930 spec->multiout.dac_nids = spec->private_dac_nids;
11931 spec->multiout.dac_nids[0] = 2;
11933 nid = cfg->line_out_pins[0];
11935 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11936 "Front Playback Volume",
11937 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
11940 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11941 "Front Playback Switch",
11942 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11947 nid = cfg->speaker_pins[0];
11949 if (!cfg->line_out_pins[0]) {
11950 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11951 "Speaker Playback Volume",
11952 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11958 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11959 "Speaker Playback Switch",
11960 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11965 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11966 "Speaker Playback Switch",
11967 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11973 nid = cfg->hp_pins[0];
11975 /* spec->multiout.hp_nid = 2; */
11976 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
11977 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11978 "Headphone Playback Volume",
11979 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11985 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11986 "Headphone Playback Switch",
11987 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11992 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11993 "Headphone Playback Switch",
11994 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12003 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12004 const struct auto_pin_cfg *cfg)
12008 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12011 /* digital-mic input pin is excluded in alc880_auto_create..()
12012 * because it's under 0x18
12014 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12015 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12016 struct hda_input_mux *imux = &spec->private_imux;
12017 imux->items[imux->num_items].label = "Int Mic";
12018 imux->items[imux->num_items].index = 0x05;
12024 #ifdef CONFIG_SND_HDA_POWER_SAVE
12025 #define alc269_loopbacks alc880_loopbacks
12028 /* pcm configuration: identiacal with ALC880 */
12029 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12030 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12031 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12032 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12035 * BIOS auto configuration
12037 static int alc269_parse_auto_config(struct hda_codec *codec)
12039 struct alc_spec *spec = codec->spec;
12041 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12043 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12048 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12051 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12055 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12057 if (spec->autocfg.dig_out_pin)
12058 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12060 if (spec->kctls.list)
12061 add_mixer(spec, spec->kctls.list);
12063 /* create a beep mixer control if the pin 0x1d isn't assigned */
12064 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)
12065 if (spec->autocfg.input_pins[i] == 0x1d)
12067 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))
12068 add_mixer(spec, alc269_beep_mixer);
12070 add_verb(spec, alc269_init_verbs);
12071 spec->num_mux_defs = 1;
12072 spec->input_mux = &spec->private_imux;
12073 /* set default input source */
12074 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12075 0, AC_VERB_SET_CONNECT_SEL,
12076 spec->input_mux->items[0].index);
12078 err = alc_auto_add_mic_boost(codec);
12082 if (!spec->cap_mixer)
12083 set_capture_mixer(spec);
12085 store_pin_configs(codec);
12089 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12090 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12091 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12094 /* init callback for auto-configuration model -- overriding the default init */
12095 static void alc269_auto_init(struct hda_codec *codec)
12097 struct alc_spec *spec = codec->spec;
12098 alc269_auto_init_multi_out(codec);
12099 alc269_auto_init_hp_out(codec);
12100 alc269_auto_init_analog_input(codec);
12101 if (spec->unsol_event)
12102 alc_inithook(codec);
12106 * configuration and preset
12108 static const char *alc269_models[ALC269_MODEL_LAST] = {
12109 [ALC269_BASIC] = "basic",
12110 [ALC269_QUANTA_FL1] = "quanta",
12111 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12112 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12113 [ALC269_FUJITSU] = "fujitsu"
12116 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12117 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12118 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12119 ALC269_ASUS_EEEPC_P703),
12120 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12121 ALC269_ASUS_EEEPC_P901),
12122 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12123 ALC269_ASUS_EEEPC_P901),
12124 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12128 static struct alc_config_preset alc269_presets[] = {
12130 .mixers = { alc269_base_mixer },
12131 .init_verbs = { alc269_init_verbs },
12132 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12133 .dac_nids = alc269_dac_nids,
12135 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12136 .channel_mode = alc269_modes,
12137 .input_mux = &alc269_capture_source,
12139 [ALC269_QUANTA_FL1] = {
12140 .mixers = { alc269_quanta_fl1_mixer },
12141 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12142 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12143 .dac_nids = alc269_dac_nids,
12145 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12146 .channel_mode = alc269_modes,
12147 .input_mux = &alc269_capture_source,
12148 .unsol_event = alc269_quanta_fl1_unsol_event,
12149 .init_hook = alc269_quanta_fl1_init_hook,
12151 [ALC269_ASUS_EEEPC_P703] = {
12152 .mixers = { alc269_eeepc_mixer },
12153 .cap_mixer = alc269_epc_capture_mixer,
12154 .init_verbs = { alc269_init_verbs,
12155 alc269_eeepc_amic_init_verbs },
12156 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12157 .dac_nids = alc269_dac_nids,
12159 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12160 .channel_mode = alc269_modes,
12161 .input_mux = &alc269_eeepc_amic_capture_source,
12162 .unsol_event = alc269_eeepc_amic_unsol_event,
12163 .init_hook = alc269_eeepc_amic_inithook,
12165 [ALC269_ASUS_EEEPC_P901] = {
12166 .mixers = { alc269_eeepc_mixer },
12167 .cap_mixer = alc269_epc_capture_mixer,
12168 .init_verbs = { alc269_init_verbs,
12169 alc269_eeepc_dmic_init_verbs },
12170 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12171 .dac_nids = alc269_dac_nids,
12173 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12174 .channel_mode = alc269_modes,
12175 .input_mux = &alc269_eeepc_dmic_capture_source,
12176 .unsol_event = alc269_eeepc_dmic_unsol_event,
12177 .init_hook = alc269_eeepc_dmic_inithook,
12179 [ALC269_FUJITSU] = {
12180 .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer },
12181 .cap_mixer = alc269_epc_capture_mixer,
12182 .init_verbs = { alc269_init_verbs,
12183 alc269_eeepc_dmic_init_verbs },
12184 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12185 .dac_nids = alc269_dac_nids,
12187 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12188 .channel_mode = alc269_modes,
12189 .input_mux = &alc269_eeepc_dmic_capture_source,
12190 .unsol_event = alc269_eeepc_dmic_unsol_event,
12191 .init_hook = alc269_eeepc_dmic_inithook,
12195 static int patch_alc269(struct hda_codec *codec)
12197 struct alc_spec *spec;
12201 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12205 codec->spec = spec;
12207 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12209 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
12213 if (board_config < 0) {
12214 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
12215 "trying auto-probe from BIOS...\n");
12216 board_config = ALC269_AUTO;
12219 if (board_config == ALC269_AUTO) {
12220 /* automatic parse from the BIOS config */
12221 err = alc269_parse_auto_config(codec);
12227 "hda_codec: Cannot set up configuration "
12228 "from BIOS. Using base mode...\n");
12229 board_config = ALC269_BASIC;
12233 if (board_config != ALC269_AUTO)
12234 setup_preset(spec, &alc269_presets[board_config]);
12236 spec->stream_name_analog = "ALC269 Analog";
12237 spec->stream_analog_playback = &alc269_pcm_analog_playback;
12238 spec->stream_analog_capture = &alc269_pcm_analog_capture;
12240 spec->stream_name_digital = "ALC269 Digital";
12241 spec->stream_digital_playback = &alc269_pcm_digital_playback;
12242 spec->stream_digital_capture = &alc269_pcm_digital_capture;
12244 spec->adc_nids = alc269_adc_nids;
12245 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
12246 spec->capsrc_nids = alc269_capsrc_nids;
12247 if (!spec->cap_mixer)
12248 set_capture_mixer(spec);
12250 codec->patch_ops = alc_patch_ops;
12251 if (board_config == ALC269_AUTO)
12252 spec->init_hook = alc269_auto_init;
12253 #ifdef CONFIG_SND_HDA_POWER_SAVE
12254 if (!spec->loopback.amplist)
12255 spec->loopback.amplist = alc269_loopbacks;
12262 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12266 * set the path ways for 2 channel output
12267 * need to set the codec line out and mic 1 pin widgets to inputs
12269 static struct hda_verb alc861_threestack_ch2_init[] = {
12270 /* set pin widget 1Ah (line in) for input */
12271 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12272 /* set pin widget 18h (mic1/2) for input, for mic also enable
12275 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12277 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12279 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12280 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12286 * need to set the codec line out and mic 1 pin widgets to outputs
12288 static struct hda_verb alc861_threestack_ch6_init[] = {
12289 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12290 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12291 /* set pin widget 18h (mic1) for output (CLFE)*/
12292 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12294 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12295 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12297 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12300 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12305 static struct hda_channel_mode alc861_threestack_modes[2] = {
12306 { 2, alc861_threestack_ch2_init },
12307 { 6, alc861_threestack_ch6_init },
12309 /* Set mic1 as input and unmute the mixer */
12310 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
12311 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12312 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12315 /* Set mic1 as output and mute mixer */
12316 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
12317 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12318 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12322 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
12323 { 2, alc861_uniwill_m31_ch2_init },
12324 { 4, alc861_uniwill_m31_ch4_init },
12327 /* Set mic1 and line-in as input and unmute the mixer */
12328 static struct hda_verb alc861_asus_ch2_init[] = {
12329 /* set pin widget 1Ah (line in) for input */
12330 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12331 /* set pin widget 18h (mic1/2) for input, for mic also enable
12334 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12336 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
12338 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
12339 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
12343 /* Set mic1 nad line-in as output and mute mixer */
12344 static struct hda_verb alc861_asus_ch6_init[] = {
12345 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12346 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12347 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12348 /* set pin widget 18h (mic1) for output (CLFE)*/
12349 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12350 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12351 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
12352 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
12354 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
12356 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
12357 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
12362 static struct hda_channel_mode alc861_asus_modes[2] = {
12363 { 2, alc861_asus_ch2_init },
12364 { 6, alc861_asus_ch6_init },
12369 static struct snd_kcontrol_new alc861_base_mixer[] = {
12370 /* output mixer control */
12371 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12372 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12373 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12375 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12377 /*Input mixer control */
12378 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12379 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12380 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12381 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12382 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12383 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12385 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12386 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12387 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12392 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
12393 /* output mixer control */
12394 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12395 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12396 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12397 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12398 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12400 /* Input mixer control */
12401 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12402 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12403 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12404 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12405 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12406 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12408 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12409 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12413 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12414 .name = "Channel Mode",
12415 .info = alc_ch_mode_info,
12416 .get = alc_ch_mode_get,
12417 .put = alc_ch_mode_put,
12418 .private_value = ARRAY_SIZE(alc861_threestack_modes),
12423 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
12424 /* output mixer control */
12425 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12427 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12432 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
12433 /* output mixer control */
12434 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12435 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12436 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12437 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12438 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12440 /* Input mixer control */
12441 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12442 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12443 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12444 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12445 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12446 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12448 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12449 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12450 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
12453 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12454 .name = "Channel Mode",
12455 .info = alc_ch_mode_info,
12456 .get = alc_ch_mode_get,
12457 .put = alc_ch_mode_put,
12458 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
12463 static struct snd_kcontrol_new alc861_asus_mixer[] = {
12464 /* output mixer control */
12465 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12466 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
12467 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
12468 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
12469 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
12471 /* Input mixer control */
12472 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12473 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12474 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12475 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12476 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
12477 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
12478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
12479 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
12480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
12481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
12484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12485 .name = "Channel Mode",
12486 .info = alc_ch_mode_info,
12487 .get = alc_ch_mode_get,
12488 .put = alc_ch_mode_put,
12489 .private_value = ARRAY_SIZE(alc861_asus_modes),
12494 /* additional mixer */
12495 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
12496 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
12497 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
12498 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
12499 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
12504 * generic initialization of ADC, input mixers and output mixers
12506 static struct hda_verb alc861_base_init_verbs[] = {
12508 * Unmute ADC0 and set the default input to mic-in
12510 /* port-A for surround (rear panel) */
12511 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12512 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
12513 /* port-B for mic-in (rear panel) with vref */
12514 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12515 /* port-C for line-in (rear panel) */
12516 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12517 /* port-D for Front */
12518 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12519 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12520 /* port-E for HP out (front panel) */
12521 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12522 /* route front PCM to HP */
12523 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12524 /* port-F for mic-in (front panel) with vref */
12525 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12526 /* port-G for CLFE (rear panel) */
12527 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12528 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12529 /* port-H for side (rear panel) */
12530 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12531 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
12533 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12534 /* route front mic to ADC1*/
12535 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12538 /* Unmute DAC0~3 & spdif out*/
12539 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12540 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12541 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12542 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12545 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12546 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12547 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12548 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12549 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12551 /* Unmute Stereo Mixer 15 */
12552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12553 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12554 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12555 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12557 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12558 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12559 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12560 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12561 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12562 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12563 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12565 /* hp used DAC 3 (Front) */
12566 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12567 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12572 static struct hda_verb alc861_threestack_init_verbs[] = {
12574 * Unmute ADC0 and set the default input to mic-in
12576 /* port-A for surround (rear panel) */
12577 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12578 /* port-B for mic-in (rear panel) with vref */
12579 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12580 /* port-C for line-in (rear panel) */
12581 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12582 /* port-D for Front */
12583 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12584 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12585 /* port-E for HP out (front panel) */
12586 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
12587 /* route front PCM to HP */
12588 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12589 /* port-F for mic-in (front panel) with vref */
12590 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12591 /* port-G for CLFE (rear panel) */
12592 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12593 /* port-H for side (rear panel) */
12594 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12596 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12597 /* route front mic to ADC1*/
12598 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12600 /* Unmute DAC0~3 & spdif out*/
12601 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12602 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12603 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12604 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12607 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12608 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12609 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12610 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12611 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12613 /* Unmute Stereo Mixer 15 */
12614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12620 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12621 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12622 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12623 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12626 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12627 /* hp used DAC 3 (Front) */
12628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12633 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
12635 * Unmute ADC0 and set the default input to mic-in
12637 /* port-A for surround (rear panel) */
12638 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12639 /* port-B for mic-in (rear panel) with vref */
12640 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12641 /* port-C for line-in (rear panel) */
12642 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12643 /* port-D for Front */
12644 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12645 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12646 /* port-E for HP out (front panel) */
12647 /* this has to be set to VREF80 */
12648 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12649 /* route front PCM to HP */
12650 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12651 /* port-F for mic-in (front panel) with vref */
12652 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12653 /* port-G for CLFE (rear panel) */
12654 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12655 /* port-H for side (rear panel) */
12656 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12658 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12659 /* route front mic to ADC1*/
12660 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12662 /* Unmute DAC0~3 & spdif out*/
12663 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12665 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12666 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12669 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12670 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12671 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12672 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12673 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12675 /* Unmute Stereo Mixer 15 */
12676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12683 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12689 /* hp used DAC 3 (Front) */
12690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12695 static struct hda_verb alc861_asus_init_verbs[] = {
12697 * Unmute ADC0 and set the default input to mic-in
12699 /* port-A for surround (rear panel)
12700 * according to codec#0 this is the HP jack
12702 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
12703 /* route front PCM to HP */
12704 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
12705 /* port-B for mic-in (rear panel) with vref */
12706 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12707 /* port-C for line-in (rear panel) */
12708 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12709 /* port-D for Front */
12710 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12711 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
12712 /* port-E for HP out (front panel) */
12713 /* this has to be set to VREF80 */
12714 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12715 /* route front PCM to HP */
12716 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
12717 /* port-F for mic-in (front panel) with vref */
12718 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
12719 /* port-G for CLFE (rear panel) */
12720 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12721 /* port-H for side (rear panel) */
12722 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
12724 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
12725 /* route front mic to ADC1*/
12726 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12727 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12728 /* Unmute DAC0~3 & spdif out*/
12729 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12730 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12732 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12734 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12735 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12736 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12737 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12738 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12740 /* Unmute Stereo Mixer 15 */
12741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
12746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12750 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12754 /* hp used DAC 3 (Front) */
12755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12760 /* additional init verbs for ASUS laptops */
12761 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
12762 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
12763 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
12768 * generic initialization of ADC, input mixers and output mixers
12770 static struct hda_verb alc861_auto_init_verbs[] = {
12772 * Unmute ADC0 and set the default input to mic-in
12774 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12777 /* Unmute DAC0~3 & spdif out*/
12778 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12779 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12781 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12784 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12785 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12786 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12787 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12788 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12790 /* Unmute Stereo Mixer 15 */
12791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
12796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12799 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12806 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12807 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12808 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12809 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12810 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12812 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
12814 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
12819 static struct hda_verb alc861_toshiba_init_verbs[] = {
12820 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12825 /* toggle speaker-output according to the hp-jack state */
12826 static void alc861_toshiba_automute(struct hda_codec *codec)
12828 unsigned int present;
12830 present = snd_hda_codec_read(codec, 0x0f, 0,
12831 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12832 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
12833 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12834 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
12835 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
12838 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
12841 if ((res >> 26) == ALC880_HP_EVENT)
12842 alc861_toshiba_automute(codec);
12845 /* pcm configuration: identiacal with ALC880 */
12846 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12847 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12848 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12849 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12852 #define ALC861_DIGOUT_NID 0x07
12854 static struct hda_channel_mode alc861_8ch_modes[1] = {
12858 static hda_nid_t alc861_dac_nids[4] = {
12859 /* front, surround, clfe, side */
12860 0x03, 0x06, 0x05, 0x04
12863 static hda_nid_t alc660_dac_nids[3] = {
12864 /* front, clfe, surround */
12868 static hda_nid_t alc861_adc_nids[1] = {
12873 static struct hda_input_mux alc861_capture_source = {
12877 { "Front Mic", 0x3 },
12884 /* fill in the dac_nids table from the parsed pin configuration */
12885 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
12886 const struct auto_pin_cfg *cfg)
12891 spec->multiout.dac_nids = spec->private_dac_nids;
12892 for (i = 0; i < cfg->line_outs; i++) {
12893 nid = cfg->line_out_pins[i];
12895 if (i >= ARRAY_SIZE(alc861_dac_nids))
12897 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
12900 spec->multiout.num_dacs = cfg->line_outs;
12904 /* add playback controls from the parsed DAC table */
12905 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
12906 const struct auto_pin_cfg *cfg)
12909 static const char *chname[4] = {
12910 "Front", "Surround", NULL /*CLFE*/, "Side"
12915 for (i = 0; i < cfg->line_outs; i++) {
12916 nid = spec->multiout.dac_nids[i];
12921 err = add_control(spec, ALC_CTL_BIND_MUTE,
12922 "Center Playback Switch",
12923 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12927 err = add_control(spec, ALC_CTL_BIND_MUTE,
12928 "LFE Playback Switch",
12929 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12934 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
12936 if (nid == alc861_dac_nids[idx])
12938 sprintf(name, "%s Playback Switch", chname[idx]);
12939 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12940 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12949 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
12957 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
12959 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12960 "Headphone Playback Switch",
12961 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12964 spec->multiout.hp_nid = nid;
12969 /* create playback/capture controls for input pins */
12970 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
12971 const struct auto_pin_cfg *cfg)
12973 struct hda_input_mux *imux = &spec->private_imux;
12974 int i, err, idx, idx1;
12976 for (i = 0; i < AUTO_PIN_LAST; i++) {
12977 switch (cfg->input_pins[i]) {
12980 idx = 2; /* Line In */
12984 idx = 2; /* Line In */
12988 idx = 1; /* Mic In */
12992 idx = 1; /* Mic In */
13002 err = new_analog_input(spec, cfg->input_pins[i],
13003 auto_pin_cfg_labels[i], idx, 0x15);
13007 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13008 imux->items[imux->num_items].index = idx1;
13014 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13016 int pin_type, int dac_idx)
13018 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13020 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13024 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13026 struct alc_spec *spec = codec->spec;
13029 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13030 for (i = 0; i < spec->autocfg.line_outs; i++) {
13031 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13032 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13034 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13035 spec->multiout.dac_nids[i]);
13039 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13041 struct alc_spec *spec = codec->spec;
13044 pin = spec->autocfg.hp_pins[0];
13045 if (pin) /* connect to front */
13046 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13047 spec->multiout.dac_nids[0]);
13048 pin = spec->autocfg.speaker_pins[0];
13050 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13053 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13055 struct alc_spec *spec = codec->spec;
13058 for (i = 0; i < AUTO_PIN_LAST; i++) {
13059 hda_nid_t nid = spec->autocfg.input_pins[i];
13060 if (nid >= 0x0c && nid <= 0x11) {
13061 snd_hda_codec_write(codec, nid, 0,
13062 AC_VERB_SET_PIN_WIDGET_CONTROL,
13063 i <= AUTO_PIN_FRONT_MIC ?
13064 PIN_VREF80 : PIN_IN);
13069 /* parse the BIOS configuration and set up the alc_spec */
13070 /* return 1 if successful, 0 if the proper config is not found,
13071 * or a negative error code
13073 static int alc861_parse_auto_config(struct hda_codec *codec)
13075 struct alc_spec *spec = codec->spec;
13077 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13079 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13083 if (!spec->autocfg.line_outs)
13084 return 0; /* can't find valid BIOS pin config */
13086 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13089 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13092 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13095 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13099 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13101 if (spec->autocfg.dig_out_pin)
13102 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13104 if (spec->kctls.list)
13105 add_mixer(spec, spec->kctls.list);
13107 add_verb(spec, alc861_auto_init_verbs);
13109 spec->num_mux_defs = 1;
13110 spec->input_mux = &spec->private_imux;
13112 spec->adc_nids = alc861_adc_nids;
13113 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13114 set_capture_mixer(spec);
13116 store_pin_configs(codec);
13120 /* additional initialization for auto-configuration model */
13121 static void alc861_auto_init(struct hda_codec *codec)
13123 struct alc_spec *spec = codec->spec;
13124 alc861_auto_init_multi_out(codec);
13125 alc861_auto_init_hp_out(codec);
13126 alc861_auto_init_analog_input(codec);
13127 if (spec->unsol_event)
13128 alc_inithook(codec);
13131 #ifdef CONFIG_SND_HDA_POWER_SAVE
13132 static struct hda_amp_list alc861_loopbacks[] = {
13133 { 0x15, HDA_INPUT, 0 },
13134 { 0x15, HDA_INPUT, 1 },
13135 { 0x15, HDA_INPUT, 2 },
13136 { 0x15, HDA_INPUT, 3 },
13143 * configuration and preset
13145 static const char *alc861_models[ALC861_MODEL_LAST] = {
13146 [ALC861_3ST] = "3stack",
13147 [ALC660_3ST] = "3stack-660",
13148 [ALC861_3ST_DIG] = "3stack-dig",
13149 [ALC861_6ST_DIG] = "6stack-dig",
13150 [ALC861_UNIWILL_M31] = "uniwill-m31",
13151 [ALC861_TOSHIBA] = "toshiba",
13152 [ALC861_ASUS] = "asus",
13153 [ALC861_ASUS_LAPTOP] = "asus-laptop",
13154 [ALC861_AUTO] = "auto",
13157 static struct snd_pci_quirk alc861_cfg_tbl[] = {
13158 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
13159 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13160 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
13161 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
13162 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
13163 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
13164 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
13165 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13166 * Any other models that need this preset?
13168 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13169 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
13170 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
13171 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
13172 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
13173 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
13174 /* FIXME: the below seems conflict */
13175 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13176 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
13177 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
13181 static struct alc_config_preset alc861_presets[] = {
13183 .mixers = { alc861_3ST_mixer },
13184 .init_verbs = { alc861_threestack_init_verbs },
13185 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13186 .dac_nids = alc861_dac_nids,
13187 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13188 .channel_mode = alc861_threestack_modes,
13190 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13191 .adc_nids = alc861_adc_nids,
13192 .input_mux = &alc861_capture_source,
13194 [ALC861_3ST_DIG] = {
13195 .mixers = { alc861_base_mixer },
13196 .init_verbs = { alc861_threestack_init_verbs },
13197 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13198 .dac_nids = alc861_dac_nids,
13199 .dig_out_nid = ALC861_DIGOUT_NID,
13200 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13201 .channel_mode = alc861_threestack_modes,
13203 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13204 .adc_nids = alc861_adc_nids,
13205 .input_mux = &alc861_capture_source,
13207 [ALC861_6ST_DIG] = {
13208 .mixers = { alc861_base_mixer },
13209 .init_verbs = { alc861_base_init_verbs },
13210 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13211 .dac_nids = alc861_dac_nids,
13212 .dig_out_nid = ALC861_DIGOUT_NID,
13213 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
13214 .channel_mode = alc861_8ch_modes,
13215 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13216 .adc_nids = alc861_adc_nids,
13217 .input_mux = &alc861_capture_source,
13220 .mixers = { alc861_3ST_mixer },
13221 .init_verbs = { alc861_threestack_init_verbs },
13222 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
13223 .dac_nids = alc660_dac_nids,
13224 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
13225 .channel_mode = alc861_threestack_modes,
13227 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13228 .adc_nids = alc861_adc_nids,
13229 .input_mux = &alc861_capture_source,
13231 [ALC861_UNIWILL_M31] = {
13232 .mixers = { alc861_uniwill_m31_mixer },
13233 .init_verbs = { alc861_uniwill_m31_init_verbs },
13234 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13235 .dac_nids = alc861_dac_nids,
13236 .dig_out_nid = ALC861_DIGOUT_NID,
13237 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
13238 .channel_mode = alc861_uniwill_m31_modes,
13240 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13241 .adc_nids = alc861_adc_nids,
13242 .input_mux = &alc861_capture_source,
13244 [ALC861_TOSHIBA] = {
13245 .mixers = { alc861_toshiba_mixer },
13246 .init_verbs = { alc861_base_init_verbs,
13247 alc861_toshiba_init_verbs },
13248 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13249 .dac_nids = alc861_dac_nids,
13250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13251 .channel_mode = alc883_3ST_2ch_modes,
13252 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13253 .adc_nids = alc861_adc_nids,
13254 .input_mux = &alc861_capture_source,
13255 .unsol_event = alc861_toshiba_unsol_event,
13256 .init_hook = alc861_toshiba_automute,
13259 .mixers = { alc861_asus_mixer },
13260 .init_verbs = { alc861_asus_init_verbs },
13261 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13262 .dac_nids = alc861_dac_nids,
13263 .dig_out_nid = ALC861_DIGOUT_NID,
13264 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
13265 .channel_mode = alc861_asus_modes,
13268 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13269 .adc_nids = alc861_adc_nids,
13270 .input_mux = &alc861_capture_source,
13272 [ALC861_ASUS_LAPTOP] = {
13273 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
13274 .init_verbs = { alc861_asus_init_verbs,
13275 alc861_asus_laptop_init_verbs },
13276 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
13277 .dac_nids = alc861_dac_nids,
13278 .dig_out_nid = ALC861_DIGOUT_NID,
13279 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
13280 .channel_mode = alc883_3ST_2ch_modes,
13282 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
13283 .adc_nids = alc861_adc_nids,
13284 .input_mux = &alc861_capture_source,
13289 static int patch_alc861(struct hda_codec *codec)
13291 struct alc_spec *spec;
13295 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13299 codec->spec = spec;
13301 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
13305 if (board_config < 0) {
13306 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
13307 "trying auto-probe from BIOS...\n");
13308 board_config = ALC861_AUTO;
13311 if (board_config == ALC861_AUTO) {
13312 /* automatic parse from the BIOS config */
13313 err = alc861_parse_auto_config(codec);
13319 "hda_codec: Cannot set up configuration "
13320 "from BIOS. Using base mode...\n");
13321 board_config = ALC861_3ST_DIG;
13325 if (board_config != ALC861_AUTO)
13326 setup_preset(spec, &alc861_presets[board_config]);
13328 spec->stream_name_analog = "ALC861 Analog";
13329 spec->stream_analog_playback = &alc861_pcm_analog_playback;
13330 spec->stream_analog_capture = &alc861_pcm_analog_capture;
13332 spec->stream_name_digital = "ALC861 Digital";
13333 spec->stream_digital_playback = &alc861_pcm_digital_playback;
13334 spec->stream_digital_capture = &alc861_pcm_digital_capture;
13336 spec->vmaster_nid = 0x03;
13338 codec->patch_ops = alc_patch_ops;
13339 if (board_config == ALC861_AUTO)
13340 spec->init_hook = alc861_auto_init;
13341 #ifdef CONFIG_SND_HDA_POWER_SAVE
13342 if (!spec->loopback.amplist)
13343 spec->loopback.amplist = alc861_loopbacks;
13350 * ALC861-VD support
13354 * In addition, an independent DAC
13356 #define ALC861VD_DIGOUT_NID 0x06
13358 static hda_nid_t alc861vd_dac_nids[4] = {
13359 /* front, surr, clfe, side surr */
13360 0x02, 0x03, 0x04, 0x05
13363 /* dac_nids for ALC660vd are in a different order - according to
13364 * Realtek's driver.
13365 * This should probably tesult in a different mixer for 6stack models
13366 * of ALC660vd codecs, but for now there is only 3stack mixer
13367 * - and it is the same as in 861vd.
13368 * adc_nids in ALC660vd are (is) the same as in 861vd
13370 static hda_nid_t alc660vd_dac_nids[3] = {
13371 /* front, rear, clfe, rear_surr */
13375 static hda_nid_t alc861vd_adc_nids[1] = {
13380 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
13383 /* FIXME: should be a matrix-type input source selection */
13384 static struct hda_input_mux alc861vd_capture_source = {
13388 { "Front Mic", 0x1 },
13394 static struct hda_input_mux alc861vd_dallas_capture_source = {
13397 { "Ext Mic", 0x0 },
13398 { "Int Mic", 0x1 },
13402 static struct hda_input_mux alc861vd_hp_capture_source = {
13405 { "Front Mic", 0x0 },
13406 { "ATAPI Mic", 0x1 },
13413 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
13420 static struct hda_verb alc861vd_6stack_ch6_init[] = {
13421 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13422 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13423 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13424 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13431 static struct hda_verb alc861vd_6stack_ch8_init[] = {
13432 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13433 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13434 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13435 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13439 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
13440 { 6, alc861vd_6stack_ch6_init },
13441 { 8, alc861vd_6stack_ch8_init },
13444 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
13446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13447 .name = "Channel Mode",
13448 .info = alc_ch_mode_info,
13449 .get = alc_ch_mode_get,
13450 .put = alc_ch_mode_put,
13455 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13456 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13458 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
13459 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13460 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13462 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13463 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
13465 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13467 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13469 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13470 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
13472 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
13473 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
13475 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13481 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13482 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13483 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13485 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13486 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13491 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13492 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13497 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
13498 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13501 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13503 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13507 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13508 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13509 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13514 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13515 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13517 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13518 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13523 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
13524 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13525 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13526 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13530 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13535 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13536 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13544 /* Pin assignment: Speaker=0x14, HP = 0x15,
13545 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13547 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
13548 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13549 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
13550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13551 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13552 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13553 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13554 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13555 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13556 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13557 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13558 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
13559 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
13563 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13564 * Front Mic=0x18, ATAPI Mic = 0x19,
13566 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
13567 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13568 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
13569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13570 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
13571 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13572 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13573 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13574 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13580 * generic initialization of ADC, input mixers and output mixers
13582 static struct hda_verb alc861vd_volume_init_verbs[] = {
13584 * Unmute ADC0 and set the default input to mic-in
13586 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13587 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13589 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13590 * the analog-loopback mixer widget
13592 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13599 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13606 * Set up output mixers (0x02 - 0x05)
13608 /* set vol=0 to output mixers */
13609 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13610 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13611 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13612 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13614 /* set up input amps for analog loopback */
13615 /* Amp Indices: DAC = 0, mixer = 1 */
13616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13629 * 3-stack pin configuration:
13630 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13632 static struct hda_verb alc861vd_3stack_init_verbs[] = {
13634 * Set pin mode and muting
13636 /* set front pin widgets 0x14 for output */
13637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13639 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13641 /* Mic (rear) pin: input vref at 80% */
13642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13644 /* Front Mic pin: input vref at 80% */
13645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13647 /* Line In pin: input */
13648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13650 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13653 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13654 /* CD pin widget for input */
13655 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13661 * 6-stack pin configuration:
13663 static struct hda_verb alc861vd_6stack_init_verbs[] = {
13665 * Set pin mode and muting
13667 /* set front pin widgets 0x14 for output */
13668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13670 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13672 /* Rear Pin: output 1 (0x0d) */
13673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13675 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13676 /* CLFE Pin: output 2 (0x0e) */
13677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13678 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13679 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
13680 /* Side Pin: output 3 (0x0f) */
13681 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13682 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13683 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
13685 /* Mic (rear) pin: input vref at 80% */
13686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13688 /* Front Mic pin: input vref at 80% */
13689 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13691 /* Line In pin: input */
13692 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13694 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13695 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13696 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13697 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13698 /* CD pin widget for input */
13699 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13704 static struct hda_verb alc861vd_eapd_verbs[] = {
13705 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13709 static struct hda_verb alc660vd_eapd_verbs[] = {
13710 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13711 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13715 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
13716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13717 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
13719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13720 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13724 /* toggle speaker-output according to the hp-jack state */
13725 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
13727 unsigned int present;
13728 unsigned char bits;
13730 present = snd_hda_codec_read(codec, 0x1b, 0,
13731 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13732 bits = present ? HDA_AMP_MUTE : 0;
13733 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13734 HDA_AMP_MUTE, bits);
13737 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
13739 unsigned int present;
13740 unsigned char bits;
13742 present = snd_hda_codec_read(codec, 0x18, 0,
13743 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13744 bits = present ? HDA_AMP_MUTE : 0;
13745 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
13746 HDA_AMP_MUTE, bits);
13749 static void alc861vd_lenovo_automute(struct hda_codec *codec)
13751 alc861vd_lenovo_hp_automute(codec);
13752 alc861vd_lenovo_mic_automute(codec);
13755 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
13758 switch (res >> 26) {
13759 case ALC880_HP_EVENT:
13760 alc861vd_lenovo_hp_automute(codec);
13762 case ALC880_MIC_EVENT:
13763 alc861vd_lenovo_mic_automute(codec);
13768 static struct hda_verb alc861vd_dallas_verbs[] = {
13769 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13770 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13771 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13772 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13780 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13788 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13790 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13793 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13794 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
13795 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13796 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13799 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13807 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13813 /* toggle speaker-output according to the hp-jack state */
13814 static void alc861vd_dallas_automute(struct hda_codec *codec)
13816 unsigned int present;
13818 present = snd_hda_codec_read(codec, 0x15, 0,
13819 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13820 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13821 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13824 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
13826 if ((res >> 26) == ALC880_HP_EVENT)
13827 alc861vd_dallas_automute(codec);
13830 #ifdef CONFIG_SND_HDA_POWER_SAVE
13831 #define alc861vd_loopbacks alc880_loopbacks
13834 /* pcm configuration: identiacal with ALC880 */
13835 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13836 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13837 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13838 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13841 * configuration and preset
13843 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
13844 [ALC660VD_3ST] = "3stack-660",
13845 [ALC660VD_3ST_DIG] = "3stack-660-digout",
13846 [ALC660VD_ASUS_V1S] = "asus-v1s",
13847 [ALC861VD_3ST] = "3stack",
13848 [ALC861VD_3ST_DIG] = "3stack-digout",
13849 [ALC861VD_6ST_DIG] = "6stack-digout",
13850 [ALC861VD_LENOVO] = "lenovo",
13851 [ALC861VD_DALLAS] = "dallas",
13852 [ALC861VD_HP] = "hp",
13853 [ALC861VD_AUTO] = "auto",
13856 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
13857 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
13858 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
13859 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
13860 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
13861 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
13862 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
13863 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
13864 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
13865 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13866 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
13867 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
13868 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
13869 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
13870 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
13871 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
13872 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO),
13873 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
13877 static struct alc_config_preset alc861vd_presets[] = {
13879 .mixers = { alc861vd_3st_mixer },
13880 .init_verbs = { alc861vd_volume_init_verbs,
13881 alc861vd_3stack_init_verbs },
13882 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13883 .dac_nids = alc660vd_dac_nids,
13884 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13885 .channel_mode = alc861vd_3stack_2ch_modes,
13886 .input_mux = &alc861vd_capture_source,
13888 [ALC660VD_3ST_DIG] = {
13889 .mixers = { alc861vd_3st_mixer },
13890 .init_verbs = { alc861vd_volume_init_verbs,
13891 alc861vd_3stack_init_verbs },
13892 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13893 .dac_nids = alc660vd_dac_nids,
13894 .dig_out_nid = ALC861VD_DIGOUT_NID,
13895 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13896 .channel_mode = alc861vd_3stack_2ch_modes,
13897 .input_mux = &alc861vd_capture_source,
13900 .mixers = { alc861vd_3st_mixer },
13901 .init_verbs = { alc861vd_volume_init_verbs,
13902 alc861vd_3stack_init_verbs },
13903 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13904 .dac_nids = alc861vd_dac_nids,
13905 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13906 .channel_mode = alc861vd_3stack_2ch_modes,
13907 .input_mux = &alc861vd_capture_source,
13909 [ALC861VD_3ST_DIG] = {
13910 .mixers = { alc861vd_3st_mixer },
13911 .init_verbs = { alc861vd_volume_init_verbs,
13912 alc861vd_3stack_init_verbs },
13913 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13914 .dac_nids = alc861vd_dac_nids,
13915 .dig_out_nid = ALC861VD_DIGOUT_NID,
13916 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13917 .channel_mode = alc861vd_3stack_2ch_modes,
13918 .input_mux = &alc861vd_capture_source,
13920 [ALC861VD_6ST_DIG] = {
13921 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
13922 .init_verbs = { alc861vd_volume_init_verbs,
13923 alc861vd_6stack_init_verbs },
13924 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13925 .dac_nids = alc861vd_dac_nids,
13926 .dig_out_nid = ALC861VD_DIGOUT_NID,
13927 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
13928 .channel_mode = alc861vd_6stack_modes,
13929 .input_mux = &alc861vd_capture_source,
13931 [ALC861VD_LENOVO] = {
13932 .mixers = { alc861vd_lenovo_mixer },
13933 .init_verbs = { alc861vd_volume_init_verbs,
13934 alc861vd_3stack_init_verbs,
13935 alc861vd_eapd_verbs,
13936 alc861vd_lenovo_unsol_verbs },
13937 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13938 .dac_nids = alc660vd_dac_nids,
13939 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13940 .channel_mode = alc861vd_3stack_2ch_modes,
13941 .input_mux = &alc861vd_capture_source,
13942 .unsol_event = alc861vd_lenovo_unsol_event,
13943 .init_hook = alc861vd_lenovo_automute,
13945 [ALC861VD_DALLAS] = {
13946 .mixers = { alc861vd_dallas_mixer },
13947 .init_verbs = { alc861vd_dallas_verbs },
13948 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13949 .dac_nids = alc861vd_dac_nids,
13950 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13951 .channel_mode = alc861vd_3stack_2ch_modes,
13952 .input_mux = &alc861vd_dallas_capture_source,
13953 .unsol_event = alc861vd_dallas_unsol_event,
13954 .init_hook = alc861vd_dallas_automute,
13957 .mixers = { alc861vd_hp_mixer },
13958 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
13959 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
13960 .dac_nids = alc861vd_dac_nids,
13961 .dig_out_nid = ALC861VD_DIGOUT_NID,
13962 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13963 .channel_mode = alc861vd_3stack_2ch_modes,
13964 .input_mux = &alc861vd_hp_capture_source,
13965 .unsol_event = alc861vd_dallas_unsol_event,
13966 .init_hook = alc861vd_dallas_automute,
13968 [ALC660VD_ASUS_V1S] = {
13969 .mixers = { alc861vd_lenovo_mixer },
13970 .init_verbs = { alc861vd_volume_init_verbs,
13971 alc861vd_3stack_init_verbs,
13972 alc861vd_eapd_verbs,
13973 alc861vd_lenovo_unsol_verbs },
13974 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
13975 .dac_nids = alc660vd_dac_nids,
13976 .dig_out_nid = ALC861VD_DIGOUT_NID,
13977 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
13978 .channel_mode = alc861vd_3stack_2ch_modes,
13979 .input_mux = &alc861vd_capture_source,
13980 .unsol_event = alc861vd_lenovo_unsol_event,
13981 .init_hook = alc861vd_lenovo_automute,
13986 * BIOS auto configuration
13988 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
13989 hda_nid_t nid, int pin_type, int dac_idx)
13991 alc_set_pin_output(codec, nid, pin_type);
13994 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
13996 struct alc_spec *spec = codec->spec;
13999 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14000 for (i = 0; i <= HDA_SIDE; i++) {
14001 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14002 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14004 alc861vd_auto_set_output_and_unmute(codec, nid,
14010 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14012 struct alc_spec *spec = codec->spec;
14015 pin = spec->autocfg.hp_pins[0];
14016 if (pin) /* connect to front and use dac 0 */
14017 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14018 pin = spec->autocfg.speaker_pins[0];
14020 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14023 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14024 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14026 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14028 struct alc_spec *spec = codec->spec;
14031 for (i = 0; i < AUTO_PIN_LAST; i++) {
14032 hda_nid_t nid = spec->autocfg.input_pins[i];
14033 if (alc861vd_is_input_pin(nid)) {
14034 snd_hda_codec_write(codec, nid, 0,
14035 AC_VERB_SET_PIN_WIDGET_CONTROL,
14036 i <= AUTO_PIN_FRONT_MIC ?
14037 PIN_VREF80 : PIN_IN);
14038 if (nid != ALC861VD_PIN_CD_NID)
14039 snd_hda_codec_write(codec, nid, 0,
14040 AC_VERB_SET_AMP_GAIN_MUTE,
14046 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14048 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14049 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14051 /* add playback controls from the parsed DAC table */
14052 /* Based on ALC880 version. But ALC861VD has separate,
14053 * different NIDs for mute/unmute switch and volume control */
14054 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14055 const struct auto_pin_cfg *cfg)
14058 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14059 hda_nid_t nid_v, nid_s;
14062 for (i = 0; i < cfg->line_outs; i++) {
14063 if (!spec->multiout.dac_nids[i])
14065 nid_v = alc861vd_idx_to_mixer_vol(
14067 spec->multiout.dac_nids[i]));
14068 nid_s = alc861vd_idx_to_mixer_switch(
14070 spec->multiout.dac_nids[i]));
14074 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14075 "Center Playback Volume",
14076 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14080 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14081 "LFE Playback Volume",
14082 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14086 err = add_control(spec, ALC_CTL_BIND_MUTE,
14087 "Center Playback Switch",
14088 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14092 err = add_control(spec, ALC_CTL_BIND_MUTE,
14093 "LFE Playback Switch",
14094 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14099 sprintf(name, "%s Playback Volume", chname[i]);
14100 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14101 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14105 sprintf(name, "%s Playback Switch", chname[i]);
14106 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14107 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14116 /* add playback controls for speaker and HP outputs */
14117 /* Based on ALC880 version. But ALC861VD has separate,
14118 * different NIDs for mute/unmute switch and volume control */
14119 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14120 hda_nid_t pin, const char *pfx)
14122 hda_nid_t nid_v, nid_s;
14129 if (alc880_is_fixed_pin(pin)) {
14130 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14131 /* specify the DAC as the extra output */
14132 if (!spec->multiout.hp_nid)
14133 spec->multiout.hp_nid = nid_v;
14135 spec->multiout.extra_out_nid[0] = nid_v;
14136 /* control HP volume/switch on the output mixer amp */
14137 nid_v = alc861vd_idx_to_mixer_vol(
14138 alc880_fixed_pin_idx(pin));
14139 nid_s = alc861vd_idx_to_mixer_switch(
14140 alc880_fixed_pin_idx(pin));
14142 sprintf(name, "%s Playback Volume", pfx);
14143 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14144 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14147 sprintf(name, "%s Playback Switch", pfx);
14148 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14149 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14152 } else if (alc880_is_multi_pin(pin)) {
14153 /* set manual connection */
14154 /* we have only a switch on HP-out PIN */
14155 sprintf(name, "%s Playback Switch", pfx);
14156 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14157 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14164 /* parse the BIOS configuration and set up the alc_spec
14165 * return 1 if successful, 0 if the proper config is not found,
14166 * or a negative error code
14167 * Based on ALC880 version - had to change it to override
14168 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14169 static int alc861vd_parse_auto_config(struct hda_codec *codec)
14171 struct alc_spec *spec = codec->spec;
14173 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
14175 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14179 if (!spec->autocfg.line_outs)
14180 return 0; /* can't find valid BIOS pin config */
14182 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14185 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
14188 err = alc861vd_auto_create_extra_out(spec,
14189 spec->autocfg.speaker_pins[0],
14193 err = alc861vd_auto_create_extra_out(spec,
14194 spec->autocfg.hp_pins[0],
14198 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
14202 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14204 if (spec->autocfg.dig_out_pin)
14205 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
14207 if (spec->kctls.list)
14208 add_mixer(spec, spec->kctls.list);
14210 add_verb(spec, alc861vd_volume_init_verbs);
14212 spec->num_mux_defs = 1;
14213 spec->input_mux = &spec->private_imux;
14215 err = alc_auto_add_mic_boost(codec);
14219 store_pin_configs(codec);
14223 /* additional initialization for auto-configuration model */
14224 static void alc861vd_auto_init(struct hda_codec *codec)
14226 struct alc_spec *spec = codec->spec;
14227 alc861vd_auto_init_multi_out(codec);
14228 alc861vd_auto_init_hp_out(codec);
14229 alc861vd_auto_init_analog_input(codec);
14230 alc861vd_auto_init_input_src(codec);
14231 if (spec->unsol_event)
14232 alc_inithook(codec);
14235 static int patch_alc861vd(struct hda_codec *codec)
14237 struct alc_spec *spec;
14238 int err, board_config;
14240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14244 codec->spec = spec;
14246 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
14250 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
14251 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
14252 "ALC861VD, trying auto-probe from BIOS...\n");
14253 board_config = ALC861VD_AUTO;
14256 if (board_config == ALC861VD_AUTO) {
14257 /* automatic parse from the BIOS config */
14258 err = alc861vd_parse_auto_config(codec);
14264 "hda_codec: Cannot set up configuration "
14265 "from BIOS. Using base mode...\n");
14266 board_config = ALC861VD_3ST;
14270 if (board_config != ALC861VD_AUTO)
14271 setup_preset(spec, &alc861vd_presets[board_config]);
14273 if (codec->vendor_id == 0x10ec0660) {
14274 spec->stream_name_analog = "ALC660-VD Analog";
14275 spec->stream_name_digital = "ALC660-VD Digital";
14276 /* always turn on EAPD */
14277 add_verb(spec, alc660vd_eapd_verbs);
14279 spec->stream_name_analog = "ALC861VD Analog";
14280 spec->stream_name_digital = "ALC861VD Digital";
14283 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
14284 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
14286 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
14287 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
14289 spec->adc_nids = alc861vd_adc_nids;
14290 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14291 spec->capsrc_nids = alc861vd_capsrc_nids;
14292 spec->is_mix_capture = 1;
14294 set_capture_mixer(spec);
14296 spec->vmaster_nid = 0x02;
14298 codec->patch_ops = alc_patch_ops;
14300 if (board_config == ALC861VD_AUTO)
14301 spec->init_hook = alc861vd_auto_init;
14302 #ifdef CONFIG_SND_HDA_POWER_SAVE
14303 if (!spec->loopback.amplist)
14304 spec->loopback.amplist = alc861vd_loopbacks;
14313 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14314 * configuration. Each pin widget can choose any input DACs and a mixer.
14315 * Each ADC is connected from a mixer of all inputs. This makes possible
14316 * 6-channel independent captures.
14318 * In addition, an independent DAC for the multi-playback (not used in this
14321 #define ALC662_DIGOUT_NID 0x06
14322 #define ALC662_DIGIN_NID 0x0a
14324 static hda_nid_t alc662_dac_nids[4] = {
14325 /* front, rear, clfe, rear_surr */
14329 static hda_nid_t alc662_adc_nids[1] = {
14334 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
14337 /* FIXME: should be a matrix-type input source selection */
14338 static struct hda_input_mux alc662_capture_source = {
14342 { "Front Mic", 0x1 },
14348 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
14356 static struct hda_input_mux alc662_eeepc_capture_source = {
14364 static struct hda_input_mux alc663_capture_source = {
14368 { "Front Mic", 0x1 },
14373 static struct hda_input_mux alc663_m51va_capture_source = {
14376 { "Ext-Mic", 0x0 },
14384 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
14391 static struct hda_verb alc662_3ST_ch2_init[] = {
14392 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
14393 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14394 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
14395 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
14402 static struct hda_verb alc662_3ST_ch6_init[] = {
14403 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14404 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14405 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
14406 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14407 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
14408 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
14412 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
14413 { 2, alc662_3ST_ch2_init },
14414 { 6, alc662_3ST_ch6_init },
14420 static struct hda_verb alc662_sixstack_ch6_init[] = {
14421 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14422 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14423 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14430 static struct hda_verb alc662_sixstack_ch8_init[] = {
14431 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14432 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14433 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14437 static struct hda_channel_mode alc662_5stack_modes[2] = {
14438 { 2, alc662_sixstack_ch6_init },
14439 { 6, alc662_sixstack_ch8_init },
14442 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14443 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14446 static struct snd_kcontrol_new alc662_base_mixer[] = {
14447 /* output mixer control */
14448 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
14449 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14450 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
14451 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14452 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14453 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14454 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14455 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14456 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14458 /*Input mixer control */
14459 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
14460 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
14461 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
14462 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
14463 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
14464 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
14465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
14466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
14470 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
14471 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14472 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14473 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14474 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14475 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14476 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14477 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14480 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14481 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14482 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14483 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14487 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
14488 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14489 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
14490 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14491 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
14492 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14493 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14494 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
14495 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
14496 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14505 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
14506 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
14510 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
14511 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14512 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
14513 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14514 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
14515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14516 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14517 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14523 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
14524 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14526 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14527 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14529 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
14530 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14531 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14533 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
14534 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14535 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14539 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
14540 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14541 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14542 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14543 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
14544 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
14545 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
14546 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
14547 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
14548 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14549 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
14550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14557 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
14558 .ops = &snd_hda_bind_vol,
14560 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14561 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
14566 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
14567 .ops = &snd_hda_bind_sw,
14569 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14570 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14575 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
14576 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14577 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
14578 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14579 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14583 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
14584 .ops = &snd_hda_bind_sw,
14586 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14587 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14588 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
14593 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
14594 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14595 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
14596 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14598 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14599 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14604 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
14605 .ops = &snd_hda_bind_sw,
14607 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14608 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
14609 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
14614 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
14615 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14616 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
14617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14619 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14620 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14624 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
14625 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14626 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14630 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14631 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14635 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
14636 .ops = &snd_hda_bind_vol,
14638 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
14639 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
14644 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
14645 .ops = &snd_hda_bind_sw,
14647 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14648 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
14653 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
14654 HDA_BIND_VOL("Master Playback Volume",
14655 &alc663_asus_two_bind_master_vol),
14656 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14657 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14658 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14664 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
14665 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
14666 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
14667 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14674 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
14675 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14676 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14677 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14678 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14683 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14684 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14688 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
14689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14695 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14696 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14697 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14698 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14702 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
14704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14705 .name = "Channel Mode",
14706 .info = alc_ch_mode_info,
14707 .get = alc_ch_mode_get,
14708 .put = alc_ch_mode_put,
14713 static struct hda_verb alc662_init_verbs[] = {
14714 /* ADC: mute amp left and right */
14715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14716 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14717 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14719 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14720 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14727 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14728 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14729 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14730 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14732 /* Front Pin: output 0 (0x0c) */
14733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14736 /* Rear Pin: output 1 (0x0d) */
14737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14740 /* CLFE Pin: output 2 (0x0e) */
14741 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14744 /* Mic (rear) pin: input vref at 80% */
14745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14747 /* Front Mic pin: input vref at 80% */
14748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14750 /* Line In pin: input */
14751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14753 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14755 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14756 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14757 /* CD pin widget for input */
14758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14760 /* FIXME: use matrix-type input source selection */
14761 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14773 /* always trun on EAPD */
14774 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14775 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14780 static struct hda_verb alc662_sue_init_verbs[] = {
14781 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14782 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14786 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
14787 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14788 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14792 /* Set Unsolicited Event*/
14793 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
14794 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14800 * generic initialization of ADC, input mixers and output mixers
14802 static struct hda_verb alc662_auto_init_verbs[] = {
14804 * Unmute ADC and set the default input to mic-in
14806 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14809 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14811 * Note: PASD motherboards uses the Line In 2 as the input for front
14812 * panel mic (mic 2)
14814 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14817 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14818 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14819 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14822 * Set up output mixers (0x0c - 0x0f)
14824 /* set vol=0 to output mixers */
14825 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14826 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14827 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14829 /* set up input amps for analog loopback */
14830 /* Amp Indices: DAC = 0, mixer = 1 */
14831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14833 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14834 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14835 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14836 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14839 /* FIXME: use matrix-type input source selection */
14840 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14847 /* additional verbs for ALC663 */
14848 static struct hda_verb alc663_auto_init_verbs[] = {
14849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14854 static struct hda_verb alc663_m51va_init_verbs[] = {
14855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14856 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14857 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14858 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14859 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
14862 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14863 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14867 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
14868 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14869 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14870 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14873 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14874 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14878 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
14879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14880 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14881 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14882 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14885 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14886 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14890 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
14891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14893 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14896 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14897 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14901 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
14902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14903 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14904 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14905 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
14906 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14908 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
14909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14910 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14911 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14912 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14913 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14917 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
14918 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14920 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14921 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
14925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14927 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14933 static struct hda_verb alc663_g71v_init_verbs[] = {
14934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14935 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14936 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14938 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14939 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14940 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
14943 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
14944 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
14948 static struct hda_verb alc663_g50v_init_verbs[] = {
14949 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14950 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14951 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
14953 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14954 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14958 static struct hda_verb alc662_ecs_init_verbs[] = {
14959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
14960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14961 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14962 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14966 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
14967 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14968 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14972 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
14974 unsigned int present;
14975 unsigned char bits;
14977 present = snd_hda_codec_read(codec, 0x14, 0,
14978 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14979 bits = present ? HDA_AMP_MUTE : 0;
14980 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14981 HDA_AMP_MUTE, bits);
14984 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
14986 unsigned int present;
14987 unsigned char bits;
14989 present = snd_hda_codec_read(codec, 0x1b, 0,
14990 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14991 bits = present ? HDA_AMP_MUTE : 0;
14992 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
14993 HDA_AMP_MUTE, bits);
14994 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14995 HDA_AMP_MUTE, bits);
14998 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15001 if ((res >> 26) == ALC880_HP_EVENT)
15002 alc662_lenovo_101e_all_automute(codec);
15003 if ((res >> 26) == ALC880_FRONT_EVENT)
15004 alc662_lenovo_101e_ispeaker_automute(codec);
15007 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15009 unsigned int present;
15011 present = snd_hda_codec_read(codec, 0x18, 0,
15012 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15013 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15014 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15015 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15016 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15017 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15018 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15019 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15020 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15023 /* unsolicited event for HP jack sensing */
15024 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15027 if ((res >> 26) == ALC880_HP_EVENT)
15028 alc262_hippo1_automute( codec );
15030 if ((res >> 26) == ALC880_MIC_EVENT)
15031 alc662_eeepc_mic_automute(codec);
15034 static void alc662_eeepc_inithook(struct hda_codec *codec)
15036 alc262_hippo1_automute( codec );
15037 alc662_eeepc_mic_automute(codec);
15040 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15043 unsigned int present;
15045 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15046 present = snd_hda_codec_read(codec, 0x14, 0,
15047 AC_VERB_GET_PIN_SENSE, 0);
15048 present = (present & 0x80000000) != 0;
15050 /* mute internal speaker */
15051 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15052 HDA_AMP_MUTE, HDA_AMP_MUTE);
15054 /* unmute internal speaker if necessary */
15055 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15056 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15057 HDA_AMP_MUTE, mute);
15061 /* unsolicited event for HP jack sensing */
15062 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15065 if ((res >> 26) == ALC880_HP_EVENT)
15066 alc662_eeepc_ep20_automute(codec);
15069 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15071 alc662_eeepc_ep20_automute(codec);
15074 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15076 unsigned int present;
15077 unsigned char bits;
15079 present = snd_hda_codec_read(codec, 0x21, 0,
15080 AC_VERB_GET_PIN_SENSE, 0)
15081 & AC_PINSENSE_PRESENCE;
15082 bits = present ? HDA_AMP_MUTE : 0;
15083 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15084 AMP_IN_MUTE(0), bits);
15085 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15086 AMP_IN_MUTE(0), bits);
15089 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15091 unsigned int present;
15092 unsigned char bits;
15094 present = snd_hda_codec_read(codec, 0x21, 0,
15095 AC_VERB_GET_PIN_SENSE, 0)
15096 & AC_PINSENSE_PRESENCE;
15097 bits = present ? HDA_AMP_MUTE : 0;
15098 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15099 AMP_IN_MUTE(0), bits);
15100 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15101 AMP_IN_MUTE(0), bits);
15102 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15103 AMP_IN_MUTE(0), bits);
15104 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15105 AMP_IN_MUTE(0), bits);
15108 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15110 unsigned int present;
15111 unsigned char bits;
15113 present = snd_hda_codec_read(codec, 0x15, 0,
15114 AC_VERB_GET_PIN_SENSE, 0)
15115 & AC_PINSENSE_PRESENCE;
15116 bits = present ? HDA_AMP_MUTE : 0;
15117 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15118 AMP_IN_MUTE(0), bits);
15119 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15120 AMP_IN_MUTE(0), bits);
15121 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15122 AMP_IN_MUTE(0), bits);
15123 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15124 AMP_IN_MUTE(0), bits);
15127 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
15129 unsigned int present;
15130 unsigned char bits;
15132 present = snd_hda_codec_read(codec, 0x1b, 0,
15133 AC_VERB_GET_PIN_SENSE, 0)
15134 & AC_PINSENSE_PRESENCE;
15135 bits = present ? 0 : PIN_OUT;
15136 snd_hda_codec_write(codec, 0x14, 0,
15137 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
15140 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
15142 unsigned int present1, present2;
15144 present1 = snd_hda_codec_read(codec, 0x21, 0,
15145 AC_VERB_GET_PIN_SENSE, 0)
15146 & AC_PINSENSE_PRESENCE;
15147 present2 = snd_hda_codec_read(codec, 0x15, 0,
15148 AC_VERB_GET_PIN_SENSE, 0)
15149 & AC_PINSENSE_PRESENCE;
15151 if (present1 || present2) {
15152 snd_hda_codec_write_cache(codec, 0x14, 0,
15153 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
15155 snd_hda_codec_write_cache(codec, 0x14, 0,
15156 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
15160 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
15162 unsigned int present1, present2;
15164 present1 = snd_hda_codec_read(codec, 0x1b, 0,
15165 AC_VERB_GET_PIN_SENSE, 0)
15166 & AC_PINSENSE_PRESENCE;
15167 present2 = snd_hda_codec_read(codec, 0x15, 0,
15168 AC_VERB_GET_PIN_SENSE, 0)
15169 & AC_PINSENSE_PRESENCE;
15171 if (present1 || present2) {
15172 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15173 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15174 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15175 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15177 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15178 AMP_IN_MUTE(0), 0);
15179 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15180 AMP_IN_MUTE(0), 0);
15184 static void alc663_m51va_mic_automute(struct hda_codec *codec)
15186 unsigned int present;
15188 present = snd_hda_codec_read(codec, 0x18, 0,
15189 AC_VERB_GET_PIN_SENSE, 0)
15190 & AC_PINSENSE_PRESENCE;
15191 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15192 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15193 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15194 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15195 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15196 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15197 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15198 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
15201 static void alc663_m51va_unsol_event(struct hda_codec *codec,
15204 switch (res >> 26) {
15205 case ALC880_HP_EVENT:
15206 alc663_m51va_speaker_automute(codec);
15208 case ALC880_MIC_EVENT:
15209 alc663_m51va_mic_automute(codec);
15214 static void alc663_m51va_inithook(struct hda_codec *codec)
15216 alc663_m51va_speaker_automute(codec);
15217 alc663_m51va_mic_automute(codec);
15220 /* ***************** Mode1 ******************************/
15221 static void alc663_mode1_unsol_event(struct hda_codec *codec,
15224 switch (res >> 26) {
15225 case ALC880_HP_EVENT:
15226 alc663_m51va_speaker_automute(codec);
15228 case ALC880_MIC_EVENT:
15229 alc662_eeepc_mic_automute(codec);
15234 static void alc663_mode1_inithook(struct hda_codec *codec)
15236 alc663_m51va_speaker_automute(codec);
15237 alc662_eeepc_mic_automute(codec);
15239 /* ***************** Mode2 ******************************/
15240 static void alc662_mode2_unsol_event(struct hda_codec *codec,
15243 switch (res >> 26) {
15244 case ALC880_HP_EVENT:
15245 alc662_f5z_speaker_automute(codec);
15247 case ALC880_MIC_EVENT:
15248 alc662_eeepc_mic_automute(codec);
15253 static void alc662_mode2_inithook(struct hda_codec *codec)
15255 alc662_f5z_speaker_automute(codec);
15256 alc662_eeepc_mic_automute(codec);
15258 /* ***************** Mode3 ******************************/
15259 static void alc663_mode3_unsol_event(struct hda_codec *codec,
15262 switch (res >> 26) {
15263 case ALC880_HP_EVENT:
15264 alc663_two_hp_m1_speaker_automute(codec);
15266 case ALC880_MIC_EVENT:
15267 alc662_eeepc_mic_automute(codec);
15272 static void alc663_mode3_inithook(struct hda_codec *codec)
15274 alc663_two_hp_m1_speaker_automute(codec);
15275 alc662_eeepc_mic_automute(codec);
15277 /* ***************** Mode4 ******************************/
15278 static void alc663_mode4_unsol_event(struct hda_codec *codec,
15281 switch (res >> 26) {
15282 case ALC880_HP_EVENT:
15283 alc663_21jd_two_speaker_automute(codec);
15285 case ALC880_MIC_EVENT:
15286 alc662_eeepc_mic_automute(codec);
15291 static void alc663_mode4_inithook(struct hda_codec *codec)
15293 alc663_21jd_two_speaker_automute(codec);
15294 alc662_eeepc_mic_automute(codec);
15296 /* ***************** Mode5 ******************************/
15297 static void alc663_mode5_unsol_event(struct hda_codec *codec,
15300 switch (res >> 26) {
15301 case ALC880_HP_EVENT:
15302 alc663_15jd_two_speaker_automute(codec);
15304 case ALC880_MIC_EVENT:
15305 alc662_eeepc_mic_automute(codec);
15310 static void alc663_mode5_inithook(struct hda_codec *codec)
15312 alc663_15jd_two_speaker_automute(codec);
15313 alc662_eeepc_mic_automute(codec);
15315 /* ***************** Mode6 ******************************/
15316 static void alc663_mode6_unsol_event(struct hda_codec *codec,
15319 switch (res >> 26) {
15320 case ALC880_HP_EVENT:
15321 alc663_two_hp_m2_speaker_automute(codec);
15323 case ALC880_MIC_EVENT:
15324 alc662_eeepc_mic_automute(codec);
15329 static void alc663_mode6_inithook(struct hda_codec *codec)
15331 alc663_two_hp_m2_speaker_automute(codec);
15332 alc662_eeepc_mic_automute(codec);
15335 static void alc663_g71v_hp_automute(struct hda_codec *codec)
15337 unsigned int present;
15338 unsigned char bits;
15340 present = snd_hda_codec_read(codec, 0x21, 0,
15341 AC_VERB_GET_PIN_SENSE, 0)
15342 & AC_PINSENSE_PRESENCE;
15343 bits = present ? HDA_AMP_MUTE : 0;
15344 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15345 HDA_AMP_MUTE, bits);
15346 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15347 HDA_AMP_MUTE, bits);
15350 static void alc663_g71v_front_automute(struct hda_codec *codec)
15352 unsigned int present;
15353 unsigned char bits;
15355 present = snd_hda_codec_read(codec, 0x15, 0,
15356 AC_VERB_GET_PIN_SENSE, 0)
15357 & AC_PINSENSE_PRESENCE;
15358 bits = present ? HDA_AMP_MUTE : 0;
15359 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15360 HDA_AMP_MUTE, bits);
15363 static void alc663_g71v_unsol_event(struct hda_codec *codec,
15366 switch (res >> 26) {
15367 case ALC880_HP_EVENT:
15368 alc663_g71v_hp_automute(codec);
15370 case ALC880_FRONT_EVENT:
15371 alc663_g71v_front_automute(codec);
15373 case ALC880_MIC_EVENT:
15374 alc662_eeepc_mic_automute(codec);
15379 static void alc663_g71v_inithook(struct hda_codec *codec)
15381 alc663_g71v_front_automute(codec);
15382 alc663_g71v_hp_automute(codec);
15383 alc662_eeepc_mic_automute(codec);
15386 static void alc663_g50v_unsol_event(struct hda_codec *codec,
15389 switch (res >> 26) {
15390 case ALC880_HP_EVENT:
15391 alc663_m51va_speaker_automute(codec);
15393 case ALC880_MIC_EVENT:
15394 alc662_eeepc_mic_automute(codec);
15399 static void alc663_g50v_inithook(struct hda_codec *codec)
15401 alc663_m51va_speaker_automute(codec);
15402 alc662_eeepc_mic_automute(codec);
15405 /* bind hp and internal speaker mute (with plug check) */
15406 static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
15407 struct snd_ctl_elem_value *ucontrol)
15409 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
15410 long *valp = ucontrol->value.integer.value;
15413 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
15415 valp[0] ? 0 : HDA_AMP_MUTE);
15416 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
15418 valp[1] ? 0 : HDA_AMP_MUTE);
15420 alc262_hippo1_automute(codec);
15424 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
15425 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15428 .name = "Master Playback Switch",
15429 .info = snd_hda_mixer_amp_switch_info,
15430 .get = snd_hda_mixer_amp_switch_get,
15431 .put = alc662_ecs_master_sw_put,
15432 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15435 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
15436 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
15437 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
15439 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15440 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15441 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15445 #ifdef CONFIG_SND_HDA_POWER_SAVE
15446 #define alc662_loopbacks alc880_loopbacks
15450 /* pcm configuration: identiacal with ALC880 */
15451 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15452 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15453 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15454 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15457 * configuration and preset
15459 static const char *alc662_models[ALC662_MODEL_LAST] = {
15460 [ALC662_3ST_2ch_DIG] = "3stack-dig",
15461 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
15462 [ALC662_3ST_6ch] = "3stack-6ch",
15463 [ALC662_5ST_DIG] = "6stack-dig",
15464 [ALC662_LENOVO_101E] = "lenovo-101e",
15465 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
15466 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
15467 [ALC662_ECS] = "ecs",
15468 [ALC663_ASUS_M51VA] = "m51va",
15469 [ALC663_ASUS_G71V] = "g71v",
15470 [ALC663_ASUS_H13] = "h13",
15471 [ALC663_ASUS_G50V] = "g50v",
15472 [ALC663_ASUS_MODE1] = "asus-mode1",
15473 [ALC662_ASUS_MODE2] = "asus-mode2",
15474 [ALC663_ASUS_MODE3] = "asus-mode3",
15475 [ALC663_ASUS_MODE4] = "asus-mode4",
15476 [ALC663_ASUS_MODE5] = "asus-mode5",
15477 [ALC663_ASUS_MODE6] = "asus-mode6",
15478 [ALC662_AUTO] = "auto",
15481 static struct snd_pci_quirk alc662_cfg_tbl[] = {
15482 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
15483 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
15484 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
15485 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
15486 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
15487 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
15488 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),
15489 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
15490 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
15491 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
15492 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),
15493 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
15494 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
15495 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
15496 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
15497 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
15498 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
15499 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
15500 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
15501 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
15502 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
15503 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
15504 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
15505 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
15506 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
15507 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
15508 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
15509 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
15510 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
15511 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
15512 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
15513 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
15514 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
15515 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
15516 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
15517 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
15518 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
15519 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15520 ALC662_3ST_6ch_DIG),
15521 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
15522 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
15523 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
15524 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15525 ALC662_3ST_6ch_DIG),
15526 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
15527 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15528 ALC662_3ST_6ch_DIG),
15529 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13),
15530 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13),
15531 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13),
15535 static struct alc_config_preset alc662_presets[] = {
15536 [ALC662_3ST_2ch_DIG] = {
15537 .mixers = { alc662_3ST_2ch_mixer },
15538 .init_verbs = { alc662_init_verbs },
15539 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15540 .dac_nids = alc662_dac_nids,
15541 .dig_out_nid = ALC662_DIGOUT_NID,
15542 .dig_in_nid = ALC662_DIGIN_NID,
15543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15544 .channel_mode = alc662_3ST_2ch_modes,
15545 .input_mux = &alc662_capture_source,
15547 [ALC662_3ST_6ch_DIG] = {
15548 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15549 .init_verbs = { alc662_init_verbs },
15550 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15551 .dac_nids = alc662_dac_nids,
15552 .dig_out_nid = ALC662_DIGOUT_NID,
15553 .dig_in_nid = ALC662_DIGIN_NID,
15554 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15555 .channel_mode = alc662_3ST_6ch_modes,
15557 .input_mux = &alc662_capture_source,
15559 [ALC662_3ST_6ch] = {
15560 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
15561 .init_verbs = { alc662_init_verbs },
15562 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15563 .dac_nids = alc662_dac_nids,
15564 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15565 .channel_mode = alc662_3ST_6ch_modes,
15567 .input_mux = &alc662_capture_source,
15569 [ALC662_5ST_DIG] = {
15570 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
15571 .init_verbs = { alc662_init_verbs },
15572 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15573 .dac_nids = alc662_dac_nids,
15574 .dig_out_nid = ALC662_DIGOUT_NID,
15575 .dig_in_nid = ALC662_DIGIN_NID,
15576 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
15577 .channel_mode = alc662_5stack_modes,
15578 .input_mux = &alc662_capture_source,
15580 [ALC662_LENOVO_101E] = {
15581 .mixers = { alc662_lenovo_101e_mixer },
15582 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
15583 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15584 .dac_nids = alc662_dac_nids,
15585 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15586 .channel_mode = alc662_3ST_2ch_modes,
15587 .input_mux = &alc662_lenovo_101e_capture_source,
15588 .unsol_event = alc662_lenovo_101e_unsol_event,
15589 .init_hook = alc662_lenovo_101e_all_automute,
15591 [ALC662_ASUS_EEEPC_P701] = {
15592 .mixers = { alc662_eeepc_p701_mixer },
15593 .init_verbs = { alc662_init_verbs,
15594 alc662_eeepc_sue_init_verbs },
15595 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15596 .dac_nids = alc662_dac_nids,
15597 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15598 .channel_mode = alc662_3ST_2ch_modes,
15599 .input_mux = &alc662_eeepc_capture_source,
15600 .unsol_event = alc662_eeepc_unsol_event,
15601 .init_hook = alc662_eeepc_inithook,
15603 [ALC662_ASUS_EEEPC_EP20] = {
15604 .mixers = { alc662_eeepc_ep20_mixer,
15605 alc662_chmode_mixer },
15606 .init_verbs = { alc662_init_verbs,
15607 alc662_eeepc_ep20_sue_init_verbs },
15608 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15609 .dac_nids = alc662_dac_nids,
15610 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15611 .channel_mode = alc662_3ST_6ch_modes,
15612 .input_mux = &alc662_lenovo_101e_capture_source,
15613 .unsol_event = alc662_eeepc_ep20_unsol_event,
15614 .init_hook = alc662_eeepc_ep20_inithook,
15617 .mixers = { alc662_ecs_mixer },
15618 .init_verbs = { alc662_init_verbs,
15619 alc662_ecs_init_verbs },
15620 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15621 .dac_nids = alc662_dac_nids,
15622 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15623 .channel_mode = alc662_3ST_2ch_modes,
15624 .input_mux = &alc662_eeepc_capture_source,
15625 .unsol_event = alc662_eeepc_unsol_event,
15626 .init_hook = alc662_eeepc_inithook,
15628 [ALC663_ASUS_M51VA] = {
15629 .mixers = { alc663_m51va_mixer },
15630 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15631 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15632 .dac_nids = alc662_dac_nids,
15633 .dig_out_nid = ALC662_DIGOUT_NID,
15634 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15635 .channel_mode = alc662_3ST_2ch_modes,
15636 .input_mux = &alc663_m51va_capture_source,
15637 .unsol_event = alc663_m51va_unsol_event,
15638 .init_hook = alc663_m51va_inithook,
15640 [ALC663_ASUS_G71V] = {
15641 .mixers = { alc663_g71v_mixer },
15642 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
15643 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15644 .dac_nids = alc662_dac_nids,
15645 .dig_out_nid = ALC662_DIGOUT_NID,
15646 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15647 .channel_mode = alc662_3ST_2ch_modes,
15648 .input_mux = &alc662_eeepc_capture_source,
15649 .unsol_event = alc663_g71v_unsol_event,
15650 .init_hook = alc663_g71v_inithook,
15652 [ALC663_ASUS_H13] = {
15653 .mixers = { alc663_m51va_mixer },
15654 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
15655 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15656 .dac_nids = alc662_dac_nids,
15657 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15658 .channel_mode = alc662_3ST_2ch_modes,
15659 .input_mux = &alc663_m51va_capture_source,
15660 .unsol_event = alc663_m51va_unsol_event,
15661 .init_hook = alc663_m51va_inithook,
15663 [ALC663_ASUS_G50V] = {
15664 .mixers = { alc663_g50v_mixer },
15665 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
15666 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15667 .dac_nids = alc662_dac_nids,
15668 .dig_out_nid = ALC662_DIGOUT_NID,
15669 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
15670 .channel_mode = alc662_3ST_6ch_modes,
15671 .input_mux = &alc663_capture_source,
15672 .unsol_event = alc663_g50v_unsol_event,
15673 .init_hook = alc663_g50v_inithook,
15675 [ALC663_ASUS_MODE1] = {
15676 .mixers = { alc663_m51va_mixer },
15677 .cap_mixer = alc662_auto_capture_mixer,
15678 .init_verbs = { alc662_init_verbs,
15679 alc663_21jd_amic_init_verbs },
15680 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15682 .dac_nids = alc662_dac_nids,
15683 .dig_out_nid = ALC662_DIGOUT_NID,
15684 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15685 .channel_mode = alc662_3ST_2ch_modes,
15686 .input_mux = &alc662_eeepc_capture_source,
15687 .unsol_event = alc663_mode1_unsol_event,
15688 .init_hook = alc663_mode1_inithook,
15690 [ALC662_ASUS_MODE2] = {
15691 .mixers = { alc662_1bjd_mixer },
15692 .cap_mixer = alc662_auto_capture_mixer,
15693 .init_verbs = { alc662_init_verbs,
15694 alc662_1bjd_amic_init_verbs },
15695 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15696 .dac_nids = alc662_dac_nids,
15697 .dig_out_nid = ALC662_DIGOUT_NID,
15698 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15699 .channel_mode = alc662_3ST_2ch_modes,
15700 .input_mux = &alc662_eeepc_capture_source,
15701 .unsol_event = alc662_mode2_unsol_event,
15702 .init_hook = alc662_mode2_inithook,
15704 [ALC663_ASUS_MODE3] = {
15705 .mixers = { alc663_two_hp_m1_mixer },
15706 .cap_mixer = alc662_auto_capture_mixer,
15707 .init_verbs = { alc662_init_verbs,
15708 alc663_two_hp_amic_m1_init_verbs },
15709 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15711 .dac_nids = alc662_dac_nids,
15712 .dig_out_nid = ALC662_DIGOUT_NID,
15713 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15714 .channel_mode = alc662_3ST_2ch_modes,
15715 .input_mux = &alc662_eeepc_capture_source,
15716 .unsol_event = alc663_mode3_unsol_event,
15717 .init_hook = alc663_mode3_inithook,
15719 [ALC663_ASUS_MODE4] = {
15720 .mixers = { alc663_asus_21jd_clfe_mixer },
15721 .cap_mixer = alc662_auto_capture_mixer,
15722 .init_verbs = { alc662_init_verbs,
15723 alc663_21jd_amic_init_verbs},
15724 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15726 .dac_nids = alc662_dac_nids,
15727 .dig_out_nid = ALC662_DIGOUT_NID,
15728 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15729 .channel_mode = alc662_3ST_2ch_modes,
15730 .input_mux = &alc662_eeepc_capture_source,
15731 .unsol_event = alc663_mode4_unsol_event,
15732 .init_hook = alc663_mode4_inithook,
15734 [ALC663_ASUS_MODE5] = {
15735 .mixers = { alc663_asus_15jd_clfe_mixer },
15736 .cap_mixer = alc662_auto_capture_mixer,
15737 .init_verbs = { alc662_init_verbs,
15738 alc663_15jd_amic_init_verbs },
15739 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15741 .dac_nids = alc662_dac_nids,
15742 .dig_out_nid = ALC662_DIGOUT_NID,
15743 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15744 .channel_mode = alc662_3ST_2ch_modes,
15745 .input_mux = &alc662_eeepc_capture_source,
15746 .unsol_event = alc663_mode5_unsol_event,
15747 .init_hook = alc663_mode5_inithook,
15749 [ALC663_ASUS_MODE6] = {
15750 .mixers = { alc663_two_hp_m2_mixer },
15751 .cap_mixer = alc662_auto_capture_mixer,
15752 .init_verbs = { alc662_init_verbs,
15753 alc663_two_hp_amic_m2_init_verbs },
15754 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
15756 .dac_nids = alc662_dac_nids,
15757 .dig_out_nid = ALC662_DIGOUT_NID,
15758 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
15759 .channel_mode = alc662_3ST_2ch_modes,
15760 .input_mux = &alc662_eeepc_capture_source,
15761 .unsol_event = alc663_mode6_unsol_event,
15762 .init_hook = alc663_mode6_inithook,
15768 * BIOS auto configuration
15771 /* add playback controls from the parsed DAC table */
15772 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
15773 const struct auto_pin_cfg *cfg)
15776 static const char *chname[4] = {
15777 "Front", "Surround", NULL /*CLFE*/, "Side"
15782 for (i = 0; i < cfg->line_outs; i++) {
15783 if (!spec->multiout.dac_nids[i])
15785 nid = alc880_idx_to_dac(i);
15788 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15789 "Center Playback Volume",
15790 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
15794 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15795 "LFE Playback Volume",
15796 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
15800 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15801 "Center Playback Switch",
15802 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
15806 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
15807 "LFE Playback Switch",
15808 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
15813 sprintf(name, "%s Playback Volume", chname[i]);
15814 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15815 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
15819 sprintf(name, "%s Playback Switch", chname[i]);
15820 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15821 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
15830 /* add playback controls for speaker and HP outputs */
15831 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
15842 /* ALC663 has a mono output pin on 0x17 */
15843 sprintf(name, "%s Playback Switch", pfx);
15844 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15845 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
15849 if (alc880_is_fixed_pin(pin)) {
15850 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15851 /* printk("DAC nid=%x\n",nid); */
15852 /* specify the DAC as the extra output */
15853 if (!spec->multiout.hp_nid)
15854 spec->multiout.hp_nid = nid;
15856 spec->multiout.extra_out_nid[0] = nid;
15857 /* control HP volume/switch on the output mixer amp */
15858 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15859 sprintf(name, "%s Playback Volume", pfx);
15860 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15861 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
15864 sprintf(name, "%s Playback Switch", pfx);
15865 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15866 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
15869 } else if (alc880_is_multi_pin(pin)) {
15870 /* set manual connection */
15871 /* we have only a switch on HP-out PIN */
15872 sprintf(name, "%s Playback Switch", pfx);
15873 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15874 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15881 /* create playback/capture controls for input pins */
15882 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
15883 const struct auto_pin_cfg *cfg)
15885 struct hda_input_mux *imux = &spec->private_imux;
15888 for (i = 0; i < AUTO_PIN_LAST; i++) {
15889 if (alc880_is_input_pin(cfg->input_pins[i])) {
15890 idx = alc880_input_pin_idx(cfg->input_pins[i]);
15891 err = new_analog_input(spec, cfg->input_pins[i],
15892 auto_pin_cfg_labels[i],
15896 imux->items[imux->num_items].label =
15897 auto_pin_cfg_labels[i];
15898 imux->items[imux->num_items].index =
15899 alc880_input_pin_idx(cfg->input_pins[i]);
15906 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
15907 hda_nid_t nid, int pin_type,
15910 alc_set_pin_output(codec, nid, pin_type);
15911 /* need the manual connection? */
15912 if (alc880_is_multi_pin(nid)) {
15913 struct alc_spec *spec = codec->spec;
15914 int idx = alc880_multi_pin_idx(nid);
15915 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
15916 AC_VERB_SET_CONNECT_SEL,
15917 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
15921 static void alc662_auto_init_multi_out(struct hda_codec *codec)
15923 struct alc_spec *spec = codec->spec;
15926 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
15927 for (i = 0; i <= HDA_SIDE; i++) {
15928 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15929 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15931 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
15936 static void alc662_auto_init_hp_out(struct hda_codec *codec)
15938 struct alc_spec *spec = codec->spec;
15941 pin = spec->autocfg.hp_pins[0];
15942 if (pin) /* connect to front */
15944 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15945 pin = spec->autocfg.speaker_pins[0];
15947 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15950 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
15951 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
15953 static void alc662_auto_init_analog_input(struct hda_codec *codec)
15955 struct alc_spec *spec = codec->spec;
15958 for (i = 0; i < AUTO_PIN_LAST; i++) {
15959 hda_nid_t nid = spec->autocfg.input_pins[i];
15960 if (alc662_is_input_pin(nid)) {
15961 snd_hda_codec_write(codec, nid, 0,
15962 AC_VERB_SET_PIN_WIDGET_CONTROL,
15963 (i <= AUTO_PIN_FRONT_MIC ?
15964 PIN_VREF80 : PIN_IN));
15965 if (nid != ALC662_PIN_CD_NID)
15966 snd_hda_codec_write(codec, nid, 0,
15967 AC_VERB_SET_AMP_GAIN_MUTE,
15973 #define alc662_auto_init_input_src alc882_auto_init_input_src
15975 static int alc662_parse_auto_config(struct hda_codec *codec)
15977 struct alc_spec *spec = codec->spec;
15979 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
15981 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15985 if (!spec->autocfg.line_outs)
15986 return 0; /* can't find valid BIOS pin config */
15988 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15991 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
15994 err = alc662_auto_create_extra_out(spec,
15995 spec->autocfg.speaker_pins[0],
15999 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16003 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
16007 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16009 if (spec->autocfg.dig_out_pin)
16010 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16012 if (spec->kctls.list)
16013 add_mixer(spec, spec->kctls.list);
16015 spec->num_mux_defs = 1;
16016 spec->input_mux = &spec->private_imux;
16018 add_verb(spec, alc662_auto_init_verbs);
16019 if (codec->vendor_id == 0x10ec0663)
16020 add_verb(spec, alc663_auto_init_verbs);
16022 err = alc_auto_add_mic_boost(codec);
16026 store_pin_configs(codec);
16030 /* additional initialization for auto-configuration model */
16031 static void alc662_auto_init(struct hda_codec *codec)
16033 struct alc_spec *spec = codec->spec;
16034 alc662_auto_init_multi_out(codec);
16035 alc662_auto_init_hp_out(codec);
16036 alc662_auto_init_analog_input(codec);
16037 alc662_auto_init_input_src(codec);
16038 if (spec->unsol_event)
16039 alc_inithook(codec);
16042 static int patch_alc662(struct hda_codec *codec)
16044 struct alc_spec *spec;
16045 int err, board_config;
16047 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16051 codec->spec = spec;
16053 alc_fix_pll_init(codec, 0x20, 0x04, 15);
16055 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
16058 if (board_config < 0) {
16059 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
16060 "trying auto-probe from BIOS...\n");
16061 board_config = ALC662_AUTO;
16064 if (board_config == ALC662_AUTO) {
16065 /* automatic parse from the BIOS config */
16066 err = alc662_parse_auto_config(codec);
16072 "hda_codec: Cannot set up configuration "
16073 "from BIOS. Using base mode...\n");
16074 board_config = ALC662_3ST_2ch_DIG;
16078 if (board_config != ALC662_AUTO)
16079 setup_preset(spec, &alc662_presets[board_config]);
16081 if (codec->vendor_id == 0x10ec0663) {
16082 spec->stream_name_analog = "ALC663 Analog";
16083 spec->stream_name_digital = "ALC663 Digital";
16084 } else if (codec->vendor_id == 0x10ec0272) {
16085 spec->stream_name_analog = "ALC272 Analog";
16086 spec->stream_name_digital = "ALC272 Digital";
16088 spec->stream_name_analog = "ALC662 Analog";
16089 spec->stream_name_digital = "ALC662 Digital";
16092 spec->stream_analog_playback = &alc662_pcm_analog_playback;
16093 spec->stream_analog_capture = &alc662_pcm_analog_capture;
16095 spec->stream_digital_playback = &alc662_pcm_digital_playback;
16096 spec->stream_digital_capture = &alc662_pcm_digital_capture;
16098 spec->adc_nids = alc662_adc_nids;
16099 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16100 spec->capsrc_nids = alc662_capsrc_nids;
16101 spec->is_mix_capture = 1;
16103 if (!spec->cap_mixer)
16104 set_capture_mixer(spec);
16106 spec->vmaster_nid = 0x02;
16108 codec->patch_ops = alc_patch_ops;
16109 if (board_config == ALC662_AUTO)
16110 spec->init_hook = alc662_auto_init;
16111 #ifdef CONFIG_SND_HDA_POWER_SAVE
16112 if (!spec->loopback.amplist)
16113 spec->loopback.amplist = alc662_loopbacks;
16122 struct hda_codec_preset snd_hda_preset_realtek[] = {
16123 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16124 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16125 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
16126 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
16127 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
16128 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
16129 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
16130 .patch = patch_alc861 },
16131 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
16132 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
16133 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
16134 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
16135 .patch = patch_alc883 },
16136 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
16137 .patch = patch_alc662 },
16138 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
16139 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
16140 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
16141 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
16142 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
16143 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16144 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
16145 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16146 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16147 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16148 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16149 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16150 .patch = patch_alc883 },
16151 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16152 {} /* terminator */