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"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
62 #ifdef CONFIG_SND_DEBUG
66 ALC880_MODEL_LAST /* last tag */
78 #ifdef CONFIG_SND_DEBUG
82 ALC260_MODEL_LAST /* last tag */
92 ALC262_HP_BPC_D7000_WL,
93 ALC262_HP_BPC_D7000_WF,
101 ALC262_MODEL_LAST /* last tag */
109 #ifdef CONFIG_SND_DEBUG
113 ALC268_MODEL_LAST /* last tag */
120 ALC269_MODEL_LAST /* last tag */
137 /* ALC861-VD models */
158 ALC662_ASUS_EEEPC_P701,
159 ALC662_ASUS_EEEPC_EP20,
187 ALC883_TARGA_2ch_DIG,
193 ALC883_LENOVO_101E_2ch,
194 ALC883_LENOVO_NB0763,
195 ALC888_LENOVO_MS7195_DIG,
205 #define GPIO_MASK 0x03
208 /* codec parameterization */
209 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
210 unsigned int num_mixers;
212 const struct hda_verb *init_verbs[5]; /* initialization verbs
216 unsigned int num_init_verbs;
218 char *stream_name_analog; /* analog PCM stream */
219 struct hda_pcm_stream *stream_analog_playback;
220 struct hda_pcm_stream *stream_analog_capture;
222 char *stream_name_digital; /* digital PCM stream */
223 struct hda_pcm_stream *stream_digital_playback;
224 struct hda_pcm_stream *stream_digital_capture;
227 struct hda_multi_out multiout; /* playback set-up
228 * max_channels, dacs must be set
229 * dig_out_nid and hp_nid are optional
233 unsigned int num_adc_nids;
235 hda_nid_t dig_in_nid; /* digital-in NID; optional */
238 unsigned int num_mux_defs;
239 const struct hda_input_mux *input_mux;
240 unsigned int cur_mux[3];
243 const struct hda_channel_mode *channel_mode;
244 int num_channel_mode;
247 /* PCM information */
248 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
250 /* dynamic controls, init_verbs and input_mux */
251 struct auto_pin_cfg autocfg;
252 unsigned int num_kctl_alloc, num_kctl_used;
253 struct snd_kcontrol_new *kctl_alloc;
254 struct hda_input_mux private_imux;
255 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
258 void (*init_hook)(struct hda_codec *codec);
259 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
261 /* for pin sensing */
262 unsigned int sense_updated: 1;
263 unsigned int jack_present: 1;
265 /* for virtual master */
266 hda_nid_t vmaster_nid;
268 #ifdef CONFIG_SND_HDA_POWER_SAVE
269 struct hda_loopback_check loopback;
274 * configuration template - to be copied to the spec instance
276 struct alc_config_preset {
277 struct snd_kcontrol_new *mixers[5]; /* should be identical size
280 const struct hda_verb *init_verbs[5];
281 unsigned int num_dacs;
283 hda_nid_t dig_out_nid; /* optional */
284 hda_nid_t hp_nid; /* optional */
285 unsigned int num_adc_nids;
287 hda_nid_t dig_in_nid;
288 unsigned int num_channel_mode;
289 const struct hda_channel_mode *channel_mode;
291 unsigned int num_mux_defs;
292 const struct hda_input_mux *input_mux;
293 void (*unsol_event)(struct hda_codec *, unsigned int);
294 void (*init_hook)(struct hda_codec *);
295 #ifdef CONFIG_SND_HDA_POWER_SAVE
296 struct hda_amp_list *loopbacks;
304 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
305 struct snd_ctl_elem_info *uinfo)
307 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
308 struct alc_spec *spec = codec->spec;
309 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
310 if (mux_idx >= spec->num_mux_defs)
312 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
315 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
316 struct snd_ctl_elem_value *ucontrol)
318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
319 struct alc_spec *spec = codec->spec;
320 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
322 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
326 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
327 struct snd_ctl_elem_value *ucontrol)
329 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
330 struct alc_spec *spec = codec->spec;
331 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
332 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
333 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
334 spec->adc_nids[adc_idx],
335 &spec->cur_mux[adc_idx]);
340 * channel mode setting
342 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
343 struct snd_ctl_elem_info *uinfo)
345 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
346 struct alc_spec *spec = codec->spec;
347 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
348 spec->num_channel_mode);
351 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
352 struct snd_ctl_elem_value *ucontrol)
354 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
355 struct alc_spec *spec = codec->spec;
356 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
357 spec->num_channel_mode,
358 spec->multiout.max_channels);
361 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
362 struct snd_ctl_elem_value *ucontrol)
364 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
365 struct alc_spec *spec = codec->spec;
366 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
367 spec->num_channel_mode,
368 &spec->multiout.max_channels);
369 if (err >= 0 && spec->need_dac_fix)
370 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
375 * Control the mode of pin widget settings via the mixer. "pc" is used
376 * instead of "%" to avoid consequences of accidently treating the % as
377 * being part of a format specifier. Maximum allowed length of a value is
378 * 63 characters plus NULL terminator.
380 * Note: some retasking pin complexes seem to ignore requests for input
381 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
382 * are requested. Therefore order this list so that this behaviour will not
383 * cause problems when mixer clients move through the enum sequentially.
384 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
387 static char *alc_pin_mode_names[] = {
388 "Mic 50pc bias", "Mic 80pc bias",
389 "Line in", "Line out", "Headphone out",
391 static unsigned char alc_pin_mode_values[] = {
392 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
394 /* The control can present all 5 options, or it can limit the options based
395 * in the pin being assumed to be exclusively an input or an output pin. In
396 * addition, "input" pins may or may not process the mic bias option
397 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
398 * accept requests for bias as of chip versions up to March 2006) and/or
399 * wiring in the computer.
401 #define ALC_PIN_DIR_IN 0x00
402 #define ALC_PIN_DIR_OUT 0x01
403 #define ALC_PIN_DIR_INOUT 0x02
404 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
405 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
407 /* Info about the pin modes supported by the different pin direction modes.
408 * For each direction the minimum and maximum values are given.
410 static signed char alc_pin_mode_dir_info[5][2] = {
411 { 0, 2 }, /* ALC_PIN_DIR_IN */
412 { 3, 4 }, /* ALC_PIN_DIR_OUT */
413 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
414 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
415 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
417 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
418 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
419 #define alc_pin_mode_n_items(_dir) \
420 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
422 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
423 struct snd_ctl_elem_info *uinfo)
425 unsigned int item_num = uinfo->value.enumerated.item;
426 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
428 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
430 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
432 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
433 item_num = alc_pin_mode_min(dir);
434 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
438 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
439 struct snd_ctl_elem_value *ucontrol)
442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
443 hda_nid_t nid = kcontrol->private_value & 0xffff;
444 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
445 long *valp = ucontrol->value.integer.value;
446 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
447 AC_VERB_GET_PIN_WIDGET_CONTROL,
450 /* Find enumerated value for current pinctl setting */
451 i = alc_pin_mode_min(dir);
452 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
454 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
458 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 hda_nid_t nid = kcontrol->private_value & 0xffff;
464 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
465 long val = *ucontrol->value.integer.value;
466 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
467 AC_VERB_GET_PIN_WIDGET_CONTROL,
470 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
471 val = alc_pin_mode_min(dir);
473 change = pinctl != alc_pin_mode_values[val];
475 /* Set pin mode to that requested */
476 snd_hda_codec_write_cache(codec, nid, 0,
477 AC_VERB_SET_PIN_WIDGET_CONTROL,
478 alc_pin_mode_values[val]);
480 /* Also enable the retasking pin's input/output as required
481 * for the requested pin mode. Enum values of 2 or less are
484 * Dynamically switching the input/output buffers probably
485 * reduces noise slightly (particularly on input) so we'll
486 * do it. However, having both input and output buffers
487 * enabled simultaneously doesn't seem to be problematic if
488 * this turns out to be necessary in the future.
491 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
492 HDA_AMP_MUTE, HDA_AMP_MUTE);
493 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
496 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
497 HDA_AMP_MUTE, HDA_AMP_MUTE);
498 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
505 #define ALC_PIN_MODE(xname, nid, dir) \
506 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
507 .info = alc_pin_mode_info, \
508 .get = alc_pin_mode_get, \
509 .put = alc_pin_mode_put, \
510 .private_value = nid | (dir<<16) }
512 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
513 * together using a mask with more than one bit set. This control is
514 * currently used only by the ALC260 test model. At this stage they are not
515 * needed for any "production" models.
517 #ifdef CONFIG_SND_DEBUG
518 #define alc_gpio_data_info snd_ctl_boolean_mono_info
520 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
521 struct snd_ctl_elem_value *ucontrol)
523 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
524 hda_nid_t nid = kcontrol->private_value & 0xffff;
525 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
526 long *valp = ucontrol->value.integer.value;
527 unsigned int val = snd_hda_codec_read(codec, nid, 0,
528 AC_VERB_GET_GPIO_DATA, 0x00);
530 *valp = (val & mask) != 0;
533 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
534 struct snd_ctl_elem_value *ucontrol)
537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
538 hda_nid_t nid = kcontrol->private_value & 0xffff;
539 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
540 long val = *ucontrol->value.integer.value;
541 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
542 AC_VERB_GET_GPIO_DATA,
545 /* Set/unset the masked GPIO bit(s) as needed */
546 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
551 snd_hda_codec_write_cache(codec, nid, 0,
552 AC_VERB_SET_GPIO_DATA, gpio_data);
556 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
557 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
558 .info = alc_gpio_data_info, \
559 .get = alc_gpio_data_get, \
560 .put = alc_gpio_data_put, \
561 .private_value = nid | (mask<<16) }
562 #endif /* CONFIG_SND_DEBUG */
564 /* A switch control to allow the enabling of the digital IO pins on the
565 * ALC260. This is incredibly simplistic; the intention of this control is
566 * to provide something in the test model allowing digital outputs to be
567 * identified if present. If models are found which can utilise these
568 * outputs a more complete mixer control can be devised for those models if
571 #ifdef CONFIG_SND_DEBUG
572 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
574 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
575 struct snd_ctl_elem_value *ucontrol)
577 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
578 hda_nid_t nid = kcontrol->private_value & 0xffff;
579 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
580 long *valp = ucontrol->value.integer.value;
581 unsigned int val = snd_hda_codec_read(codec, nid, 0,
582 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
584 *valp = (val & mask) != 0;
587 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_DIGI_CONVERT_1,
599 /* Set/unset the masked control bit(s) as needed */
600 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
605 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
610 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
611 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
612 .info = alc_spdif_ctrl_info, \
613 .get = alc_spdif_ctrl_get, \
614 .put = alc_spdif_ctrl_put, \
615 .private_value = nid | (mask<<16) }
616 #endif /* CONFIG_SND_DEBUG */
618 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
619 * Again, this is only used in the ALC26x test models to help identify when
620 * the EAPD line must be asserted for features to work.
622 #ifdef CONFIG_SND_DEBUG
623 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
625 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
626 struct snd_ctl_elem_value *ucontrol)
628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
629 hda_nid_t nid = kcontrol->private_value & 0xffff;
630 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
631 long *valp = ucontrol->value.integer.value;
632 unsigned int val = snd_hda_codec_read(codec, nid, 0,
633 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
635 *valp = (val & mask) != 0;
639 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
644 hda_nid_t nid = kcontrol->private_value & 0xffff;
645 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
646 long val = *ucontrol->value.integer.value;
647 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
648 AC_VERB_GET_EAPD_BTLENABLE,
651 /* Set/unset the masked control bit(s) as needed */
652 change = (!val ? 0 : mask) != (ctrl_data & mask);
657 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
663 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
664 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
665 .info = alc_eapd_ctrl_info, \
666 .get = alc_eapd_ctrl_get, \
667 .put = alc_eapd_ctrl_put, \
668 .private_value = nid | (mask<<16) }
669 #endif /* CONFIG_SND_DEBUG */
672 * set up from the preset table
674 static void setup_preset(struct alc_spec *spec,
675 const struct alc_config_preset *preset)
679 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
680 spec->mixers[spec->num_mixers++] = preset->mixers[i];
681 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
683 spec->init_verbs[spec->num_init_verbs++] =
684 preset->init_verbs[i];
686 spec->channel_mode = preset->channel_mode;
687 spec->num_channel_mode = preset->num_channel_mode;
688 spec->need_dac_fix = preset->need_dac_fix;
690 spec->multiout.max_channels = spec->channel_mode[0].channels;
692 spec->multiout.num_dacs = preset->num_dacs;
693 spec->multiout.dac_nids = preset->dac_nids;
694 spec->multiout.dig_out_nid = preset->dig_out_nid;
695 spec->multiout.hp_nid = preset->hp_nid;
697 spec->num_mux_defs = preset->num_mux_defs;
698 if (!spec->num_mux_defs)
699 spec->num_mux_defs = 1;
700 spec->input_mux = preset->input_mux;
702 spec->num_adc_nids = preset->num_adc_nids;
703 spec->adc_nids = preset->adc_nids;
704 spec->dig_in_nid = preset->dig_in_nid;
706 spec->unsol_event = preset->unsol_event;
707 spec->init_hook = preset->init_hook;
708 #ifdef CONFIG_SND_HDA_POWER_SAVE
709 spec->loopback.amplist = preset->loopbacks;
713 /* Enable GPIO mask and set output */
714 static struct hda_verb alc_gpio1_init_verbs[] = {
715 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
716 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
717 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
721 static struct hda_verb alc_gpio2_init_verbs[] = {
722 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
723 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
724 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
728 static struct hda_verb alc_gpio3_init_verbs[] = {
729 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
730 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
731 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
735 static void alc_sku_automute(struct hda_codec *codec)
737 struct alc_spec *spec = codec->spec;
739 unsigned int present;
740 unsigned int hp_nid = spec->autocfg.hp_pins[0];
741 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
743 /* need to execute and sync at first */
744 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
745 present = snd_hda_codec_read(codec, hp_nid, 0,
746 AC_VERB_GET_PIN_SENSE, 0);
747 spec->jack_present = (present & 0x80000000) != 0;
748 if (spec->jack_present) {
749 /* mute internal speaker */
750 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
751 HDA_AMP_MUTE, HDA_AMP_MUTE);
753 /* unmute internal speaker if necessary */
754 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
755 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
760 /* unsolicited event for HP jack sensing */
761 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
763 if (codec->vendor_id == 0x10ec0880)
767 if (res != ALC880_HP_EVENT)
770 alc_sku_automute(codec);
773 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
774 * 31 ~ 16 : Manufacture ID
776 * 7 ~ 0 : Assembly ID
777 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
779 static void alc_subsystem_id(struct hda_codec *codec,
780 unsigned int porta, unsigned int porte,
783 unsigned int ass, tmp, i;
785 struct alc_spec *spec = codec->spec;
787 ass = codec->subsystem_id & 0xffff;
788 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
792 * 31~30 : port conetcivity
795 * 19~16 : Check sum (15:1)
800 if (codec->vendor_id == 0x10ec0260)
802 ass = snd_hda_codec_read(codec, nid, 0,
803 AC_VERB_GET_CONFIG_DEFAULT, 0);
804 if (!(ass & 1) && !(ass & 0x100000))
806 if ((ass >> 30) != 1) /* no physical connection */
811 for (i = 1; i < 16; i++) {
815 if (((ass >> 16) & 0xf) != tmp)
821 * 2 : 0 --> Desktop, 1 --> Laptop
822 * 3~5 : External Amplifier control
825 tmp = (ass & 0x38) >> 3; /* external Amp control */
828 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
831 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
834 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
836 case 5: /* set EAPD output high */
837 switch (codec->vendor_id) {
839 snd_hda_codec_write(codec, 0x0f, 0,
840 AC_VERB_SET_EAPD_BTLENABLE, 2);
841 snd_hda_codec_write(codec, 0x10, 0,
842 AC_VERB_SET_EAPD_BTLENABLE, 2);
850 snd_hda_codec_write(codec, 0x14, 0,
851 AC_VERB_SET_EAPD_BTLENABLE, 2);
852 snd_hda_codec_write(codec, 0x15, 0,
853 AC_VERB_SET_EAPD_BTLENABLE, 2);
856 switch (codec->vendor_id) {
858 snd_hda_codec_write(codec, 0x1a, 0,
859 AC_VERB_SET_COEF_INDEX, 7);
860 tmp = snd_hda_codec_read(codec, 0x1a, 0,
861 AC_VERB_GET_PROC_COEF, 0);
862 snd_hda_codec_write(codec, 0x1a, 0,
863 AC_VERB_SET_COEF_INDEX, 7);
864 snd_hda_codec_write(codec, 0x1a, 0,
865 AC_VERB_SET_PROC_COEF,
874 snd_hda_codec_write(codec, 0x20, 0,
875 AC_VERB_SET_COEF_INDEX, 7);
876 tmp = snd_hda_codec_read(codec, 0x20, 0,
877 AC_VERB_GET_PROC_COEF, 0);
878 snd_hda_codec_write(codec, 0x20, 0,
879 AC_VERB_SET_COEF_INDEX, 7);
880 snd_hda_codec_write(codec, 0x20, 0,
881 AC_VERB_SET_PROC_COEF,
886 snd_hda_codec_write(codec, 0x20, 0,
887 AC_VERB_SET_COEF_INDEX, 7);
888 tmp = snd_hda_codec_read(codec, 0x20, 0,
889 AC_VERB_GET_PROC_COEF, 0);
890 snd_hda_codec_write(codec, 0x20, 0,
891 AC_VERB_SET_COEF_INDEX, 7);
892 snd_hda_codec_write(codec, 0x20, 0,
893 AC_VERB_SET_PROC_COEF,
901 /* is laptop or Desktop and enable the function "Mute internal speaker
902 * when the external headphone out jack is plugged"
907 * 10~8 : Jack location
908 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
910 * 15 : 1 --> enable the function "Mute internal speaker
911 * when the external headphone out jack is plugged"
913 if (!spec->autocfg.speaker_pins[0]) {
914 if (spec->autocfg.line_out_pins[0])
915 spec->autocfg.speaker_pins[0] =
916 spec->autocfg.line_out_pins[0];
921 if (!spec->autocfg.hp_pins[0]) {
922 tmp = (ass >> 11) & 0x3; /* HP to chassis */
924 spec->autocfg.hp_pins[0] = porta;
926 spec->autocfg.hp_pins[0] = porte;
928 spec->autocfg.hp_pins[0] = portd;
933 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
934 AC_VERB_SET_UNSOLICITED_ENABLE,
935 AC_USRSP_EN | ALC880_HP_EVENT);
936 spec->unsol_event = alc_sku_unsol_event;
937 spec->init_hook = alc_sku_automute;
941 * Fix-up pin default configurations
949 static void alc_fix_pincfg(struct hda_codec *codec,
950 const struct snd_pci_quirk *quirk,
951 const struct alc_pincfg **pinfix)
953 const struct alc_pincfg *cfg;
955 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
959 cfg = pinfix[quirk->value];
960 for (; cfg->nid; cfg++) {
963 for (i = 0; i < 4; i++) {
964 snd_hda_codec_write(codec, cfg->nid, 0,
965 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
973 * ALC880 3-stack model
975 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
976 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
977 * F-Mic = 0x1b, HP = 0x19
980 static hda_nid_t alc880_dac_nids[4] = {
981 /* front, rear, clfe, rear_surr */
982 0x02, 0x05, 0x04, 0x03
985 static hda_nid_t alc880_adc_nids[3] = {
990 /* The datasheet says the node 0x07 is connected from inputs,
991 * but it shows zero connection in the real implementation on some devices.
992 * Note: this is a 915GAV bug, fixed on 915GLV
994 static hda_nid_t alc880_adc_nids_alt[2] = {
999 #define ALC880_DIGOUT_NID 0x06
1000 #define ALC880_DIGIN_NID 0x0a
1002 static struct hda_input_mux alc880_capture_source = {
1006 { "Front Mic", 0x3 },
1012 /* channel source setting (2/6 channel selection for 3-stack) */
1014 static struct hda_verb alc880_threestack_ch2_init[] = {
1015 /* set line-in to input, mute it */
1016 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1017 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1018 /* set mic-in to input vref 80%, mute it */
1019 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1020 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1025 static struct hda_verb alc880_threestack_ch6_init[] = {
1026 /* set line-in to output, unmute it */
1027 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1028 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1029 /* set mic-in to output, unmute it */
1030 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1031 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1035 static struct hda_channel_mode alc880_threestack_modes[2] = {
1036 { 2, alc880_threestack_ch2_init },
1037 { 6, alc880_threestack_ch6_init },
1040 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1044 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1049 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1050 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1051 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1052 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1057 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1058 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1062 .name = "Channel Mode",
1063 .info = alc_ch_mode_info,
1064 .get = alc_ch_mode_get,
1065 .put = alc_ch_mode_put,
1070 /* capture mixer elements */
1071 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1072 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1073 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1074 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1075 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1076 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1077 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1080 /* The multiple "Capture Source" controls confuse alsamixer
1081 * So call somewhat different..
1082 * FIXME: the controls appear in the "playback" view!
1084 /* .name = "Capture Source", */
1085 .name = "Input Source",
1087 .info = alc_mux_enum_info,
1088 .get = alc_mux_enum_get,
1089 .put = alc_mux_enum_put,
1094 /* capture mixer elements (in case NID 0x07 not available) */
1095 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1096 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1097 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1098 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1099 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1101 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1102 /* The multiple "Capture Source" controls confuse alsamixer
1103 * So call somewhat different..
1104 * FIXME: the controls appear in the "playback" view!
1106 /* .name = "Capture Source", */
1107 .name = "Input Source",
1109 .info = alc_mux_enum_info,
1110 .get = alc_mux_enum_get,
1111 .put = alc_mux_enum_put,
1119 * ALC880 5-stack model
1121 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1123 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1124 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1127 /* additional mixers to alc880_three_stack_mixer */
1128 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1129 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1130 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1134 /* channel source setting (6/8 channel selection for 5-stack) */
1136 static struct hda_verb alc880_fivestack_ch6_init[] = {
1137 /* set line-in to input, mute it */
1138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1144 static struct hda_verb alc880_fivestack_ch8_init[] = {
1145 /* set line-in to output, unmute it */
1146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1151 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1152 { 6, alc880_fivestack_ch6_init },
1153 { 8, alc880_fivestack_ch8_init },
1158 * ALC880 6-stack model
1160 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1161 * Side = 0x05 (0x0f)
1162 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1163 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1166 static hda_nid_t alc880_6st_dac_nids[4] = {
1167 /* front, rear, clfe, rear_surr */
1168 0x02, 0x03, 0x04, 0x05
1171 static struct hda_input_mux alc880_6stack_capture_source = {
1175 { "Front Mic", 0x1 },
1181 /* fixed 8-channels */
1182 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1186 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1195 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1205 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1206 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1209 .name = "Channel Mode",
1210 .info = alc_ch_mode_info,
1211 .get = alc_ch_mode_get,
1212 .put = alc_ch_mode_put,
1221 * W810 has rear IO for:
1224 * Center/LFE (DAC 04)
1227 * The system also has a pair of internal speakers, and a headphone jack.
1228 * These are both connected to Line2 on the codec, hence to DAC 02.
1230 * There is a variable resistor to control the speaker or headphone
1231 * volume. This is a hardware-only device without a software API.
1233 * Plugging headphones in will disable the internal speakers. This is
1234 * implemented in hardware, not via the driver using jack sense. In
1235 * a similar fashion, plugging into the rear socket marked "front" will
1236 * disable both the speakers and headphones.
1238 * For input, there's a microphone jack, and an "audio in" jack.
1239 * These may not do anything useful with this driver yet, because I
1240 * haven't setup any initialization verbs for these yet...
1243 static hda_nid_t alc880_w810_dac_nids[3] = {
1244 /* front, rear/surround, clfe */
1248 /* fixed 6 channels */
1249 static struct hda_channel_mode alc880_w810_modes[1] = {
1253 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1254 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1258 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1259 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1262 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1271 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1272 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1276 static hda_nid_t alc880_z71v_dac_nids[1] = {
1279 #define ALC880_Z71V_HP_DAC 0x03
1281 /* fixed 2 channels */
1282 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1286 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1289 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1290 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1291 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1292 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1301 * ALC880 F1734 model
1303 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1304 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1307 static hda_nid_t alc880_f1734_dac_nids[1] = {
1310 #define ALC880_F1734_HP_DAC 0x02
1312 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1314 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1315 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1316 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1317 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1318 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1329 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1330 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1331 * Mic = 0x18, Line = 0x1a
1334 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1335 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1337 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1341 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1343 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1345 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1346 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1347 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1348 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1349 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1354 .name = "Channel Mode",
1355 .info = alc_ch_mode_info,
1356 .get = alc_ch_mode_get,
1357 .put = alc_ch_mode_put,
1364 * ALC880 ASUS W1V model
1366 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1367 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1368 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1371 /* additional mixers to alc880_asus_mixer */
1372 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1373 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1374 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1378 /* additional mixers to alc880_asus_mixer */
1379 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1380 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1381 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1386 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1387 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1388 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1391 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1395 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1398 /* The multiple "Capture Source" controls confuse alsamixer
1399 * So call somewhat different..
1400 * FIXME: the controls appear in the "playback" view!
1402 /* .name = "Capture Source", */
1403 .name = "Input Source",
1405 .info = alc_mux_enum_info,
1406 .get = alc_mux_enum_get,
1407 .put = alc_mux_enum_put,
1413 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1414 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1415 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1416 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1417 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1418 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1419 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1420 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1421 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1425 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1428 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1430 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1431 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1434 .name = "Channel Mode",
1435 .info = alc_ch_mode_info,
1436 .get = alc_ch_mode_get,
1437 .put = alc_ch_mode_put,
1442 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1444 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1445 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1446 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1447 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1448 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1449 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1450 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1451 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1452 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1456 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1457 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1458 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1460 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1467 * virtual master controls
1471 * slave controls for virtual master
1473 static const char *alc_slave_vols[] = {
1474 "Front Playback Volume",
1475 "Surround Playback Volume",
1476 "Center Playback Volume",
1477 "LFE Playback Volume",
1478 "Side Playback Volume",
1479 "Headphone Playback Volume",
1480 "Speaker Playback Volume",
1481 "Mono Playback Volume",
1482 "iSpeaker Playback Volume",
1483 "Line-Out Playback Volume",
1487 static const char *alc_slave_sws[] = {
1488 "Front Playback Switch",
1489 "Surround Playback Switch",
1490 "Center Playback Switch",
1491 "LFE Playback Switch",
1492 "Side Playback Switch",
1493 "Headphone Playback Switch",
1494 "Speaker Playback Switch",
1495 "Mono Playback Switch",
1496 "iSpeaker Playback Switch",
1501 * build control elements
1503 static int alc_build_controls(struct hda_codec *codec)
1505 struct alc_spec *spec = codec->spec;
1509 for (i = 0; i < spec->num_mixers; i++) {
1510 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1515 if (spec->multiout.dig_out_nid) {
1516 err = snd_hda_create_spdif_out_ctls(codec,
1517 spec->multiout.dig_out_nid);
1521 if (spec->dig_in_nid) {
1522 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1527 /* if we have no master control, let's create it */
1528 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1529 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1530 HDA_OUTPUT, spec->vmaster_tlv);
1531 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1532 spec->vmaster_tlv, alc_slave_vols);
1536 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1537 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1538 NULL, alc_slave_sws);
1548 * initialize the codec volumes, etc
1552 * generic initialization of ADC, input mixers and output mixers
1554 static struct hda_verb alc880_volume_init_verbs[] = {
1556 * Unmute ADC0-2 and set the default input to mic-in
1558 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1565 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1567 * Note: PASD motherboards uses the Line In 2 as the input for front
1570 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1580 * Set up output mixers (0x0c - 0x0f)
1582 /* set vol=0 to output mixers */
1583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1586 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1587 /* set up input amps for analog loopback */
1588 /* Amp Indices: DAC = 0, mixer = 1 */
1589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1595 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1596 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1602 * 3-stack pin configuration:
1603 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1605 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1607 * preset connection lists of input pins
1608 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1610 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1611 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1612 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1615 * Set pin mode and muting
1617 /* set front pin widgets 0x14 for output */
1618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1619 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1620 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1621 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1623 /* Mic2 (as headphone out) for HP output */
1624 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1626 /* Line In pin widget for input */
1627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1629 /* Line2 (as front mic) pin widget for input and vref at 80% */
1630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1631 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1632 /* CD pin widget for input */
1633 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1639 * 5-stack pin configuration:
1640 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1641 * line-in/side = 0x1a, f-mic = 0x1b
1643 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1645 * preset connection lists of input pins
1646 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1648 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1649 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1652 * Set pin mode and muting
1654 /* set pin widgets 0x14-0x17 for output */
1655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1657 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1659 /* unmute pins for output (no gain on this amp) */
1660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1665 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1666 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1667 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1668 /* Mic2 (as headphone out) for HP output */
1669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1670 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1671 /* Line In pin widget for input */
1672 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1674 /* Line2 (as front mic) pin widget for input and vref at 80% */
1675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1676 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1677 /* CD pin widget for input */
1678 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1684 * W810 pin configuration:
1685 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1687 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1688 /* hphone/speaker input selector: front DAC */
1689 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1691 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1692 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1693 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1695 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1705 * Z71V pin configuration:
1706 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1708 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1714 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1715 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1717 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1723 * 6-stack pin configuration:
1724 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1725 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1727 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1728 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1735 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1736 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1737 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1739 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1746 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1747 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1753 * Uniwill pin configuration:
1754 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1757 static struct hda_verb alc880_uniwill_init_verbs[] = {
1758 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1764 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1765 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1766 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1767 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1771 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1773 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1775 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1779 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1781 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1782 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1783 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1785 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1786 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1793 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1795 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1796 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1801 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1818 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1819 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1824 static struct hda_verb alc880_beep_init_verbs[] = {
1825 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1829 /* toggle speaker-output according to the hp-jack state */
1830 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1832 unsigned int present;
1835 present = snd_hda_codec_read(codec, 0x14, 0,
1836 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1837 bits = present ? HDA_AMP_MUTE : 0;
1838 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1839 HDA_AMP_MUTE, bits);
1840 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1841 HDA_AMP_MUTE, bits);
1844 /* auto-toggle front mic */
1845 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1847 unsigned int present;
1850 present = snd_hda_codec_read(codec, 0x18, 0,
1851 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1852 bits = present ? HDA_AMP_MUTE : 0;
1853 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1856 static void alc880_uniwill_automute(struct hda_codec *codec)
1858 alc880_uniwill_hp_automute(codec);
1859 alc880_uniwill_mic_automute(codec);
1862 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1865 /* Looks like the unsol event is incompatible with the standard
1866 * definition. 4bit tag is placed at 28 bit!
1868 switch (res >> 28) {
1869 case ALC880_HP_EVENT:
1870 alc880_uniwill_hp_automute(codec);
1872 case ALC880_MIC_EVENT:
1873 alc880_uniwill_mic_automute(codec);
1878 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1880 unsigned int present;
1883 present = snd_hda_codec_read(codec, 0x14, 0,
1884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1885 bits = present ? HDA_AMP_MUTE : 0;
1886 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1889 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1891 unsigned int present;
1893 present = snd_hda_codec_read(codec, 0x21, 0,
1894 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1895 present &= HDA_AMP_VOLMASK;
1896 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1897 HDA_AMP_VOLMASK, present);
1898 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1899 HDA_AMP_VOLMASK, present);
1902 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1905 /* Looks like the unsol event is incompatible with the standard
1906 * definition. 4bit tag is placed at 28 bit!
1908 if ((res >> 28) == ALC880_HP_EVENT)
1909 alc880_uniwill_p53_hp_automute(codec);
1910 if ((res >> 28) == ALC880_DCVOL_EVENT)
1911 alc880_uniwill_p53_dcvol_automute(codec);
1916 * F1734 pin configuration:
1917 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1919 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1920 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1921 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1922 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1923 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1925 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1926 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1930 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1931 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1932 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1933 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1934 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1935 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1938 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1945 * ASUS pin configuration:
1946 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1948 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1949 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1950 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1951 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1952 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1955 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1957 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1960 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1961 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1963 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1965 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1968 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1969 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1971 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1976 /* Enable GPIO mask and set output */
1977 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1978 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1980 /* Clevo m520g init */
1981 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1982 /* headphone output */
1983 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1985 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1991 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1992 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1993 /* Mic1 (rear panel) */
1994 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 /* Mic2 (front panel) */
1997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2002 /* change to EAPD mode */
2003 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2004 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2009 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2010 /* change to EAPD mode */
2011 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2012 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2014 /* Headphone output */
2015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2018 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2020 /* Line In pin widget for input */
2021 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2022 /* CD pin widget for input */
2023 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2024 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2027 /* change to EAPD mode */
2028 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2029 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2035 * LG m1 express dual
2038 * Rear Line-In/Out (blue): 0x14
2039 * Build-in Mic-In: 0x15
2041 * HP-Out (green): 0x1b
2042 * Mic-In/Out (red): 0x19
2046 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2047 static hda_nid_t alc880_lg_dac_nids[3] = {
2051 /* seems analog CD is not working */
2052 static struct hda_input_mux alc880_lg_capture_source = {
2057 { "Internal Mic", 0x6 },
2061 /* 2,4,6 channel modes */
2062 static struct hda_verb alc880_lg_ch2_init[] = {
2063 /* set line-in and mic-in to input */
2064 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2065 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2069 static struct hda_verb alc880_lg_ch4_init[] = {
2070 /* set line-in to out and mic-in to input */
2071 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2072 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2076 static struct hda_verb alc880_lg_ch6_init[] = {
2077 /* set line-in and mic-in to output */
2078 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2079 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2083 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2084 { 2, alc880_lg_ch2_init },
2085 { 4, alc880_lg_ch4_init },
2086 { 6, alc880_lg_ch6_init },
2089 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2090 /* FIXME: it's not really "master" but front channels */
2091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2092 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2093 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2094 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2095 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2096 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2098 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2103 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2104 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2107 .name = "Channel Mode",
2108 .info = alc_ch_mode_info,
2109 .get = alc_ch_mode_get,
2110 .put = alc_ch_mode_put,
2115 static struct hda_verb alc880_lg_init_verbs[] = {
2116 /* set capture source to mic-in */
2117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2120 /* mute all amp mixer inputs */
2121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2124 /* line-in to input */
2125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2126 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2131 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2132 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2133 /* mic-in to input */
2134 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2135 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2138 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2139 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2140 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2146 /* toggle speaker-output according to the hp-jack state */
2147 static void alc880_lg_automute(struct hda_codec *codec)
2149 unsigned int present;
2152 present = snd_hda_codec_read(codec, 0x1b, 0,
2153 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2154 bits = present ? HDA_AMP_MUTE : 0;
2155 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2156 HDA_AMP_MUTE, bits);
2159 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2161 /* Looks like the unsol event is incompatible with the standard
2162 * definition. 4bit tag is placed at 28 bit!
2164 if ((res >> 28) == 0x01)
2165 alc880_lg_automute(codec);
2174 * Built-in Mic-In: 0x19
2180 static struct hda_input_mux alc880_lg_lw_capture_source = {
2184 { "Internal Mic", 0x1 },
2189 #define alc880_lg_lw_modes alc880_threestack_modes
2191 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2195 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2197 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2198 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2199 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2204 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2205 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2208 .name = "Channel Mode",
2209 .info = alc_ch_mode_info,
2210 .get = alc_ch_mode_get,
2211 .put = alc_ch_mode_put,
2216 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2217 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2218 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2219 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2221 /* set capture source to mic-in */
2222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2224 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2227 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2228 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2230 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2231 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2232 /* mic-in to input */
2233 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2234 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2236 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2237 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2239 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2243 /* toggle speaker-output according to the hp-jack state */
2244 static void alc880_lg_lw_automute(struct hda_codec *codec)
2246 unsigned int present;
2249 present = snd_hda_codec_read(codec, 0x1b, 0,
2250 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2251 bits = present ? HDA_AMP_MUTE : 0;
2252 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2253 HDA_AMP_MUTE, bits);
2256 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2258 /* Looks like the unsol event is incompatible with the standard
2259 * definition. 4bit tag is placed at 28 bit!
2261 if ((res >> 28) == 0x01)
2262 alc880_lg_lw_automute(codec);
2265 #ifdef CONFIG_SND_HDA_POWER_SAVE
2266 static struct hda_amp_list alc880_loopbacks[] = {
2267 { 0x0b, HDA_INPUT, 0 },
2268 { 0x0b, HDA_INPUT, 1 },
2269 { 0x0b, HDA_INPUT, 2 },
2270 { 0x0b, HDA_INPUT, 3 },
2271 { 0x0b, HDA_INPUT, 4 },
2275 static struct hda_amp_list alc880_lg_loopbacks[] = {
2276 { 0x0b, HDA_INPUT, 1 },
2277 { 0x0b, HDA_INPUT, 6 },
2278 { 0x0b, HDA_INPUT, 7 },
2287 static int alc_init(struct hda_codec *codec)
2289 struct alc_spec *spec = codec->spec;
2292 for (i = 0; i < spec->num_init_verbs; i++)
2293 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2295 if (spec->init_hook)
2296 spec->init_hook(codec);
2301 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2303 struct alc_spec *spec = codec->spec;
2305 if (spec->unsol_event)
2306 spec->unsol_event(codec, res);
2309 #ifdef CONFIG_SND_HDA_POWER_SAVE
2310 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2312 struct alc_spec *spec = codec->spec;
2313 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2318 * Analog playback callbacks
2320 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2321 struct hda_codec *codec,
2322 struct snd_pcm_substream *substream)
2324 struct alc_spec *spec = codec->spec;
2325 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2328 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2329 struct hda_codec *codec,
2330 unsigned int stream_tag,
2331 unsigned int format,
2332 struct snd_pcm_substream *substream)
2334 struct alc_spec *spec = codec->spec;
2335 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2336 stream_tag, format, substream);
2339 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2340 struct hda_codec *codec,
2341 struct snd_pcm_substream *substream)
2343 struct alc_spec *spec = codec->spec;
2344 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2350 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2351 struct hda_codec *codec,
2352 struct snd_pcm_substream *substream)
2354 struct alc_spec *spec = codec->spec;
2355 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2358 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2359 struct hda_codec *codec,
2360 unsigned int stream_tag,
2361 unsigned int format,
2362 struct snd_pcm_substream *substream)
2364 struct alc_spec *spec = codec->spec;
2365 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2366 stream_tag, format, substream);
2369 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2370 struct hda_codec *codec,
2371 struct snd_pcm_substream *substream)
2373 struct alc_spec *spec = codec->spec;
2374 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2380 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2381 struct hda_codec *codec,
2382 unsigned int stream_tag,
2383 unsigned int format,
2384 struct snd_pcm_substream *substream)
2386 struct alc_spec *spec = codec->spec;
2388 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2389 stream_tag, 0, format);
2393 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2394 struct hda_codec *codec,
2395 struct snd_pcm_substream *substream)
2397 struct alc_spec *spec = codec->spec;
2399 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2407 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2411 /* NID is set in alc_build_pcms */
2413 .open = alc880_playback_pcm_open,
2414 .prepare = alc880_playback_pcm_prepare,
2415 .cleanup = alc880_playback_pcm_cleanup
2419 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2423 /* NID is set in alc_build_pcms */
2425 .prepare = alc880_capture_pcm_prepare,
2426 .cleanup = alc880_capture_pcm_cleanup
2430 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2434 /* NID is set in alc_build_pcms */
2436 .open = alc880_dig_playback_pcm_open,
2437 .close = alc880_dig_playback_pcm_close,
2438 .prepare = alc880_dig_playback_pcm_prepare
2442 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2446 /* NID is set in alc_build_pcms */
2449 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2450 static struct hda_pcm_stream alc_pcm_null_playback = {
2456 static int alc_build_pcms(struct hda_codec *codec)
2458 struct alc_spec *spec = codec->spec;
2459 struct hda_pcm *info = spec->pcm_rec;
2462 codec->num_pcms = 1;
2463 codec->pcm_info = info;
2465 info->name = spec->stream_name_analog;
2466 if (spec->stream_analog_playback) {
2467 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2468 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2469 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2471 if (spec->stream_analog_capture) {
2472 snd_assert(spec->adc_nids, return -EINVAL);
2473 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2474 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2477 if (spec->channel_mode) {
2478 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2479 for (i = 0; i < spec->num_channel_mode; i++) {
2480 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2481 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2486 /* SPDIF for stream index #1 */
2487 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2488 codec->num_pcms = 2;
2489 info = spec->pcm_rec + 1;
2490 info->name = spec->stream_name_digital;
2491 if (spec->multiout.dig_out_nid &&
2492 spec->stream_digital_playback) {
2493 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2494 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2496 if (spec->dig_in_nid &&
2497 spec->stream_digital_capture) {
2498 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2499 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2503 /* If the use of more than one ADC is requested for the current
2504 * model, configure a second analog capture-only PCM.
2506 /* Additional Analaog capture for index #2 */
2507 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2509 codec->num_pcms = 3;
2510 info = spec->pcm_rec + 2;
2511 info->name = spec->stream_name_analog;
2512 /* No playback stream for second PCM */
2513 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2514 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2515 if (spec->stream_analog_capture) {
2516 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2517 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2524 static void alc_free(struct hda_codec *codec)
2526 struct alc_spec *spec = codec->spec;
2532 if (spec->kctl_alloc) {
2533 for (i = 0; i < spec->num_kctl_used; i++)
2534 kfree(spec->kctl_alloc[i].name);
2535 kfree(spec->kctl_alloc);
2542 static struct hda_codec_ops alc_patch_ops = {
2543 .build_controls = alc_build_controls,
2544 .build_pcms = alc_build_pcms,
2547 .unsol_event = alc_unsol_event,
2548 #ifdef CONFIG_SND_HDA_POWER_SAVE
2549 .check_power_status = alc_check_power_status,
2555 * Test configuration for debugging
2557 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2560 #ifdef CONFIG_SND_DEBUG
2561 static hda_nid_t alc880_test_dac_nids[4] = {
2562 0x02, 0x03, 0x04, 0x05
2565 static struct hda_input_mux alc880_test_capture_source = {
2574 { "Surround", 0x6 },
2578 static struct hda_channel_mode alc880_test_modes[4] = {
2585 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2586 struct snd_ctl_elem_info *uinfo)
2588 static char *texts[] = {
2589 "N/A", "Line Out", "HP Out",
2590 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2592 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2594 uinfo->value.enumerated.items = 8;
2595 if (uinfo->value.enumerated.item >= 8)
2596 uinfo->value.enumerated.item = 7;
2597 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2601 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2602 struct snd_ctl_elem_value *ucontrol)
2604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2605 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2606 unsigned int pin_ctl, item = 0;
2608 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2609 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2610 if (pin_ctl & AC_PINCTL_OUT_EN) {
2611 if (pin_ctl & AC_PINCTL_HP_EN)
2615 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2616 switch (pin_ctl & AC_PINCTL_VREFEN) {
2617 case AC_PINCTL_VREF_HIZ: item = 3; break;
2618 case AC_PINCTL_VREF_50: item = 4; break;
2619 case AC_PINCTL_VREF_GRD: item = 5; break;
2620 case AC_PINCTL_VREF_80: item = 6; break;
2621 case AC_PINCTL_VREF_100: item = 7; break;
2624 ucontrol->value.enumerated.item[0] = item;
2628 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2629 struct snd_ctl_elem_value *ucontrol)
2631 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2632 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2633 static unsigned int ctls[] = {
2634 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2635 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2636 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2637 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2638 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2639 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2641 unsigned int old_ctl, new_ctl;
2643 old_ctl = snd_hda_codec_read(codec, nid, 0,
2644 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2645 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2646 if (old_ctl != new_ctl) {
2648 snd_hda_codec_write_cache(codec, nid, 0,
2649 AC_VERB_SET_PIN_WIDGET_CONTROL,
2651 val = ucontrol->value.enumerated.item[0] >= 3 ?
2653 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2660 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2661 struct snd_ctl_elem_info *uinfo)
2663 static char *texts[] = {
2664 "Front", "Surround", "CLFE", "Side"
2666 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2668 uinfo->value.enumerated.items = 4;
2669 if (uinfo->value.enumerated.item >= 4)
2670 uinfo->value.enumerated.item = 3;
2671 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2675 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2676 struct snd_ctl_elem_value *ucontrol)
2678 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2679 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2682 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2683 ucontrol->value.enumerated.item[0] = sel & 3;
2687 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2688 struct snd_ctl_elem_value *ucontrol)
2690 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2691 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2694 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2695 if (ucontrol->value.enumerated.item[0] != sel) {
2696 sel = ucontrol->value.enumerated.item[0] & 3;
2697 snd_hda_codec_write_cache(codec, nid, 0,
2698 AC_VERB_SET_CONNECT_SEL, sel);
2704 #define PIN_CTL_TEST(xname,nid) { \
2705 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2707 .info = alc_test_pin_ctl_info, \
2708 .get = alc_test_pin_ctl_get, \
2709 .put = alc_test_pin_ctl_put, \
2710 .private_value = nid \
2713 #define PIN_SRC_TEST(xname,nid) { \
2714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2716 .info = alc_test_pin_src_info, \
2717 .get = alc_test_pin_src_get, \
2718 .put = alc_test_pin_src_put, \
2719 .private_value = nid \
2722 static struct snd_kcontrol_new alc880_test_mixer[] = {
2723 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2724 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2725 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2726 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2727 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2728 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2729 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2730 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2731 PIN_CTL_TEST("Front Pin Mode", 0x14),
2732 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2733 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2734 PIN_CTL_TEST("Side Pin Mode", 0x17),
2735 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2736 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2737 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2738 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2739 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2740 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2741 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2742 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2743 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2744 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2745 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2746 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2747 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2748 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2749 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2750 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2751 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2752 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2754 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2755 .name = "Channel Mode",
2756 .info = alc_ch_mode_info,
2757 .get = alc_ch_mode_get,
2758 .put = alc_ch_mode_put,
2763 static struct hda_verb alc880_test_init_verbs[] = {
2764 /* Unmute inputs of 0x0c - 0x0f */
2765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2767 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2771 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2772 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2773 /* Vol output for 0x0c-0x0f */
2774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2775 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2776 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2777 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2778 /* Set output pins 0x14-0x17 */
2779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2781 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2782 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2783 /* Unmute output pins 0x14-0x17 */
2784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2788 /* Set input pins 0x18-0x1c */
2789 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2790 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2791 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2792 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2793 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2794 /* Mute input pins 0x18-0x1b */
2795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2797 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2801 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2803 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2805 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2806 /* Analog input/passthru */
2807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2819 static const char *alc880_models[ALC880_MODEL_LAST] = {
2820 [ALC880_3ST] = "3stack",
2821 [ALC880_TCL_S700] = "tcl",
2822 [ALC880_3ST_DIG] = "3stack-digout",
2823 [ALC880_CLEVO] = "clevo",
2824 [ALC880_5ST] = "5stack",
2825 [ALC880_5ST_DIG] = "5stack-digout",
2826 [ALC880_W810] = "w810",
2827 [ALC880_Z71V] = "z71v",
2828 [ALC880_6ST] = "6stack",
2829 [ALC880_6ST_DIG] = "6stack-digout",
2830 [ALC880_ASUS] = "asus",
2831 [ALC880_ASUS_W1V] = "asus-w1v",
2832 [ALC880_ASUS_DIG] = "asus-dig",
2833 [ALC880_ASUS_DIG2] = "asus-dig2",
2834 [ALC880_UNIWILL_DIG] = "uniwill",
2835 [ALC880_UNIWILL_P53] = "uniwill-p53",
2836 [ALC880_FUJITSU] = "fujitsu",
2837 [ALC880_F1734] = "F1734",
2839 [ALC880_LG_LW] = "lg-lw",
2840 #ifdef CONFIG_SND_DEBUG
2841 [ALC880_TEST] = "test",
2843 [ALC880_AUTO] = "auto",
2846 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2847 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2848 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2849 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2850 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2851 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2852 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2853 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2854 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2855 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2856 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2857 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2858 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2859 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2860 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2861 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2862 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2863 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2864 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2865 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2866 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2867 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2868 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2869 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2870 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2871 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2872 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2873 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2874 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2875 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2876 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2877 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2878 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2879 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2880 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2881 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2882 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2883 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2884 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2885 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2886 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2887 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2888 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2889 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2890 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2891 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2892 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2893 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2894 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2895 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2896 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2897 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2898 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2899 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2900 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2901 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2902 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2903 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2904 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2905 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2906 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2907 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2908 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2909 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2910 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2911 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2912 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2913 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2914 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2915 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2920 * ALC880 codec presets
2922 static struct alc_config_preset alc880_presets[] = {
2924 .mixers = { alc880_three_stack_mixer },
2925 .init_verbs = { alc880_volume_init_verbs,
2926 alc880_pin_3stack_init_verbs },
2927 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2928 .dac_nids = alc880_dac_nids,
2929 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2930 .channel_mode = alc880_threestack_modes,
2932 .input_mux = &alc880_capture_source,
2934 [ALC880_3ST_DIG] = {
2935 .mixers = { alc880_three_stack_mixer },
2936 .init_verbs = { alc880_volume_init_verbs,
2937 alc880_pin_3stack_init_verbs },
2938 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2939 .dac_nids = alc880_dac_nids,
2940 .dig_out_nid = ALC880_DIGOUT_NID,
2941 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2942 .channel_mode = alc880_threestack_modes,
2944 .input_mux = &alc880_capture_source,
2946 [ALC880_TCL_S700] = {
2947 .mixers = { alc880_tcl_s700_mixer },
2948 .init_verbs = { alc880_volume_init_verbs,
2949 alc880_pin_tcl_S700_init_verbs,
2950 alc880_gpio2_init_verbs },
2951 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2952 .dac_nids = alc880_dac_nids,
2954 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2955 .channel_mode = alc880_2_jack_modes,
2956 .input_mux = &alc880_capture_source,
2959 .mixers = { alc880_three_stack_mixer,
2960 alc880_five_stack_mixer},
2961 .init_verbs = { alc880_volume_init_verbs,
2962 alc880_pin_5stack_init_verbs },
2963 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2964 .dac_nids = alc880_dac_nids,
2965 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2966 .channel_mode = alc880_fivestack_modes,
2967 .input_mux = &alc880_capture_source,
2969 [ALC880_5ST_DIG] = {
2970 .mixers = { alc880_three_stack_mixer,
2971 alc880_five_stack_mixer },
2972 .init_verbs = { alc880_volume_init_verbs,
2973 alc880_pin_5stack_init_verbs },
2974 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2975 .dac_nids = alc880_dac_nids,
2976 .dig_out_nid = ALC880_DIGOUT_NID,
2977 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2978 .channel_mode = alc880_fivestack_modes,
2979 .input_mux = &alc880_capture_source,
2982 .mixers = { alc880_six_stack_mixer },
2983 .init_verbs = { alc880_volume_init_verbs,
2984 alc880_pin_6stack_init_verbs },
2985 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2986 .dac_nids = alc880_6st_dac_nids,
2987 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2988 .channel_mode = alc880_sixstack_modes,
2989 .input_mux = &alc880_6stack_capture_source,
2991 [ALC880_6ST_DIG] = {
2992 .mixers = { alc880_six_stack_mixer },
2993 .init_verbs = { alc880_volume_init_verbs,
2994 alc880_pin_6stack_init_verbs },
2995 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2996 .dac_nids = alc880_6st_dac_nids,
2997 .dig_out_nid = ALC880_DIGOUT_NID,
2998 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2999 .channel_mode = alc880_sixstack_modes,
3000 .input_mux = &alc880_6stack_capture_source,
3003 .mixers = { alc880_w810_base_mixer },
3004 .init_verbs = { alc880_volume_init_verbs,
3005 alc880_pin_w810_init_verbs,
3006 alc880_gpio2_init_verbs },
3007 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3008 .dac_nids = alc880_w810_dac_nids,
3009 .dig_out_nid = ALC880_DIGOUT_NID,
3010 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3011 .channel_mode = alc880_w810_modes,
3012 .input_mux = &alc880_capture_source,
3015 .mixers = { alc880_z71v_mixer },
3016 .init_verbs = { alc880_volume_init_verbs,
3017 alc880_pin_z71v_init_verbs },
3018 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3019 .dac_nids = alc880_z71v_dac_nids,
3020 .dig_out_nid = ALC880_DIGOUT_NID,
3022 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3023 .channel_mode = alc880_2_jack_modes,
3024 .input_mux = &alc880_capture_source,
3027 .mixers = { alc880_f1734_mixer },
3028 .init_verbs = { alc880_volume_init_verbs,
3029 alc880_pin_f1734_init_verbs },
3030 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3031 .dac_nids = alc880_f1734_dac_nids,
3033 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3034 .channel_mode = alc880_2_jack_modes,
3035 .input_mux = &alc880_capture_source,
3038 .mixers = { alc880_asus_mixer },
3039 .init_verbs = { alc880_volume_init_verbs,
3040 alc880_pin_asus_init_verbs,
3041 alc880_gpio1_init_verbs },
3042 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3043 .dac_nids = alc880_asus_dac_nids,
3044 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3045 .channel_mode = alc880_asus_modes,
3047 .input_mux = &alc880_capture_source,
3049 [ALC880_ASUS_DIG] = {
3050 .mixers = { alc880_asus_mixer },
3051 .init_verbs = { alc880_volume_init_verbs,
3052 alc880_pin_asus_init_verbs,
3053 alc880_gpio1_init_verbs },
3054 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3055 .dac_nids = alc880_asus_dac_nids,
3056 .dig_out_nid = ALC880_DIGOUT_NID,
3057 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3058 .channel_mode = alc880_asus_modes,
3060 .input_mux = &alc880_capture_source,
3062 [ALC880_ASUS_DIG2] = {
3063 .mixers = { alc880_asus_mixer },
3064 .init_verbs = { alc880_volume_init_verbs,
3065 alc880_pin_asus_init_verbs,
3066 alc880_gpio2_init_verbs }, /* use GPIO2 */
3067 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3068 .dac_nids = alc880_asus_dac_nids,
3069 .dig_out_nid = ALC880_DIGOUT_NID,
3070 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3071 .channel_mode = alc880_asus_modes,
3073 .input_mux = &alc880_capture_source,
3075 [ALC880_ASUS_W1V] = {
3076 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3077 .init_verbs = { alc880_volume_init_verbs,
3078 alc880_pin_asus_init_verbs,
3079 alc880_gpio1_init_verbs },
3080 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3081 .dac_nids = alc880_asus_dac_nids,
3082 .dig_out_nid = ALC880_DIGOUT_NID,
3083 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3084 .channel_mode = alc880_asus_modes,
3086 .input_mux = &alc880_capture_source,
3088 [ALC880_UNIWILL_DIG] = {
3089 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3090 .init_verbs = { alc880_volume_init_verbs,
3091 alc880_pin_asus_init_verbs },
3092 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3093 .dac_nids = alc880_asus_dac_nids,
3094 .dig_out_nid = ALC880_DIGOUT_NID,
3095 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3096 .channel_mode = alc880_asus_modes,
3098 .input_mux = &alc880_capture_source,
3100 [ALC880_UNIWILL] = {
3101 .mixers = { alc880_uniwill_mixer },
3102 .init_verbs = { alc880_volume_init_verbs,
3103 alc880_uniwill_init_verbs },
3104 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3105 .dac_nids = alc880_asus_dac_nids,
3106 .dig_out_nid = ALC880_DIGOUT_NID,
3107 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3108 .channel_mode = alc880_threestack_modes,
3110 .input_mux = &alc880_capture_source,
3111 .unsol_event = alc880_uniwill_unsol_event,
3112 .init_hook = alc880_uniwill_automute,
3114 [ALC880_UNIWILL_P53] = {
3115 .mixers = { alc880_uniwill_p53_mixer },
3116 .init_verbs = { alc880_volume_init_verbs,
3117 alc880_uniwill_p53_init_verbs },
3118 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3119 .dac_nids = alc880_asus_dac_nids,
3120 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3121 .channel_mode = alc880_threestack_modes,
3122 .input_mux = &alc880_capture_source,
3123 .unsol_event = alc880_uniwill_p53_unsol_event,
3124 .init_hook = alc880_uniwill_p53_hp_automute,
3126 [ALC880_FUJITSU] = {
3127 .mixers = { alc880_fujitsu_mixer,
3128 alc880_pcbeep_mixer, },
3129 .init_verbs = { alc880_volume_init_verbs,
3130 alc880_uniwill_p53_init_verbs,
3131 alc880_beep_init_verbs },
3132 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3133 .dac_nids = alc880_dac_nids,
3134 .dig_out_nid = ALC880_DIGOUT_NID,
3135 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3136 .channel_mode = alc880_2_jack_modes,
3137 .input_mux = &alc880_capture_source,
3138 .unsol_event = alc880_uniwill_p53_unsol_event,
3139 .init_hook = alc880_uniwill_p53_hp_automute,
3142 .mixers = { alc880_three_stack_mixer },
3143 .init_verbs = { alc880_volume_init_verbs,
3144 alc880_pin_clevo_init_verbs },
3145 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3146 .dac_nids = alc880_dac_nids,
3148 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3149 .channel_mode = alc880_threestack_modes,
3151 .input_mux = &alc880_capture_source,
3154 .mixers = { alc880_lg_mixer },
3155 .init_verbs = { alc880_volume_init_verbs,
3156 alc880_lg_init_verbs },
3157 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3158 .dac_nids = alc880_lg_dac_nids,
3159 .dig_out_nid = ALC880_DIGOUT_NID,
3160 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3161 .channel_mode = alc880_lg_ch_modes,
3163 .input_mux = &alc880_lg_capture_source,
3164 .unsol_event = alc880_lg_unsol_event,
3165 .init_hook = alc880_lg_automute,
3166 #ifdef CONFIG_SND_HDA_POWER_SAVE
3167 .loopbacks = alc880_lg_loopbacks,
3171 .mixers = { alc880_lg_lw_mixer },
3172 .init_verbs = { alc880_volume_init_verbs,
3173 alc880_lg_lw_init_verbs },
3174 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3175 .dac_nids = alc880_dac_nids,
3176 .dig_out_nid = ALC880_DIGOUT_NID,
3177 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3178 .channel_mode = alc880_lg_lw_modes,
3179 .input_mux = &alc880_lg_lw_capture_source,
3180 .unsol_event = alc880_lg_lw_unsol_event,
3181 .init_hook = alc880_lg_lw_automute,
3183 #ifdef CONFIG_SND_DEBUG
3185 .mixers = { alc880_test_mixer },
3186 .init_verbs = { alc880_test_init_verbs },
3187 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3188 .dac_nids = alc880_test_dac_nids,
3189 .dig_out_nid = ALC880_DIGOUT_NID,
3190 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3191 .channel_mode = alc880_test_modes,
3192 .input_mux = &alc880_test_capture_source,
3198 * Automatic parse of I/O pins from the BIOS configuration
3201 #define NUM_CONTROL_ALLOC 32
3202 #define NUM_VERB_ALLOC 32
3206 ALC_CTL_WIDGET_MUTE,
3209 static struct snd_kcontrol_new alc880_control_templates[] = {
3210 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3211 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3212 HDA_BIND_MUTE(NULL, 0, 0, 0),
3215 /* add dynamic controls */
3216 static int add_control(struct alc_spec *spec, int type, const char *name,
3219 struct snd_kcontrol_new *knew;
3221 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3222 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3224 /* array + terminator */
3225 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3228 if (spec->kctl_alloc) {
3229 memcpy(knew, spec->kctl_alloc,
3230 sizeof(*knew) * spec->num_kctl_alloc);
3231 kfree(spec->kctl_alloc);
3233 spec->kctl_alloc = knew;
3234 spec->num_kctl_alloc = num;
3237 knew = &spec->kctl_alloc[spec->num_kctl_used];
3238 *knew = alc880_control_templates[type];
3239 knew->name = kstrdup(name, GFP_KERNEL);
3242 knew->private_value = val;
3243 spec->num_kctl_used++;
3247 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3248 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3249 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3250 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3251 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3252 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3253 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3254 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3255 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3256 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3257 #define ALC880_PIN_CD_NID 0x1c
3259 /* fill in the dac_nids table from the parsed pin configuration */
3260 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3261 const struct auto_pin_cfg *cfg)
3267 memset(assigned, 0, sizeof(assigned));
3268 spec->multiout.dac_nids = spec->private_dac_nids;
3270 /* check the pins hardwired to audio widget */
3271 for (i = 0; i < cfg->line_outs; i++) {
3272 nid = cfg->line_out_pins[i];
3273 if (alc880_is_fixed_pin(nid)) {
3274 int idx = alc880_fixed_pin_idx(nid);
3275 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3279 /* left pins can be connect to any audio widget */
3280 for (i = 0; i < cfg->line_outs; i++) {
3281 nid = cfg->line_out_pins[i];
3282 if (alc880_is_fixed_pin(nid))
3284 /* search for an empty channel */
3285 for (j = 0; j < cfg->line_outs; j++) {
3287 spec->multiout.dac_nids[i] =
3288 alc880_idx_to_dac(j);
3294 spec->multiout.num_dacs = cfg->line_outs;
3298 /* add playback controls from the parsed DAC table */
3299 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3300 const struct auto_pin_cfg *cfg)
3303 static const char *chname[4] = {
3304 "Front", "Surround", NULL /*CLFE*/, "Side"
3309 for (i = 0; i < cfg->line_outs; i++) {
3310 if (!spec->multiout.dac_nids[i])
3312 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3315 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3316 "Center Playback Volume",
3317 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3321 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3322 "LFE Playback Volume",
3323 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3327 err = add_control(spec, ALC_CTL_BIND_MUTE,
3328 "Center Playback Switch",
3329 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3333 err = add_control(spec, ALC_CTL_BIND_MUTE,
3334 "LFE Playback Switch",
3335 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3340 sprintf(name, "%s Playback Volume", chname[i]);
3341 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3342 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3346 sprintf(name, "%s Playback Switch", chname[i]);
3347 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3348 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3357 /* add playback controls for speaker and HP outputs */
3358 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3368 if (alc880_is_fixed_pin(pin)) {
3369 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3370 /* specify the DAC as the extra output */
3371 if (!spec->multiout.hp_nid)
3372 spec->multiout.hp_nid = nid;
3374 spec->multiout.extra_out_nid[0] = nid;
3375 /* control HP volume/switch on the output mixer amp */
3376 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3377 sprintf(name, "%s Playback Volume", pfx);
3378 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3379 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3382 sprintf(name, "%s Playback Switch", pfx);
3383 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3384 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3387 } else if (alc880_is_multi_pin(pin)) {
3388 /* set manual connection */
3389 /* we have only a switch on HP-out PIN */
3390 sprintf(name, "%s Playback Switch", pfx);
3391 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3392 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3399 /* create input playback/capture controls for the given pin */
3400 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3401 const char *ctlname,
3402 int idx, hda_nid_t mix_nid)
3407 sprintf(name, "%s Playback Volume", ctlname);
3408 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3409 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3412 sprintf(name, "%s Playback Switch", ctlname);
3413 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3414 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3420 /* create playback/capture controls for input pins */
3421 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3422 const struct auto_pin_cfg *cfg)
3424 struct hda_input_mux *imux = &spec->private_imux;
3427 for (i = 0; i < AUTO_PIN_LAST; i++) {
3428 if (alc880_is_input_pin(cfg->input_pins[i])) {
3429 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3430 err = new_analog_input(spec, cfg->input_pins[i],
3431 auto_pin_cfg_labels[i],
3435 imux->items[imux->num_items].label =
3436 auto_pin_cfg_labels[i];
3437 imux->items[imux->num_items].index =
3438 alc880_input_pin_idx(cfg->input_pins[i]);
3445 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3446 hda_nid_t nid, int pin_type,
3450 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3452 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3454 /* need the manual connection? */
3455 if (alc880_is_multi_pin(nid)) {
3456 struct alc_spec *spec = codec->spec;
3457 int idx = alc880_multi_pin_idx(nid);
3458 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3459 AC_VERB_SET_CONNECT_SEL,
3460 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3464 static int get_pin_type(int line_out_type)
3466 if (line_out_type == AUTO_PIN_HP_OUT)
3472 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3474 struct alc_spec *spec = codec->spec;
3477 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3478 for (i = 0; i < spec->autocfg.line_outs; i++) {
3479 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3480 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3481 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3485 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3487 struct alc_spec *spec = codec->spec;
3490 pin = spec->autocfg.speaker_pins[0];
3491 if (pin) /* connect to front */
3492 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3493 pin = spec->autocfg.hp_pins[0];
3494 if (pin) /* connect to front */
3495 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3498 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3500 struct alc_spec *spec = codec->spec;
3503 for (i = 0; i < AUTO_PIN_LAST; i++) {
3504 hda_nid_t nid = spec->autocfg.input_pins[i];
3505 if (alc880_is_input_pin(nid)) {
3506 snd_hda_codec_write(codec, nid, 0,
3507 AC_VERB_SET_PIN_WIDGET_CONTROL,
3508 i <= AUTO_PIN_FRONT_MIC ?
3509 PIN_VREF80 : PIN_IN);
3510 if (nid != ALC880_PIN_CD_NID)
3511 snd_hda_codec_write(codec, nid, 0,
3512 AC_VERB_SET_AMP_GAIN_MUTE,
3518 /* parse the BIOS configuration and set up the alc_spec */
3519 /* return 1 if successful, 0 if the proper config is not found,
3520 * or a negative error code
3522 static int alc880_parse_auto_config(struct hda_codec *codec)
3524 struct alc_spec *spec = codec->spec;
3526 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3528 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3532 if (!spec->autocfg.line_outs)
3533 return 0; /* can't find valid BIOS pin config */
3535 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3538 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3541 err = alc880_auto_create_extra_out(spec,
3542 spec->autocfg.speaker_pins[0],
3546 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3550 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3554 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3556 if (spec->autocfg.dig_out_pin)
3557 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3558 if (spec->autocfg.dig_in_pin)
3559 spec->dig_in_nid = ALC880_DIGIN_NID;
3561 if (spec->kctl_alloc)
3562 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3564 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3566 spec->num_mux_defs = 1;
3567 spec->input_mux = &spec->private_imux;
3572 /* additional initialization for auto-configuration model */
3573 static void alc880_auto_init(struct hda_codec *codec)
3575 alc880_auto_init_multi_out(codec);
3576 alc880_auto_init_extra_out(codec);
3577 alc880_auto_init_analog_input(codec);
3581 * OK, here we have finally the patch for ALC880
3584 static int patch_alc880(struct hda_codec *codec)
3586 struct alc_spec *spec;
3590 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3596 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3599 if (board_config < 0) {
3600 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3601 "trying auto-probe from BIOS...\n");
3602 board_config = ALC880_AUTO;
3605 if (board_config == ALC880_AUTO) {
3606 /* automatic parse from the BIOS config */
3607 err = alc880_parse_auto_config(codec);
3613 "hda_codec: Cannot set up configuration "
3614 "from BIOS. Using 3-stack mode...\n");
3615 board_config = ALC880_3ST;
3619 if (board_config != ALC880_AUTO)
3620 setup_preset(spec, &alc880_presets[board_config]);
3622 spec->stream_name_analog = "ALC880 Analog";
3623 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3624 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3626 spec->stream_name_digital = "ALC880 Digital";
3627 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3628 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3630 if (!spec->adc_nids && spec->input_mux) {
3631 /* check whether NID 0x07 is valid */
3632 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3634 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3635 if (wcap != AC_WID_AUD_IN) {
3636 spec->adc_nids = alc880_adc_nids_alt;
3637 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3638 spec->mixers[spec->num_mixers] =
3639 alc880_capture_alt_mixer;
3642 spec->adc_nids = alc880_adc_nids;
3643 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3644 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3649 spec->vmaster_nid = 0x0c;
3651 codec->patch_ops = alc_patch_ops;
3652 if (board_config == ALC880_AUTO)
3653 spec->init_hook = alc880_auto_init;
3654 #ifdef CONFIG_SND_HDA_POWER_SAVE
3655 if (!spec->loopback.amplist)
3656 spec->loopback.amplist = alc880_loopbacks;
3667 static hda_nid_t alc260_dac_nids[1] = {
3672 static hda_nid_t alc260_adc_nids[1] = {
3677 static hda_nid_t alc260_adc_nids_alt[1] = {
3682 static hda_nid_t alc260_hp_adc_nids[2] = {
3687 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3688 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3690 static hda_nid_t alc260_dual_adc_nids[2] = {
3695 #define ALC260_DIGOUT_NID 0x03
3696 #define ALC260_DIGIN_NID 0x06
3698 static struct hda_input_mux alc260_capture_source = {
3702 { "Front Mic", 0x1 },
3708 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3709 * headphone jack and the internal CD lines since these are the only pins at
3710 * which audio can appear. For flexibility, also allow the option of
3711 * recording the mixer output on the second ADC (ADC0 doesn't have a
3712 * connection to the mixer output).
3714 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3718 { "Mic/Line", 0x0 },
3720 { "Headphone", 0x2 },
3726 { "Mic/Line", 0x0 },
3728 { "Headphone", 0x2 },
3735 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3736 * the Fujitsu S702x, but jacks are marked differently.
3738 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3745 { "Headphone", 0x5 },
3754 { "Headphone", 0x6 },
3760 * This is just place-holder, so there's something for alc_build_pcms to look
3761 * at when it calculates the maximum number of channels. ALC260 has no mixer
3762 * element which allows changing the channel mode, so the verb list is
3765 static struct hda_channel_mode alc260_modes[1] = {
3770 /* Mixer combinations
3772 * basic: base_output + input + pc_beep + capture
3773 * HP: base_output + input + capture_alt
3774 * HP_3013: hp_3013 + input + capture
3775 * fujitsu: fujitsu + capture
3776 * acer: acer + capture
3779 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3780 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3781 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3782 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3783 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3784 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3785 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3789 static struct snd_kcontrol_new alc260_input_mixer[] = {
3790 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3791 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3792 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3793 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3795 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3796 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3797 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3801 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3802 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3803 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3807 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3808 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3809 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3810 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3811 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3814 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3815 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3819 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3820 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3822 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3823 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3824 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3825 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3826 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3827 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3828 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3829 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3830 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3831 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3832 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3833 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3834 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3838 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3839 * versions of the ALC260 don't act on requests to enable mic bias from NID
3840 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3841 * datasheet doesn't mention this restriction. At this stage it's not clear
3842 * whether this behaviour is intentional or is a hardware bug in chip
3843 * revisions available in early 2006. Therefore for now allow the
3844 * "Headphone Jack Mode" control to span all choices, but if it turns out
3845 * that the lack of mic bias for this NID is intentional we could change the
3846 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3848 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3849 * don't appear to make the mic bias available from the "line" jack, even
3850 * though the NID used for this jack (0x14) can supply it. The theory is
3851 * that perhaps Acer have included blocking capacitors between the ALC260
3852 * and the output jack. If this turns out to be the case for all such
3853 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3854 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3856 * The C20x Tablet series have a mono internal speaker which is controlled
3857 * via the chip's Mono sum widget and pin complex, so include the necessary
3858 * controls for such models. On models without a "mono speaker" the control
3859 * won't do anything.
3861 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3862 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3863 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3864 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3865 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3867 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3869 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3870 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3872 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3873 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3874 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3875 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3876 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3877 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3878 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3882 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3883 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3885 static struct snd_kcontrol_new alc260_will_mixer[] = {
3886 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3887 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3889 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3890 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3891 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3892 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3893 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3894 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3895 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3896 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3897 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3901 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3902 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3904 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3905 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3906 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3908 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3909 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3910 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3911 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3912 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3913 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3914 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3918 /* capture mixer elements */
3919 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3920 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3921 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3922 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3923 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3926 /* The multiple "Capture Source" controls confuse alsamixer
3927 * So call somewhat different..
3928 * FIXME: the controls appear in the "playback" view!
3930 /* .name = "Capture Source", */
3931 .name = "Input Source",
3933 .info = alc_mux_enum_info,
3934 .get = alc_mux_enum_get,
3935 .put = alc_mux_enum_put,
3940 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3941 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3942 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3945 /* The multiple "Capture Source" controls confuse alsamixer
3946 * So call somewhat different..
3947 * FIXME: the controls appear in the "playback" view!
3949 /* .name = "Capture Source", */
3950 .name = "Input Source",
3952 .info = alc_mux_enum_info,
3953 .get = alc_mux_enum_get,
3954 .put = alc_mux_enum_put,
3960 * initialization verbs
3962 static struct hda_verb alc260_init_verbs[] = {
3963 /* Line In pin widget for input */
3964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3965 /* CD pin widget for input */
3966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3967 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3968 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3969 /* Mic2 (front panel) pin widget for input and vref at 80% */
3970 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3971 /* LINE-2 is used for line-out in rear */
3972 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3973 /* select line-out */
3974 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3976 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3978 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3980 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3981 /* mute capture amp left and right */
3982 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3983 /* set connection select to line in (default select for this ADC) */
3984 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3985 /* mute capture amp left and right */
3986 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3987 /* set connection select to line in (default select for this ADC) */
3988 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3989 /* set vol=0 Line-Out mixer amp left and right */
3990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3991 /* unmute pin widget amp left and right (no gain on this amp) */
3992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3993 /* set vol=0 HP mixer amp left and right */
3994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3995 /* unmute pin widget amp left and right (no gain on this amp) */
3996 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3997 /* set vol=0 Mono mixer amp left and right */
3998 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3999 /* unmute pin widget amp left and right (no gain on this amp) */
4000 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4001 /* unmute LINE-2 out pin */
4002 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4003 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4006 /* mute analog inputs */
4007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4010 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4011 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4012 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4013 /* mute Front out path */
4014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4016 /* mute Headphone out path */
4017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4019 /* mute Mono out path */
4020 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4021 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4025 #if 0 /* should be identical with alc260_init_verbs? */
4026 static struct hda_verb alc260_hp_init_verbs[] = {
4027 /* Headphone and output */
4028 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4030 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4031 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4032 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4033 /* Mic2 (front panel) pin widget for input and vref at 80% */
4034 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4035 /* Line In pin widget for input */
4036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4037 /* Line-2 pin widget for output */
4038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4039 /* CD pin widget for input */
4040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4041 /* unmute amp left and right */
4042 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4043 /* set connection select to line in (default select for this ADC) */
4044 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4045 /* unmute Line-Out mixer amp left and right (volume = 0) */
4046 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4047 /* mute pin widget amp left and right (no gain on this amp) */
4048 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4049 /* unmute HP mixer amp left and right (volume = 0) */
4050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4051 /* mute pin widget amp left and right (no gain on this amp) */
4052 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4053 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4056 /* mute analog inputs */
4057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4062 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4063 /* Unmute Front out path */
4064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4066 /* Unmute Headphone out path */
4067 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4069 /* Unmute Mono out path */
4070 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4076 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4077 /* Line out and output */
4078 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4080 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4081 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4083 /* Mic2 (front panel) pin widget for input and vref at 80% */
4084 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4085 /* Line In pin widget for input */
4086 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4087 /* Headphone pin widget for output */
4088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4089 /* CD pin widget for input */
4090 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4091 /* unmute amp left and right */
4092 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4093 /* set connection select to line in (default select for this ADC) */
4094 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4095 /* unmute Line-Out mixer amp left and right (volume = 0) */
4096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4097 /* mute pin widget amp left and right (no gain on this amp) */
4098 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4099 /* unmute HP mixer amp left and right (volume = 0) */
4100 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4101 /* mute pin widget amp left and right (no gain on this amp) */
4102 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4103 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4106 /* mute analog inputs */
4107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4112 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4113 /* Unmute Front out path */
4114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4116 /* Unmute Headphone out path */
4117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4118 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4119 /* Unmute Mono out path */
4120 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4121 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4125 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4126 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4127 * audio = 0x16, internal speaker = 0x10.
4129 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4130 /* Disable all GPIOs */
4131 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4132 /* Internal speaker is connected to headphone pin */
4133 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4134 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4136 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4137 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4138 /* Ensure all other unused pins are disabled and muted. */
4139 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4140 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4141 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4142 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4143 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4144 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4146 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4148 /* Disable digital (SPDIF) pins */
4149 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4150 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4152 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4153 * when acting as an output.
4155 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4157 /* Start with output sum widgets muted and their output gains at min */
4158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4163 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4164 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4165 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4166 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4168 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4169 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4170 /* Unmute Line1 pin widget output buffer since it starts as an output.
4171 * If the pin mode is changed by the user the pin mode control will
4172 * take care of enabling the pin's input/output buffers as needed.
4173 * Therefore there's no need to enable the input buffer at this
4176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4177 /* Unmute input buffer of pin widget used for Line-in (no equiv
4180 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4182 /* Mute capture amp left and right */
4183 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4184 /* Set ADC connection select to match default mixer setting - line
4187 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4189 /* Do the same for the second ADC: mute capture input amp and
4190 * set ADC connection to line in (on mic1 pin)
4192 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4193 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4195 /* Mute all inputs to mixer widget (even unconnected ones) */
4196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4202 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4208 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4209 * similar laptops (adapted from Fujitsu init verbs).
4211 static struct hda_verb alc260_acer_init_verbs[] = {
4212 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4213 * the headphone jack. Turn this on and rely on the standard mute
4214 * methods whenever the user wants to turn these outputs off.
4216 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4217 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4218 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4219 /* Internal speaker/Headphone jack is connected to Line-out pin */
4220 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4221 /* Internal microphone/Mic jack is connected to Mic1 pin */
4222 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4223 /* Line In jack is connected to Line1 pin */
4224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4225 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4226 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4227 /* Ensure all other unused pins are disabled and muted. */
4228 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4229 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4230 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4231 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4234 /* Disable digital (SPDIF) pins */
4235 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4236 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4238 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4239 * bus when acting as outputs.
4241 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4242 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4244 /* Start with output sum widgets muted and their output gains at min */
4245 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4247 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4249 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4251 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4252 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4253 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4255 /* Unmute Line-out pin widget amp left and right
4256 * (no equiv mixer ctrl)
4258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4259 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4260 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4261 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4262 * inputs. If the pin mode is changed by the user the pin mode control
4263 * will take care of enabling the pin's input/output buffers as needed.
4264 * Therefore there's no need to enable the input buffer at this
4267 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4268 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4270 /* Mute capture amp left and right */
4271 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4272 /* Set ADC connection select to match default mixer setting - mic
4275 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4277 /* Do similar with the second ADC: mute capture input amp and
4278 * set ADC connection to mic to match ALSA's default state.
4280 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4281 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4283 /* Mute all inputs to mixer widget (even unconnected ones) */
4284 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4296 static struct hda_verb alc260_will_verbs[] = {
4297 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4298 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4299 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4300 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4301 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4302 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4306 static struct hda_verb alc260_replacer_672v_verbs[] = {
4307 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4308 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4309 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4311 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4312 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4313 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4315 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4319 /* toggle speaker-output according to the hp-jack state */
4320 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4322 unsigned int present;
4324 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4325 present = snd_hda_codec_read(codec, 0x0f, 0,
4326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4328 snd_hda_codec_write_cache(codec, 0x01, 0,
4329 AC_VERB_SET_GPIO_DATA, 1);
4330 snd_hda_codec_write_cache(codec, 0x0f, 0,
4331 AC_VERB_SET_PIN_WIDGET_CONTROL,
4334 snd_hda_codec_write_cache(codec, 0x01, 0,
4335 AC_VERB_SET_GPIO_DATA, 0);
4336 snd_hda_codec_write_cache(codec, 0x0f, 0,
4337 AC_VERB_SET_PIN_WIDGET_CONTROL,
4342 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4345 if ((res >> 26) == ALC880_HP_EVENT)
4346 alc260_replacer_672v_automute(codec);
4349 /* Test configuration for debugging, modelled after the ALC880 test
4352 #ifdef CONFIG_SND_DEBUG
4353 static hda_nid_t alc260_test_dac_nids[1] = {
4356 static hda_nid_t alc260_test_adc_nids[2] = {
4359 /* For testing the ALC260, each input MUX needs its own definition since
4360 * the signal assignments are different. This assumes that the first ADC
4363 static struct hda_input_mux alc260_test_capture_sources[2] = {
4367 { "MIC1 pin", 0x0 },
4368 { "MIC2 pin", 0x1 },
4369 { "LINE1 pin", 0x2 },
4370 { "LINE2 pin", 0x3 },
4372 { "LINE-OUT pin", 0x5 },
4373 { "HP-OUT pin", 0x6 },
4379 { "MIC1 pin", 0x0 },
4380 { "MIC2 pin", 0x1 },
4381 { "LINE1 pin", 0x2 },
4382 { "LINE2 pin", 0x3 },
4385 { "LINE-OUT pin", 0x6 },
4386 { "HP-OUT pin", 0x7 },
4390 static struct snd_kcontrol_new alc260_test_mixer[] = {
4391 /* Output driver widgets */
4392 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4393 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4394 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4395 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4396 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4397 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4399 /* Modes for retasking pin widgets
4400 * Note: the ALC260 doesn't seem to act on requests to enable mic
4401 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4402 * mention this restriction. At this stage it's not clear whether
4403 * this behaviour is intentional or is a hardware bug in chip
4404 * revisions available at least up until early 2006. Therefore for
4405 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4406 * choices, but if it turns out that the lack of mic bias for these
4407 * NIDs is intentional we could change their modes from
4408 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4410 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4411 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4412 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4413 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4414 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4415 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4417 /* Loopback mixer controls */
4418 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4419 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4420 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4421 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4422 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4423 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4424 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4425 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4426 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4427 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4428 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4429 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4430 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4431 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4432 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4433 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4435 /* Controls for GPIO pins, assuming they are configured as outputs */
4436 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4437 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4438 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4439 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4441 /* Switches to allow the digital IO pins to be enabled. The datasheet
4442 * is ambigious as to which NID is which; testing on laptops which
4443 * make this output available should provide clarification.
4445 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4446 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4448 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4449 * this output to turn on an external amplifier.
4451 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4452 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4456 static struct hda_verb alc260_test_init_verbs[] = {
4457 /* Enable all GPIOs as outputs with an initial value of 0 */
4458 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4459 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4460 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4462 /* Enable retasking pins as output, initially without power amp */
4463 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4467 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4468 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4470 /* Disable digital (SPDIF) pins initially, but users can enable
4471 * them via a mixer switch. In the case of SPDIF-out, this initverb
4472 * payload also sets the generation to 0, output to be in "consumer"
4473 * PCM format, copyright asserted, no pre-emphasis and no validity
4476 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4477 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4479 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4480 * OUT1 sum bus when acting as an output.
4482 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4483 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4484 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4485 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4487 /* Start with output sum widgets muted and their output gains at min */
4488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4494 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4495 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4496 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4498 /* Unmute retasking pin widget output buffers since the default
4499 * state appears to be output. As the pin mode is changed by the
4500 * user the pin mode control will take care of enabling the pin's
4501 * input/output buffers as needed.
4503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4507 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4508 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4509 /* Also unmute the mono-out pin widget */
4510 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4512 /* Mute capture amp left and right */
4513 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4514 /* Set ADC connection select to match default mixer setting (mic1
4517 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4519 /* Do the same for the second ADC: mute capture input amp and
4520 * set ADC connection to mic1 pin
4522 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4523 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4525 /* Mute all inputs to mixer widget (even unconnected ones) */
4526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4539 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4545 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4551 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4552 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4555 * for BIOS auto-configuration
4558 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4562 unsigned long vol_val, sw_val;
4566 if (nid >= 0x0f && nid < 0x11) {
4567 nid_vol = nid - 0x7;
4568 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4569 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4570 } else if (nid == 0x11) {
4571 nid_vol = nid - 0x7;
4572 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4573 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4574 } else if (nid >= 0x12 && nid <= 0x15) {
4576 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4577 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4581 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4582 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4585 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4586 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4592 /* add playback controls from the parsed DAC table */
4593 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4594 const struct auto_pin_cfg *cfg)
4599 spec->multiout.num_dacs = 1;
4600 spec->multiout.dac_nids = spec->private_dac_nids;
4601 spec->multiout.dac_nids[0] = 0x02;
4603 nid = cfg->line_out_pins[0];
4605 err = alc260_add_playback_controls(spec, nid, "Front");
4610 nid = cfg->speaker_pins[0];
4612 err = alc260_add_playback_controls(spec, nid, "Speaker");
4617 nid = cfg->hp_pins[0];
4619 err = alc260_add_playback_controls(spec, nid, "Headphone");
4626 /* create playback/capture controls for input pins */
4627 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4628 const struct auto_pin_cfg *cfg)
4630 struct hda_input_mux *imux = &spec->private_imux;
4633 for (i = 0; i < AUTO_PIN_LAST; i++) {
4634 if (cfg->input_pins[i] >= 0x12) {
4635 idx = cfg->input_pins[i] - 0x12;
4636 err = new_analog_input(spec, cfg->input_pins[i],
4637 auto_pin_cfg_labels[i], idx,
4641 imux->items[imux->num_items].label =
4642 auto_pin_cfg_labels[i];
4643 imux->items[imux->num_items].index = idx;
4646 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4647 idx = cfg->input_pins[i] - 0x09;
4648 err = new_analog_input(spec, cfg->input_pins[i],
4649 auto_pin_cfg_labels[i], idx,
4653 imux->items[imux->num_items].label =
4654 auto_pin_cfg_labels[i];
4655 imux->items[imux->num_items].index = idx;
4662 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4663 hda_nid_t nid, int pin_type,
4667 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4669 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4671 /* need the manual connection? */
4673 int idx = nid - 0x12;
4674 snd_hda_codec_write(codec, idx + 0x0b, 0,
4675 AC_VERB_SET_CONNECT_SEL, sel_idx);
4679 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4681 struct alc_spec *spec = codec->spec;
4684 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4685 nid = spec->autocfg.line_out_pins[0];
4687 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4688 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4691 nid = spec->autocfg.speaker_pins[0];
4693 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4695 nid = spec->autocfg.hp_pins[0];
4697 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4700 #define ALC260_PIN_CD_NID 0x16
4701 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4703 struct alc_spec *spec = codec->spec;
4706 for (i = 0; i < AUTO_PIN_LAST; i++) {
4707 hda_nid_t nid = spec->autocfg.input_pins[i];
4709 snd_hda_codec_write(codec, nid, 0,
4710 AC_VERB_SET_PIN_WIDGET_CONTROL,
4711 i <= AUTO_PIN_FRONT_MIC ?
4712 PIN_VREF80 : PIN_IN);
4713 if (nid != ALC260_PIN_CD_NID)
4714 snd_hda_codec_write(codec, nid, 0,
4715 AC_VERB_SET_AMP_GAIN_MUTE,
4722 * generic initialization of ADC, input mixers and output mixers
4724 static struct hda_verb alc260_volume_init_verbs[] = {
4726 * Unmute ADC0-1 and set the default input to mic-in
4728 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4729 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4730 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4733 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4735 * Note: PASD motherboards uses the Line In 2 as the input for
4736 * front panel mic (mic 2)
4738 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4739 /* mute analog inputs */
4740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4744 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4747 * Set up output mixers (0x08 - 0x0a)
4749 /* set vol=0 to output mixers */
4750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4751 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4752 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4753 /* set up input amps for analog loopback */
4754 /* Amp Indices: DAC = 0, mixer = 1 */
4755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4760 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4765 static int alc260_parse_auto_config(struct hda_codec *codec)
4767 struct alc_spec *spec = codec->spec;
4770 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4772 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4776 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4779 if (!spec->kctl_alloc)
4780 return 0; /* can't find valid BIOS pin config */
4781 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4785 spec->multiout.max_channels = 2;
4787 if (spec->autocfg.dig_out_pin)
4788 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4789 if (spec->kctl_alloc)
4790 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4792 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4794 spec->num_mux_defs = 1;
4795 spec->input_mux = &spec->private_imux;
4797 /* check whether NID 0x04 is valid */
4798 wcap = get_wcaps(codec, 0x04);
4799 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4800 if (wcap != AC_WID_AUD_IN) {
4801 spec->adc_nids = alc260_adc_nids_alt;
4802 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4803 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4805 spec->adc_nids = alc260_adc_nids;
4806 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4807 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4814 /* additional initialization for auto-configuration model */
4815 static void alc260_auto_init(struct hda_codec *codec)
4817 alc260_auto_init_multi_out(codec);
4818 alc260_auto_init_analog_input(codec);
4821 #ifdef CONFIG_SND_HDA_POWER_SAVE
4822 static struct hda_amp_list alc260_loopbacks[] = {
4823 { 0x07, HDA_INPUT, 0 },
4824 { 0x07, HDA_INPUT, 1 },
4825 { 0x07, HDA_INPUT, 2 },
4826 { 0x07, HDA_INPUT, 3 },
4827 { 0x07, HDA_INPUT, 4 },
4833 * ALC260 configurations
4835 static const char *alc260_models[ALC260_MODEL_LAST] = {
4836 [ALC260_BASIC] = "basic",
4838 [ALC260_HP_3013] = "hp-3013",
4839 [ALC260_FUJITSU_S702X] = "fujitsu",
4840 [ALC260_ACER] = "acer",
4841 [ALC260_WILL] = "will",
4842 [ALC260_REPLACER_672V] = "replacer",
4843 #ifdef CONFIG_SND_DEBUG
4844 [ALC260_TEST] = "test",
4846 [ALC260_AUTO] = "auto",
4849 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4850 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4851 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4852 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4853 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4854 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4855 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4856 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4857 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4858 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4859 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4860 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4861 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4862 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4863 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4864 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4865 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4866 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4867 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4871 static struct alc_config_preset alc260_presets[] = {
4873 .mixers = { alc260_base_output_mixer,
4875 alc260_pc_beep_mixer,
4876 alc260_capture_mixer },
4877 .init_verbs = { alc260_init_verbs },
4878 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4879 .dac_nids = alc260_dac_nids,
4880 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4881 .adc_nids = alc260_adc_nids,
4882 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4883 .channel_mode = alc260_modes,
4884 .input_mux = &alc260_capture_source,
4887 .mixers = { alc260_base_output_mixer,
4889 alc260_capture_alt_mixer },
4890 .init_verbs = { alc260_init_verbs },
4891 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4892 .dac_nids = alc260_dac_nids,
4893 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4894 .adc_nids = alc260_hp_adc_nids,
4895 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4896 .channel_mode = alc260_modes,
4897 .input_mux = &alc260_capture_source,
4899 [ALC260_HP_3013] = {
4900 .mixers = { alc260_hp_3013_mixer,
4902 alc260_capture_alt_mixer },
4903 .init_verbs = { alc260_hp_3013_init_verbs },
4904 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4905 .dac_nids = alc260_dac_nids,
4906 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4907 .adc_nids = alc260_hp_adc_nids,
4908 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4909 .channel_mode = alc260_modes,
4910 .input_mux = &alc260_capture_source,
4912 [ALC260_FUJITSU_S702X] = {
4913 .mixers = { alc260_fujitsu_mixer,
4914 alc260_capture_mixer },
4915 .init_verbs = { alc260_fujitsu_init_verbs },
4916 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4917 .dac_nids = alc260_dac_nids,
4918 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4919 .adc_nids = alc260_dual_adc_nids,
4920 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4921 .channel_mode = alc260_modes,
4922 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4923 .input_mux = alc260_fujitsu_capture_sources,
4926 .mixers = { alc260_acer_mixer,
4927 alc260_capture_mixer },
4928 .init_verbs = { alc260_acer_init_verbs },
4929 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4930 .dac_nids = alc260_dac_nids,
4931 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4932 .adc_nids = alc260_dual_adc_nids,
4933 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4934 .channel_mode = alc260_modes,
4935 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4936 .input_mux = alc260_acer_capture_sources,
4939 .mixers = { alc260_will_mixer,
4940 alc260_capture_mixer },
4941 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4942 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4943 .dac_nids = alc260_dac_nids,
4944 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4945 .adc_nids = alc260_adc_nids,
4946 .dig_out_nid = ALC260_DIGOUT_NID,
4947 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4948 .channel_mode = alc260_modes,
4949 .input_mux = &alc260_capture_source,
4951 [ALC260_REPLACER_672V] = {
4952 .mixers = { alc260_replacer_672v_mixer,
4953 alc260_capture_mixer },
4954 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4955 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4956 .dac_nids = alc260_dac_nids,
4957 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4958 .adc_nids = alc260_adc_nids,
4959 .dig_out_nid = ALC260_DIGOUT_NID,
4960 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4961 .channel_mode = alc260_modes,
4962 .input_mux = &alc260_capture_source,
4963 .unsol_event = alc260_replacer_672v_unsol_event,
4964 .init_hook = alc260_replacer_672v_automute,
4966 #ifdef CONFIG_SND_DEBUG
4968 .mixers = { alc260_test_mixer,
4969 alc260_capture_mixer },
4970 .init_verbs = { alc260_test_init_verbs },
4971 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4972 .dac_nids = alc260_test_dac_nids,
4973 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4974 .adc_nids = alc260_test_adc_nids,
4975 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4976 .channel_mode = alc260_modes,
4977 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4978 .input_mux = alc260_test_capture_sources,
4983 static int patch_alc260(struct hda_codec *codec)
4985 struct alc_spec *spec;
4986 int err, board_config;
4988 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4994 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4997 if (board_config < 0) {
4998 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4999 "trying auto-probe from BIOS...\n");
5000 board_config = ALC260_AUTO;
5003 if (board_config == ALC260_AUTO) {
5004 /* automatic parse from the BIOS config */
5005 err = alc260_parse_auto_config(codec);
5011 "hda_codec: Cannot set up configuration "
5012 "from BIOS. Using base mode...\n");
5013 board_config = ALC260_BASIC;
5017 if (board_config != ALC260_AUTO)
5018 setup_preset(spec, &alc260_presets[board_config]);
5020 spec->stream_name_analog = "ALC260 Analog";
5021 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5022 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5024 spec->stream_name_digital = "ALC260 Digital";
5025 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5026 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5028 spec->vmaster_nid = 0x08;
5030 codec->patch_ops = alc_patch_ops;
5031 if (board_config == ALC260_AUTO)
5032 spec->init_hook = alc260_auto_init;
5033 #ifdef CONFIG_SND_HDA_POWER_SAVE
5034 if (!spec->loopback.amplist)
5035 spec->loopback.amplist = alc260_loopbacks;
5045 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5046 * configuration. Each pin widget can choose any input DACs and a mixer.
5047 * Each ADC is connected from a mixer of all inputs. This makes possible
5048 * 6-channel independent captures.
5050 * In addition, an independent DAC for the multi-playback (not used in this
5053 #define ALC882_DIGOUT_NID 0x06
5054 #define ALC882_DIGIN_NID 0x0a
5056 static struct hda_channel_mode alc882_ch_modes[1] = {
5060 static hda_nid_t alc882_dac_nids[4] = {
5061 /* front, rear, clfe, rear_surr */
5062 0x02, 0x03, 0x04, 0x05
5065 /* identical with ALC880 */
5066 #define alc882_adc_nids alc880_adc_nids
5067 #define alc882_adc_nids_alt alc880_adc_nids_alt
5070 /* FIXME: should be a matrix-type input source selection */
5072 static struct hda_input_mux alc882_capture_source = {
5076 { "Front Mic", 0x1 },
5081 #define alc882_mux_enum_info alc_mux_enum_info
5082 #define alc882_mux_enum_get alc_mux_enum_get
5084 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5085 struct snd_ctl_elem_value *ucontrol)
5087 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5088 struct alc_spec *spec = codec->spec;
5089 const struct hda_input_mux *imux = spec->input_mux;
5090 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5091 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5092 hda_nid_t nid = capture_mixers[adc_idx];
5093 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5094 unsigned int i, idx;
5096 idx = ucontrol->value.enumerated.item[0];
5097 if (idx >= imux->num_items)
5098 idx = imux->num_items - 1;
5099 if (*cur_val == idx)
5101 for (i = 0; i < imux->num_items; i++) {
5102 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5103 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5104 imux->items[i].index,
5114 static struct hda_verb alc882_3ST_ch2_init[] = {
5115 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5116 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5117 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5118 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5125 static struct hda_verb alc882_3ST_ch6_init[] = {
5126 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5127 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5128 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5129 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5130 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5131 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5135 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5136 { 2, alc882_3ST_ch2_init },
5137 { 6, alc882_3ST_ch6_init },
5143 static struct hda_verb alc882_sixstack_ch6_init[] = {
5144 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5145 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5146 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5147 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5154 static struct hda_verb alc882_sixstack_ch8_init[] = {
5155 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5156 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5157 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5158 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5162 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5163 { 6, alc882_sixstack_ch6_init },
5164 { 8, alc882_sixstack_ch8_init },
5168 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5174 static struct hda_verb alc885_mbp_ch2_init[] = {
5175 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5176 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5177 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5184 static struct hda_verb alc885_mbp_ch6_init[] = {
5185 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5186 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5187 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5188 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5189 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5193 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5194 { 2, alc885_mbp_ch2_init },
5195 { 6, alc885_mbp_ch6_init },
5199 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5200 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5202 static struct snd_kcontrol_new alc882_base_mixer[] = {
5203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5204 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5205 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5206 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5211 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5212 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5221 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5222 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5223 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5224 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5225 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5229 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5230 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5231 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5232 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5233 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5235 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5237 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5238 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5239 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5242 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5245 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5246 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5247 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5248 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5252 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5253 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5257 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5268 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5269 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5270 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5274 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5275 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5277 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5279 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5280 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5281 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5286 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5287 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5290 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5294 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5303 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5305 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5306 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5310 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5312 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5313 .name = "Channel Mode",
5314 .info = alc_ch_mode_info,
5315 .get = alc_ch_mode_get,
5316 .put = alc_ch_mode_put,
5321 static struct hda_verb alc882_init_verbs[] = {
5322 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5332 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5339 /* Front Pin: output 0 (0x0c) */
5340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5341 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5342 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5343 /* Rear Pin: output 1 (0x0d) */
5344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5346 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5347 /* CLFE Pin: output 2 (0x0e) */
5348 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5349 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5350 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5351 /* Side Pin: output 3 (0x0f) */
5352 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5353 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5354 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5355 /* Mic (rear) pin: input vref at 80% */
5356 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5358 /* Front Mic pin: input vref at 80% */
5359 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5360 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5361 /* Line In pin: input */
5362 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5363 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5364 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5366 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5367 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5368 /* CD pin widget for input */
5369 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5371 /* FIXME: use matrix-type input source selection */
5372 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5373 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5376 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5377 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5388 /* ADC1: mute amp left and right */
5389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5390 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5391 /* ADC2: mute amp left and right */
5392 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5393 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5394 /* ADC3: mute amp left and right */
5395 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5396 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5401 static struct hda_verb alc882_eapd_verbs[] = {
5402 /* change to EAPD mode */
5403 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5404 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5409 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5410 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5411 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5415 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5416 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5420 static struct hda_verb alc882_macpro_init_verbs[] = {
5421 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5425 /* Front Pin: output 0 (0x0c) */
5426 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5428 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5429 /* Front Mic pin: input vref at 80% */
5430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5432 /* Speaker: output */
5433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5435 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5436 /* Headphone output (output 0 - 0x0c) */
5437 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5439 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5441 /* FIXME: use matrix-type input source selection */
5442 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5443 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5449 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5458 /* ADC1: mute amp left and right */
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5460 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5461 /* ADC2: mute amp left and right */
5462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5463 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5464 /* ADC3: mute amp left and right */
5465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5471 /* Macbook Pro rev3 */
5472 static struct hda_verb alc885_mbp3_init_verbs[] = {
5473 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5481 /* Front Pin: output 0 (0x0c) */
5482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5485 /* HP Pin: output 0 (0x0d) */
5486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5489 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5490 /* Mic (rear) pin: input vref at 80% */
5491 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5493 /* Front Mic pin: input vref at 80% */
5494 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5495 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5496 /* Line In pin: use output 1 when in LineOut mode */
5497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5499 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5501 /* FIXME: use matrix-type input source selection */
5502 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5503 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5509 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5517 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5518 /* ADC1: mute amp left and right */
5519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5520 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5521 /* ADC2: mute amp left and right */
5522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5523 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5524 /* ADC3: mute amp left and right */
5525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5526 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5531 /* iMac 24 mixer. */
5532 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5533 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5534 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5538 /* iMac 24 init verbs. */
5539 static struct hda_verb alc885_imac24_init_verbs[] = {
5540 /* Internal speakers: output 0 (0x0c) */
5541 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5542 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5543 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5544 /* Internal speakers: output 0 (0x0c) */
5545 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5546 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5547 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5548 /* Headphone: output 0 (0x0c) */
5549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5551 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5553 /* Front Mic: input vref at 80% */
5554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5559 /* Toggle speaker-output according to the hp-jack state */
5560 static void alc885_imac24_automute(struct hda_codec *codec)
5562 unsigned int present;
5564 present = snd_hda_codec_read(codec, 0x14, 0,
5565 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5566 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5567 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5568 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5569 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5572 /* Processes unsolicited events. */
5573 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5576 /* Headphone insertion or removal. */
5577 if ((res >> 26) == ALC880_HP_EVENT)
5578 alc885_imac24_automute(codec);
5581 static void alc885_mbp3_automute(struct hda_codec *codec)
5583 unsigned int present;
5585 present = snd_hda_codec_read(codec, 0x15, 0,
5586 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5587 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5588 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5589 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5590 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5593 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5596 /* Headphone insertion or removal. */
5597 if ((res >> 26) == ALC880_HP_EVENT)
5598 alc885_mbp3_automute(codec);
5602 static struct hda_verb alc882_targa_verbs[] = {
5603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5607 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5609 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5610 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5611 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5613 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5614 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5615 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5616 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5620 /* toggle speaker-output according to the hp-jack state */
5621 static void alc882_targa_automute(struct hda_codec *codec)
5623 unsigned int present;
5625 present = snd_hda_codec_read(codec, 0x14, 0,
5626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5627 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5628 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5629 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5633 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5635 /* Looks like the unsol event is incompatible with the standard
5636 * definition. 4bit tag is placed at 26 bit!
5638 if (((res >> 26) == ALC880_HP_EVENT)) {
5639 alc882_targa_automute(codec);
5643 static struct hda_verb alc882_asus_a7j_verbs[] = {
5644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5649 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5651 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5652 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5653 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5655 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5656 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5657 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5661 static struct hda_verb alc882_asus_a7m_verbs[] = {
5662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5667 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5669 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5670 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5671 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5673 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5674 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5675 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5679 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5681 unsigned int gpiostate, gpiomask, gpiodir;
5683 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5684 AC_VERB_GET_GPIO_DATA, 0);
5687 gpiostate |= (1 << pin);
5689 gpiostate &= ~(1 << pin);
5691 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5692 AC_VERB_GET_GPIO_MASK, 0);
5693 gpiomask |= (1 << pin);
5695 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5696 AC_VERB_GET_GPIO_DIRECTION, 0);
5697 gpiodir |= (1 << pin);
5700 snd_hda_codec_write(codec, codec->afg, 0,
5701 AC_VERB_SET_GPIO_MASK, gpiomask);
5702 snd_hda_codec_write(codec, codec->afg, 0,
5703 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5707 snd_hda_codec_write(codec, codec->afg, 0,
5708 AC_VERB_SET_GPIO_DATA, gpiostate);
5711 /* set up GPIO at initialization */
5712 static void alc885_macpro_init_hook(struct hda_codec *codec)
5714 alc882_gpio_mute(codec, 0, 0);
5715 alc882_gpio_mute(codec, 1, 0);
5718 /* set up GPIO and update auto-muting at initialization */
5719 static void alc885_imac24_init_hook(struct hda_codec *codec)
5721 alc885_macpro_init_hook(codec);
5722 alc885_imac24_automute(codec);
5726 * generic initialization of ADC, input mixers and output mixers
5728 static struct hda_verb alc882_auto_init_verbs[] = {
5730 * Unmute ADC0-2 and set the default input to mic-in
5732 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5734 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5736 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5739 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5741 * Note: PASD motherboards uses the Line In 2 as the input for
5742 * front panel mic (mic 2)
5744 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5745 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5746 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5747 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5748 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5752 * Set up output mixers (0x0c - 0x0f)
5754 /* set vol=0 to output mixers */
5755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5759 /* set up input amps for analog loopback */
5760 /* Amp Indices: DAC = 0, mixer = 1 */
5761 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5763 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5765 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5767 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5769 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5770 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5772 /* FIXME: use matrix-type input source selection */
5773 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5774 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5793 /* capture mixer elements */
5794 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5795 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5796 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5797 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5798 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5801 /* The multiple "Capture Source" controls confuse alsamixer
5802 * So call somewhat different..
5803 * FIXME: the controls appear in the "playback" view!
5805 /* .name = "Capture Source", */
5806 .name = "Input Source",
5808 .info = alc882_mux_enum_info,
5809 .get = alc882_mux_enum_get,
5810 .put = alc882_mux_enum_put,
5815 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5816 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5817 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5818 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5819 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5820 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5821 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5824 /* The multiple "Capture Source" controls confuse alsamixer
5825 * So call somewhat different..
5826 * FIXME: the controls appear in the "playback" view!
5828 /* .name = "Capture Source", */
5829 .name = "Input Source",
5831 .info = alc882_mux_enum_info,
5832 .get = alc882_mux_enum_get,
5833 .put = alc882_mux_enum_put,
5838 #ifdef CONFIG_SND_HDA_POWER_SAVE
5839 #define alc882_loopbacks alc880_loopbacks
5842 /* pcm configuration: identiacal with ALC880 */
5843 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5844 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5845 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5846 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5849 * configuration and preset
5851 static const char *alc882_models[ALC882_MODEL_LAST] = {
5852 [ALC882_3ST_DIG] = "3stack-dig",
5853 [ALC882_6ST_DIG] = "6stack-dig",
5854 [ALC882_ARIMA] = "arima",
5855 [ALC882_W2JC] = "w2jc",
5856 [ALC882_TARGA] = "targa",
5857 [ALC882_ASUS_A7J] = "asus-a7j",
5858 [ALC882_ASUS_A7M] = "asus-a7m",
5859 [ALC885_MACPRO] = "macpro",
5860 [ALC885_MBP3] = "mbp3",
5861 [ALC885_IMAC24] = "imac24",
5862 [ALC882_AUTO] = "auto",
5865 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5866 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5867 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5868 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5869 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5870 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5871 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5872 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5873 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5874 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5875 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5876 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5880 static struct alc_config_preset alc882_presets[] = {
5881 [ALC882_3ST_DIG] = {
5882 .mixers = { alc882_base_mixer },
5883 .init_verbs = { alc882_init_verbs },
5884 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5885 .dac_nids = alc882_dac_nids,
5886 .dig_out_nid = ALC882_DIGOUT_NID,
5887 .dig_in_nid = ALC882_DIGIN_NID,
5888 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5889 .channel_mode = alc882_ch_modes,
5891 .input_mux = &alc882_capture_source,
5893 [ALC882_6ST_DIG] = {
5894 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5895 .init_verbs = { alc882_init_verbs },
5896 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5897 .dac_nids = alc882_dac_nids,
5898 .dig_out_nid = ALC882_DIGOUT_NID,
5899 .dig_in_nid = ALC882_DIGIN_NID,
5900 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5901 .channel_mode = alc882_sixstack_modes,
5902 .input_mux = &alc882_capture_source,
5905 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5906 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5907 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5908 .dac_nids = alc882_dac_nids,
5909 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5910 .channel_mode = alc882_sixstack_modes,
5911 .input_mux = &alc882_capture_source,
5914 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5915 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5916 alc880_gpio1_init_verbs },
5917 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5918 .dac_nids = alc882_dac_nids,
5919 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5920 .channel_mode = alc880_threestack_modes,
5922 .input_mux = &alc882_capture_source,
5923 .dig_out_nid = ALC882_DIGOUT_NID,
5926 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5927 .init_verbs = { alc885_mbp3_init_verbs,
5928 alc880_gpio1_init_verbs },
5929 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5930 .dac_nids = alc882_dac_nids,
5931 .channel_mode = alc885_mbp_6ch_modes,
5932 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5933 .input_mux = &alc882_capture_source,
5934 .dig_out_nid = ALC882_DIGOUT_NID,
5935 .dig_in_nid = ALC882_DIGIN_NID,
5936 .unsol_event = alc885_mbp3_unsol_event,
5937 .init_hook = alc885_mbp3_automute,
5940 .mixers = { alc882_macpro_mixer },
5941 .init_verbs = { alc882_macpro_init_verbs },
5942 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5943 .dac_nids = alc882_dac_nids,
5944 .dig_out_nid = ALC882_DIGOUT_NID,
5945 .dig_in_nid = ALC882_DIGIN_NID,
5946 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5947 .channel_mode = alc882_ch_modes,
5948 .input_mux = &alc882_capture_source,
5949 .init_hook = alc885_macpro_init_hook,
5952 .mixers = { alc885_imac24_mixer },
5953 .init_verbs = { alc885_imac24_init_verbs },
5954 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5955 .dac_nids = alc882_dac_nids,
5956 .dig_out_nid = ALC882_DIGOUT_NID,
5957 .dig_in_nid = ALC882_DIGIN_NID,
5958 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5959 .channel_mode = alc882_ch_modes,
5960 .input_mux = &alc882_capture_source,
5961 .unsol_event = alc885_imac24_unsol_event,
5962 .init_hook = alc885_imac24_init_hook,
5965 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5966 alc882_capture_mixer },
5967 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5968 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5969 .dac_nids = alc882_dac_nids,
5970 .dig_out_nid = ALC882_DIGOUT_NID,
5971 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5972 .adc_nids = alc882_adc_nids,
5973 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5974 .channel_mode = alc882_3ST_6ch_modes,
5976 .input_mux = &alc882_capture_source,
5977 .unsol_event = alc882_targa_unsol_event,
5978 .init_hook = alc882_targa_automute,
5980 [ALC882_ASUS_A7J] = {
5981 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5982 alc882_capture_mixer },
5983 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5984 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5985 .dac_nids = alc882_dac_nids,
5986 .dig_out_nid = ALC882_DIGOUT_NID,
5987 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5988 .adc_nids = alc882_adc_nids,
5989 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5990 .channel_mode = alc882_3ST_6ch_modes,
5992 .input_mux = &alc882_capture_source,
5994 [ALC882_ASUS_A7M] = {
5995 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
5996 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5997 alc880_gpio1_init_verbs,
5998 alc882_asus_a7m_verbs },
5999 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6000 .dac_nids = alc882_dac_nids,
6001 .dig_out_nid = ALC882_DIGOUT_NID,
6002 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6003 .channel_mode = alc880_threestack_modes,
6005 .input_mux = &alc882_capture_source,
6014 PINFIX_ABIT_AW9D_MAX
6017 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6018 { 0x15, 0x01080104 }, /* side */
6019 { 0x16, 0x01011012 }, /* rear */
6020 { 0x17, 0x01016011 }, /* clfe */
6024 static const struct alc_pincfg *alc882_pin_fixes[] = {
6025 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6028 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6029 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6034 * BIOS auto configuration
6036 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6037 hda_nid_t nid, int pin_type,
6041 struct alc_spec *spec = codec->spec;
6044 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6047 idx = spec->multiout.dac_nids[dac_idx] - 2;
6049 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6051 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6053 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6057 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6059 struct alc_spec *spec = codec->spec;
6062 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6063 for (i = 0; i <= HDA_SIDE; i++) {
6064 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6065 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6067 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6072 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6074 struct alc_spec *spec = codec->spec;
6077 pin = spec->autocfg.hp_pins[0];
6078 if (pin) /* connect to front */
6080 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6083 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6084 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6086 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6088 struct alc_spec *spec = codec->spec;
6091 for (i = 0; i < AUTO_PIN_LAST; i++) {
6092 hda_nid_t nid = spec->autocfg.input_pins[i];
6093 if (alc882_is_input_pin(nid)) {
6094 snd_hda_codec_write(codec, nid, 0,
6095 AC_VERB_SET_PIN_WIDGET_CONTROL,
6096 i <= AUTO_PIN_FRONT_MIC ?
6097 PIN_VREF80 : PIN_IN);
6098 if (nid != ALC882_PIN_CD_NID)
6099 snd_hda_codec_write(codec, nid, 0,
6100 AC_VERB_SET_AMP_GAIN_MUTE,
6106 /* add mic boosts if needed */
6107 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6109 struct alc_spec *spec = codec->spec;
6113 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6114 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6115 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6117 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6121 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6122 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6123 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6125 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6132 /* almost identical with ALC880 parser... */
6133 static int alc882_parse_auto_config(struct hda_codec *codec)
6135 struct alc_spec *spec = codec->spec;
6136 int err = alc880_parse_auto_config(codec);
6141 return 0; /* no config found */
6143 err = alc_auto_add_mic_boost(codec);
6147 /* hack - override the init verbs */
6148 spec->init_verbs[0] = alc882_auto_init_verbs;
6150 return 1; /* config found */
6153 /* additional initialization for auto-configuration model */
6154 static void alc882_auto_init(struct hda_codec *codec)
6156 alc882_auto_init_multi_out(codec);
6157 alc882_auto_init_hp_out(codec);
6158 alc882_auto_init_analog_input(codec);
6161 static int patch_alc882(struct hda_codec *codec)
6163 struct alc_spec *spec;
6164 int err, board_config;
6166 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6172 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6176 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6177 /* Pick up systems that don't supply PCI SSID */
6178 switch (codec->subsystem_id) {
6179 case 0x106b0c00: /* Mac Pro */
6180 board_config = ALC885_MACPRO;
6182 case 0x106b1000: /* iMac 24 */
6183 board_config = ALC885_IMAC24;
6185 case 0x106b00a1: /* Macbook */
6186 case 0x106b2c00: /* Macbook Pro rev3 */
6187 board_config = ALC885_MBP3;
6190 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6191 "trying auto-probe from BIOS...\n");
6192 board_config = ALC882_AUTO;
6196 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6198 if (board_config == ALC882_AUTO) {
6199 /* automatic parse from the BIOS config */
6200 err = alc882_parse_auto_config(codec);
6206 "hda_codec: Cannot set up configuration "
6207 "from BIOS. Using base mode...\n");
6208 board_config = ALC882_3ST_DIG;
6212 if (board_config != ALC882_AUTO)
6213 setup_preset(spec, &alc882_presets[board_config]);
6215 spec->stream_name_analog = "ALC882 Analog";
6216 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6217 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6219 spec->stream_name_digital = "ALC882 Digital";
6220 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6221 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6223 if (!spec->adc_nids && spec->input_mux) {
6224 /* check whether NID 0x07 is valid */
6225 unsigned int wcap = get_wcaps(codec, 0x07);
6227 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6228 if (wcap != AC_WID_AUD_IN) {
6229 spec->adc_nids = alc882_adc_nids_alt;
6230 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6231 spec->mixers[spec->num_mixers] =
6232 alc882_capture_alt_mixer;
6235 spec->adc_nids = alc882_adc_nids;
6236 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6237 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6242 spec->vmaster_nid = 0x0c;
6244 codec->patch_ops = alc_patch_ops;
6245 if (board_config == ALC882_AUTO)
6246 spec->init_hook = alc882_auto_init;
6247 #ifdef CONFIG_SND_HDA_POWER_SAVE
6248 if (!spec->loopback.amplist)
6249 spec->loopback.amplist = alc882_loopbacks;
6258 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6259 * configuration. Each pin widget can choose any input DACs and a mixer.
6260 * Each ADC is connected from a mixer of all inputs. This makes possible
6261 * 6-channel independent captures.
6263 * In addition, an independent DAC for the multi-playback (not used in this
6266 #define ALC883_DIGOUT_NID 0x06
6267 #define ALC883_DIGIN_NID 0x0a
6269 static hda_nid_t alc883_dac_nids[4] = {
6270 /* front, rear, clfe, rear_surr */
6271 0x02, 0x04, 0x03, 0x05
6274 static hda_nid_t alc883_adc_nids[2] = {
6280 /* FIXME: should be a matrix-type input source selection */
6282 static struct hda_input_mux alc883_capture_source = {
6286 { "Front Mic", 0x1 },
6292 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6300 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6310 #define alc883_mux_enum_info alc_mux_enum_info
6311 #define alc883_mux_enum_get alc_mux_enum_get
6313 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6314 struct snd_ctl_elem_value *ucontrol)
6316 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6317 struct alc_spec *spec = codec->spec;
6318 const struct hda_input_mux *imux = spec->input_mux;
6319 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6320 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6321 hda_nid_t nid = capture_mixers[adc_idx];
6322 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6323 unsigned int i, idx;
6325 idx = ucontrol->value.enumerated.item[0];
6326 if (idx >= imux->num_items)
6327 idx = imux->num_items - 1;
6328 if (*cur_val == idx)
6330 for (i = 0; i < imux->num_items; i++) {
6331 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6332 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6333 imux->items[i].index,
6343 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6350 static struct hda_verb alc883_3ST_ch2_init[] = {
6351 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6352 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6353 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6354 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6361 static struct hda_verb alc883_3ST_ch4_init[] = {
6362 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6363 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6364 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6365 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6366 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6373 static struct hda_verb alc883_3ST_ch6_init[] = {
6374 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6375 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6376 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6377 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6378 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6379 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6383 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6384 { 2, alc883_3ST_ch2_init },
6385 { 4, alc883_3ST_ch4_init },
6386 { 6, alc883_3ST_ch6_init },
6392 static struct hda_verb alc883_sixstack_ch6_init[] = {
6393 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6394 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6395 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6396 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6403 static struct hda_verb alc883_sixstack_ch8_init[] = {
6404 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6405 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6406 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6407 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6411 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6412 { 6, alc883_sixstack_ch6_init },
6413 { 8, alc883_sixstack_ch8_init },
6416 static struct hda_verb alc883_medion_eapd_verbs[] = {
6417 /* eanable EAPD on medion laptop */
6418 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6419 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6423 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6424 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6427 static struct snd_kcontrol_new alc883_base_mixer[] = {
6428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6431 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6433 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6435 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6436 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6437 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6447 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6448 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6449 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6450 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6451 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6452 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6453 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6454 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6457 /* .name = "Capture Source", */
6458 .name = "Input Source",
6460 .info = alc883_mux_enum_info,
6461 .get = alc883_mux_enum_get,
6462 .put = alc883_mux_enum_put,
6467 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6470 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6471 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6472 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6473 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6474 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6479 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6481 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6482 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6483 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6484 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6486 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6487 /* .name = "Capture Source", */
6488 .name = "Input Source",
6490 .info = alc883_mux_enum_info,
6491 .get = alc883_mux_enum_get,
6492 .put = alc883_mux_enum_put,
6497 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6498 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6500 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6501 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6502 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6503 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6504 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6506 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6508 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6509 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6510 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6511 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6512 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6513 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6514 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6515 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6516 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6518 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6519 /* .name = "Capture Source", */
6520 .name = "Input Source",
6522 .info = alc883_mux_enum_info,
6523 .get = alc883_mux_enum_get,
6524 .put = alc883_mux_enum_put,
6529 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6530 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6531 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6532 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6533 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6534 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6535 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6536 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6537 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6539 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6540 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6541 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6542 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6545 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6546 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6547 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6549 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6550 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6551 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6552 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6553 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6554 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6556 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6557 /* .name = "Capture Source", */
6558 .name = "Input Source",
6560 .info = alc883_mux_enum_info,
6561 .get = alc883_mux_enum_get,
6562 .put = alc883_mux_enum_put,
6567 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6569 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6570 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6571 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6572 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6573 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6574 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6575 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6577 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6578 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6579 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6580 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6584 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6585 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6586 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6587 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6588 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6589 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6590 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6594 /* .name = "Capture Source", */
6595 .name = "Input Source",
6597 .info = alc883_mux_enum_info,
6598 .get = alc883_mux_enum_get,
6599 .put = alc883_mux_enum_put,
6604 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6605 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6606 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6607 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6608 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6609 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6610 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6611 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6612 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6613 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6614 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6615 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6618 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6619 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6621 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6622 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6623 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6624 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6627 /* .name = "Capture Source", */
6628 .name = "Input Source",
6630 .info = alc883_mux_enum_info,
6631 .get = alc883_mux_enum_get,
6632 .put = alc883_mux_enum_put,
6637 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6638 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6640 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6641 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6642 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6646 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6647 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6648 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6649 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6652 /* .name = "Capture Source", */
6653 .name = "Input Source",
6655 .info = alc883_mux_enum_info,
6656 .get = alc883_mux_enum_get,
6657 .put = alc883_mux_enum_put,
6662 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6665 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6666 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6671 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6672 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6675 /* .name = "Capture Source", */
6676 .name = "Input Source",
6678 .info = alc883_mux_enum_info,
6679 .get = alc883_mux_enum_get,
6680 .put = alc883_mux_enum_put,
6685 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6686 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6687 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6688 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6689 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6690 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6693 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6694 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6695 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6696 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6697 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6698 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6700 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6701 /* .name = "Capture Source", */
6702 .name = "Input Source",
6704 .info = alc883_mux_enum_info,
6705 .get = alc883_mux_enum_get,
6706 .put = alc883_mux_enum_put,
6711 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6712 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6714 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6715 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6716 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6717 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6721 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6722 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6723 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6724 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6726 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6727 /* .name = "Capture Source", */
6728 .name = "Input Source",
6730 .info = alc883_mux_enum_info,
6731 .get = alc883_mux_enum_get,
6732 .put = alc883_mux_enum_put,
6737 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6738 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6739 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6740 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6741 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6742 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6743 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6744 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6745 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6746 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6747 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6749 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6750 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6751 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6752 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6756 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6757 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6758 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6759 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6760 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6761 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6762 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6763 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6764 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6767 /* .name = "Capture Source", */
6768 .name = "Input Source",
6770 .info = alc883_mux_enum_info,
6771 .get = alc883_mux_enum_get,
6772 .put = alc883_mux_enum_put,
6777 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6778 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6780 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6781 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6782 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6784 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6785 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6786 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6787 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6788 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6794 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6795 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6797 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6798 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6799 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6800 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6801 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6802 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6804 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6805 /* .name = "Capture Source", */
6806 .name = "Input Source",
6808 .info = alc883_mux_enum_info,
6809 .get = alc883_mux_enum_get,
6810 .put = alc883_mux_enum_put,
6815 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6819 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6820 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6822 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6824 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6825 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6826 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6827 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6830 /* .name = "Capture Source", */
6831 .name = "Input Source",
6833 .info = alc883_mux_enum_info,
6834 .get = alc883_mux_enum_get,
6835 .put = alc883_mux_enum_put,
6840 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6843 .name = "Channel Mode",
6844 .info = alc_ch_mode_info,
6845 .get = alc_ch_mode_get,
6846 .put = alc_ch_mode_put,
6851 static struct hda_verb alc883_init_verbs[] = {
6852 /* ADC1: mute amp left and right */
6853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6854 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6855 /* ADC2: mute amp left and right */
6856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6858 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6859 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6863 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6867 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6868 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6873 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6875 /* mute analog input loopbacks */
6876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6882 /* Front Pin: output 0 (0x0c) */
6883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6884 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6885 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6886 /* Rear Pin: output 1 (0x0d) */
6887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6890 /* CLFE Pin: output 2 (0x0e) */
6891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6892 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6893 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6894 /* Side Pin: output 3 (0x0f) */
6895 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6896 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6897 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6898 /* Mic (rear) pin: input vref at 80% */
6899 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6901 /* Front Mic pin: input vref at 80% */
6902 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6903 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6904 /* Line In pin: input */
6905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6906 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6907 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6908 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6909 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6910 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6911 /* CD pin widget for input */
6912 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6914 /* FIXME: use matrix-type input source selection */
6915 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6917 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6929 /* toggle speaker-output according to the hp-jack state */
6930 static void alc883_mitac_hp_automute(struct hda_codec *codec)
6932 unsigned int present;
6934 present = snd_hda_codec_read(codec, 0x15, 0,
6935 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6936 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6937 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6938 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
6939 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6942 /* auto-toggle front mic */
6944 static void alc883_mitac_mic_automute(struct hda_codec *codec)
6946 unsigned int present;
6949 present = snd_hda_codec_read(codec, 0x18, 0,
6950 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6951 bits = present ? HDA_AMP_MUTE : 0;
6952 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
6956 static void alc883_mitac_automute(struct hda_codec *codec)
6958 alc883_mitac_hp_automute(codec);
6959 /* alc883_mitac_mic_automute(codec); */
6962 static void alc883_mitac_unsol_event(struct hda_codec *codec,
6965 switch (res >> 26) {
6966 case ALC880_HP_EVENT:
6967 alc883_mitac_hp_automute(codec);
6969 case ALC880_MIC_EVENT:
6970 /* alc883_mitac_mic_automute(codec); */
6975 static struct hda_verb alc883_mitac_verbs[] = {
6977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6980 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
6981 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6983 /* enable unsolicited event */
6984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6985 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
6990 static struct hda_verb alc883_tagra_verbs[] = {
6991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6995 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6997 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6998 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6999 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7001 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7002 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7003 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7004 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7009 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7010 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7011 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7012 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7016 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7017 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7018 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7019 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7024 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7027 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7028 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7029 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7033 static struct hda_verb alc883_haier_w66_verbs[] = {
7034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7039 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7040 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7041 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7042 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7046 static struct hda_verb alc888_6st_hp_verbs[] = {
7047 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7049 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7050 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7054 static struct hda_verb alc888_3st_hp_verbs[] = {
7055 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7056 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7057 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7061 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7062 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7063 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7064 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7065 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7069 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7070 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7071 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7072 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7073 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7077 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7078 { 2, alc888_3st_hp_2ch_init },
7079 { 6, alc888_3st_hp_6ch_init },
7082 /* toggle front-jack and RCA according to the hp-jack state */
7083 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7085 unsigned int present;
7087 present = snd_hda_codec_read(codec, 0x1b, 0,
7088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7089 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7090 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7091 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7092 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7095 /* toggle RCA according to the front-jack state */
7096 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7098 unsigned int present;
7100 present = snd_hda_codec_read(codec, 0x14, 0,
7101 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7102 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7103 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7106 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7109 if ((res >> 26) == ALC880_HP_EVENT)
7110 alc888_lenovo_ms7195_front_automute(codec);
7111 if ((res >> 26) == ALC880_FRONT_EVENT)
7112 alc888_lenovo_ms7195_rca_automute(codec);
7115 static struct hda_verb alc883_medion_md2_verbs[] = {
7116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7121 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7125 /* toggle speaker-output according to the hp-jack state */
7126 static void alc883_medion_md2_automute(struct hda_codec *codec)
7128 unsigned int present;
7130 present = snd_hda_codec_read(codec, 0x14, 0,
7131 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7132 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7133 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7136 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7139 if ((res >> 26) == ALC880_HP_EVENT)
7140 alc883_medion_md2_automute(codec);
7143 /* toggle speaker-output according to the hp-jack state */
7144 static void alc883_tagra_automute(struct hda_codec *codec)
7146 unsigned int present;
7149 present = snd_hda_codec_read(codec, 0x14, 0,
7150 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7151 bits = present ? HDA_AMP_MUTE : 0;
7152 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7153 HDA_AMP_MUTE, bits);
7154 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7158 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7160 if ((res >> 26) == ALC880_HP_EVENT)
7161 alc883_tagra_automute(codec);
7164 static void alc883_haier_w66_automute(struct hda_codec *codec)
7166 unsigned int present;
7169 present = snd_hda_codec_read(codec, 0x1b, 0,
7170 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7171 bits = present ? 0x80 : 0;
7172 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7176 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7179 if ((res >> 26) == ALC880_HP_EVENT)
7180 alc883_haier_w66_automute(codec);
7183 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7185 unsigned int present;
7188 present = snd_hda_codec_read(codec, 0x14, 0,
7189 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7190 bits = present ? HDA_AMP_MUTE : 0;
7191 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7192 HDA_AMP_MUTE, bits);
7195 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7197 unsigned int present;
7200 present = snd_hda_codec_read(codec, 0x1b, 0,
7201 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7202 bits = present ? HDA_AMP_MUTE : 0;
7203 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7204 HDA_AMP_MUTE, bits);
7205 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7206 HDA_AMP_MUTE, bits);
7209 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7212 if ((res >> 26) == ALC880_HP_EVENT)
7213 alc883_lenovo_101e_all_automute(codec);
7214 if ((res >> 26) == ALC880_FRONT_EVENT)
7215 alc883_lenovo_101e_ispeaker_automute(codec);
7218 /* toggle speaker-output according to the hp-jack state */
7219 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7221 unsigned int present;
7223 present = snd_hda_codec_read(codec, 0x14, 0,
7224 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7225 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7226 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7227 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7228 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7231 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7234 if ((res >> 26) == ALC880_HP_EVENT)
7235 alc883_acer_aspire_automute(codec);
7238 static struct hda_verb alc883_acer_eapd_verbs[] = {
7239 /* HP Pin: output 0 (0x0c) */
7240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7242 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7243 /* Front Pin: output 0 (0x0c) */
7244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7246 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7247 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7248 /* eanable EAPD on medion laptop */
7249 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7250 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7251 /* enable unsolicited event */
7252 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7257 * generic initialization of ADC, input mixers and output mixers
7259 static struct hda_verb alc883_auto_init_verbs[] = {
7261 * Unmute ADC0-2 and set the default input to mic-in
7263 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7264 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7265 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7268 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7270 * Note: PASD motherboards uses the Line In 2 as the input for
7271 * front panel mic (mic 2)
7273 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7281 * Set up output mixers (0x0c - 0x0f)
7283 /* set vol=0 to output mixers */
7284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7287 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7288 /* set up input amps for analog loopback */
7289 /* Amp Indices: DAC = 0, mixer = 1 */
7290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7296 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7298 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7299 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7301 /* FIXME: use matrix-type input source selection */
7302 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7307 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7313 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7319 /* capture mixer elements */
7320 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7321 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7322 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7323 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7324 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7327 /* The multiple "Capture Source" controls confuse alsamixer
7328 * So call somewhat different..
7329 * FIXME: the controls appear in the "playback" view!
7331 /* .name = "Capture Source", */
7332 .name = "Input Source",
7334 .info = alc882_mux_enum_info,
7335 .get = alc882_mux_enum_get,
7336 .put = alc882_mux_enum_put,
7341 #ifdef CONFIG_SND_HDA_POWER_SAVE
7342 #define alc883_loopbacks alc880_loopbacks
7345 /* pcm configuration: identiacal with ALC880 */
7346 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7347 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7348 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7349 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7352 * configuration and preset
7354 static const char *alc883_models[ALC883_MODEL_LAST] = {
7355 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7356 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7357 [ALC883_3ST_6ch] = "3stack-6ch",
7358 [ALC883_6ST_DIG] = "6stack-dig",
7359 [ALC883_TARGA_DIG] = "targa-dig",
7360 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7361 [ALC883_ACER] = "acer",
7362 [ALC883_ACER_ASPIRE] = "acer-aspire",
7363 [ALC883_MEDION] = "medion",
7364 [ALC883_MEDION_MD2] = "medion-md2",
7365 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7366 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7367 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7368 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7369 [ALC883_HAIER_W66] = "haier-w66",
7370 [ALC888_6ST_HP] = "6stack-hp",
7371 [ALC888_3ST_HP] = "3stack-hp",
7372 [ALC883_MITAC] = "mitac",
7373 [ALC883_AUTO] = "auto",
7376 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7377 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7378 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7379 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7380 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7381 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7382 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7383 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7384 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7385 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7386 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7387 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7388 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7389 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7390 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7391 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7392 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7393 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7394 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7395 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7396 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7397 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7398 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7399 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7400 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7401 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7402 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7403 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7404 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7405 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7406 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7407 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7408 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7409 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7410 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7411 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7412 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7413 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7414 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7415 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7416 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7417 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7418 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7419 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7420 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7421 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7425 static struct alc_config_preset alc883_presets[] = {
7426 [ALC883_3ST_2ch_DIG] = {
7427 .mixers = { alc883_3ST_2ch_mixer },
7428 .init_verbs = { alc883_init_verbs },
7429 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7430 .dac_nids = alc883_dac_nids,
7431 .dig_out_nid = ALC883_DIGOUT_NID,
7432 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7433 .adc_nids = alc883_adc_nids,
7434 .dig_in_nid = ALC883_DIGIN_NID,
7435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7436 .channel_mode = alc883_3ST_2ch_modes,
7437 .input_mux = &alc883_capture_source,
7439 [ALC883_3ST_6ch_DIG] = {
7440 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7441 .init_verbs = { alc883_init_verbs },
7442 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7443 .dac_nids = alc883_dac_nids,
7444 .dig_out_nid = ALC883_DIGOUT_NID,
7445 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7446 .adc_nids = alc883_adc_nids,
7447 .dig_in_nid = ALC883_DIGIN_NID,
7448 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7449 .channel_mode = alc883_3ST_6ch_modes,
7451 .input_mux = &alc883_capture_source,
7453 [ALC883_3ST_6ch] = {
7454 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7455 .init_verbs = { alc883_init_verbs },
7456 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7457 .dac_nids = alc883_dac_nids,
7458 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7459 .adc_nids = alc883_adc_nids,
7460 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7461 .channel_mode = alc883_3ST_6ch_modes,
7463 .input_mux = &alc883_capture_source,
7465 [ALC883_6ST_DIG] = {
7466 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7467 .init_verbs = { alc883_init_verbs },
7468 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7469 .dac_nids = alc883_dac_nids,
7470 .dig_out_nid = ALC883_DIGOUT_NID,
7471 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7472 .adc_nids = alc883_adc_nids,
7473 .dig_in_nid = ALC883_DIGIN_NID,
7474 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7475 .channel_mode = alc883_sixstack_modes,
7476 .input_mux = &alc883_capture_source,
7478 [ALC883_TARGA_DIG] = {
7479 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7480 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7481 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7482 .dac_nids = alc883_dac_nids,
7483 .dig_out_nid = ALC883_DIGOUT_NID,
7484 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7485 .adc_nids = alc883_adc_nids,
7486 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7487 .channel_mode = alc883_3ST_6ch_modes,
7489 .input_mux = &alc883_capture_source,
7490 .unsol_event = alc883_tagra_unsol_event,
7491 .init_hook = alc883_tagra_automute,
7493 [ALC883_TARGA_2ch_DIG] = {
7494 .mixers = { alc883_tagra_2ch_mixer},
7495 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7496 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7497 .dac_nids = alc883_dac_nids,
7498 .dig_out_nid = ALC883_DIGOUT_NID,
7499 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7500 .adc_nids = alc883_adc_nids,
7501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7502 .channel_mode = alc883_3ST_2ch_modes,
7503 .input_mux = &alc883_capture_source,
7504 .unsol_event = alc883_tagra_unsol_event,
7505 .init_hook = alc883_tagra_automute,
7508 .mixers = { alc883_base_mixer },
7509 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7510 * and the headphone jack. Turn this on and rely on the
7511 * standard mute methods whenever the user wants to turn
7512 * these outputs off.
7514 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7515 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7516 .dac_nids = alc883_dac_nids,
7517 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7518 .adc_nids = alc883_adc_nids,
7519 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7520 .channel_mode = alc883_3ST_2ch_modes,
7521 .input_mux = &alc883_capture_source,
7523 [ALC883_ACER_ASPIRE] = {
7524 .mixers = { alc883_acer_aspire_mixer },
7525 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7527 .dac_nids = alc883_dac_nids,
7528 .dig_out_nid = ALC883_DIGOUT_NID,
7529 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7530 .adc_nids = alc883_adc_nids,
7531 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7532 .channel_mode = alc883_3ST_2ch_modes,
7533 .input_mux = &alc883_capture_source,
7534 .unsol_event = alc883_acer_aspire_unsol_event,
7535 .init_hook = alc883_acer_aspire_automute,
7538 .mixers = { alc883_fivestack_mixer,
7539 alc883_chmode_mixer },
7540 .init_verbs = { alc883_init_verbs,
7541 alc883_medion_eapd_verbs },
7542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7543 .dac_nids = alc883_dac_nids,
7544 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7545 .adc_nids = alc883_adc_nids,
7546 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7547 .channel_mode = alc883_sixstack_modes,
7548 .input_mux = &alc883_capture_source,
7550 [ALC883_MEDION_MD2] = {
7551 .mixers = { alc883_medion_md2_mixer},
7552 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7553 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7554 .dac_nids = alc883_dac_nids,
7555 .dig_out_nid = ALC883_DIGOUT_NID,
7556 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7557 .adc_nids = alc883_adc_nids,
7558 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7559 .channel_mode = alc883_3ST_2ch_modes,
7560 .input_mux = &alc883_capture_source,
7561 .unsol_event = alc883_medion_md2_unsol_event,
7562 .init_hook = alc883_medion_md2_automute,
7564 [ALC883_LAPTOP_EAPD] = {
7565 .mixers = { alc883_base_mixer },
7566 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7567 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7568 .dac_nids = alc883_dac_nids,
7569 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7570 .adc_nids = alc883_adc_nids,
7571 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7572 .channel_mode = alc883_3ST_2ch_modes,
7573 .input_mux = &alc883_capture_source,
7575 [ALC883_LENOVO_101E_2ch] = {
7576 .mixers = { alc883_lenovo_101e_2ch_mixer},
7577 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7579 .dac_nids = alc883_dac_nids,
7580 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7581 .adc_nids = alc883_adc_nids,
7582 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7583 .channel_mode = alc883_3ST_2ch_modes,
7584 .input_mux = &alc883_lenovo_101e_capture_source,
7585 .unsol_event = alc883_lenovo_101e_unsol_event,
7586 .init_hook = alc883_lenovo_101e_all_automute,
7588 [ALC883_LENOVO_NB0763] = {
7589 .mixers = { alc883_lenovo_nb0763_mixer },
7590 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7591 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7592 .dac_nids = alc883_dac_nids,
7593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7594 .adc_nids = alc883_adc_nids,
7595 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7596 .channel_mode = alc883_3ST_2ch_modes,
7598 .input_mux = &alc883_lenovo_nb0763_capture_source,
7599 .unsol_event = alc883_medion_md2_unsol_event,
7600 .init_hook = alc883_medion_md2_automute,
7602 [ALC888_LENOVO_MS7195_DIG] = {
7603 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7604 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7605 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7606 .dac_nids = alc883_dac_nids,
7607 .dig_out_nid = ALC883_DIGOUT_NID,
7608 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7609 .adc_nids = alc883_adc_nids,
7610 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7611 .channel_mode = alc883_3ST_6ch_modes,
7613 .input_mux = &alc883_capture_source,
7614 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7615 .init_hook = alc888_lenovo_ms7195_front_automute,
7617 [ALC883_HAIER_W66] = {
7618 .mixers = { alc883_tagra_2ch_mixer},
7619 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7621 .dac_nids = alc883_dac_nids,
7622 .dig_out_nid = ALC883_DIGOUT_NID,
7623 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7624 .adc_nids = alc883_adc_nids,
7625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7626 .channel_mode = alc883_3ST_2ch_modes,
7627 .input_mux = &alc883_capture_source,
7628 .unsol_event = alc883_haier_w66_unsol_event,
7629 .init_hook = alc883_haier_w66_automute,
7632 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7633 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7634 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7635 .dac_nids = alc883_dac_nids,
7636 .dig_out_nid = ALC883_DIGOUT_NID,
7637 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7638 .adc_nids = alc883_adc_nids,
7639 .dig_in_nid = ALC883_DIGIN_NID,
7640 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7641 .channel_mode = alc883_sixstack_modes,
7642 .input_mux = &alc883_capture_source,
7645 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7646 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7648 .dac_nids = alc883_dac_nids,
7649 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7650 .adc_nids = alc883_adc_nids,
7651 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7652 .channel_mode = alc888_3st_hp_modes,
7654 .input_mux = &alc883_capture_source,
7657 .mixers = { alc883_mitac_mixer },
7658 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7659 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7660 .dac_nids = alc883_dac_nids,
7661 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7662 .adc_nids = alc883_adc_nids,
7663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7664 .channel_mode = alc883_3ST_2ch_modes,
7665 .input_mux = &alc883_capture_source,
7666 .unsol_event = alc883_mitac_unsol_event,
7667 .init_hook = alc883_mitac_automute,
7673 * BIOS auto configuration
7675 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7676 hda_nid_t nid, int pin_type,
7680 struct alc_spec *spec = codec->spec;
7683 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7686 idx = spec->multiout.dac_nids[dac_idx] - 2;
7688 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7690 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7692 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7696 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7698 struct alc_spec *spec = codec->spec;
7701 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7702 for (i = 0; i <= HDA_SIDE; i++) {
7703 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7704 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7706 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7711 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7713 struct alc_spec *spec = codec->spec;
7716 pin = spec->autocfg.hp_pins[0];
7717 if (pin) /* connect to front */
7719 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7722 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7723 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7725 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7727 struct alc_spec *spec = codec->spec;
7730 for (i = 0; i < AUTO_PIN_LAST; i++) {
7731 hda_nid_t nid = spec->autocfg.input_pins[i];
7732 if (alc883_is_input_pin(nid)) {
7733 snd_hda_codec_write(codec, nid, 0,
7734 AC_VERB_SET_PIN_WIDGET_CONTROL,
7735 (i <= AUTO_PIN_FRONT_MIC ?
7736 PIN_VREF80 : PIN_IN));
7737 if (nid != ALC883_PIN_CD_NID)
7738 snd_hda_codec_write(codec, nid, 0,
7739 AC_VERB_SET_AMP_GAIN_MUTE,
7745 /* almost identical with ALC880 parser... */
7746 static int alc883_parse_auto_config(struct hda_codec *codec)
7748 struct alc_spec *spec = codec->spec;
7749 int err = alc880_parse_auto_config(codec);
7754 return 0; /* no config found */
7756 err = alc_auto_add_mic_boost(codec);
7760 /* hack - override the init verbs */
7761 spec->init_verbs[0] = alc883_auto_init_verbs;
7762 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7765 return 1; /* config found */
7768 /* additional initialization for auto-configuration model */
7769 static void alc883_auto_init(struct hda_codec *codec)
7771 alc883_auto_init_multi_out(codec);
7772 alc883_auto_init_hp_out(codec);
7773 alc883_auto_init_analog_input(codec);
7776 static int patch_alc883(struct hda_codec *codec)
7778 struct alc_spec *spec;
7779 int err, board_config;
7781 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7787 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7790 if (board_config < 0) {
7791 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7792 "trying auto-probe from BIOS...\n");
7793 board_config = ALC883_AUTO;
7796 if (board_config == ALC883_AUTO) {
7797 /* automatic parse from the BIOS config */
7798 err = alc883_parse_auto_config(codec);
7804 "hda_codec: Cannot set up configuration "
7805 "from BIOS. Using base mode...\n");
7806 board_config = ALC883_3ST_2ch_DIG;
7810 if (board_config != ALC883_AUTO)
7811 setup_preset(spec, &alc883_presets[board_config]);
7813 spec->stream_name_analog = "ALC883 Analog";
7814 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7815 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7817 spec->stream_name_digital = "ALC883 Digital";
7818 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7819 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7821 if (!spec->adc_nids && spec->input_mux) {
7822 spec->adc_nids = alc883_adc_nids;
7823 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7826 spec->vmaster_nid = 0x0c;
7828 codec->patch_ops = alc_patch_ops;
7829 if (board_config == ALC883_AUTO)
7830 spec->init_hook = alc883_auto_init;
7831 #ifdef CONFIG_SND_HDA_POWER_SAVE
7832 if (!spec->loopback.amplist)
7833 spec->loopback.amplist = alc883_loopbacks;
7843 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7844 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7846 #define alc262_dac_nids alc260_dac_nids
7847 #define alc262_adc_nids alc882_adc_nids
7848 #define alc262_adc_nids_alt alc882_adc_nids_alt
7850 #define alc262_modes alc260_modes
7851 #define alc262_capture_source alc882_capture_source
7853 static struct snd_kcontrol_new alc262_base_mixer[] = {
7854 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7855 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7863 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7866 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7867 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7868 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7870 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7871 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7875 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7877 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7878 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7879 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7885 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7886 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7888 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7889 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7890 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7891 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7895 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7897 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7899 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7900 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7906 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7907 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7909 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7912 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7913 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7914 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7915 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7919 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7920 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7921 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7922 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7924 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7925 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7927 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7929 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7930 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7931 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7932 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7933 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7934 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7938 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7939 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7940 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7945 static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = {
7946 .ops = &snd_hda_bind_vol,
7948 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7949 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7954 static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = {
7955 .ops = &snd_hda_bind_sw,
7957 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7958 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7963 /* mute/unmute internal speaker according to the hp jack and mute state */
7964 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
7966 struct alc_spec *spec = codec->spec;
7969 if (force || !spec->sense_updated) {
7970 unsigned int present;
7971 present = snd_hda_codec_read(codec, 0x15, 0,
7972 AC_VERB_GET_PIN_SENSE, 0);
7973 spec->jack_present = (present & 0x80000000) != 0;
7974 spec->sense_updated = 1;
7976 if (spec->jack_present)
7977 mute = (0x7080 | ((0)<<8)); /* mute internal speaker */
7978 else /* unmute internal speaker if necessary */
7979 mute = (0x7000 | ((0)<<8));
7980 snd_hda_codec_write(codec, 0x0c, 0,
7981 AC_VERB_SET_AMP_GAIN_MUTE, mute );
7984 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
7987 if ((res >> 26) != ALC880_HP_EVENT)
7989 alc262_hp_t5735_automute(codec, 1);
7992 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
7994 alc262_hp_t5735_automute(codec, 1);
7997 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
7998 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol),
7999 HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw),
8000 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8001 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8002 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8003 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8004 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8005 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8012 static struct hda_verb alc262_hp_t5735_verbs[] = {
8013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8014 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8016 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8020 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = {
8021 .ops = &snd_hda_bind_vol,
8023 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8024 HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT),
8029 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = {
8030 .ops = &snd_hda_bind_sw,
8032 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8033 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
8038 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8039 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol),
8040 HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw),
8041 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8042 HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8043 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8044 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8050 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8051 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8052 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8053 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8055 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8056 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8064 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8071 /* bind hp and internal speaker mute (with plug check) */
8072 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8073 struct snd_ctl_elem_value *ucontrol)
8075 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8076 long *valp = ucontrol->value.integer.value;
8079 /* change hp mute */
8080 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8082 valp[0] ? 0 : HDA_AMP_MUTE);
8083 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8085 valp[1] ? 0 : HDA_AMP_MUTE);
8087 /* change speaker according to HP jack state */
8088 struct alc_spec *spec = codec->spec;
8090 if (spec->jack_present)
8091 mute = HDA_AMP_MUTE;
8093 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8095 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8096 HDA_AMP_MUTE, mute);
8101 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8102 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8105 .name = "Master Playback Switch",
8106 .info = snd_hda_mixer_amp_switch_info,
8107 .get = snd_hda_mixer_amp_switch_get,
8108 .put = alc262_sony_master_sw_put,
8109 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8113 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8114 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8118 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8120 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8124 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8125 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8129 #define alc262_capture_mixer alc882_capture_mixer
8130 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8133 * generic initialization of ADC, input mixers and output mixers
8135 static struct hda_verb alc262_init_verbs[] = {
8137 * Unmute ADC0-2 and set the default input to mic-in
8139 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8141 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8143 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8146 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8148 * Note: PASD motherboards uses the Line In 2 as the input for
8149 * front panel mic (mic 2)
8151 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8159 * Set up output mixers (0x0c - 0x0e)
8161 /* set vol=0 to output mixers */
8162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8165 /* set up input amps for analog loopback */
8166 /* Amp Indices: DAC = 0, mixer = 1 */
8167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8174 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8176 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8178 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8179 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8187 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8190 /* FIXME: use matrix-type input source selection */
8191 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8192 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8211 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8217 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8219 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8222 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8223 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8227 static struct hda_verb alc262_sony_unsol_verbs[] = {
8228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8232 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8236 /* mute/unmute internal speaker according to the hp jack and mute state */
8237 static void alc262_hippo_automute(struct hda_codec *codec)
8239 struct alc_spec *spec = codec->spec;
8241 unsigned int present;
8243 /* need to execute and sync at first */
8244 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8245 present = snd_hda_codec_read(codec, 0x15, 0,
8246 AC_VERB_GET_PIN_SENSE, 0);
8247 spec->jack_present = (present & 0x80000000) != 0;
8248 if (spec->jack_present) {
8249 /* mute internal speaker */
8250 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8251 HDA_AMP_MUTE, HDA_AMP_MUTE);
8253 /* unmute internal speaker if necessary */
8254 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8255 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8256 HDA_AMP_MUTE, mute);
8260 /* unsolicited event for HP jack sensing */
8261 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8264 if ((res >> 26) != ALC880_HP_EVENT)
8266 alc262_hippo_automute(codec);
8269 static void alc262_hippo1_automute(struct hda_codec *codec)
8272 unsigned int present;
8274 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8275 present = snd_hda_codec_read(codec, 0x1b, 0,
8276 AC_VERB_GET_PIN_SENSE, 0);
8277 present = (present & 0x80000000) != 0;
8279 /* mute internal speaker */
8280 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8281 HDA_AMP_MUTE, HDA_AMP_MUTE);
8283 /* unmute internal speaker if necessary */
8284 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8285 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8286 HDA_AMP_MUTE, mute);
8290 /* unsolicited event for HP jack sensing */
8291 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8294 if ((res >> 26) != ALC880_HP_EVENT)
8296 alc262_hippo1_automute(codec);
8301 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8304 #define ALC_HP_EVENT 0x37
8306 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8307 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8312 static struct hda_input_mux alc262_fujitsu_capture_source = {
8321 static struct hda_input_mux alc262_HP_capture_source = {
8325 { "Front Mic", 0x1 },
8332 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8336 { "Front Mic", 0x2 },
8342 /* mute/unmute internal speaker according to the hp jack and mute state */
8343 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8345 struct alc_spec *spec = codec->spec;
8348 if (force || !spec->sense_updated) {
8349 unsigned int present;
8350 /* need to execute and sync at first */
8351 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8352 present = snd_hda_codec_read(codec, 0x14, 0,
8353 AC_VERB_GET_PIN_SENSE, 0);
8354 spec->jack_present = (present & 0x80000000) != 0;
8355 spec->sense_updated = 1;
8357 if (spec->jack_present) {
8358 /* mute internal speaker */
8359 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8360 HDA_AMP_MUTE, HDA_AMP_MUTE);
8362 /* unmute internal speaker if necessary */
8363 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8364 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8365 HDA_AMP_MUTE, mute);
8369 /* unsolicited event for HP jack sensing */
8370 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8373 if ((res >> 26) != ALC_HP_EVENT)
8375 alc262_fujitsu_automute(codec, 1);
8378 /* bind volumes of both NID 0x0c and 0x0d */
8379 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8380 .ops = &snd_hda_bind_vol,
8382 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8383 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8388 /* bind hp and internal speaker mute (with plug check) */
8389 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8390 struct snd_ctl_elem_value *ucontrol)
8392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8393 long *valp = ucontrol->value.integer.value;
8396 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8398 valp[0] ? 0 : HDA_AMP_MUTE);
8399 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8401 valp[1] ? 0 : HDA_AMP_MUTE);
8403 alc262_fujitsu_automute(codec, 0);
8407 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8408 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8411 .name = "Master Playback Switch",
8412 .info = snd_hda_mixer_amp_switch_info,
8413 .get = snd_hda_mixer_amp_switch_get,
8414 .put = alc262_fujitsu_master_sw_put,
8415 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8422 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8423 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8424 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8428 /* additional init verbs for Benq laptops */
8429 static struct hda_verb alc262_EAPD_verbs[] = {
8430 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8431 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8435 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8436 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8437 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8439 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8440 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8444 /* Samsung Q1 Ultra Vista model setup */
8445 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8446 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8447 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8448 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8451 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8455 static struct hda_verb alc262_ultra_verbs[] = {
8456 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8458 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8459 /* Mic is on Node 0x19 */
8460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8461 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8463 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8465 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8470 static struct hda_input_mux alc262_ultra_capture_source = {
8477 /* mute/unmute internal speaker according to the hp jack and mute state */
8478 static void alc262_ultra_automute(struct hda_codec *codec)
8480 struct alc_spec *spec = codec->spec;
8482 unsigned int present;
8484 /* need to execute and sync at first */
8485 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8486 present = snd_hda_codec_read(codec, 0x15, 0,
8487 AC_VERB_GET_PIN_SENSE, 0);
8488 spec->jack_present = (present & 0x80000000) != 0;
8489 if (spec->jack_present) {
8490 /* mute internal speaker */
8491 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8492 HDA_AMP_MUTE, HDA_AMP_MUTE);
8494 /* unmute internal speaker if necessary */
8495 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8496 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8497 HDA_AMP_MUTE, mute);
8501 /* unsolicited event for HP jack sensing */
8502 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8505 if ((res >> 26) != ALC880_HP_EVENT)
8507 alc262_ultra_automute(codec);
8510 /* add playback controls from the parsed DAC table */
8511 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8512 const struct auto_pin_cfg *cfg)
8517 spec->multiout.num_dacs = 1; /* only use one dac */
8518 spec->multiout.dac_nids = spec->private_dac_nids;
8519 spec->multiout.dac_nids[0] = 2;
8521 nid = cfg->line_out_pins[0];
8523 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8524 "Front Playback Volume",
8525 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8528 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8529 "Front Playback Switch",
8530 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8535 nid = cfg->speaker_pins[0];
8538 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8539 "Speaker Playback Volume",
8540 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8544 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8545 "Speaker Playback Switch",
8546 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8551 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8552 "Speaker Playback Switch",
8553 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8559 nid = cfg->hp_pins[0];
8561 /* spec->multiout.hp_nid = 2; */
8563 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8564 "Headphone Playback Volume",
8565 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8569 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8570 "Headphone Playback Switch",
8571 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8576 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8577 "Headphone Playback Switch",
8578 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8587 /* identical with ALC880 */
8588 #define alc262_auto_create_analog_input_ctls \
8589 alc880_auto_create_analog_input_ctls
8592 * generic initialization of ADC, input mixers and output mixers
8594 static struct hda_verb alc262_volume_init_verbs[] = {
8596 * Unmute ADC0-2 and set the default input to mic-in
8598 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8602 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8605 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8607 * Note: PASD motherboards uses the Line In 2 as the input for
8608 * front panel mic (mic 2)
8610 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8618 * Set up output mixers (0x0c - 0x0f)
8620 /* set vol=0 to output mixers */
8621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8625 /* set up input amps for analog loopback */
8626 /* Amp Indices: DAC = 0, mixer = 1 */
8627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8634 /* FIXME: use matrix-type input source selection */
8635 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8636 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8655 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8657 * Unmute ADC0-2 and set the default input to mic-in
8659 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8661 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8663 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8666 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8668 * Note: PASD motherboards uses the Line In 2 as the input for
8669 * front panel mic (mic 2)
8671 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8672 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8673 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8674 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8675 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8681 * Set up output mixers (0x0c - 0x0e)
8683 /* set vol=0 to output mixers */
8684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8686 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8688 /* set up input amps for analog loopback */
8689 /* Amp Indices: DAC = 0, mixer = 1 */
8690 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8691 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8692 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8693 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8694 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8695 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8697 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8701 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8702 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8704 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8705 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8709 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8714 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8715 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8717 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8718 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8721 /* FIXME: use matrix-type input source selection */
8722 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8723 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8724 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8742 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8744 * Unmute ADC0-2 and set the default input to mic-in
8746 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8749 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8750 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8751 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8753 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8755 * Note: PASD motherboards uses the Line In 2 as the input for front
8758 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8768 * Set up output mixers (0x0c - 0x0e)
8770 /* set vol=0 to output mixers */
8771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8772 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8773 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8775 /* set up input amps for analog loopback */
8776 /* Amp Indices: DAC = 0, mixer = 1 */
8777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8786 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8787 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8789 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8793 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8796 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8799 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8802 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8803 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8804 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8806 /* FIXME: use matrix-type input source selection */
8807 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8808 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8810 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8811 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8812 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8813 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8814 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8817 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8819 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8820 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8822 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8830 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8836 #ifdef CONFIG_SND_HDA_POWER_SAVE
8837 #define alc262_loopbacks alc880_loopbacks
8840 /* pcm configuration: identiacal with ALC880 */
8841 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8842 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8843 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8844 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8847 * BIOS auto configuration
8849 static int alc262_parse_auto_config(struct hda_codec *codec)
8851 struct alc_spec *spec = codec->spec;
8853 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8855 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8859 if (!spec->autocfg.line_outs)
8860 return 0; /* can't find valid BIOS pin config */
8861 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8864 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8868 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8870 if (spec->autocfg.dig_out_pin)
8871 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8872 if (spec->autocfg.dig_in_pin)
8873 spec->dig_in_nid = ALC262_DIGIN_NID;
8875 if (spec->kctl_alloc)
8876 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8878 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8879 spec->num_mux_defs = 1;
8880 spec->input_mux = &spec->private_imux;
8882 err = alc_auto_add_mic_boost(codec);
8889 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8890 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8891 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8894 /* init callback for auto-configuration model -- overriding the default init */
8895 static void alc262_auto_init(struct hda_codec *codec)
8897 alc262_auto_init_multi_out(codec);
8898 alc262_auto_init_hp_out(codec);
8899 alc262_auto_init_analog_input(codec);
8903 * configuration and preset
8905 static const char *alc262_models[ALC262_MODEL_LAST] = {
8906 [ALC262_BASIC] = "basic",
8907 [ALC262_HIPPO] = "hippo",
8908 [ALC262_HIPPO_1] = "hippo_1",
8909 [ALC262_FUJITSU] = "fujitsu",
8910 [ALC262_HP_BPC] = "hp-bpc",
8911 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8912 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
8913 [ALC262_HP_RP5700] = "hp-rp5700",
8914 [ALC262_BENQ_ED8] = "benq",
8915 [ALC262_BENQ_T31] = "benq-t31",
8916 [ALC262_SONY_ASSAMD] = "sony-assamd",
8917 [ALC262_ULTRA] = "ultra",
8918 [ALC262_AUTO] = "auto",
8921 static struct snd_pci_quirk alc262_cfg_tbl[] = {
8922 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
8923 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
8924 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
8925 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
8926 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
8927 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
8928 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
8929 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
8930 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
8931 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
8932 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
8933 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
8934 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
8935 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
8936 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
8937 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
8938 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
8939 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
8940 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
8941 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
8942 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
8943 ALC262_HP_TC_T5735),
8944 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
8945 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8946 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
8947 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8948 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8949 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
8950 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
8951 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
8952 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
8953 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
8954 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
8958 static struct alc_config_preset alc262_presets[] = {
8960 .mixers = { alc262_base_mixer },
8961 .init_verbs = { alc262_init_verbs },
8962 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8963 .dac_nids = alc262_dac_nids,
8965 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8966 .channel_mode = alc262_modes,
8967 .input_mux = &alc262_capture_source,
8970 .mixers = { alc262_base_mixer },
8971 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8972 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8973 .dac_nids = alc262_dac_nids,
8975 .dig_out_nid = ALC262_DIGOUT_NID,
8976 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8977 .channel_mode = alc262_modes,
8978 .input_mux = &alc262_capture_source,
8979 .unsol_event = alc262_hippo_unsol_event,
8980 .init_hook = alc262_hippo_automute,
8982 [ALC262_HIPPO_1] = {
8983 .mixers = { alc262_hippo1_mixer },
8984 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8985 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8986 .dac_nids = alc262_dac_nids,
8988 .dig_out_nid = ALC262_DIGOUT_NID,
8989 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8990 .channel_mode = alc262_modes,
8991 .input_mux = &alc262_capture_source,
8992 .unsol_event = alc262_hippo1_unsol_event,
8993 .init_hook = alc262_hippo1_automute,
8995 [ALC262_FUJITSU] = {
8996 .mixers = { alc262_fujitsu_mixer },
8997 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
8998 alc262_fujitsu_unsol_verbs },
8999 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9000 .dac_nids = alc262_dac_nids,
9002 .dig_out_nid = ALC262_DIGOUT_NID,
9003 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9004 .channel_mode = alc262_modes,
9005 .input_mux = &alc262_fujitsu_capture_source,
9006 .unsol_event = alc262_fujitsu_unsol_event,
9009 .mixers = { alc262_HP_BPC_mixer },
9010 .init_verbs = { alc262_HP_BPC_init_verbs },
9011 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9012 .dac_nids = alc262_dac_nids,
9014 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9015 .channel_mode = alc262_modes,
9016 .input_mux = &alc262_HP_capture_source,
9018 [ALC262_HP_BPC_D7000_WF] = {
9019 .mixers = { alc262_HP_BPC_WildWest_mixer },
9020 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9021 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9022 .dac_nids = alc262_dac_nids,
9024 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9025 .channel_mode = alc262_modes,
9026 .input_mux = &alc262_HP_D7000_capture_source,
9028 [ALC262_HP_BPC_D7000_WL] = {
9029 .mixers = { alc262_HP_BPC_WildWest_mixer,
9030 alc262_HP_BPC_WildWest_option_mixer },
9031 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9032 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9033 .dac_nids = alc262_dac_nids,
9035 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9036 .channel_mode = alc262_modes,
9037 .input_mux = &alc262_HP_D7000_capture_source,
9039 [ALC262_HP_TC_T5735] = {
9040 .mixers = { alc262_hp_t5735_mixer },
9041 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9042 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9043 .dac_nids = alc262_dac_nids,
9045 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9046 .channel_mode = alc262_modes,
9047 .input_mux = &alc262_capture_source,
9048 .unsol_event = alc262_hp_t5735_unsol_event,
9049 .init_hook = alc262_hp_t5735_init_hook,
9051 [ALC262_HP_RP5700] = {
9052 .mixers = { alc262_hp_rp5700_mixer },
9053 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9054 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9055 .dac_nids = alc262_dac_nids,
9056 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9057 .channel_mode = alc262_modes,
9058 .input_mux = &alc262_hp_rp5700_capture_source,
9060 [ALC262_BENQ_ED8] = {
9061 .mixers = { alc262_base_mixer },
9062 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9063 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9064 .dac_nids = alc262_dac_nids,
9066 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9067 .channel_mode = alc262_modes,
9068 .input_mux = &alc262_capture_source,
9070 [ALC262_SONY_ASSAMD] = {
9071 .mixers = { alc262_sony_mixer },
9072 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9073 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9074 .dac_nids = alc262_dac_nids,
9076 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9077 .channel_mode = alc262_modes,
9078 .input_mux = &alc262_capture_source,
9079 .unsol_event = alc262_hippo_unsol_event,
9080 .init_hook = alc262_hippo_automute,
9082 [ALC262_BENQ_T31] = {
9083 .mixers = { alc262_benq_t31_mixer },
9084 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9085 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9086 .dac_nids = alc262_dac_nids,
9088 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9089 .channel_mode = alc262_modes,
9090 .input_mux = &alc262_capture_source,
9091 .unsol_event = alc262_hippo_unsol_event,
9092 .init_hook = alc262_hippo_automute,
9095 .mixers = { alc262_ultra_mixer },
9096 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
9097 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9098 .dac_nids = alc262_dac_nids,
9100 .dig_out_nid = ALC262_DIGOUT_NID,
9101 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9102 .channel_mode = alc262_modes,
9103 .input_mux = &alc262_ultra_capture_source,
9104 .unsol_event = alc262_ultra_unsol_event,
9105 .init_hook = alc262_ultra_automute,
9109 static int patch_alc262(struct hda_codec *codec)
9111 struct alc_spec *spec;
9115 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9121 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9126 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9127 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9128 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9129 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9133 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9137 if (board_config < 0) {
9138 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9139 "trying auto-probe from BIOS...\n");
9140 board_config = ALC262_AUTO;
9143 if (board_config == ALC262_AUTO) {
9144 /* automatic parse from the BIOS config */
9145 err = alc262_parse_auto_config(codec);
9151 "hda_codec: Cannot set up configuration "
9152 "from BIOS. Using base mode...\n");
9153 board_config = ALC262_BASIC;
9157 if (board_config != ALC262_AUTO)
9158 setup_preset(spec, &alc262_presets[board_config]);
9160 spec->stream_name_analog = "ALC262 Analog";
9161 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9162 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9164 spec->stream_name_digital = "ALC262 Digital";
9165 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9166 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9168 if (!spec->adc_nids && spec->input_mux) {
9169 /* check whether NID 0x07 is valid */
9170 unsigned int wcap = get_wcaps(codec, 0x07);
9173 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9174 if (wcap != AC_WID_AUD_IN) {
9175 spec->adc_nids = alc262_adc_nids_alt;
9176 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9177 spec->mixers[spec->num_mixers] =
9178 alc262_capture_alt_mixer;
9181 spec->adc_nids = alc262_adc_nids;
9182 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9183 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9188 spec->vmaster_nid = 0x0c;
9190 codec->patch_ops = alc_patch_ops;
9191 if (board_config == ALC262_AUTO)
9192 spec->init_hook = alc262_auto_init;
9193 #ifdef CONFIG_SND_HDA_POWER_SAVE
9194 if (!spec->loopback.amplist)
9195 spec->loopback.amplist = alc262_loopbacks;
9202 * ALC268 channel source setting (2 channel)
9204 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9205 #define alc268_modes alc260_modes
9207 static hda_nid_t alc268_dac_nids[2] = {
9212 static hda_nid_t alc268_adc_nids[2] = {
9217 static hda_nid_t alc268_adc_nids_alt[1] = {
9222 static struct snd_kcontrol_new alc268_base_mixer[] = {
9223 /* output mixer control */
9224 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9225 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9228 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9229 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9230 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9234 static struct hda_verb alc268_eapd_verbs[] = {
9235 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9236 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9240 /* Toshiba specific */
9241 #define alc268_toshiba_automute alc262_hippo_automute
9243 static struct hda_verb alc268_toshiba_verbs[] = {
9244 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9249 /* bind volumes of both NID 0x02 and 0x03 */
9250 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9251 .ops = &snd_hda_bind_vol,
9253 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9254 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9259 /* mute/unmute internal speaker according to the hp jack and mute state */
9260 static void alc268_acer_automute(struct hda_codec *codec, int force)
9262 struct alc_spec *spec = codec->spec;
9265 if (force || !spec->sense_updated) {
9266 unsigned int present;
9267 present = snd_hda_codec_read(codec, 0x14, 0,
9268 AC_VERB_GET_PIN_SENSE, 0);
9269 spec->jack_present = (present & 0x80000000) != 0;
9270 spec->sense_updated = 1;
9272 if (spec->jack_present)
9273 mute = HDA_AMP_MUTE; /* mute internal speaker */
9274 else /* unmute internal speaker if necessary */
9275 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9276 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9277 HDA_AMP_MUTE, mute);
9281 /* bind hp and internal speaker mute (with plug check) */
9282 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9283 struct snd_ctl_elem_value *ucontrol)
9285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9286 long *valp = ucontrol->value.integer.value;
9289 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9291 valp[0] ? 0 : HDA_AMP_MUTE);
9292 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9294 valp[1] ? 0 : HDA_AMP_MUTE);
9296 alc268_acer_automute(codec, 0);
9300 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9301 /* output mixer control */
9302 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9304 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9305 .name = "Master Playback Switch",
9306 .info = snd_hda_mixer_amp_switch_info,
9307 .get = snd_hda_mixer_amp_switch_get,
9308 .put = alc268_acer_master_sw_put,
9309 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9311 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9312 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9313 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9317 static struct hda_verb alc268_acer_verbs[] = {
9318 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9321 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9325 /* unsolicited event for HP jack sensing */
9326 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9329 if ((res >> 26) != ALC880_HP_EVENT)
9331 alc268_toshiba_automute(codec);
9334 static void alc268_acer_unsol_event(struct hda_codec *codec,
9337 if ((res >> 26) != ALC880_HP_EVENT)
9339 alc268_acer_automute(codec, 1);
9342 static void alc268_acer_init_hook(struct hda_codec *codec)
9344 alc268_acer_automute(codec, 1);
9348 * generic initialization of ADC, input mixers and output mixers
9350 static struct hda_verb alc268_base_init_verbs[] = {
9351 /* Unmute DAC0-1 and set vol = 0 */
9352 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9353 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9354 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9355 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9356 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9357 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9360 * Set up output mixers (0x0c - 0x0e)
9362 /* set vol=0 to output mixers */
9363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9365 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9366 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9368 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9369 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9373 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9374 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9377 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9378 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9380 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9382 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9383 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9386 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9387 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9389 /* Unmute Selector 23h,24h and set the default input to mic-in */
9391 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9393 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9400 * generic initialization of ADC, input mixers and output mixers
9402 static struct hda_verb alc268_volume_init_verbs[] = {
9403 /* set output DAC */
9404 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9405 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9406 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9407 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9410 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9411 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9412 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9413 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9416 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9417 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9419 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9422 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9424 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9426 /* set PCBEEP vol = 0 */
9427 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9432 #define alc268_mux_enum_info alc_mux_enum_info
9433 #define alc268_mux_enum_get alc_mux_enum_get
9435 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9436 struct snd_ctl_elem_value *ucontrol)
9438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9439 struct alc_spec *spec = codec->spec;
9441 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9442 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9443 hda_nid_t nid = capture_mixers[adc_idx];
9445 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9447 &spec->cur_mux[adc_idx]);
9450 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9451 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9452 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9455 /* The multiple "Capture Source" controls confuse alsamixer
9456 * So call somewhat different..
9457 * FIXME: the controls appear in the "playback" view!
9459 /* .name = "Capture Source", */
9460 .name = "Input Source",
9462 .info = alc268_mux_enum_info,
9463 .get = alc268_mux_enum_get,
9464 .put = alc268_mux_enum_put,
9469 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9470 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9471 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9472 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9473 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9475 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9476 /* The multiple "Capture Source" controls confuse alsamixer
9477 * So call somewhat different..
9478 * FIXME: the controls appear in the "playback" view!
9480 /* .name = "Capture Source", */
9481 .name = "Input Source",
9483 .info = alc268_mux_enum_info,
9484 .get = alc268_mux_enum_get,
9485 .put = alc268_mux_enum_put,
9490 static struct hda_input_mux alc268_capture_source = {
9494 { "Front Mic", 0x1 },
9500 #ifdef CONFIG_SND_DEBUG
9501 static struct snd_kcontrol_new alc268_test_mixer[] = {
9502 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9503 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9504 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9507 /* Volume widgets */
9508 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9509 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9510 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9511 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9512 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9513 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9514 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9515 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9516 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9517 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9518 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9519 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9520 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9521 HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),
9522 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9523 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9524 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9525 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9527 /* Modes for retasking pin widgets */
9528 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9529 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9530 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9531 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9533 /* Controls for GPIO pins, assuming they are configured as outputs */
9534 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9535 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9536 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9537 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9539 /* Switches to allow the digital SPDIF output pin to be enabled.
9540 * The ALC268 does not have an SPDIF input.
9542 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9544 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9545 * this output to turn on an external amplifier.
9547 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9548 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9554 /* create input playback/capture controls for the given pin */
9555 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9556 const char *ctlname, int idx)
9561 sprintf(name, "%s Playback Volume", ctlname);
9563 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9564 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9568 } else if (nid == 0x15) {
9569 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9570 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9576 sprintf(name, "%s Playback Switch", ctlname);
9577 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9578 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9584 /* add playback controls from the parsed DAC table */
9585 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9586 const struct auto_pin_cfg *cfg)
9591 spec->multiout.num_dacs = 2; /* only use one dac */
9592 spec->multiout.dac_nids = spec->private_dac_nids;
9593 spec->multiout.dac_nids[0] = 2;
9594 spec->multiout.dac_nids[1] = 3;
9596 nid = cfg->line_out_pins[0];
9598 alc268_new_analog_output(spec, nid, "Front", 0);
9600 nid = cfg->speaker_pins[0];
9602 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9603 "Speaker Playback Volume",
9604 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9608 nid = cfg->hp_pins[0];
9610 alc268_new_analog_output(spec, nid, "Headphone", 0);
9612 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9614 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9615 "Mono Playback Switch",
9616 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9623 /* create playback/capture controls for input pins */
9624 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9625 const struct auto_pin_cfg *cfg)
9627 struct hda_input_mux *imux = &spec->private_imux;
9630 for (i = 0; i < AUTO_PIN_LAST; i++) {
9631 switch(cfg->input_pins[i]) {
9633 idx1 = 0; /* Mic 1 */
9636 idx1 = 1; /* Mic 2 */
9639 idx1 = 2; /* Line In */
9647 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9648 imux->items[imux->num_items].index = idx1;
9654 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9656 struct alc_spec *spec = codec->spec;
9657 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9658 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9659 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9660 unsigned int dac_vol1, dac_vol2;
9663 snd_hda_codec_write(codec, speaker_nid, 0,
9664 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9665 snd_hda_codec_write(codec, 0x0f, 0,
9666 AC_VERB_SET_AMP_GAIN_MUTE,
9668 snd_hda_codec_write(codec, 0x10, 0,
9669 AC_VERB_SET_AMP_GAIN_MUTE,
9672 snd_hda_codec_write(codec, 0x0f, 0,
9673 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9674 snd_hda_codec_write(codec, 0x10, 0,
9675 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9678 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9679 if (line_nid == 0x14)
9680 dac_vol2 = AMP_OUT_ZERO;
9681 else if (line_nid == 0x15)
9682 dac_vol1 = AMP_OUT_ZERO;
9684 dac_vol2 = AMP_OUT_ZERO;
9685 else if (hp_nid == 0x15)
9686 dac_vol1 = AMP_OUT_ZERO;
9687 if (line_nid != 0x16 || hp_nid != 0x16 ||
9688 spec->autocfg.line_out_pins[1] != 0x16 ||
9689 spec->autocfg.line_out_pins[2] != 0x16)
9690 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9692 snd_hda_codec_write(codec, 0x02, 0,
9693 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9694 snd_hda_codec_write(codec, 0x03, 0,
9695 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9698 /* pcm configuration: identiacal with ALC880 */
9699 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9700 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9701 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9704 * BIOS auto configuration
9706 static int alc268_parse_auto_config(struct hda_codec *codec)
9708 struct alc_spec *spec = codec->spec;
9710 static hda_nid_t alc268_ignore[] = { 0 };
9712 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9716 if (!spec->autocfg.line_outs)
9717 return 0; /* can't find valid BIOS pin config */
9719 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9722 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9726 spec->multiout.max_channels = 2;
9728 /* digital only support output */
9729 if (spec->autocfg.dig_out_pin)
9730 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9732 if (spec->kctl_alloc)
9733 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9735 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9736 spec->num_mux_defs = 1;
9737 spec->input_mux = &spec->private_imux;
9739 err = alc_auto_add_mic_boost(codec);
9746 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9747 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9748 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9750 /* init callback for auto-configuration model -- overriding the default init */
9751 static void alc268_auto_init(struct hda_codec *codec)
9753 alc268_auto_init_multi_out(codec);
9754 alc268_auto_init_hp_out(codec);
9755 alc268_auto_init_mono_speaker_out(codec);
9756 alc268_auto_init_analog_input(codec);
9760 * configuration and preset
9762 static const char *alc268_models[ALC268_MODEL_LAST] = {
9763 [ALC268_3ST] = "3stack",
9764 [ALC268_TOSHIBA] = "toshiba",
9765 [ALC268_ACER] = "acer",
9766 #ifdef CONFIG_SND_DEBUG
9767 [ALC268_TEST] = "test",
9769 [ALC268_AUTO] = "auto",
9772 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9773 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9774 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9775 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9776 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9777 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9778 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9779 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9783 static struct alc_config_preset alc268_presets[] = {
9785 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9786 .init_verbs = { alc268_base_init_verbs },
9787 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9788 .dac_nids = alc268_dac_nids,
9789 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9790 .adc_nids = alc268_adc_nids_alt,
9792 .dig_out_nid = ALC268_DIGOUT_NID,
9793 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9794 .channel_mode = alc268_modes,
9795 .input_mux = &alc268_capture_source,
9797 [ALC268_TOSHIBA] = {
9798 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9799 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9800 alc268_toshiba_verbs },
9801 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9802 .dac_nids = alc268_dac_nids,
9803 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9804 .adc_nids = alc268_adc_nids_alt,
9806 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9807 .channel_mode = alc268_modes,
9808 .input_mux = &alc268_capture_source,
9809 .unsol_event = alc268_toshiba_unsol_event,
9810 .init_hook = alc268_toshiba_automute,
9813 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9814 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9815 alc268_acer_verbs },
9816 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9817 .dac_nids = alc268_dac_nids,
9818 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9819 .adc_nids = alc268_adc_nids_alt,
9821 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9822 .channel_mode = alc268_modes,
9823 .input_mux = &alc268_capture_source,
9824 .unsol_event = alc268_acer_unsol_event,
9825 .init_hook = alc268_acer_init_hook,
9827 #ifdef CONFIG_SND_DEBUG
9829 .mixers = { alc268_test_mixer, alc268_capture_mixer },
9830 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9831 alc268_volume_init_verbs },
9832 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9833 .dac_nids = alc268_dac_nids,
9834 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9835 .adc_nids = alc268_adc_nids_alt,
9837 .dig_out_nid = ALC268_DIGOUT_NID,
9838 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9839 .channel_mode = alc268_modes,
9840 .input_mux = &alc268_capture_source,
9845 static int patch_alc268(struct hda_codec *codec)
9847 struct alc_spec *spec;
9851 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
9857 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
9861 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
9862 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
9863 "trying auto-probe from BIOS...\n");
9864 board_config = ALC268_AUTO;
9867 if (board_config == ALC268_AUTO) {
9868 /* automatic parse from the BIOS config */
9869 err = alc268_parse_auto_config(codec);
9875 "hda_codec: Cannot set up configuration "
9876 "from BIOS. Using base mode...\n");
9877 board_config = ALC268_3ST;
9881 if (board_config != ALC268_AUTO)
9882 setup_preset(spec, &alc268_presets[board_config]);
9884 spec->stream_name_analog = "ALC268 Analog";
9885 spec->stream_analog_playback = &alc268_pcm_analog_playback;
9886 spec->stream_analog_capture = &alc268_pcm_analog_capture;
9888 spec->stream_name_digital = "ALC268 Digital";
9889 spec->stream_digital_playback = &alc268_pcm_digital_playback;
9891 if (board_config == ALC268_AUTO) {
9892 if (!spec->adc_nids && spec->input_mux) {
9893 /* check whether NID 0x07 is valid */
9894 unsigned int wcap = get_wcaps(codec, 0x07);
9897 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9898 if (wcap != AC_WID_AUD_IN) {
9899 spec->adc_nids = alc268_adc_nids_alt;
9900 spec->num_adc_nids =
9901 ARRAY_SIZE(alc268_adc_nids_alt);
9902 spec->mixers[spec->num_mixers] =
9903 alc268_capture_alt_mixer;
9906 spec->adc_nids = alc268_adc_nids;
9907 spec->num_adc_nids =
9908 ARRAY_SIZE(alc268_adc_nids);
9909 spec->mixers[spec->num_mixers] =
9910 alc268_capture_mixer;
9916 spec->vmaster_nid = 0x02;
9918 codec->patch_ops = alc_patch_ops;
9919 if (board_config == ALC268_AUTO)
9920 spec->init_hook = alc268_auto_init;
9926 * ALC269 channel source setting (2 channel)
9928 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
9930 #define alc269_dac_nids alc260_dac_nids
9932 static hda_nid_t alc269_adc_nids[1] = {
9937 #define alc269_modes alc260_modes
9938 #define alc269_capture_source alc880_lg_lw_capture_source
9940 static struct snd_kcontrol_new alc269_base_mixer[] = {
9941 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9942 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9943 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9944 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9950 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9952 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9956 /* capture mixer elements */
9957 static struct snd_kcontrol_new alc269_capture_mixer[] = {
9958 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9959 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9961 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9962 /* The multiple "Capture Source" controls confuse alsamixer
9963 * So call somewhat different..
9964 * FIXME: the controls appear in the "playback" view!
9966 /* .name = "Capture Source", */
9967 .name = "Input Source",
9969 .info = alc_mux_enum_info,
9970 .get = alc_mux_enum_get,
9971 .put = alc_mux_enum_put,
9977 * generic initialization of ADC, input mixers and output mixers
9979 static struct hda_verb alc269_init_verbs[] = {
9981 * Unmute ADC0 and set the default input to mic-in
9983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9985 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
9986 * analog-loopback mixer widget
9987 * Note: PASD motherboards uses the Line In 2 as the input for
9988 * front panel mic (mic 2)
9990 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9998 * Set up output mixers (0x0c - 0x0e)
10000 /* set vol=0 to output mixers */
10001 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10002 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10004 /* set up input amps for analog loopback */
10005 /* Amp Indices: DAC = 0, mixer = 1 */
10006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10009 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10011 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10014 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10015 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10017 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10018 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10019 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10022 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10023 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10024 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10027 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10029 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10032 /* FIXME: use matrix-type input source selection */
10033 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10034 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10036 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10041 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10042 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10046 /* add playback controls from the parsed DAC table */
10047 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10048 const struct auto_pin_cfg *cfg)
10053 spec->multiout.num_dacs = 1; /* only use one dac */
10054 spec->multiout.dac_nids = spec->private_dac_nids;
10055 spec->multiout.dac_nids[0] = 2;
10057 nid = cfg->line_out_pins[0];
10059 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10060 "Front Playback Volume",
10061 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10064 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10065 "Front Playback Switch",
10066 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10071 nid = cfg->speaker_pins[0];
10073 if (!cfg->line_out_pins[0]) {
10074 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10075 "Speaker Playback Volume",
10076 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10082 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10083 "Speaker Playback Switch",
10084 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10089 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10090 "Speaker Playback Switch",
10091 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10097 nid = cfg->hp_pins[0];
10099 /* spec->multiout.hp_nid = 2; */
10100 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10101 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10102 "Headphone Playback Volume",
10103 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10109 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10110 "Headphone Playback Switch",
10111 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10116 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10117 "Headphone Playback Switch",
10118 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10127 #define alc269_auto_create_analog_input_ctls \
10128 alc880_auto_create_analog_input_ctls
10130 #ifdef CONFIG_SND_HDA_POWER_SAVE
10131 #define alc269_loopbacks alc880_loopbacks
10134 /* pcm configuration: identiacal with ALC880 */
10135 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10136 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10137 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10138 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10141 * BIOS auto configuration
10143 static int alc269_parse_auto_config(struct hda_codec *codec)
10145 struct alc_spec *spec = codec->spec;
10147 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10149 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10154 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10157 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10161 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10163 if (spec->autocfg.dig_out_pin)
10164 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10166 if (spec->kctl_alloc)
10167 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10169 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10170 spec->num_mux_defs = 1;
10171 spec->input_mux = &spec->private_imux;
10173 err = alc_auto_add_mic_boost(codec);
10180 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10181 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10182 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10185 /* init callback for auto-configuration model -- overriding the default init */
10186 static void alc269_auto_init(struct hda_codec *codec)
10188 alc269_auto_init_multi_out(codec);
10189 alc269_auto_init_hp_out(codec);
10190 alc269_auto_init_analog_input(codec);
10194 * configuration and preset
10196 static const char *alc269_models[ALC269_MODEL_LAST] = {
10197 [ALC269_BASIC] = "basic",
10200 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10204 static struct alc_config_preset alc269_presets[] = {
10206 .mixers = { alc269_base_mixer },
10207 .init_verbs = { alc269_init_verbs },
10208 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10209 .dac_nids = alc269_dac_nids,
10211 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10212 .channel_mode = alc269_modes,
10213 .input_mux = &alc269_capture_source,
10217 static int patch_alc269(struct hda_codec *codec)
10219 struct alc_spec *spec;
10223 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10227 codec->spec = spec;
10229 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10233 if (board_config < 0) {
10234 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10235 "trying auto-probe from BIOS...\n");
10236 board_config = ALC269_AUTO;
10239 if (board_config == ALC269_AUTO) {
10240 /* automatic parse from the BIOS config */
10241 err = alc269_parse_auto_config(codec);
10247 "hda_codec: Cannot set up configuration "
10248 "from BIOS. Using base mode...\n");
10249 board_config = ALC269_BASIC;
10253 if (board_config != ALC269_AUTO)
10254 setup_preset(spec, &alc269_presets[board_config]);
10256 spec->stream_name_analog = "ALC269 Analog";
10257 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10258 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10260 spec->stream_name_digital = "ALC269 Digital";
10261 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10262 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10264 spec->adc_nids = alc269_adc_nids;
10265 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10266 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10267 spec->num_mixers++;
10269 codec->patch_ops = alc_patch_ops;
10270 if (board_config == ALC269_AUTO)
10271 spec->init_hook = alc269_auto_init;
10272 #ifdef CONFIG_SND_HDA_POWER_SAVE
10273 if (!spec->loopback.amplist)
10274 spec->loopback.amplist = alc269_loopbacks;
10281 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10285 * set the path ways for 2 channel output
10286 * need to set the codec line out and mic 1 pin widgets to inputs
10288 static struct hda_verb alc861_threestack_ch2_init[] = {
10289 /* set pin widget 1Ah (line in) for input */
10290 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10291 /* set pin widget 18h (mic1/2) for input, for mic also enable
10294 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10298 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10305 * need to set the codec line out and mic 1 pin widgets to outputs
10307 static struct hda_verb alc861_threestack_ch6_init[] = {
10308 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10309 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10310 /* set pin widget 18h (mic1) for output (CLFE)*/
10311 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10313 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10314 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10316 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10318 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10319 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10324 static struct hda_channel_mode alc861_threestack_modes[2] = {
10325 { 2, alc861_threestack_ch2_init },
10326 { 6, alc861_threestack_ch6_init },
10328 /* Set mic1 as input and unmute the mixer */
10329 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10330 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10331 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10334 /* Set mic1 as output and mute mixer */
10335 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10336 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10337 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10341 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10342 { 2, alc861_uniwill_m31_ch2_init },
10343 { 4, alc861_uniwill_m31_ch4_init },
10346 /* Set mic1 and line-in as input and unmute the mixer */
10347 static struct hda_verb alc861_asus_ch2_init[] = {
10348 /* set pin widget 1Ah (line in) for input */
10349 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10350 /* set pin widget 18h (mic1/2) for input, for mic also enable
10353 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10355 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10357 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10358 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10362 /* Set mic1 nad line-in as output and mute mixer */
10363 static struct hda_verb alc861_asus_ch6_init[] = {
10364 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10365 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10366 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10367 /* set pin widget 18h (mic1) for output (CLFE)*/
10368 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10369 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10370 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10371 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10373 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10375 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10376 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10381 static struct hda_channel_mode alc861_asus_modes[2] = {
10382 { 2, alc861_asus_ch2_init },
10383 { 6, alc861_asus_ch6_init },
10388 static struct snd_kcontrol_new alc861_base_mixer[] = {
10389 /* output mixer control */
10390 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10391 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10392 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10393 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10396 /*Input mixer control */
10397 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10398 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10399 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10400 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10401 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10402 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10404 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10405 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10408 /* Capture mixer control */
10409 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10410 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10412 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10413 .name = "Capture Source",
10415 .info = alc_mux_enum_info,
10416 .get = alc_mux_enum_get,
10417 .put = alc_mux_enum_put,
10422 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10423 /* output mixer control */
10424 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10425 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10426 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10427 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10428 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10430 /* Input mixer control */
10431 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10432 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10433 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10434 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10435 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10436 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10438 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10439 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10440 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10442 /* Capture mixer control */
10443 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10444 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10447 .name = "Capture Source",
10449 .info = alc_mux_enum_info,
10450 .get = alc_mux_enum_get,
10451 .put = alc_mux_enum_put,
10454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10455 .name = "Channel Mode",
10456 .info = alc_ch_mode_info,
10457 .get = alc_ch_mode_get,
10458 .put = alc_ch_mode_put,
10459 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10464 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10465 /* output mixer control */
10466 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10468 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10470 /*Capture mixer control */
10471 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10472 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10474 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10475 .name = "Capture Source",
10477 .info = alc_mux_enum_info,
10478 .get = alc_mux_enum_get,
10479 .put = alc_mux_enum_put,
10485 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10486 /* output mixer control */
10487 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10488 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10489 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10490 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10491 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10493 /* Input mixer control */
10494 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10495 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10496 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10497 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10498 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10499 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10501 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10502 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10505 /* Capture mixer control */
10506 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10507 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10510 .name = "Capture Source",
10512 .info = alc_mux_enum_info,
10513 .get = alc_mux_enum_get,
10514 .put = alc_mux_enum_put,
10517 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10518 .name = "Channel Mode",
10519 .info = alc_ch_mode_info,
10520 .get = alc_ch_mode_get,
10521 .put = alc_ch_mode_put,
10522 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10527 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10528 /* output mixer control */
10529 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10530 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10531 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10532 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10533 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10535 /* Input mixer control */
10536 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10537 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10538 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10539 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10540 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10541 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10542 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10543 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10544 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10547 /* Capture mixer control */
10548 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10549 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10551 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10552 .name = "Capture Source",
10554 .info = alc_mux_enum_info,
10555 .get = alc_mux_enum_get,
10556 .put = alc_mux_enum_put,
10559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10560 .name = "Channel Mode",
10561 .info = alc_ch_mode_info,
10562 .get = alc_ch_mode_get,
10563 .put = alc_ch_mode_put,
10564 .private_value = ARRAY_SIZE(alc861_asus_modes),
10569 /* additional mixer */
10570 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10571 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10572 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10573 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10574 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10579 * generic initialization of ADC, input mixers and output mixers
10581 static struct hda_verb alc861_base_init_verbs[] = {
10583 * Unmute ADC0 and set the default input to mic-in
10585 /* port-A for surround (rear panel) */
10586 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10587 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10588 /* port-B for mic-in (rear panel) with vref */
10589 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10590 /* port-C for line-in (rear panel) */
10591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10592 /* port-D for Front */
10593 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10594 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10595 /* port-E for HP out (front panel) */
10596 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10597 /* route front PCM to HP */
10598 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10599 /* port-F for mic-in (front panel) with vref */
10600 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10601 /* port-G for CLFE (rear panel) */
10602 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10603 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10604 /* port-H for side (rear panel) */
10605 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10606 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10608 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10609 /* route front mic to ADC1*/
10610 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10613 /* Unmute DAC0~3 & spdif out*/
10614 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10615 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10616 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10617 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10620 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10621 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10622 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10623 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10624 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10626 /* Unmute Stereo Mixer 15 */
10627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10636 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10639 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10640 /* hp used DAC 3 (Front) */
10641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10647 static struct hda_verb alc861_threestack_init_verbs[] = {
10649 * Unmute ADC0 and set the default input to mic-in
10651 /* port-A for surround (rear panel) */
10652 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10653 /* port-B for mic-in (rear panel) with vref */
10654 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10655 /* port-C for line-in (rear panel) */
10656 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10657 /* port-D for Front */
10658 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10659 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10660 /* port-E for HP out (front panel) */
10661 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10662 /* route front PCM to HP */
10663 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10664 /* port-F for mic-in (front panel) with vref */
10665 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10666 /* port-G for CLFE (rear panel) */
10667 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10668 /* port-H for side (rear panel) */
10669 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10671 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10672 /* route front mic to ADC1*/
10673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10675 /* Unmute DAC0~3 & spdif out*/
10676 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10677 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10678 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10679 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10682 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10683 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10684 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10685 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10686 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10688 /* Unmute Stereo Mixer 15 */
10689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10696 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10697 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10700 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10701 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10702 /* hp used DAC 3 (Front) */
10703 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10708 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10710 * Unmute ADC0 and set the default input to mic-in
10712 /* port-A for surround (rear panel) */
10713 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10714 /* port-B for mic-in (rear panel) with vref */
10715 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10716 /* port-C for line-in (rear panel) */
10717 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10718 /* port-D for Front */
10719 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10720 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10721 /* port-E for HP out (front panel) */
10722 /* this has to be set to VREF80 */
10723 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10724 /* route front PCM to HP */
10725 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10726 /* port-F for mic-in (front panel) with vref */
10727 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10728 /* port-G for CLFE (rear panel) */
10729 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10730 /* port-H for side (rear panel) */
10731 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10733 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10734 /* route front mic to ADC1*/
10735 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10737 /* Unmute DAC0~3 & spdif out*/
10738 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10739 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10740 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10741 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10744 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10745 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10746 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10747 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10748 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10750 /* Unmute Stereo Mixer 15 */
10751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10757 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10758 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10759 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10763 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10764 /* hp used DAC 3 (Front) */
10765 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10770 static struct hda_verb alc861_asus_init_verbs[] = {
10772 * Unmute ADC0 and set the default input to mic-in
10774 /* port-A for surround (rear panel)
10775 * according to codec#0 this is the HP jack
10777 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10778 /* route front PCM to HP */
10779 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10780 /* port-B for mic-in (rear panel) with vref */
10781 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10782 /* port-C for line-in (rear panel) */
10783 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10784 /* port-D for Front */
10785 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10786 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10787 /* port-E for HP out (front panel) */
10788 /* this has to be set to VREF80 */
10789 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10790 /* route front PCM to HP */
10791 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10792 /* port-F for mic-in (front panel) with vref */
10793 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10794 /* port-G for CLFE (rear panel) */
10795 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10796 /* port-H for side (rear panel) */
10797 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10799 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10800 /* route front mic to ADC1*/
10801 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10803 /* Unmute DAC0~3 & spdif out*/
10804 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10805 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10806 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10807 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10809 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10810 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10811 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10812 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10813 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10815 /* Unmute Stereo Mixer 15 */
10816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10818 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10819 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10821 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10822 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10823 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10829 /* hp used DAC 3 (Front) */
10830 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10835 /* additional init verbs for ASUS laptops */
10836 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
10837 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
10838 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
10843 * generic initialization of ADC, input mixers and output mixers
10845 static struct hda_verb alc861_auto_init_verbs[] = {
10847 * Unmute ADC0 and set the default input to mic-in
10849 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10850 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10852 /* Unmute DAC0~3 & spdif out*/
10853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10854 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10855 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10856 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10859 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10860 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10861 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10862 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10863 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10865 /* Unmute Stereo Mixer 15 */
10866 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10867 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10868 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
10871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10874 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10881 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10882 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10884 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10885 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10889 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
10894 static struct hda_verb alc861_toshiba_init_verbs[] = {
10895 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10900 /* toggle speaker-output according to the hp-jack state */
10901 static void alc861_toshiba_automute(struct hda_codec *codec)
10903 unsigned int present;
10905 present = snd_hda_codec_read(codec, 0x0f, 0,
10906 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10907 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
10908 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10909 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
10910 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
10913 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
10916 if ((res >> 26) == ALC880_HP_EVENT)
10917 alc861_toshiba_automute(codec);
10920 /* pcm configuration: identiacal with ALC880 */
10921 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10922 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10923 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10924 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10927 #define ALC861_DIGOUT_NID 0x07
10929 static struct hda_channel_mode alc861_8ch_modes[1] = {
10933 static hda_nid_t alc861_dac_nids[4] = {
10934 /* front, surround, clfe, side */
10935 0x03, 0x06, 0x05, 0x04
10938 static hda_nid_t alc660_dac_nids[3] = {
10939 /* front, clfe, surround */
10943 static hda_nid_t alc861_adc_nids[1] = {
10948 static struct hda_input_mux alc861_capture_source = {
10952 { "Front Mic", 0x3 },
10959 /* fill in the dac_nids table from the parsed pin configuration */
10960 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
10961 const struct auto_pin_cfg *cfg)
10966 spec->multiout.dac_nids = spec->private_dac_nids;
10967 for (i = 0; i < cfg->line_outs; i++) {
10968 nid = cfg->line_out_pins[i];
10970 if (i >= ARRAY_SIZE(alc861_dac_nids))
10972 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
10975 spec->multiout.num_dacs = cfg->line_outs;
10979 /* add playback controls from the parsed DAC table */
10980 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
10981 const struct auto_pin_cfg *cfg)
10984 static const char *chname[4] = {
10985 "Front", "Surround", NULL /*CLFE*/, "Side"
10990 for (i = 0; i < cfg->line_outs; i++) {
10991 nid = spec->multiout.dac_nids[i];
10996 err = add_control(spec, ALC_CTL_BIND_MUTE,
10997 "Center Playback Switch",
10998 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11002 err = add_control(spec, ALC_CTL_BIND_MUTE,
11003 "LFE Playback Switch",
11004 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11009 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11011 if (nid == alc861_dac_nids[idx])
11013 sprintf(name, "%s Playback Switch", chname[idx]);
11014 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11015 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11024 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11032 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11034 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11035 "Headphone Playback Switch",
11036 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11039 spec->multiout.hp_nid = nid;
11044 /* create playback/capture controls for input pins */
11045 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11046 const struct auto_pin_cfg *cfg)
11048 struct hda_input_mux *imux = &spec->private_imux;
11049 int i, err, idx, idx1;
11051 for (i = 0; i < AUTO_PIN_LAST; i++) {
11052 switch (cfg->input_pins[i]) {
11055 idx = 2; /* Line In */
11059 idx = 2; /* Line In */
11063 idx = 1; /* Mic In */
11067 idx = 1; /* Mic In */
11077 err = new_analog_input(spec, cfg->input_pins[i],
11078 auto_pin_cfg_labels[i], idx, 0x15);
11082 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11083 imux->items[imux->num_items].index = idx1;
11089 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11090 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11091 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11094 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11095 /* The multiple "Capture Source" controls confuse alsamixer
11096 * So call somewhat different..
11097 *FIXME: the controls appear in the "playback" view!
11099 /* .name = "Capture Source", */
11100 .name = "Input Source",
11102 .info = alc_mux_enum_info,
11103 .get = alc_mux_enum_get,
11104 .put = alc_mux_enum_put,
11109 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11111 int pin_type, int dac_idx)
11113 /* set as output */
11115 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11117 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11122 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11124 struct alc_spec *spec = codec->spec;
11127 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11128 for (i = 0; i < spec->autocfg.line_outs; i++) {
11129 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11130 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11132 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11133 spec->multiout.dac_nids[i]);
11137 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11139 struct alc_spec *spec = codec->spec;
11142 pin = spec->autocfg.hp_pins[0];
11143 if (pin) /* connect to front */
11144 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11145 spec->multiout.dac_nids[0]);
11148 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11150 struct alc_spec *spec = codec->spec;
11153 for (i = 0; i < AUTO_PIN_LAST; i++) {
11154 hda_nid_t nid = spec->autocfg.input_pins[i];
11155 if (nid >= 0x0c && nid <= 0x11) {
11156 snd_hda_codec_write(codec, nid, 0,
11157 AC_VERB_SET_PIN_WIDGET_CONTROL,
11158 i <= AUTO_PIN_FRONT_MIC ?
11159 PIN_VREF80 : PIN_IN);
11164 /* parse the BIOS configuration and set up the alc_spec */
11165 /* return 1 if successful, 0 if the proper config is not found,
11166 * or a negative error code
11168 static int alc861_parse_auto_config(struct hda_codec *codec)
11170 struct alc_spec *spec = codec->spec;
11172 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11174 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11178 if (!spec->autocfg.line_outs)
11179 return 0; /* can't find valid BIOS pin config */
11181 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11184 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11187 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11190 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11194 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11196 if (spec->autocfg.dig_out_pin)
11197 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11199 if (spec->kctl_alloc)
11200 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11202 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11204 spec->num_mux_defs = 1;
11205 spec->input_mux = &spec->private_imux;
11207 spec->adc_nids = alc861_adc_nids;
11208 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11209 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11210 spec->num_mixers++;
11215 /* additional initialization for auto-configuration model */
11216 static void alc861_auto_init(struct hda_codec *codec)
11218 alc861_auto_init_multi_out(codec);
11219 alc861_auto_init_hp_out(codec);
11220 alc861_auto_init_analog_input(codec);
11223 #ifdef CONFIG_SND_HDA_POWER_SAVE
11224 static struct hda_amp_list alc861_loopbacks[] = {
11225 { 0x15, HDA_INPUT, 0 },
11226 { 0x15, HDA_INPUT, 1 },
11227 { 0x15, HDA_INPUT, 2 },
11228 { 0x15, HDA_INPUT, 3 },
11235 * configuration and preset
11237 static const char *alc861_models[ALC861_MODEL_LAST] = {
11238 [ALC861_3ST] = "3stack",
11239 [ALC660_3ST] = "3stack-660",
11240 [ALC861_3ST_DIG] = "3stack-dig",
11241 [ALC861_6ST_DIG] = "6stack-dig",
11242 [ALC861_UNIWILL_M31] = "uniwill-m31",
11243 [ALC861_TOSHIBA] = "toshiba",
11244 [ALC861_ASUS] = "asus",
11245 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11246 [ALC861_AUTO] = "auto",
11249 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11250 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11251 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11252 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11253 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11254 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11255 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11256 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11257 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11258 * Any other models that need this preset?
11260 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11261 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11262 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11263 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11264 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11265 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11266 /* FIXME: the below seems conflict */
11267 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11268 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11269 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11273 static struct alc_config_preset alc861_presets[] = {
11275 .mixers = { alc861_3ST_mixer },
11276 .init_verbs = { alc861_threestack_init_verbs },
11277 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11278 .dac_nids = alc861_dac_nids,
11279 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11280 .channel_mode = alc861_threestack_modes,
11282 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11283 .adc_nids = alc861_adc_nids,
11284 .input_mux = &alc861_capture_source,
11286 [ALC861_3ST_DIG] = {
11287 .mixers = { alc861_base_mixer },
11288 .init_verbs = { alc861_threestack_init_verbs },
11289 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11290 .dac_nids = alc861_dac_nids,
11291 .dig_out_nid = ALC861_DIGOUT_NID,
11292 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11293 .channel_mode = alc861_threestack_modes,
11295 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11296 .adc_nids = alc861_adc_nids,
11297 .input_mux = &alc861_capture_source,
11299 [ALC861_6ST_DIG] = {
11300 .mixers = { alc861_base_mixer },
11301 .init_verbs = { alc861_base_init_verbs },
11302 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11303 .dac_nids = alc861_dac_nids,
11304 .dig_out_nid = ALC861_DIGOUT_NID,
11305 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11306 .channel_mode = alc861_8ch_modes,
11307 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11308 .adc_nids = alc861_adc_nids,
11309 .input_mux = &alc861_capture_source,
11312 .mixers = { alc861_3ST_mixer },
11313 .init_verbs = { alc861_threestack_init_verbs },
11314 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11315 .dac_nids = alc660_dac_nids,
11316 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11317 .channel_mode = alc861_threestack_modes,
11319 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11320 .adc_nids = alc861_adc_nids,
11321 .input_mux = &alc861_capture_source,
11323 [ALC861_UNIWILL_M31] = {
11324 .mixers = { alc861_uniwill_m31_mixer },
11325 .init_verbs = { alc861_uniwill_m31_init_verbs },
11326 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11327 .dac_nids = alc861_dac_nids,
11328 .dig_out_nid = ALC861_DIGOUT_NID,
11329 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11330 .channel_mode = alc861_uniwill_m31_modes,
11332 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11333 .adc_nids = alc861_adc_nids,
11334 .input_mux = &alc861_capture_source,
11336 [ALC861_TOSHIBA] = {
11337 .mixers = { alc861_toshiba_mixer },
11338 .init_verbs = { alc861_base_init_verbs,
11339 alc861_toshiba_init_verbs },
11340 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11341 .dac_nids = alc861_dac_nids,
11342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11343 .channel_mode = alc883_3ST_2ch_modes,
11344 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11345 .adc_nids = alc861_adc_nids,
11346 .input_mux = &alc861_capture_source,
11347 .unsol_event = alc861_toshiba_unsol_event,
11348 .init_hook = alc861_toshiba_automute,
11351 .mixers = { alc861_asus_mixer },
11352 .init_verbs = { alc861_asus_init_verbs },
11353 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11354 .dac_nids = alc861_dac_nids,
11355 .dig_out_nid = ALC861_DIGOUT_NID,
11356 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11357 .channel_mode = alc861_asus_modes,
11360 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11361 .adc_nids = alc861_adc_nids,
11362 .input_mux = &alc861_capture_source,
11364 [ALC861_ASUS_LAPTOP] = {
11365 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11366 .init_verbs = { alc861_asus_init_verbs,
11367 alc861_asus_laptop_init_verbs },
11368 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11369 .dac_nids = alc861_dac_nids,
11370 .dig_out_nid = ALC861_DIGOUT_NID,
11371 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11372 .channel_mode = alc883_3ST_2ch_modes,
11374 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11375 .adc_nids = alc861_adc_nids,
11376 .input_mux = &alc861_capture_source,
11381 static int patch_alc861(struct hda_codec *codec)
11383 struct alc_spec *spec;
11387 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11391 codec->spec = spec;
11393 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11397 if (board_config < 0) {
11398 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11399 "trying auto-probe from BIOS...\n");
11400 board_config = ALC861_AUTO;
11403 if (board_config == ALC861_AUTO) {
11404 /* automatic parse from the BIOS config */
11405 err = alc861_parse_auto_config(codec);
11411 "hda_codec: Cannot set up configuration "
11412 "from BIOS. Using base mode...\n");
11413 board_config = ALC861_3ST_DIG;
11417 if (board_config != ALC861_AUTO)
11418 setup_preset(spec, &alc861_presets[board_config]);
11420 spec->stream_name_analog = "ALC861 Analog";
11421 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11422 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11424 spec->stream_name_digital = "ALC861 Digital";
11425 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11426 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11428 spec->vmaster_nid = 0x03;
11430 codec->patch_ops = alc_patch_ops;
11431 if (board_config == ALC861_AUTO)
11432 spec->init_hook = alc861_auto_init;
11433 #ifdef CONFIG_SND_HDA_POWER_SAVE
11434 if (!spec->loopback.amplist)
11435 spec->loopback.amplist = alc861_loopbacks;
11442 * ALC861-VD support
11446 * In addition, an independent DAC
11448 #define ALC861VD_DIGOUT_NID 0x06
11450 static hda_nid_t alc861vd_dac_nids[4] = {
11451 /* front, surr, clfe, side surr */
11452 0x02, 0x03, 0x04, 0x05
11455 /* dac_nids for ALC660vd are in a different order - according to
11456 * Realtek's driver.
11457 * This should probably tesult in a different mixer for 6stack models
11458 * of ALC660vd codecs, but for now there is only 3stack mixer
11459 * - and it is the same as in 861vd.
11460 * adc_nids in ALC660vd are (is) the same as in 861vd
11462 static hda_nid_t alc660vd_dac_nids[3] = {
11463 /* front, rear, clfe, rear_surr */
11467 static hda_nid_t alc861vd_adc_nids[1] = {
11473 /* FIXME: should be a matrix-type input source selection */
11474 static struct hda_input_mux alc861vd_capture_source = {
11478 { "Front Mic", 0x1 },
11484 static struct hda_input_mux alc861vd_dallas_capture_source = {
11487 { "Front Mic", 0x0 },
11488 { "ATAPI Mic", 0x1 },
11489 { "Line In", 0x5 },
11493 static struct hda_input_mux alc861vd_hp_capture_source = {
11496 { "Front Mic", 0x0 },
11497 { "ATAPI Mic", 0x1 },
11501 #define alc861vd_mux_enum_info alc_mux_enum_info
11502 #define alc861vd_mux_enum_get alc_mux_enum_get
11504 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11505 struct snd_ctl_elem_value *ucontrol)
11507 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11508 struct alc_spec *spec = codec->spec;
11509 const struct hda_input_mux *imux = spec->input_mux;
11510 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11511 static hda_nid_t capture_mixers[1] = { 0x22 };
11512 hda_nid_t nid = capture_mixers[adc_idx];
11513 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11514 unsigned int i, idx;
11516 idx = ucontrol->value.enumerated.item[0];
11517 if (idx >= imux->num_items)
11518 idx = imux->num_items - 1;
11519 if (*cur_val == idx)
11521 for (i = 0; i < imux->num_items; i++) {
11522 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11523 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11524 imux->items[i].index,
11534 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11541 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11542 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11543 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11544 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11545 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11552 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11553 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11554 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11555 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11556 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11560 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11561 { 6, alc861vd_6stack_ch6_init },
11562 { 8, alc861vd_6stack_ch8_init },
11565 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11567 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11568 .name = "Channel Mode",
11569 .info = alc_ch_mode_info,
11570 .get = alc_ch_mode_get,
11571 .put = alc_ch_mode_put,
11576 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11577 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11578 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11582 /* The multiple "Capture Source" controls confuse alsamixer
11583 * So call somewhat different..
11584 *FIXME: the controls appear in the "playback" view!
11586 /* .name = "Capture Source", */
11587 .name = "Input Source",
11589 .info = alc861vd_mux_enum_info,
11590 .get = alc861vd_mux_enum_get,
11591 .put = alc861vd_mux_enum_put,
11596 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11597 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11599 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11600 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11601 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11604 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11606 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11608 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11610 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11611 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11613 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11614 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11618 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11622 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11623 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11632 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11633 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11638 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11639 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11640 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11648 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11649 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11650 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11652 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11653 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11658 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11659 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11664 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11665 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11666 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11667 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11675 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11676 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11677 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11679 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11680 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11685 /* Pin assignment: Front=0x14, HP = 0x15,
11686 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11688 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11689 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11690 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11692 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11693 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11694 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11695 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11696 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11697 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11698 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11702 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11703 * Front Mic=0x18, ATAPI Mic = 0x19,
11705 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11707 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11709 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11710 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11712 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11713 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11719 * generic initialization of ADC, input mixers and output mixers
11721 static struct hda_verb alc861vd_volume_init_verbs[] = {
11723 * Unmute ADC0 and set the default input to mic-in
11725 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11728 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11729 * the analog-loopback mixer widget
11731 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11738 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11742 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11745 * Set up output mixers (0x02 - 0x05)
11747 /* set vol=0 to output mixers */
11748 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11749 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11750 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11751 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11753 /* set up input amps for analog loopback */
11754 /* Amp Indices: DAC = 0, mixer = 1 */
11755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11757 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11758 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11760 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11768 * 3-stack pin configuration:
11769 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11771 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11773 * Set pin mode and muting
11775 /* set front pin widgets 0x14 for output */
11776 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11777 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11778 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11780 /* Mic (rear) pin: input vref at 80% */
11781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11783 /* Front Mic pin: input vref at 80% */
11784 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11786 /* Line In pin: input */
11787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11788 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11789 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11791 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11792 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11793 /* CD pin widget for input */
11794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11800 * 6-stack pin configuration:
11802 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11804 * Set pin mode and muting
11806 /* set front pin widgets 0x14 for output */
11807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11809 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11811 /* Rear Pin: output 1 (0x0d) */
11812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11814 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11815 /* CLFE Pin: output 2 (0x0e) */
11816 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11817 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11818 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11819 /* Side Pin: output 3 (0x0f) */
11820 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11822 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11824 /* Mic (rear) pin: input vref at 80% */
11825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11827 /* Front Mic pin: input vref at 80% */
11828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11830 /* Line In pin: input */
11831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11832 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11833 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11835 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11836 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11837 /* CD pin widget for input */
11838 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11843 static struct hda_verb alc861vd_eapd_verbs[] = {
11844 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11848 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
11849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11852 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11853 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11857 /* toggle speaker-output according to the hp-jack state */
11858 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
11860 unsigned int present;
11861 unsigned char bits;
11863 present = snd_hda_codec_read(codec, 0x1b, 0,
11864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11865 bits = present ? HDA_AMP_MUTE : 0;
11866 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11867 HDA_AMP_MUTE, bits);
11870 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
11872 unsigned int present;
11873 unsigned char bits;
11875 present = snd_hda_codec_read(codec, 0x18, 0,
11876 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11877 bits = present ? HDA_AMP_MUTE : 0;
11878 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
11879 HDA_AMP_MUTE, bits);
11882 static void alc861vd_lenovo_automute(struct hda_codec *codec)
11884 alc861vd_lenovo_hp_automute(codec);
11885 alc861vd_lenovo_mic_automute(codec);
11888 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
11891 switch (res >> 26) {
11892 case ALC880_HP_EVENT:
11893 alc861vd_lenovo_hp_automute(codec);
11895 case ALC880_MIC_EVENT:
11896 alc861vd_lenovo_mic_automute(codec);
11901 static struct hda_verb alc861vd_dallas_verbs[] = {
11902 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11903 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11904 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11905 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11907 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11908 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11909 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11912 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11913 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11914 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11916 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11917 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11920 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11922 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11925 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11926 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11927 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11928 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11930 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11931 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11932 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11940 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11941 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11946 /* toggle speaker-output according to the hp-jack state */
11947 static void alc861vd_dallas_automute(struct hda_codec *codec)
11949 unsigned int present;
11951 present = snd_hda_codec_read(codec, 0x15, 0,
11952 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11953 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11954 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11957 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
11959 if ((res >> 26) == ALC880_HP_EVENT)
11960 alc861vd_dallas_automute(codec);
11963 #ifdef CONFIG_SND_HDA_POWER_SAVE
11964 #define alc861vd_loopbacks alc880_loopbacks
11967 /* pcm configuration: identiacal with ALC880 */
11968 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11969 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11970 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11971 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11974 * configuration and preset
11976 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
11977 [ALC660VD_3ST] = "3stack-660",
11978 [ALC660VD_3ST_DIG] = "3stack-660-digout",
11979 [ALC861VD_3ST] = "3stack",
11980 [ALC861VD_3ST_DIG] = "3stack-digout",
11981 [ALC861VD_6ST_DIG] = "6stack-digout",
11982 [ALC861VD_LENOVO] = "lenovo",
11983 [ALC861VD_DALLAS] = "dallas",
11984 [ALC861VD_HP] = "hp",
11985 [ALC861VD_AUTO] = "auto",
11988 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
11989 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
11990 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
11991 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
11992 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
11993 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
11994 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
11995 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
11996 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11997 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
11998 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
11999 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12000 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12001 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12002 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12006 static struct alc_config_preset alc861vd_presets[] = {
12008 .mixers = { alc861vd_3st_mixer },
12009 .init_verbs = { alc861vd_volume_init_verbs,
12010 alc861vd_3stack_init_verbs },
12011 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12012 .dac_nids = alc660vd_dac_nids,
12013 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12014 .adc_nids = alc861vd_adc_nids,
12015 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12016 .channel_mode = alc861vd_3stack_2ch_modes,
12017 .input_mux = &alc861vd_capture_source,
12019 [ALC660VD_3ST_DIG] = {
12020 .mixers = { alc861vd_3st_mixer },
12021 .init_verbs = { alc861vd_volume_init_verbs,
12022 alc861vd_3stack_init_verbs },
12023 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12024 .dac_nids = alc660vd_dac_nids,
12025 .dig_out_nid = ALC861VD_DIGOUT_NID,
12026 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12027 .adc_nids = alc861vd_adc_nids,
12028 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12029 .channel_mode = alc861vd_3stack_2ch_modes,
12030 .input_mux = &alc861vd_capture_source,
12033 .mixers = { alc861vd_3st_mixer },
12034 .init_verbs = { alc861vd_volume_init_verbs,
12035 alc861vd_3stack_init_verbs },
12036 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12037 .dac_nids = alc861vd_dac_nids,
12038 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12039 .channel_mode = alc861vd_3stack_2ch_modes,
12040 .input_mux = &alc861vd_capture_source,
12042 [ALC861VD_3ST_DIG] = {
12043 .mixers = { alc861vd_3st_mixer },
12044 .init_verbs = { alc861vd_volume_init_verbs,
12045 alc861vd_3stack_init_verbs },
12046 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12047 .dac_nids = alc861vd_dac_nids,
12048 .dig_out_nid = ALC861VD_DIGOUT_NID,
12049 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12050 .channel_mode = alc861vd_3stack_2ch_modes,
12051 .input_mux = &alc861vd_capture_source,
12053 [ALC861VD_6ST_DIG] = {
12054 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12055 .init_verbs = { alc861vd_volume_init_verbs,
12056 alc861vd_6stack_init_verbs },
12057 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12058 .dac_nids = alc861vd_dac_nids,
12059 .dig_out_nid = ALC861VD_DIGOUT_NID,
12060 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12061 .channel_mode = alc861vd_6stack_modes,
12062 .input_mux = &alc861vd_capture_source,
12064 [ALC861VD_LENOVO] = {
12065 .mixers = { alc861vd_lenovo_mixer },
12066 .init_verbs = { alc861vd_volume_init_verbs,
12067 alc861vd_3stack_init_verbs,
12068 alc861vd_eapd_verbs,
12069 alc861vd_lenovo_unsol_verbs },
12070 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12071 .dac_nids = alc660vd_dac_nids,
12072 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12073 .adc_nids = alc861vd_adc_nids,
12074 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12075 .channel_mode = alc861vd_3stack_2ch_modes,
12076 .input_mux = &alc861vd_capture_source,
12077 .unsol_event = alc861vd_lenovo_unsol_event,
12078 .init_hook = alc861vd_lenovo_automute,
12080 [ALC861VD_DALLAS] = {
12081 .mixers = { alc861vd_dallas_mixer },
12082 .init_verbs = { alc861vd_dallas_verbs },
12083 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12084 .dac_nids = alc861vd_dac_nids,
12085 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12086 .adc_nids = alc861vd_adc_nids,
12087 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12088 .channel_mode = alc861vd_3stack_2ch_modes,
12089 .input_mux = &alc861vd_dallas_capture_source,
12090 .unsol_event = alc861vd_dallas_unsol_event,
12091 .init_hook = alc861vd_dallas_automute,
12094 .mixers = { alc861vd_hp_mixer },
12095 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12096 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12097 .dac_nids = alc861vd_dac_nids,
12098 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12099 .dig_out_nid = ALC861VD_DIGOUT_NID,
12100 .adc_nids = alc861vd_adc_nids,
12101 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12102 .channel_mode = alc861vd_3stack_2ch_modes,
12103 .input_mux = &alc861vd_hp_capture_source,
12104 .unsol_event = alc861vd_dallas_unsol_event,
12105 .init_hook = alc861vd_dallas_automute,
12110 * BIOS auto configuration
12112 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12113 hda_nid_t nid, int pin_type, int dac_idx)
12115 /* set as output */
12116 snd_hda_codec_write(codec, nid, 0,
12117 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12118 snd_hda_codec_write(codec, nid, 0,
12119 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12122 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12124 struct alc_spec *spec = codec->spec;
12127 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12128 for (i = 0; i <= HDA_SIDE; i++) {
12129 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12130 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12132 alc861vd_auto_set_output_and_unmute(codec, nid,
12138 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12140 struct alc_spec *spec = codec->spec;
12143 pin = spec->autocfg.hp_pins[0];
12144 if (pin) /* connect to front and use dac 0 */
12145 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12148 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12149 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12151 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12153 struct alc_spec *spec = codec->spec;
12156 for (i = 0; i < AUTO_PIN_LAST; i++) {
12157 hda_nid_t nid = spec->autocfg.input_pins[i];
12158 if (alc861vd_is_input_pin(nid)) {
12159 snd_hda_codec_write(codec, nid, 0,
12160 AC_VERB_SET_PIN_WIDGET_CONTROL,
12161 i <= AUTO_PIN_FRONT_MIC ?
12162 PIN_VREF80 : PIN_IN);
12163 if (nid != ALC861VD_PIN_CD_NID)
12164 snd_hda_codec_write(codec, nid, 0,
12165 AC_VERB_SET_AMP_GAIN_MUTE,
12171 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12172 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12174 /* add playback controls from the parsed DAC table */
12175 /* Based on ALC880 version. But ALC861VD has separate,
12176 * different NIDs for mute/unmute switch and volume control */
12177 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12178 const struct auto_pin_cfg *cfg)
12181 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12182 hda_nid_t nid_v, nid_s;
12185 for (i = 0; i < cfg->line_outs; i++) {
12186 if (!spec->multiout.dac_nids[i])
12188 nid_v = alc861vd_idx_to_mixer_vol(
12190 spec->multiout.dac_nids[i]));
12191 nid_s = alc861vd_idx_to_mixer_switch(
12193 spec->multiout.dac_nids[i]));
12197 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12198 "Center Playback Volume",
12199 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12203 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12204 "LFE Playback Volume",
12205 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12209 err = add_control(spec, ALC_CTL_BIND_MUTE,
12210 "Center Playback Switch",
12211 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12215 err = add_control(spec, ALC_CTL_BIND_MUTE,
12216 "LFE Playback Switch",
12217 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12222 sprintf(name, "%s Playback Volume", chname[i]);
12223 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12224 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12228 sprintf(name, "%s Playback Switch", chname[i]);
12229 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12230 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12239 /* add playback controls for speaker and HP outputs */
12240 /* Based on ALC880 version. But ALC861VD has separate,
12241 * different NIDs for mute/unmute switch and volume control */
12242 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12243 hda_nid_t pin, const char *pfx)
12245 hda_nid_t nid_v, nid_s;
12252 if (alc880_is_fixed_pin(pin)) {
12253 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12254 /* specify the DAC as the extra output */
12255 if (!spec->multiout.hp_nid)
12256 spec->multiout.hp_nid = nid_v;
12258 spec->multiout.extra_out_nid[0] = nid_v;
12259 /* control HP volume/switch on the output mixer amp */
12260 nid_v = alc861vd_idx_to_mixer_vol(
12261 alc880_fixed_pin_idx(pin));
12262 nid_s = alc861vd_idx_to_mixer_switch(
12263 alc880_fixed_pin_idx(pin));
12265 sprintf(name, "%s Playback Volume", pfx);
12266 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12267 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12270 sprintf(name, "%s Playback Switch", pfx);
12271 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12272 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12275 } else if (alc880_is_multi_pin(pin)) {
12276 /* set manual connection */
12277 /* we have only a switch on HP-out PIN */
12278 sprintf(name, "%s Playback Switch", pfx);
12279 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12280 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12287 /* parse the BIOS configuration and set up the alc_spec
12288 * return 1 if successful, 0 if the proper config is not found,
12289 * or a negative error code
12290 * Based on ALC880 version - had to change it to override
12291 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12292 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12294 struct alc_spec *spec = codec->spec;
12296 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12298 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12302 if (!spec->autocfg.line_outs)
12303 return 0; /* can't find valid BIOS pin config */
12305 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12308 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12311 err = alc861vd_auto_create_extra_out(spec,
12312 spec->autocfg.speaker_pins[0],
12316 err = alc861vd_auto_create_extra_out(spec,
12317 spec->autocfg.hp_pins[0],
12321 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12325 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12327 if (spec->autocfg.dig_out_pin)
12328 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12330 if (spec->kctl_alloc)
12331 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12333 spec->init_verbs[spec->num_init_verbs++]
12334 = alc861vd_volume_init_verbs;
12336 spec->num_mux_defs = 1;
12337 spec->input_mux = &spec->private_imux;
12339 err = alc_auto_add_mic_boost(codec);
12346 /* additional initialization for auto-configuration model */
12347 static void alc861vd_auto_init(struct hda_codec *codec)
12349 alc861vd_auto_init_multi_out(codec);
12350 alc861vd_auto_init_hp_out(codec);
12351 alc861vd_auto_init_analog_input(codec);
12354 static int patch_alc861vd(struct hda_codec *codec)
12356 struct alc_spec *spec;
12357 int err, board_config;
12359 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12363 codec->spec = spec;
12365 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12369 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12370 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12371 "ALC861VD, trying auto-probe from BIOS...\n");
12372 board_config = ALC861VD_AUTO;
12375 if (board_config == ALC861VD_AUTO) {
12376 /* automatic parse from the BIOS config */
12377 err = alc861vd_parse_auto_config(codec);
12383 "hda_codec: Cannot set up configuration "
12384 "from BIOS. Using base mode...\n");
12385 board_config = ALC861VD_3ST;
12389 if (board_config != ALC861VD_AUTO)
12390 setup_preset(spec, &alc861vd_presets[board_config]);
12392 spec->stream_name_analog = "ALC861VD Analog";
12393 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12394 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12396 spec->stream_name_digital = "ALC861VD Digital";
12397 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12398 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12400 spec->adc_nids = alc861vd_adc_nids;
12401 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12403 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12404 spec->num_mixers++;
12406 spec->vmaster_nid = 0x02;
12408 codec->patch_ops = alc_patch_ops;
12410 if (board_config == ALC861VD_AUTO)
12411 spec->init_hook = alc861vd_auto_init;
12412 #ifdef CONFIG_SND_HDA_POWER_SAVE
12413 if (!spec->loopback.amplist)
12414 spec->loopback.amplist = alc861vd_loopbacks;
12423 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12424 * configuration. Each pin widget can choose any input DACs and a mixer.
12425 * Each ADC is connected from a mixer of all inputs. This makes possible
12426 * 6-channel independent captures.
12428 * In addition, an independent DAC for the multi-playback (not used in this
12431 #define ALC662_DIGOUT_NID 0x06
12432 #define ALC662_DIGIN_NID 0x0a
12434 static hda_nid_t alc662_dac_nids[4] = {
12435 /* front, rear, clfe, rear_surr */
12439 static hda_nid_t alc662_adc_nids[1] = {
12444 /* FIXME: should be a matrix-type input source selection */
12446 static struct hda_input_mux alc662_capture_source = {
12450 { "Front Mic", 0x1 },
12456 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12464 static struct hda_input_mux alc662_eeepc_capture_source = {
12472 #define alc662_mux_enum_info alc_mux_enum_info
12473 #define alc662_mux_enum_get alc_mux_enum_get
12475 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12476 struct snd_ctl_elem_value *ucontrol)
12478 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12479 struct alc_spec *spec = codec->spec;
12480 const struct hda_input_mux *imux = spec->input_mux;
12481 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12482 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12483 hda_nid_t nid = capture_mixers[adc_idx];
12484 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12485 unsigned int i, idx;
12487 idx = ucontrol->value.enumerated.item[0];
12488 if (idx >= imux->num_items)
12489 idx = imux->num_items - 1;
12490 if (*cur_val == idx)
12492 for (i = 0; i < imux->num_items; i++) {
12493 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12494 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12495 imux->items[i].index,
12504 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12511 static struct hda_verb alc662_3ST_ch2_init[] = {
12512 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12513 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12514 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12515 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12522 static struct hda_verb alc662_3ST_ch6_init[] = {
12523 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12524 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12525 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12526 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12527 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12528 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12532 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12533 { 2, alc662_3ST_ch2_init },
12534 { 6, alc662_3ST_ch6_init },
12540 static struct hda_verb alc662_sixstack_ch6_init[] = {
12541 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12542 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12543 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12550 static struct hda_verb alc662_sixstack_ch8_init[] = {
12551 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12552 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12553 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12557 static struct hda_channel_mode alc662_5stack_modes[2] = {
12558 { 2, alc662_sixstack_ch6_init },
12559 { 6, alc662_sixstack_ch8_init },
12562 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12563 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12566 static struct snd_kcontrol_new alc662_base_mixer[] = {
12567 /* output mixer control */
12568 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12569 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12570 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12571 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12572 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12573 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12574 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12575 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12578 /*Input mixer control */
12579 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12580 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12581 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12582 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12583 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12584 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12585 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12586 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12590 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12591 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12592 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12594 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12595 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12596 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12597 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12599 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12600 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12601 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12602 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12603 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12607 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12608 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12609 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12610 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12611 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12614 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12615 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12617 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12618 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12622 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12623 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12625 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12626 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12630 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12631 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12632 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12633 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12634 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
12635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12643 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12644 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12646 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12647 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12649 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12650 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12651 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12653 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12654 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12655 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12659 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
12660 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12661 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12662 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12663 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12664 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12665 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12666 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12667 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12668 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12669 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
12670 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12671 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12677 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12680 .name = "Channel Mode",
12681 .info = alc_ch_mode_info,
12682 .get = alc_ch_mode_get,
12683 .put = alc_ch_mode_put,
12688 static struct hda_verb alc662_init_verbs[] = {
12689 /* ADC: mute amp left and right */
12690 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12691 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12692 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12702 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12703 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12707 /* Front Pin: output 0 (0x0c) */
12708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12709 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12711 /* Rear Pin: output 1 (0x0d) */
12712 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12715 /* CLFE Pin: output 2 (0x0e) */
12716 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12717 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12719 /* Mic (rear) pin: input vref at 80% */
12720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12722 /* Front Mic pin: input vref at 80% */
12723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12725 /* Line In pin: input */
12726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12728 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12731 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12732 /* CD pin widget for input */
12733 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12735 /* FIXME: use matrix-type input source selection */
12736 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12744 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12745 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12750 static struct hda_verb alc662_sue_init_verbs[] = {
12751 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12752 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12756 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12757 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12758 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12762 /* Set Unsolicited Event*/
12763 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
12764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12765 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12770 * generic initialization of ADC, input mixers and output mixers
12772 static struct hda_verb alc662_auto_init_verbs[] = {
12774 * Unmute ADC and set the default input to mic-in
12776 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12777 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12779 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12781 * Note: PASD motherboards uses the Line In 2 as the input for front
12782 * panel mic (mic 2)
12784 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12785 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12786 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12787 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12788 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12789 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12792 * Set up output mixers (0x0c - 0x0f)
12794 /* set vol=0 to output mixers */
12795 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12796 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12797 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12799 /* set up input amps for analog loopback */
12800 /* Amp Indices: DAC = 0, mixer = 1 */
12801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12809 /* FIXME: use matrix-type input source selection */
12810 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12813 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12817 /* capture mixer elements */
12818 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12819 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12820 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12822 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12823 /* The multiple "Capture Source" controls confuse alsamixer
12824 * So call somewhat different..
12825 * FIXME: the controls appear in the "playback" view!
12827 /* .name = "Capture Source", */
12828 .name = "Input Source",
12830 .info = alc662_mux_enum_info,
12831 .get = alc662_mux_enum_get,
12832 .put = alc662_mux_enum_put,
12837 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
12839 unsigned int present;
12840 unsigned char bits;
12842 present = snd_hda_codec_read(codec, 0x14, 0,
12843 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12844 bits = present ? HDA_AMP_MUTE : 0;
12845 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12846 HDA_AMP_MUTE, bits);
12849 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
12851 unsigned int present;
12852 unsigned char bits;
12854 present = snd_hda_codec_read(codec, 0x1b, 0,
12855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12856 bits = present ? HDA_AMP_MUTE : 0;
12857 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12858 HDA_AMP_MUTE, bits);
12859 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12860 HDA_AMP_MUTE, bits);
12863 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
12866 if ((res >> 26) == ALC880_HP_EVENT)
12867 alc662_lenovo_101e_all_automute(codec);
12868 if ((res >> 26) == ALC880_FRONT_EVENT)
12869 alc662_lenovo_101e_ispeaker_automute(codec);
12872 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
12874 unsigned int present;
12876 present = snd_hda_codec_read(codec, 0x18, 0,
12877 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12878 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12879 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12880 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12881 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12882 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12883 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12884 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12885 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12888 /* unsolicited event for HP jack sensing */
12889 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
12892 if ((res >> 26) == ALC880_HP_EVENT)
12893 alc262_hippo1_automute( codec );
12895 if ((res >> 26) == ALC880_MIC_EVENT)
12896 alc662_eeepc_mic_automute(codec);
12899 static void alc662_eeepc_inithook(struct hda_codec *codec)
12901 alc262_hippo1_automute( codec );
12902 alc662_eeepc_mic_automute(codec);
12905 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
12908 unsigned int present;
12910 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
12911 present = snd_hda_codec_read(codec, 0x14, 0,
12912 AC_VERB_GET_PIN_SENSE, 0);
12913 present = (present & 0x80000000) != 0;
12915 /* mute internal speaker */
12916 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
12917 HDA_AMP_MUTE, HDA_AMP_MUTE);
12919 /* unmute internal speaker if necessary */
12920 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12921 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
12922 HDA_AMP_MUTE, mute);
12926 /* unsolicited event for HP jack sensing */
12927 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
12930 if ((res >> 26) == ALC880_HP_EVENT)
12931 alc662_eeepc_ep20_automute(codec);
12934 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
12936 alc662_eeepc_ep20_automute(codec);
12939 #ifdef CONFIG_SND_HDA_POWER_SAVE
12940 #define alc662_loopbacks alc880_loopbacks
12944 /* pcm configuration: identiacal with ALC880 */
12945 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12946 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12947 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12948 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12951 * configuration and preset
12953 static const char *alc662_models[ALC662_MODEL_LAST] = {
12954 [ALC662_3ST_2ch_DIG] = "3stack-dig",
12955 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
12956 [ALC662_3ST_6ch] = "3stack-6ch",
12957 [ALC662_5ST_DIG] = "6stack-dig",
12958 [ALC662_LENOVO_101E] = "lenovo-101e",
12959 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
12960 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
12961 [ALC662_AUTO] = "auto",
12964 static struct snd_pci_quirk alc662_cfg_tbl[] = {
12965 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
12966 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
12967 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
12971 static struct alc_config_preset alc662_presets[] = {
12972 [ALC662_3ST_2ch_DIG] = {
12973 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
12974 .init_verbs = { alc662_init_verbs },
12975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12976 .dac_nids = alc662_dac_nids,
12977 .dig_out_nid = ALC662_DIGOUT_NID,
12978 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12979 .adc_nids = alc662_adc_nids,
12980 .dig_in_nid = ALC662_DIGIN_NID,
12981 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12982 .channel_mode = alc662_3ST_2ch_modes,
12983 .input_mux = &alc662_capture_source,
12985 [ALC662_3ST_6ch_DIG] = {
12986 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12987 alc662_capture_mixer },
12988 .init_verbs = { alc662_init_verbs },
12989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12990 .dac_nids = alc662_dac_nids,
12991 .dig_out_nid = ALC662_DIGOUT_NID,
12992 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12993 .adc_nids = alc662_adc_nids,
12994 .dig_in_nid = ALC662_DIGIN_NID,
12995 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12996 .channel_mode = alc662_3ST_6ch_modes,
12998 .input_mux = &alc662_capture_source,
13000 [ALC662_3ST_6ch] = {
13001 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13002 alc662_capture_mixer },
13003 .init_verbs = { alc662_init_verbs },
13004 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13005 .dac_nids = alc662_dac_nids,
13006 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13007 .adc_nids = alc662_adc_nids,
13008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13009 .channel_mode = alc662_3ST_6ch_modes,
13011 .input_mux = &alc662_capture_source,
13013 [ALC662_5ST_DIG] = {
13014 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13015 alc662_capture_mixer },
13016 .init_verbs = { alc662_init_verbs },
13017 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13018 .dac_nids = alc662_dac_nids,
13019 .dig_out_nid = ALC662_DIGOUT_NID,
13020 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13021 .adc_nids = alc662_adc_nids,
13022 .dig_in_nid = ALC662_DIGIN_NID,
13023 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13024 .channel_mode = alc662_5stack_modes,
13025 .input_mux = &alc662_capture_source,
13027 [ALC662_LENOVO_101E] = {
13028 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13029 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13030 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13031 .dac_nids = alc662_dac_nids,
13032 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13033 .adc_nids = alc662_adc_nids,
13034 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13035 .channel_mode = alc662_3ST_2ch_modes,
13036 .input_mux = &alc662_lenovo_101e_capture_source,
13037 .unsol_event = alc662_lenovo_101e_unsol_event,
13038 .init_hook = alc662_lenovo_101e_all_automute,
13040 [ALC662_ASUS_EEEPC_P701] = {
13041 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13042 .init_verbs = { alc662_init_verbs,
13043 alc662_eeepc_sue_init_verbs },
13044 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13045 .dac_nids = alc662_dac_nids,
13046 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
13047 .adc_nids = alc662_adc_nids,
13048 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13049 .channel_mode = alc662_3ST_2ch_modes,
13050 .input_mux = &alc662_eeepc_capture_source,
13051 .unsol_event = alc662_eeepc_unsol_event,
13052 .init_hook = alc662_eeepc_inithook,
13054 [ALC662_ASUS_EEEPC_EP20] = {
13055 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13056 alc662_chmode_mixer },
13057 .init_verbs = { alc662_init_verbs,
13058 alc662_eeepc_ep20_sue_init_verbs },
13059 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13060 .dac_nids = alc662_dac_nids,
13061 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13062 .adc_nids = alc662_adc_nids,
13063 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13064 .channel_mode = alc662_3ST_6ch_modes,
13065 .input_mux = &alc662_lenovo_101e_capture_source,
13066 .unsol_event = alc662_eeepc_ep20_unsol_event,
13067 .init_hook = alc662_eeepc_ep20_inithook,
13074 * BIOS auto configuration
13077 /* add playback controls from the parsed DAC table */
13078 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13079 const struct auto_pin_cfg *cfg)
13082 static const char *chname[4] = {
13083 "Front", "Surround", NULL /*CLFE*/, "Side"
13088 for (i = 0; i < cfg->line_outs; i++) {
13089 if (!spec->multiout.dac_nids[i])
13091 nid = alc880_idx_to_dac(i);
13094 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13095 "Center Playback Volume",
13096 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13100 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13101 "LFE Playback Volume",
13102 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13106 err = add_control(spec, ALC_CTL_BIND_MUTE,
13107 "Center Playback Switch",
13108 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13112 err = add_control(spec, ALC_CTL_BIND_MUTE,
13113 "LFE Playback Switch",
13114 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13119 sprintf(name, "%s Playback Volume", chname[i]);
13120 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13121 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13125 sprintf(name, "%s Playback Switch", chname[i]);
13126 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13127 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13136 /* add playback controls for speaker and HP outputs */
13137 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13147 if (alc880_is_fixed_pin(pin)) {
13148 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13149 /* printk("DAC nid=%x\n",nid); */
13150 /* specify the DAC as the extra output */
13151 if (!spec->multiout.hp_nid)
13152 spec->multiout.hp_nid = nid;
13154 spec->multiout.extra_out_nid[0] = nid;
13155 /* control HP volume/switch on the output mixer amp */
13156 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13157 sprintf(name, "%s Playback Volume", pfx);
13158 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13159 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13162 sprintf(name, "%s Playback Switch", pfx);
13163 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13164 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13167 } else if (alc880_is_multi_pin(pin)) {
13168 /* set manual connection */
13169 /* we have only a switch on HP-out PIN */
13170 sprintf(name, "%s Playback Switch", pfx);
13171 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13172 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13179 /* create playback/capture controls for input pins */
13180 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13181 const struct auto_pin_cfg *cfg)
13183 struct hda_input_mux *imux = &spec->private_imux;
13186 for (i = 0; i < AUTO_PIN_LAST; i++) {
13187 if (alc880_is_input_pin(cfg->input_pins[i])) {
13188 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13189 err = new_analog_input(spec, cfg->input_pins[i],
13190 auto_pin_cfg_labels[i],
13194 imux->items[imux->num_items].label =
13195 auto_pin_cfg_labels[i];
13196 imux->items[imux->num_items].index =
13197 alc880_input_pin_idx(cfg->input_pins[i]);
13204 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13205 hda_nid_t nid, int pin_type,
13208 /* set as output */
13209 snd_hda_codec_write(codec, nid, 0,
13210 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13211 snd_hda_codec_write(codec, nid, 0,
13212 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13213 /* need the manual connection? */
13214 if (alc880_is_multi_pin(nid)) {
13215 struct alc_spec *spec = codec->spec;
13216 int idx = alc880_multi_pin_idx(nid);
13217 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13218 AC_VERB_SET_CONNECT_SEL,
13219 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13223 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13225 struct alc_spec *spec = codec->spec;
13228 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13229 for (i = 0; i <= HDA_SIDE; i++) {
13230 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13231 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13233 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13238 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13240 struct alc_spec *spec = codec->spec;
13243 pin = spec->autocfg.hp_pins[0];
13244 if (pin) /* connect to front */
13246 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13249 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13250 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13252 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13254 struct alc_spec *spec = codec->spec;
13257 for (i = 0; i < AUTO_PIN_LAST; i++) {
13258 hda_nid_t nid = spec->autocfg.input_pins[i];
13259 if (alc662_is_input_pin(nid)) {
13260 snd_hda_codec_write(codec, nid, 0,
13261 AC_VERB_SET_PIN_WIDGET_CONTROL,
13262 (i <= AUTO_PIN_FRONT_MIC ?
13263 PIN_VREF80 : PIN_IN));
13264 if (nid != ALC662_PIN_CD_NID)
13265 snd_hda_codec_write(codec, nid, 0,
13266 AC_VERB_SET_AMP_GAIN_MUTE,
13272 static int alc662_parse_auto_config(struct hda_codec *codec)
13274 struct alc_spec *spec = codec->spec;
13276 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13278 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13282 if (!spec->autocfg.line_outs)
13283 return 0; /* can't find valid BIOS pin config */
13285 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13288 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13291 err = alc662_auto_create_extra_out(spec,
13292 spec->autocfg.speaker_pins[0],
13296 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13300 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13304 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13306 if (spec->autocfg.dig_out_pin)
13307 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13309 if (spec->kctl_alloc)
13310 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13312 spec->num_mux_defs = 1;
13313 spec->input_mux = &spec->private_imux;
13315 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13316 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13317 spec->num_mixers++;
13321 /* additional initialization for auto-configuration model */
13322 static void alc662_auto_init(struct hda_codec *codec)
13324 alc662_auto_init_multi_out(codec);
13325 alc662_auto_init_hp_out(codec);
13326 alc662_auto_init_analog_input(codec);
13329 static int patch_alc662(struct hda_codec *codec)
13331 struct alc_spec *spec;
13332 int err, board_config;
13334 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13338 codec->spec = spec;
13340 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13343 if (board_config < 0) {
13344 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13345 "trying auto-probe from BIOS...\n");
13346 board_config = ALC662_AUTO;
13349 if (board_config == ALC662_AUTO) {
13350 /* automatic parse from the BIOS config */
13351 err = alc662_parse_auto_config(codec);
13357 "hda_codec: Cannot set up configuration "
13358 "from BIOS. Using base mode...\n");
13359 board_config = ALC662_3ST_2ch_DIG;
13363 if (board_config != ALC662_AUTO)
13364 setup_preset(spec, &alc662_presets[board_config]);
13366 spec->stream_name_analog = "ALC662 Analog";
13367 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13368 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13370 spec->stream_name_digital = "ALC662 Digital";
13371 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13372 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13374 if (!spec->adc_nids && spec->input_mux) {
13375 spec->adc_nids = alc662_adc_nids;
13376 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13379 spec->vmaster_nid = 0x02;
13381 codec->patch_ops = alc_patch_ops;
13382 if (board_config == ALC662_AUTO)
13383 spec->init_hook = alc662_auto_init;
13384 #ifdef CONFIG_SND_HDA_POWER_SAVE
13385 if (!spec->loopback.amplist)
13386 spec->loopback.amplist = alc662_loopbacks;
13395 struct hda_codec_preset snd_hda_preset_realtek[] = {
13396 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13397 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13398 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13399 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13400 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13401 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13402 .patch = patch_alc861 },
13403 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13404 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13405 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13406 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13407 .patch = patch_alc883 },
13408 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13409 .patch = patch_alc662 },
13410 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13411 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13412 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13413 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13414 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13415 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13416 {} /* terminator */