2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST /* last tag */
94 ALC262_HP_BPC_D7000_WL,
95 ALC262_HP_BPC_D7000_WF,
104 ALC262_MODEL_LAST /* last tag */
115 #ifdef CONFIG_SND_DEBUG
119 ALC268_MODEL_LAST /* last tag */
126 ALC269_MODEL_LAST /* last tag */
143 /* ALC861-VD models */
164 ALC662_ASUS_EEEPC_P701,
165 ALC662_ASUS_EEEPC_EP20,
193 ALC883_TARGA_2ch_DIG,
199 ALC883_LENOVO_101E_2ch,
200 ALC883_LENOVO_NB0763,
201 ALC888_LENOVO_MS7195_DIG,
207 ALC883_FUJITSU_PI2515,
213 #define GPIO_MASK 0x03
216 /* codec parameterization */
217 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
218 unsigned int num_mixers;
220 const struct hda_verb *init_verbs[5]; /* initialization verbs
224 unsigned int num_init_verbs;
226 char *stream_name_analog; /* analog PCM stream */
227 struct hda_pcm_stream *stream_analog_playback;
228 struct hda_pcm_stream *stream_analog_capture;
229 struct hda_pcm_stream *stream_analog_alt_playback;
230 struct hda_pcm_stream *stream_analog_alt_capture;
232 char *stream_name_digital; /* digital PCM stream */
233 struct hda_pcm_stream *stream_digital_playback;
234 struct hda_pcm_stream *stream_digital_capture;
237 struct hda_multi_out multiout; /* playback set-up
238 * max_channels, dacs must be set
239 * dig_out_nid and hp_nid are optional
241 hda_nid_t alt_dac_nid;
244 unsigned int num_adc_nids;
246 hda_nid_t *capsrc_nids;
247 hda_nid_t dig_in_nid; /* digital-in NID; optional */
250 unsigned int num_mux_defs;
251 const struct hda_input_mux *input_mux;
252 unsigned int cur_mux[3];
255 const struct hda_channel_mode *channel_mode;
256 int num_channel_mode;
259 /* PCM information */
260 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
262 /* dynamic controls, init_verbs and input_mux */
263 struct auto_pin_cfg autocfg;
264 unsigned int num_kctl_alloc, num_kctl_used;
265 struct snd_kcontrol_new *kctl_alloc;
266 struct hda_input_mux private_imux;
267 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
270 void (*init_hook)(struct hda_codec *codec);
271 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
273 /* for pin sensing */
274 unsigned int sense_updated: 1;
275 unsigned int jack_present: 1;
276 unsigned int master_sw: 1;
278 /* for virtual master */
279 hda_nid_t vmaster_nid;
280 #ifdef CONFIG_SND_HDA_POWER_SAVE
281 struct hda_loopback_check loopback;
286 * configuration template - to be copied to the spec instance
288 struct alc_config_preset {
289 struct snd_kcontrol_new *mixers[5]; /* should be identical size
292 const struct hda_verb *init_verbs[5];
293 unsigned int num_dacs;
295 hda_nid_t dig_out_nid; /* optional */
296 hda_nid_t hp_nid; /* optional */
297 unsigned int num_adc_nids;
299 hda_nid_t *capsrc_nids;
300 hda_nid_t dig_in_nid;
301 unsigned int num_channel_mode;
302 const struct hda_channel_mode *channel_mode;
304 unsigned int num_mux_defs;
305 const struct hda_input_mux *input_mux;
306 void (*unsol_event)(struct hda_codec *, unsigned int);
307 void (*init_hook)(struct hda_codec *);
308 #ifdef CONFIG_SND_HDA_POWER_SAVE
309 struct hda_amp_list *loopbacks;
317 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
318 struct snd_ctl_elem_info *uinfo)
320 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
321 struct alc_spec *spec = codec->spec;
322 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
323 if (mux_idx >= spec->num_mux_defs)
325 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
328 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
329 struct snd_ctl_elem_value *ucontrol)
331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
332 struct alc_spec *spec = codec->spec;
333 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
335 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
339 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
340 struct snd_ctl_elem_value *ucontrol)
342 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
343 struct alc_spec *spec = codec->spec;
344 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
345 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
346 hda_nid_t nid = spec->capsrc_nids ?
347 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
348 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
349 nid, &spec->cur_mux[adc_idx]);
354 * channel mode setting
356 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
357 struct snd_ctl_elem_info *uinfo)
359 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
360 struct alc_spec *spec = codec->spec;
361 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
362 spec->num_channel_mode);
365 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_value *ucontrol)
368 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct alc_spec *spec = codec->spec;
370 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
371 spec->num_channel_mode,
372 spec->multiout.max_channels);
375 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
376 struct snd_ctl_elem_value *ucontrol)
378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
379 struct alc_spec *spec = codec->spec;
380 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
381 spec->num_channel_mode,
382 &spec->multiout.max_channels);
383 if (err >= 0 && spec->need_dac_fix)
384 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
389 * Control the mode of pin widget settings via the mixer. "pc" is used
390 * instead of "%" to avoid consequences of accidently treating the % as
391 * being part of a format specifier. Maximum allowed length of a value is
392 * 63 characters plus NULL terminator.
394 * Note: some retasking pin complexes seem to ignore requests for input
395 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
396 * are requested. Therefore order this list so that this behaviour will not
397 * cause problems when mixer clients move through the enum sequentially.
398 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
401 static char *alc_pin_mode_names[] = {
402 "Mic 50pc bias", "Mic 80pc bias",
403 "Line in", "Line out", "Headphone out",
405 static unsigned char alc_pin_mode_values[] = {
406 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
408 /* The control can present all 5 options, or it can limit the options based
409 * in the pin being assumed to be exclusively an input or an output pin. In
410 * addition, "input" pins may or may not process the mic bias option
411 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
412 * accept requests for bias as of chip versions up to March 2006) and/or
413 * wiring in the computer.
415 #define ALC_PIN_DIR_IN 0x00
416 #define ALC_PIN_DIR_OUT 0x01
417 #define ALC_PIN_DIR_INOUT 0x02
418 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
419 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
421 /* Info about the pin modes supported by the different pin direction modes.
422 * For each direction the minimum and maximum values are given.
424 static signed char alc_pin_mode_dir_info[5][2] = {
425 { 0, 2 }, /* ALC_PIN_DIR_IN */
426 { 3, 4 }, /* ALC_PIN_DIR_OUT */
427 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
428 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
429 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
431 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
432 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
433 #define alc_pin_mode_n_items(_dir) \
434 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
436 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
437 struct snd_ctl_elem_info *uinfo)
439 unsigned int item_num = uinfo->value.enumerated.item;
440 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
442 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
444 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
446 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
447 item_num = alc_pin_mode_min(dir);
448 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
452 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
453 struct snd_ctl_elem_value *ucontrol)
456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
457 hda_nid_t nid = kcontrol->private_value & 0xffff;
458 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
459 long *valp = ucontrol->value.integer.value;
460 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
461 AC_VERB_GET_PIN_WIDGET_CONTROL,
464 /* Find enumerated value for current pinctl setting */
465 i = alc_pin_mode_min(dir);
466 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
468 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
472 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
473 struct snd_ctl_elem_value *ucontrol)
476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
477 hda_nid_t nid = kcontrol->private_value & 0xffff;
478 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
479 long val = *ucontrol->value.integer.value;
480 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
481 AC_VERB_GET_PIN_WIDGET_CONTROL,
484 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
485 val = alc_pin_mode_min(dir);
487 change = pinctl != alc_pin_mode_values[val];
489 /* Set pin mode to that requested */
490 snd_hda_codec_write_cache(codec, nid, 0,
491 AC_VERB_SET_PIN_WIDGET_CONTROL,
492 alc_pin_mode_values[val]);
494 /* Also enable the retasking pin's input/output as required
495 * for the requested pin mode. Enum values of 2 or less are
498 * Dynamically switching the input/output buffers probably
499 * reduces noise slightly (particularly on input) so we'll
500 * do it. However, having both input and output buffers
501 * enabled simultaneously doesn't seem to be problematic if
502 * this turns out to be necessary in the future.
505 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
506 HDA_AMP_MUTE, HDA_AMP_MUTE);
507 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
510 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
511 HDA_AMP_MUTE, HDA_AMP_MUTE);
512 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
519 #define ALC_PIN_MODE(xname, nid, dir) \
520 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
521 .info = alc_pin_mode_info, \
522 .get = alc_pin_mode_get, \
523 .put = alc_pin_mode_put, \
524 .private_value = nid | (dir<<16) }
526 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
527 * together using a mask with more than one bit set. This control is
528 * currently used only by the ALC260 test model. At this stage they are not
529 * needed for any "production" models.
531 #ifdef CONFIG_SND_DEBUG
532 #define alc_gpio_data_info snd_ctl_boolean_mono_info
534 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
535 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 *valp = ucontrol->value.integer.value;
541 unsigned int val = snd_hda_codec_read(codec, nid, 0,
542 AC_VERB_GET_GPIO_DATA, 0x00);
544 *valp = (val & mask) != 0;
547 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
548 struct snd_ctl_elem_value *ucontrol)
551 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
552 hda_nid_t nid = kcontrol->private_value & 0xffff;
553 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
554 long val = *ucontrol->value.integer.value;
555 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
556 AC_VERB_GET_GPIO_DATA,
559 /* Set/unset the masked GPIO bit(s) as needed */
560 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
565 snd_hda_codec_write_cache(codec, nid, 0,
566 AC_VERB_SET_GPIO_DATA, gpio_data);
570 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
571 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
572 .info = alc_gpio_data_info, \
573 .get = alc_gpio_data_get, \
574 .put = alc_gpio_data_put, \
575 .private_value = nid | (mask<<16) }
576 #endif /* CONFIG_SND_DEBUG */
578 /* A switch control to allow the enabling of the digital IO pins on the
579 * ALC260. This is incredibly simplistic; the intention of this control is
580 * to provide something in the test model allowing digital outputs to be
581 * identified if present. If models are found which can utilise these
582 * outputs a more complete mixer control can be devised for those models if
585 #ifdef CONFIG_SND_DEBUG
586 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
588 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
589 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 *valp = ucontrol->value.integer.value;
595 unsigned int val = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
598 *valp = (val & mask) != 0;
601 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
602 struct snd_ctl_elem_value *ucontrol)
605 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
606 hda_nid_t nid = kcontrol->private_value & 0xffff;
607 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
608 long val = *ucontrol->value.integer.value;
609 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
610 AC_VERB_GET_DIGI_CONVERT_1,
613 /* Set/unset the masked control bit(s) as needed */
614 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
619 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
624 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
625 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
626 .info = alc_spdif_ctrl_info, \
627 .get = alc_spdif_ctrl_get, \
628 .put = alc_spdif_ctrl_put, \
629 .private_value = nid | (mask<<16) }
630 #endif /* CONFIG_SND_DEBUG */
632 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
633 * Again, this is only used in the ALC26x test models to help identify when
634 * the EAPD line must be asserted for features to work.
636 #ifdef CONFIG_SND_DEBUG
637 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
639 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
643 hda_nid_t nid = kcontrol->private_value & 0xffff;
644 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
645 long *valp = ucontrol->value.integer.value;
646 unsigned int val = snd_hda_codec_read(codec, nid, 0,
647 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
649 *valp = (val & mask) != 0;
653 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
654 struct snd_ctl_elem_value *ucontrol)
657 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
658 hda_nid_t nid = kcontrol->private_value & 0xffff;
659 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
660 long val = *ucontrol->value.integer.value;
661 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
662 AC_VERB_GET_EAPD_BTLENABLE,
665 /* Set/unset the masked control bit(s) as needed */
666 change = (!val ? 0 : mask) != (ctrl_data & mask);
671 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
677 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
678 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
679 .info = alc_eapd_ctrl_info, \
680 .get = alc_eapd_ctrl_get, \
681 .put = alc_eapd_ctrl_put, \
682 .private_value = nid | (mask<<16) }
683 #endif /* CONFIG_SND_DEBUG */
686 * set up from the preset table
688 static void setup_preset(struct alc_spec *spec,
689 const struct alc_config_preset *preset)
693 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
694 spec->mixers[spec->num_mixers++] = preset->mixers[i];
695 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
697 spec->init_verbs[spec->num_init_verbs++] =
698 preset->init_verbs[i];
700 spec->channel_mode = preset->channel_mode;
701 spec->num_channel_mode = preset->num_channel_mode;
702 spec->need_dac_fix = preset->need_dac_fix;
704 spec->multiout.max_channels = spec->channel_mode[0].channels;
706 spec->multiout.num_dacs = preset->num_dacs;
707 spec->multiout.dac_nids = preset->dac_nids;
708 spec->multiout.dig_out_nid = preset->dig_out_nid;
709 spec->multiout.hp_nid = preset->hp_nid;
711 spec->num_mux_defs = preset->num_mux_defs;
712 if (!spec->num_mux_defs)
713 spec->num_mux_defs = 1;
714 spec->input_mux = preset->input_mux;
716 spec->num_adc_nids = preset->num_adc_nids;
717 spec->adc_nids = preset->adc_nids;
718 spec->capsrc_nids = preset->capsrc_nids;
719 spec->dig_in_nid = preset->dig_in_nid;
721 spec->unsol_event = preset->unsol_event;
722 spec->init_hook = preset->init_hook;
723 #ifdef CONFIG_SND_HDA_POWER_SAVE
724 spec->loopback.amplist = preset->loopbacks;
728 /* Enable GPIO mask and set output */
729 static struct hda_verb alc_gpio1_init_verbs[] = {
730 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
731 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
732 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
736 static struct hda_verb alc_gpio2_init_verbs[] = {
737 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
738 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
739 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
743 static struct hda_verb alc_gpio3_init_verbs[] = {
744 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
745 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
746 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
750 static void alc_sku_automute(struct hda_codec *codec)
752 struct alc_spec *spec = codec->spec;
753 unsigned int present;
754 unsigned int hp_nid = spec->autocfg.hp_pins[0];
755 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
757 /* need to execute and sync at first */
758 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
759 present = snd_hda_codec_read(codec, hp_nid, 0,
760 AC_VERB_GET_PIN_SENSE, 0);
761 spec->jack_present = (present & 0x80000000) != 0;
762 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
763 spec->jack_present ? 0 : PIN_OUT);
766 /* unsolicited event for HP jack sensing */
767 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
769 if (codec->vendor_id == 0x10ec0880)
773 if (res != ALC880_HP_EVENT)
776 alc_sku_automute(codec);
779 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
780 * 31 ~ 16 : Manufacture ID
782 * 7 ~ 0 : Assembly ID
783 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
785 static void alc_subsystem_id(struct hda_codec *codec,
786 unsigned int porta, unsigned int porte,
789 unsigned int ass, tmp, i;
791 struct alc_spec *spec = codec->spec;
793 ass = codec->subsystem_id & 0xffff;
794 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
798 * 31~30 : port conetcivity
801 * 19~16 : Check sum (15:1)
806 if (codec->vendor_id == 0x10ec0260)
808 ass = snd_hda_codec_read(codec, nid, 0,
809 AC_VERB_GET_CONFIG_DEFAULT, 0);
810 if (!(ass & 1) && !(ass & 0x100000))
812 if ((ass >> 30) != 1) /* no physical connection */
817 for (i = 1; i < 16; i++) {
821 if (((ass >> 16) & 0xf) != tmp)
827 * 2 : 0 --> Desktop, 1 --> Laptop
828 * 3~5 : External Amplifier control
831 tmp = (ass & 0x38) >> 3; /* external Amp control */
834 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
837 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
840 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
842 case 5: /* set EAPD output high */
843 switch (codec->vendor_id) {
845 snd_hda_codec_write(codec, 0x0f, 0,
846 AC_VERB_SET_EAPD_BTLENABLE, 2);
847 snd_hda_codec_write(codec, 0x10, 0,
848 AC_VERB_SET_EAPD_BTLENABLE, 2);
856 snd_hda_codec_write(codec, 0x14, 0,
857 AC_VERB_SET_EAPD_BTLENABLE, 2);
858 snd_hda_codec_write(codec, 0x15, 0,
859 AC_VERB_SET_EAPD_BTLENABLE, 2);
862 switch (codec->vendor_id) {
864 snd_hda_codec_write(codec, 0x1a, 0,
865 AC_VERB_SET_COEF_INDEX, 7);
866 tmp = snd_hda_codec_read(codec, 0x1a, 0,
867 AC_VERB_GET_PROC_COEF, 0);
868 snd_hda_codec_write(codec, 0x1a, 0,
869 AC_VERB_SET_COEF_INDEX, 7);
870 snd_hda_codec_write(codec, 0x1a, 0,
871 AC_VERB_SET_PROC_COEF,
880 snd_hda_codec_write(codec, 0x20, 0,
881 AC_VERB_SET_COEF_INDEX, 7);
882 tmp = snd_hda_codec_read(codec, 0x20, 0,
883 AC_VERB_GET_PROC_COEF, 0);
884 snd_hda_codec_write(codec, 0x20, 0,
885 AC_VERB_SET_COEF_INDEX, 7);
886 snd_hda_codec_write(codec, 0x20, 0,
887 AC_VERB_SET_PROC_COEF,
892 snd_hda_codec_write(codec, 0x20, 0,
893 AC_VERB_SET_COEF_INDEX, 7);
894 tmp = snd_hda_codec_read(codec, 0x20, 0,
895 AC_VERB_GET_PROC_COEF, 0);
896 snd_hda_codec_write(codec, 0x20, 0,
897 AC_VERB_SET_COEF_INDEX, 7);
898 snd_hda_codec_write(codec, 0x20, 0,
899 AC_VERB_SET_PROC_COEF,
907 /* is laptop or Desktop and enable the function "Mute internal speaker
908 * when the external headphone out jack is plugged"
913 * 10~8 : Jack location
914 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
916 * 15 : 1 --> enable the function "Mute internal speaker
917 * when the external headphone out jack is plugged"
919 if (!spec->autocfg.speaker_pins[0]) {
920 if (spec->autocfg.line_out_pins[0])
921 spec->autocfg.speaker_pins[0] =
922 spec->autocfg.line_out_pins[0];
927 if (!spec->autocfg.hp_pins[0]) {
928 tmp = (ass >> 11) & 0x3; /* HP to chassis */
930 spec->autocfg.hp_pins[0] = porta;
932 spec->autocfg.hp_pins[0] = porte;
934 spec->autocfg.hp_pins[0] = portd;
939 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
940 AC_VERB_SET_UNSOLICITED_ENABLE,
941 AC_USRSP_EN | ALC880_HP_EVENT);
942 spec->unsol_event = alc_sku_unsol_event;
943 spec->init_hook = alc_sku_automute;
947 * Fix-up pin default configurations
955 static void alc_fix_pincfg(struct hda_codec *codec,
956 const struct snd_pci_quirk *quirk,
957 const struct alc_pincfg **pinfix)
959 const struct alc_pincfg *cfg;
961 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
965 cfg = pinfix[quirk->value];
966 for (; cfg->nid; cfg++) {
969 for (i = 0; i < 4; i++) {
970 snd_hda_codec_write(codec, cfg->nid, 0,
971 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
979 * ALC880 3-stack model
981 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
982 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
983 * F-Mic = 0x1b, HP = 0x19
986 static hda_nid_t alc880_dac_nids[4] = {
987 /* front, rear, clfe, rear_surr */
988 0x02, 0x05, 0x04, 0x03
991 static hda_nid_t alc880_adc_nids[3] = {
996 /* The datasheet says the node 0x07 is connected from inputs,
997 * but it shows zero connection in the real implementation on some devices.
998 * Note: this is a 915GAV bug, fixed on 915GLV
1000 static hda_nid_t alc880_adc_nids_alt[2] = {
1005 #define ALC880_DIGOUT_NID 0x06
1006 #define ALC880_DIGIN_NID 0x0a
1008 static struct hda_input_mux alc880_capture_source = {
1012 { "Front Mic", 0x3 },
1018 /* channel source setting (2/6 channel selection for 3-stack) */
1020 static struct hda_verb alc880_threestack_ch2_init[] = {
1021 /* set line-in to input, mute it */
1022 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1023 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1024 /* set mic-in to input vref 80%, mute it */
1025 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1026 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1031 static struct hda_verb alc880_threestack_ch6_init[] = {
1032 /* set line-in to output, unmute it */
1033 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1034 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1035 /* set mic-in to output, unmute it */
1036 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1037 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1041 static struct hda_channel_mode alc880_threestack_modes[2] = {
1042 { 2, alc880_threestack_ch2_init },
1043 { 6, alc880_threestack_ch6_init },
1046 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1048 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1050 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1051 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1052 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1053 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1054 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1061 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1062 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1063 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1064 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1068 .name = "Channel Mode",
1069 .info = alc_ch_mode_info,
1070 .get = alc_ch_mode_get,
1071 .put = alc_ch_mode_put,
1076 /* capture mixer elements */
1077 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1078 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1079 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1080 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1081 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1082 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1083 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1086 /* The multiple "Capture Source" controls confuse alsamixer
1087 * So call somewhat different..
1089 /* .name = "Capture Source", */
1090 .name = "Input Source",
1092 .info = alc_mux_enum_info,
1093 .get = alc_mux_enum_get,
1094 .put = alc_mux_enum_put,
1099 /* capture mixer elements (in case NID 0x07 not available) */
1100 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1101 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1102 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1103 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1104 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1107 /* The multiple "Capture Source" controls confuse alsamixer
1108 * So call somewhat different..
1110 /* .name = "Capture Source", */
1111 .name = "Input Source",
1113 .info = alc_mux_enum_info,
1114 .get = alc_mux_enum_get,
1115 .put = alc_mux_enum_put,
1123 * ALC880 5-stack model
1125 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1127 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1128 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1131 /* additional mixers to alc880_three_stack_mixer */
1132 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1133 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1134 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1138 /* channel source setting (6/8 channel selection for 5-stack) */
1140 static struct hda_verb alc880_fivestack_ch6_init[] = {
1141 /* set line-in to input, mute it */
1142 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1143 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1148 static struct hda_verb alc880_fivestack_ch8_init[] = {
1149 /* set line-in to output, unmute it */
1150 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1151 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1155 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1156 { 6, alc880_fivestack_ch6_init },
1157 { 8, alc880_fivestack_ch8_init },
1162 * ALC880 6-stack model
1164 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1165 * Side = 0x05 (0x0f)
1166 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1167 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1170 static hda_nid_t alc880_6st_dac_nids[4] = {
1171 /* front, rear, clfe, rear_surr */
1172 0x02, 0x03, 0x04, 0x05
1175 static struct hda_input_mux alc880_6stack_capture_source = {
1179 { "Front Mic", 0x1 },
1185 /* fixed 8-channels */
1186 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1190 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1191 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1192 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1193 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1194 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1195 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1196 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1197 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1198 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1199 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1200 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1201 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1202 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1207 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1208 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1209 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1210 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1213 .name = "Channel Mode",
1214 .info = alc_ch_mode_info,
1215 .get = alc_ch_mode_get,
1216 .put = alc_ch_mode_put,
1225 * W810 has rear IO for:
1228 * Center/LFE (DAC 04)
1231 * The system also has a pair of internal speakers, and a headphone jack.
1232 * These are both connected to Line2 on the codec, hence to DAC 02.
1234 * There is a variable resistor to control the speaker or headphone
1235 * volume. This is a hardware-only device without a software API.
1237 * Plugging headphones in will disable the internal speakers. This is
1238 * implemented in hardware, not via the driver using jack sense. In
1239 * a similar fashion, plugging into the rear socket marked "front" will
1240 * disable both the speakers and headphones.
1242 * For input, there's a microphone jack, and an "audio in" jack.
1243 * These may not do anything useful with this driver yet, because I
1244 * haven't setup any initialization verbs for these yet...
1247 static hda_nid_t alc880_w810_dac_nids[3] = {
1248 /* front, rear/surround, clfe */
1252 /* fixed 6 channels */
1253 static struct hda_channel_mode alc880_w810_modes[1] = {
1257 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1258 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1261 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1262 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1263 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1264 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1265 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1266 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1275 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1276 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1280 static hda_nid_t alc880_z71v_dac_nids[1] = {
1283 #define ALC880_Z71V_HP_DAC 0x03
1285 /* fixed 2 channels */
1286 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1290 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1293 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1294 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1304 * ALC880 F1734 model
1306 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1307 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1310 static hda_nid_t alc880_f1734_dac_nids[1] = {
1313 #define ALC880_F1734_HP_DAC 0x02
1315 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1316 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1317 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1318 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1319 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1327 static struct hda_input_mux alc880_f1734_capture_source = {
1339 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1340 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1341 * Mic = 0x18, Line = 0x1a
1344 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1345 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1347 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1349 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1350 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1351 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1352 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1353 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1354 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1355 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1356 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1357 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1358 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1359 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1364 .name = "Channel Mode",
1365 .info = alc_ch_mode_info,
1366 .get = alc_ch_mode_get,
1367 .put = alc_ch_mode_put,
1373 * ALC880 ASUS W1V model
1375 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1376 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1377 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1380 /* additional mixers to alc880_asus_mixer */
1381 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1382 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1383 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1387 /* additional mixers to alc880_asus_mixer */
1388 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1389 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1390 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1395 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1396 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1397 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1400 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1403 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1404 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1407 /* The multiple "Capture Source" controls confuse alsamixer
1408 * So call somewhat different..
1410 /* .name = "Capture Source", */
1411 .name = "Input Source",
1413 .info = alc_mux_enum_info,
1414 .get = alc_mux_enum_get,
1415 .put = alc_mux_enum_put,
1421 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1423 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1425 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1426 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1427 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1428 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1429 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1430 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1431 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1436 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1438 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1439 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1442 .name = "Channel Mode",
1443 .info = alc_ch_mode_info,
1444 .get = alc_ch_mode_get,
1445 .put = alc_ch_mode_put,
1450 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1452 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1454 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1457 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1458 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1459 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1460 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1464 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1465 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1466 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1467 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1468 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1469 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1470 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1475 * virtual master controls
1479 * slave controls for virtual master
1481 static const char *alc_slave_vols[] = {
1482 "Front Playback Volume",
1483 "Surround Playback Volume",
1484 "Center Playback Volume",
1485 "LFE Playback Volume",
1486 "Side Playback Volume",
1487 "Headphone Playback Volume",
1488 "Speaker Playback Volume",
1489 "Mono Playback Volume",
1490 "Line-Out Playback Volume",
1494 static const char *alc_slave_sws[] = {
1495 "Front Playback Switch",
1496 "Surround Playback Switch",
1497 "Center Playback Switch",
1498 "LFE Playback Switch",
1499 "Side Playback Switch",
1500 "Headphone Playback Switch",
1501 "Speaker Playback Switch",
1502 "Mono Playback Switch",
1503 "IEC958 Playback Switch",
1508 * build control elements
1510 static int alc_build_controls(struct hda_codec *codec)
1512 struct alc_spec *spec = codec->spec;
1516 for (i = 0; i < spec->num_mixers; i++) {
1517 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1522 if (spec->multiout.dig_out_nid) {
1523 err = snd_hda_create_spdif_out_ctls(codec,
1524 spec->multiout.dig_out_nid);
1527 err = snd_hda_create_spdif_share_sw(codec,
1531 spec->multiout.share_spdif = 1;
1533 if (spec->dig_in_nid) {
1534 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1539 /* if we have no master control, let's create it */
1540 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1541 unsigned int vmaster_tlv[4];
1542 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1543 HDA_OUTPUT, vmaster_tlv);
1544 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1545 vmaster_tlv, alc_slave_vols);
1549 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1550 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1551 NULL, alc_slave_sws);
1561 * initialize the codec volumes, etc
1565 * generic initialization of ADC, input mixers and output mixers
1567 static struct hda_verb alc880_volume_init_verbs[] = {
1569 * Unmute ADC0-2 and set the default input to mic-in
1571 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1573 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1575 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1576 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1578 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1580 * Note: PASD motherboards uses the Line In 2 as the input for front
1583 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1593 * Set up output mixers (0x0c - 0x0f)
1595 /* set vol=0 to output mixers */
1596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1600 /* set up input amps for analog loopback */
1601 /* Amp Indices: DAC = 0, mixer = 1 */
1602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1615 * 3-stack pin configuration:
1616 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1618 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1620 * preset connection lists of input pins
1621 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1623 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1624 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1625 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1628 * Set pin mode and muting
1630 /* set front pin widgets 0x14 for output */
1631 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1632 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1633 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1634 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1636 /* Mic2 (as headphone out) for HP output */
1637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1639 /* Line In pin widget for input */
1640 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1642 /* Line2 (as front mic) pin widget for input and vref at 80% */
1643 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1644 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1645 /* CD pin widget for input */
1646 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1652 * 5-stack pin configuration:
1653 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1654 * line-in/side = 0x1a, f-mic = 0x1b
1656 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1658 * preset connection lists of input pins
1659 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1661 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1662 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1665 * Set pin mode and muting
1667 /* set pin widgets 0x14-0x17 for output */
1668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1671 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1672 /* unmute pins for output (no gain on this amp) */
1673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1676 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1678 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1679 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1680 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1681 /* Mic2 (as headphone out) for HP output */
1682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1684 /* Line In pin widget for input */
1685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1687 /* Line2 (as front mic) pin widget for input and vref at 80% */
1688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1689 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1690 /* CD pin widget for input */
1691 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1697 * W810 pin configuration:
1698 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1700 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1701 /* hphone/speaker input selector: front DAC */
1702 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1704 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1705 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1709 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1712 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1718 * Z71V pin configuration:
1719 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1721 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1728 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1730 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1736 * 6-stack pin configuration:
1737 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1738 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1740 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1741 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1744 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1747 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1748 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1749 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1750 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1754 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1755 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1758 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1759 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1760 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1766 * Uniwill pin configuration:
1767 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1770 static struct hda_verb alc880_uniwill_init_verbs[] = {
1771 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1773 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1774 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1775 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1777 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1778 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1779 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1780 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1783 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1785 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1786 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1790 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1791 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1793 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1794 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1795 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1796 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1798 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1799 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1806 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1808 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1809 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1831 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1832 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1837 static struct hda_verb alc880_beep_init_verbs[] = {
1838 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1842 /* toggle speaker-output according to the hp-jack state */
1843 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1845 unsigned int present;
1848 present = snd_hda_codec_read(codec, 0x14, 0,
1849 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1850 bits = present ? HDA_AMP_MUTE : 0;
1851 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1852 HDA_AMP_MUTE, bits);
1853 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1854 HDA_AMP_MUTE, bits);
1857 /* auto-toggle front mic */
1858 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1860 unsigned int present;
1863 present = snd_hda_codec_read(codec, 0x18, 0,
1864 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1865 bits = present ? HDA_AMP_MUTE : 0;
1866 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1869 static void alc880_uniwill_automute(struct hda_codec *codec)
1871 alc880_uniwill_hp_automute(codec);
1872 alc880_uniwill_mic_automute(codec);
1875 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1878 /* Looks like the unsol event is incompatible with the standard
1879 * definition. 4bit tag is placed at 28 bit!
1881 switch (res >> 28) {
1882 case ALC880_HP_EVENT:
1883 alc880_uniwill_hp_automute(codec);
1885 case ALC880_MIC_EVENT:
1886 alc880_uniwill_mic_automute(codec);
1891 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1893 unsigned int present;
1896 present = snd_hda_codec_read(codec, 0x14, 0,
1897 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1898 bits = present ? HDA_AMP_MUTE : 0;
1899 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1902 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1904 unsigned int present;
1906 present = snd_hda_codec_read(codec, 0x21, 0,
1907 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1908 present &= HDA_AMP_VOLMASK;
1909 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1910 HDA_AMP_VOLMASK, present);
1911 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1912 HDA_AMP_VOLMASK, present);
1915 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1918 /* Looks like the unsol event is incompatible with the standard
1919 * definition. 4bit tag is placed at 28 bit!
1921 if ((res >> 28) == ALC880_HP_EVENT)
1922 alc880_uniwill_p53_hp_automute(codec);
1923 if ((res >> 28) == ALC880_DCVOL_EVENT)
1924 alc880_uniwill_p53_dcvol_automute(codec);
1928 * F1734 pin configuration:
1929 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1931 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1932 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1933 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1934 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1935 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1936 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1939 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1947 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1948 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1950 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1951 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1953 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1954 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1960 * ASUS pin configuration:
1961 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1963 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1964 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1965 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1966 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1967 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1973 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1975 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1976 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1979 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1981 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1982 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1986 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1991 /* Enable GPIO mask and set output */
1992 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1993 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1995 /* Clevo m520g init */
1996 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1997 /* headphone output */
1998 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2006 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2007 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 /* Mic1 (rear panel) */
2009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2010 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2011 /* Mic2 (front panel) */
2012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2013 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2015 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2017 /* change to EAPD mode */
2018 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2019 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2024 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2025 /* change to EAPD mode */
2026 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2027 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2029 /* Headphone output */
2030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2033 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2035 /* Line In pin widget for input */
2036 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2037 /* CD pin widget for input */
2038 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2039 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2040 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2042 /* change to EAPD mode */
2043 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2044 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2050 * LG m1 express dual
2053 * Rear Line-In/Out (blue): 0x14
2054 * Build-in Mic-In: 0x15
2056 * HP-Out (green): 0x1b
2057 * Mic-In/Out (red): 0x19
2061 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2062 static hda_nid_t alc880_lg_dac_nids[3] = {
2066 /* seems analog CD is not working */
2067 static struct hda_input_mux alc880_lg_capture_source = {
2072 { "Internal Mic", 0x6 },
2076 /* 2,4,6 channel modes */
2077 static struct hda_verb alc880_lg_ch2_init[] = {
2078 /* set line-in and mic-in to input */
2079 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2080 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2084 static struct hda_verb alc880_lg_ch4_init[] = {
2085 /* set line-in to out and mic-in to input */
2086 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2087 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2091 static struct hda_verb alc880_lg_ch6_init[] = {
2092 /* set line-in and mic-in to output */
2093 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2098 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2099 { 2, alc880_lg_ch2_init },
2100 { 4, alc880_lg_ch4_init },
2101 { 6, alc880_lg_ch6_init },
2104 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2106 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2107 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2108 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2109 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2110 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2111 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2112 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2116 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2117 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2118 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2121 .name = "Channel Mode",
2122 .info = alc_ch_mode_info,
2123 .get = alc_ch_mode_get,
2124 .put = alc_ch_mode_put,
2129 static struct hda_verb alc880_lg_init_verbs[] = {
2130 /* set capture source to mic-in */
2131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2132 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2134 /* mute all amp mixer inputs */
2135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2138 /* line-in to input */
2139 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2145 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2147 /* mic-in to input */
2148 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2152 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2154 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2156 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2160 /* toggle speaker-output according to the hp-jack state */
2161 static void alc880_lg_automute(struct hda_codec *codec)
2163 unsigned int present;
2166 present = snd_hda_codec_read(codec, 0x1b, 0,
2167 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2168 bits = present ? HDA_AMP_MUTE : 0;
2169 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2170 HDA_AMP_MUTE, bits);
2173 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2175 /* Looks like the unsol event is incompatible with the standard
2176 * definition. 4bit tag is placed at 28 bit!
2178 if ((res >> 28) == 0x01)
2179 alc880_lg_automute(codec);
2188 * Built-in Mic-In: 0x19
2194 static struct hda_input_mux alc880_lg_lw_capture_source = {
2198 { "Internal Mic", 0x1 },
2203 #define alc880_lg_lw_modes alc880_threestack_modes
2205 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2208 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2209 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2210 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2219 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2222 .name = "Channel Mode",
2223 .info = alc_ch_mode_info,
2224 .get = alc_ch_mode_get,
2225 .put = alc_ch_mode_put,
2230 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2231 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2232 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2233 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2235 /* set capture source to mic-in */
2236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2244 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2245 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2246 /* mic-in to input */
2247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2253 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2257 /* toggle speaker-output according to the hp-jack state */
2258 static void alc880_lg_lw_automute(struct hda_codec *codec)
2260 unsigned int present;
2263 present = snd_hda_codec_read(codec, 0x1b, 0,
2264 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2265 bits = present ? HDA_AMP_MUTE : 0;
2266 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2267 HDA_AMP_MUTE, bits);
2270 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2272 /* Looks like the unsol event is incompatible with the standard
2273 * definition. 4bit tag is placed at 28 bit!
2275 if ((res >> 28) == 0x01)
2276 alc880_lg_lw_automute(codec);
2279 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2280 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2281 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2285 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2289 static struct hda_input_mux alc880_medion_rim_capture_source = {
2293 { "Internal Mic", 0x1 },
2297 static struct hda_verb alc880_medion_rim_init_verbs[] = {
2298 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2303 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2304 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2305 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2306 /* Mic2 (as headphone out) for HP output */
2307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2308 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2309 /* Internal Speaker */
2310 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2313 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2314 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2316 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2320 /* toggle speaker-output according to the hp-jack state */
2321 static void alc880_medion_rim_automute(struct hda_codec *codec)
2323 unsigned int present;
2326 present = snd_hda_codec_read(codec, 0x14, 0,
2327 AC_VERB_GET_PIN_SENSE, 0)
2328 & AC_PINSENSE_PRESENCE;
2329 bits = present ? HDA_AMP_MUTE : 0;
2330 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2331 HDA_AMP_MUTE, bits);
2333 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2335 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
2338 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2341 /* Looks like the unsol event is incompatible with the standard
2342 * definition. 4bit tag is placed at 28 bit!
2344 if ((res >> 28) == ALC880_HP_EVENT)
2345 alc880_medion_rim_automute(codec);
2348 #ifdef CONFIG_SND_HDA_POWER_SAVE
2349 static struct hda_amp_list alc880_loopbacks[] = {
2350 { 0x0b, HDA_INPUT, 0 },
2351 { 0x0b, HDA_INPUT, 1 },
2352 { 0x0b, HDA_INPUT, 2 },
2353 { 0x0b, HDA_INPUT, 3 },
2354 { 0x0b, HDA_INPUT, 4 },
2358 static struct hda_amp_list alc880_lg_loopbacks[] = {
2359 { 0x0b, HDA_INPUT, 1 },
2360 { 0x0b, HDA_INPUT, 6 },
2361 { 0x0b, HDA_INPUT, 7 },
2370 static int alc_init(struct hda_codec *codec)
2372 struct alc_spec *spec = codec->spec;
2375 for (i = 0; i < spec->num_init_verbs; i++)
2376 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2378 if (spec->init_hook)
2379 spec->init_hook(codec);
2384 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2386 struct alc_spec *spec = codec->spec;
2388 if (spec->unsol_event)
2389 spec->unsol_event(codec, res);
2392 #ifdef CONFIG_SND_HDA_POWER_SAVE
2393 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2395 struct alc_spec *spec = codec->spec;
2396 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2401 * Analog playback callbacks
2403 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2404 struct hda_codec *codec,
2405 struct snd_pcm_substream *substream)
2407 struct alc_spec *spec = codec->spec;
2408 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2412 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2413 struct hda_codec *codec,
2414 unsigned int stream_tag,
2415 unsigned int format,
2416 struct snd_pcm_substream *substream)
2418 struct alc_spec *spec = codec->spec;
2419 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2420 stream_tag, format, substream);
2423 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2424 struct hda_codec *codec,
2425 struct snd_pcm_substream *substream)
2427 struct alc_spec *spec = codec->spec;
2428 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2434 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2435 struct hda_codec *codec,
2436 struct snd_pcm_substream *substream)
2438 struct alc_spec *spec = codec->spec;
2439 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2442 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2443 struct hda_codec *codec,
2444 unsigned int stream_tag,
2445 unsigned int format,
2446 struct snd_pcm_substream *substream)
2448 struct alc_spec *spec = codec->spec;
2449 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2450 stream_tag, format, substream);
2453 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2454 struct hda_codec *codec,
2455 struct snd_pcm_substream *substream)
2457 struct alc_spec *spec = codec->spec;
2458 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2464 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2465 struct hda_codec *codec,
2466 unsigned int stream_tag,
2467 unsigned int format,
2468 struct snd_pcm_substream *substream)
2470 struct alc_spec *spec = codec->spec;
2472 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2473 stream_tag, 0, format);
2477 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2478 struct hda_codec *codec,
2479 struct snd_pcm_substream *substream)
2481 struct alc_spec *spec = codec->spec;
2483 snd_hda_codec_cleanup_stream(codec,
2484 spec->adc_nids[substream->number + 1]);
2491 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2495 /* NID is set in alc_build_pcms */
2497 .open = alc880_playback_pcm_open,
2498 .prepare = alc880_playback_pcm_prepare,
2499 .cleanup = alc880_playback_pcm_cleanup
2503 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2507 /* NID is set in alc_build_pcms */
2510 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2514 /* NID is set in alc_build_pcms */
2517 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2518 .substreams = 2, /* can be overridden */
2521 /* NID is set in alc_build_pcms */
2523 .prepare = alc880_alt_capture_pcm_prepare,
2524 .cleanup = alc880_alt_capture_pcm_cleanup
2528 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2532 /* NID is set in alc_build_pcms */
2534 .open = alc880_dig_playback_pcm_open,
2535 .close = alc880_dig_playback_pcm_close,
2536 .prepare = alc880_dig_playback_pcm_prepare
2540 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2544 /* NID is set in alc_build_pcms */
2547 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2548 static struct hda_pcm_stream alc_pcm_null_stream = {
2554 static int alc_build_pcms(struct hda_codec *codec)
2556 struct alc_spec *spec = codec->spec;
2557 struct hda_pcm *info = spec->pcm_rec;
2560 codec->num_pcms = 1;
2561 codec->pcm_info = info;
2563 info->name = spec->stream_name_analog;
2564 if (spec->stream_analog_playback) {
2565 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2566 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2567 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2569 if (spec->stream_analog_capture) {
2570 snd_assert(spec->adc_nids, return -EINVAL);
2571 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2572 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2575 if (spec->channel_mode) {
2576 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2577 for (i = 0; i < spec->num_channel_mode; i++) {
2578 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2579 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2584 /* SPDIF for stream index #1 */
2585 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2586 codec->num_pcms = 2;
2587 info = spec->pcm_rec + 1;
2588 info->name = spec->stream_name_digital;
2589 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2590 if (spec->multiout.dig_out_nid &&
2591 spec->stream_digital_playback) {
2592 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2593 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2595 if (spec->dig_in_nid &&
2596 spec->stream_digital_capture) {
2597 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2598 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2602 /* If the use of more than one ADC is requested for the current
2603 * model, configure a second analog capture-only PCM.
2605 /* Additional Analaog capture for index #2 */
2606 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2607 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2608 codec->num_pcms = 3;
2609 info = spec->pcm_rec + 2;
2610 info->name = spec->stream_name_analog;
2611 if (spec->alt_dac_nid) {
2612 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2613 *spec->stream_analog_alt_playback;
2614 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2617 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2618 alc_pcm_null_stream;
2619 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2621 if (spec->num_adc_nids > 1) {
2622 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2623 *spec->stream_analog_alt_capture;
2624 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2626 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2627 spec->num_adc_nids - 1;
2629 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2630 alc_pcm_null_stream;
2631 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2638 static void alc_free(struct hda_codec *codec)
2640 struct alc_spec *spec = codec->spec;
2646 if (spec->kctl_alloc) {
2647 for (i = 0; i < spec->num_kctl_used; i++)
2648 kfree(spec->kctl_alloc[i].name);
2649 kfree(spec->kctl_alloc);
2652 codec->spec = NULL; /* to be sure */
2657 static struct hda_codec_ops alc_patch_ops = {
2658 .build_controls = alc_build_controls,
2659 .build_pcms = alc_build_pcms,
2662 .unsol_event = alc_unsol_event,
2663 #ifdef CONFIG_SND_HDA_POWER_SAVE
2664 .check_power_status = alc_check_power_status,
2670 * Test configuration for debugging
2672 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2675 #ifdef CONFIG_SND_DEBUG
2676 static hda_nid_t alc880_test_dac_nids[4] = {
2677 0x02, 0x03, 0x04, 0x05
2680 static struct hda_input_mux alc880_test_capture_source = {
2689 { "Surround", 0x6 },
2693 static struct hda_channel_mode alc880_test_modes[4] = {
2700 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2701 struct snd_ctl_elem_info *uinfo)
2703 static char *texts[] = {
2704 "N/A", "Line Out", "HP Out",
2705 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2707 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2709 uinfo->value.enumerated.items = 8;
2710 if (uinfo->value.enumerated.item >= 8)
2711 uinfo->value.enumerated.item = 7;
2712 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2716 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2717 struct snd_ctl_elem_value *ucontrol)
2719 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2720 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2721 unsigned int pin_ctl, item = 0;
2723 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2724 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2725 if (pin_ctl & AC_PINCTL_OUT_EN) {
2726 if (pin_ctl & AC_PINCTL_HP_EN)
2730 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2731 switch (pin_ctl & AC_PINCTL_VREFEN) {
2732 case AC_PINCTL_VREF_HIZ: item = 3; break;
2733 case AC_PINCTL_VREF_50: item = 4; break;
2734 case AC_PINCTL_VREF_GRD: item = 5; break;
2735 case AC_PINCTL_VREF_80: item = 6; break;
2736 case AC_PINCTL_VREF_100: item = 7; break;
2739 ucontrol->value.enumerated.item[0] = item;
2743 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2744 struct snd_ctl_elem_value *ucontrol)
2746 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2747 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2748 static unsigned int ctls[] = {
2749 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2750 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2751 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2752 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2753 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2754 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2756 unsigned int old_ctl, new_ctl;
2758 old_ctl = snd_hda_codec_read(codec, nid, 0,
2759 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2760 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2761 if (old_ctl != new_ctl) {
2763 snd_hda_codec_write_cache(codec, nid, 0,
2764 AC_VERB_SET_PIN_WIDGET_CONTROL,
2766 val = ucontrol->value.enumerated.item[0] >= 3 ?
2768 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2775 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2776 struct snd_ctl_elem_info *uinfo)
2778 static char *texts[] = {
2779 "Front", "Surround", "CLFE", "Side"
2781 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2783 uinfo->value.enumerated.items = 4;
2784 if (uinfo->value.enumerated.item >= 4)
2785 uinfo->value.enumerated.item = 3;
2786 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2790 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2791 struct snd_ctl_elem_value *ucontrol)
2793 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2794 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2797 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2798 ucontrol->value.enumerated.item[0] = sel & 3;
2802 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2803 struct snd_ctl_elem_value *ucontrol)
2805 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2806 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2809 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2810 if (ucontrol->value.enumerated.item[0] != sel) {
2811 sel = ucontrol->value.enumerated.item[0] & 3;
2812 snd_hda_codec_write_cache(codec, nid, 0,
2813 AC_VERB_SET_CONNECT_SEL, sel);
2819 #define PIN_CTL_TEST(xname,nid) { \
2820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2822 .info = alc_test_pin_ctl_info, \
2823 .get = alc_test_pin_ctl_get, \
2824 .put = alc_test_pin_ctl_put, \
2825 .private_value = nid \
2828 #define PIN_SRC_TEST(xname,nid) { \
2829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2831 .info = alc_test_pin_src_info, \
2832 .get = alc_test_pin_src_get, \
2833 .put = alc_test_pin_src_put, \
2834 .private_value = nid \
2837 static struct snd_kcontrol_new alc880_test_mixer[] = {
2838 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2839 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2840 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2841 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2842 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2843 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2844 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2845 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2846 PIN_CTL_TEST("Front Pin Mode", 0x14),
2847 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2848 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2849 PIN_CTL_TEST("Side Pin Mode", 0x17),
2850 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2851 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2852 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2853 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2854 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2855 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2856 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2857 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2858 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2859 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2860 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2861 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2862 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2863 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2864 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2865 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2870 .name = "Channel Mode",
2871 .info = alc_ch_mode_info,
2872 .get = alc_ch_mode_get,
2873 .put = alc_ch_mode_put,
2878 static struct hda_verb alc880_test_init_verbs[] = {
2879 /* Unmute inputs of 0x0c - 0x0f */
2880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2882 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2884 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2886 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2888 /* Vol output for 0x0c-0x0f */
2889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2892 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2893 /* Set output pins 0x14-0x17 */
2894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2897 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2898 /* Unmute output pins 0x14-0x17 */
2899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2901 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2902 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2903 /* Set input pins 0x18-0x1c */
2904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2906 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2907 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2908 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2909 /* Mute input pins 0x18-0x1b */
2910 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2911 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2913 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2916 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2918 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2920 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2921 /* Analog input/passthru */
2922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2934 static const char *alc880_models[ALC880_MODEL_LAST] = {
2935 [ALC880_3ST] = "3stack",
2936 [ALC880_TCL_S700] = "tcl",
2937 [ALC880_3ST_DIG] = "3stack-digout",
2938 [ALC880_CLEVO] = "clevo",
2939 [ALC880_5ST] = "5stack",
2940 [ALC880_5ST_DIG] = "5stack-digout",
2941 [ALC880_W810] = "w810",
2942 [ALC880_Z71V] = "z71v",
2943 [ALC880_6ST] = "6stack",
2944 [ALC880_6ST_DIG] = "6stack-digout",
2945 [ALC880_ASUS] = "asus",
2946 [ALC880_ASUS_W1V] = "asus-w1v",
2947 [ALC880_ASUS_DIG] = "asus-dig",
2948 [ALC880_ASUS_DIG2] = "asus-dig2",
2949 [ALC880_UNIWILL_DIG] = "uniwill",
2950 [ALC880_UNIWILL_P53] = "uniwill-p53",
2951 [ALC880_FUJITSU] = "fujitsu",
2952 [ALC880_F1734] = "F1734",
2954 [ALC880_LG_LW] = "lg-lw",
2955 [ALC880_MEDION_RIM] = "medion",
2956 #ifdef CONFIG_SND_DEBUG
2957 [ALC880_TEST] = "test",
2959 [ALC880_AUTO] = "auto",
2962 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2963 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2964 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2965 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2966 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2967 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2968 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2969 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2970 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2971 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2972 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2973 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2974 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2975 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2976 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2977 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2978 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2979 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2980 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2981 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2982 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2983 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2984 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2985 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2986 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2987 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2988 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2989 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2990 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2991 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2992 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2993 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2994 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2995 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2996 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2997 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2998 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2999 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3000 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3001 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3002 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3003 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3004 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3005 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3006 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3007 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3008 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3009 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3010 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3011 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3012 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3013 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3014 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3015 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3016 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3017 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3018 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3019 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3020 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3021 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3022 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3023 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3024 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3025 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3026 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3027 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3028 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3029 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3030 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
3031 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3032 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3037 * ALC880 codec presets
3039 static struct alc_config_preset alc880_presets[] = {
3041 .mixers = { alc880_three_stack_mixer },
3042 .init_verbs = { alc880_volume_init_verbs,
3043 alc880_pin_3stack_init_verbs },
3044 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3045 .dac_nids = alc880_dac_nids,
3046 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3047 .channel_mode = alc880_threestack_modes,
3049 .input_mux = &alc880_capture_source,
3051 [ALC880_3ST_DIG] = {
3052 .mixers = { alc880_three_stack_mixer },
3053 .init_verbs = { alc880_volume_init_verbs,
3054 alc880_pin_3stack_init_verbs },
3055 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3056 .dac_nids = alc880_dac_nids,
3057 .dig_out_nid = ALC880_DIGOUT_NID,
3058 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3059 .channel_mode = alc880_threestack_modes,
3061 .input_mux = &alc880_capture_source,
3063 [ALC880_TCL_S700] = {
3064 .mixers = { alc880_tcl_s700_mixer },
3065 .init_verbs = { alc880_volume_init_verbs,
3066 alc880_pin_tcl_S700_init_verbs,
3067 alc880_gpio2_init_verbs },
3068 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3069 .dac_nids = alc880_dac_nids,
3071 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3072 .channel_mode = alc880_2_jack_modes,
3073 .input_mux = &alc880_capture_source,
3076 .mixers = { alc880_three_stack_mixer,
3077 alc880_five_stack_mixer},
3078 .init_verbs = { alc880_volume_init_verbs,
3079 alc880_pin_5stack_init_verbs },
3080 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3081 .dac_nids = alc880_dac_nids,
3082 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3083 .channel_mode = alc880_fivestack_modes,
3084 .input_mux = &alc880_capture_source,
3086 [ALC880_5ST_DIG] = {
3087 .mixers = { alc880_three_stack_mixer,
3088 alc880_five_stack_mixer },
3089 .init_verbs = { alc880_volume_init_verbs,
3090 alc880_pin_5stack_init_verbs },
3091 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3092 .dac_nids = alc880_dac_nids,
3093 .dig_out_nid = ALC880_DIGOUT_NID,
3094 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3095 .channel_mode = alc880_fivestack_modes,
3096 .input_mux = &alc880_capture_source,
3099 .mixers = { alc880_six_stack_mixer },
3100 .init_verbs = { alc880_volume_init_verbs,
3101 alc880_pin_6stack_init_verbs },
3102 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3103 .dac_nids = alc880_6st_dac_nids,
3104 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3105 .channel_mode = alc880_sixstack_modes,
3106 .input_mux = &alc880_6stack_capture_source,
3108 [ALC880_6ST_DIG] = {
3109 .mixers = { alc880_six_stack_mixer },
3110 .init_verbs = { alc880_volume_init_verbs,
3111 alc880_pin_6stack_init_verbs },
3112 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3113 .dac_nids = alc880_6st_dac_nids,
3114 .dig_out_nid = ALC880_DIGOUT_NID,
3115 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3116 .channel_mode = alc880_sixstack_modes,
3117 .input_mux = &alc880_6stack_capture_source,
3120 .mixers = { alc880_w810_base_mixer },
3121 .init_verbs = { alc880_volume_init_verbs,
3122 alc880_pin_w810_init_verbs,
3123 alc880_gpio2_init_verbs },
3124 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3125 .dac_nids = alc880_w810_dac_nids,
3126 .dig_out_nid = ALC880_DIGOUT_NID,
3127 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3128 .channel_mode = alc880_w810_modes,
3129 .input_mux = &alc880_capture_source,
3132 .mixers = { alc880_z71v_mixer },
3133 .init_verbs = { alc880_volume_init_verbs,
3134 alc880_pin_z71v_init_verbs },
3135 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3136 .dac_nids = alc880_z71v_dac_nids,
3137 .dig_out_nid = ALC880_DIGOUT_NID,
3139 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3140 .channel_mode = alc880_2_jack_modes,
3141 .input_mux = &alc880_capture_source,
3144 .mixers = { alc880_f1734_mixer },
3145 .init_verbs = { alc880_volume_init_verbs,
3146 alc880_pin_f1734_init_verbs },
3147 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3148 .dac_nids = alc880_f1734_dac_nids,
3150 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3151 .channel_mode = alc880_2_jack_modes,
3152 .input_mux = &alc880_f1734_capture_source,
3153 .unsol_event = alc880_uniwill_p53_unsol_event,
3154 .init_hook = alc880_uniwill_p53_hp_automute,
3157 .mixers = { alc880_asus_mixer },
3158 .init_verbs = { alc880_volume_init_verbs,
3159 alc880_pin_asus_init_verbs,
3160 alc880_gpio1_init_verbs },
3161 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3162 .dac_nids = alc880_asus_dac_nids,
3163 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3164 .channel_mode = alc880_asus_modes,
3166 .input_mux = &alc880_capture_source,
3168 [ALC880_ASUS_DIG] = {
3169 .mixers = { alc880_asus_mixer },
3170 .init_verbs = { alc880_volume_init_verbs,
3171 alc880_pin_asus_init_verbs,
3172 alc880_gpio1_init_verbs },
3173 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3174 .dac_nids = alc880_asus_dac_nids,
3175 .dig_out_nid = ALC880_DIGOUT_NID,
3176 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3177 .channel_mode = alc880_asus_modes,
3179 .input_mux = &alc880_capture_source,
3181 [ALC880_ASUS_DIG2] = {
3182 .mixers = { alc880_asus_mixer },
3183 .init_verbs = { alc880_volume_init_verbs,
3184 alc880_pin_asus_init_verbs,
3185 alc880_gpio2_init_verbs }, /* use GPIO2 */
3186 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3187 .dac_nids = alc880_asus_dac_nids,
3188 .dig_out_nid = ALC880_DIGOUT_NID,
3189 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3190 .channel_mode = alc880_asus_modes,
3192 .input_mux = &alc880_capture_source,
3194 [ALC880_ASUS_W1V] = {
3195 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3196 .init_verbs = { alc880_volume_init_verbs,
3197 alc880_pin_asus_init_verbs,
3198 alc880_gpio1_init_verbs },
3199 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3200 .dac_nids = alc880_asus_dac_nids,
3201 .dig_out_nid = ALC880_DIGOUT_NID,
3202 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3203 .channel_mode = alc880_asus_modes,
3205 .input_mux = &alc880_capture_source,
3207 [ALC880_UNIWILL_DIG] = {
3208 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3209 .init_verbs = { alc880_volume_init_verbs,
3210 alc880_pin_asus_init_verbs },
3211 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3212 .dac_nids = alc880_asus_dac_nids,
3213 .dig_out_nid = ALC880_DIGOUT_NID,
3214 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3215 .channel_mode = alc880_asus_modes,
3217 .input_mux = &alc880_capture_source,
3219 [ALC880_UNIWILL] = {
3220 .mixers = { alc880_uniwill_mixer },
3221 .init_verbs = { alc880_volume_init_verbs,
3222 alc880_uniwill_init_verbs },
3223 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3224 .dac_nids = alc880_asus_dac_nids,
3225 .dig_out_nid = ALC880_DIGOUT_NID,
3226 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3227 .channel_mode = alc880_threestack_modes,
3229 .input_mux = &alc880_capture_source,
3230 .unsol_event = alc880_uniwill_unsol_event,
3231 .init_hook = alc880_uniwill_automute,
3233 [ALC880_UNIWILL_P53] = {
3234 .mixers = { alc880_uniwill_p53_mixer },
3235 .init_verbs = { alc880_volume_init_verbs,
3236 alc880_uniwill_p53_init_verbs },
3237 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3238 .dac_nids = alc880_asus_dac_nids,
3239 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3240 .channel_mode = alc880_threestack_modes,
3241 .input_mux = &alc880_capture_source,
3242 .unsol_event = alc880_uniwill_p53_unsol_event,
3243 .init_hook = alc880_uniwill_p53_hp_automute,
3245 [ALC880_FUJITSU] = {
3246 .mixers = { alc880_fujitsu_mixer,
3247 alc880_pcbeep_mixer, },
3248 .init_verbs = { alc880_volume_init_verbs,
3249 alc880_uniwill_p53_init_verbs,
3250 alc880_beep_init_verbs },
3251 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3252 .dac_nids = alc880_dac_nids,
3253 .dig_out_nid = ALC880_DIGOUT_NID,
3254 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3255 .channel_mode = alc880_2_jack_modes,
3256 .input_mux = &alc880_capture_source,
3257 .unsol_event = alc880_uniwill_p53_unsol_event,
3258 .init_hook = alc880_uniwill_p53_hp_automute,
3261 .mixers = { alc880_three_stack_mixer },
3262 .init_verbs = { alc880_volume_init_verbs,
3263 alc880_pin_clevo_init_verbs },
3264 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3265 .dac_nids = alc880_dac_nids,
3267 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3268 .channel_mode = alc880_threestack_modes,
3270 .input_mux = &alc880_capture_source,
3273 .mixers = { alc880_lg_mixer },
3274 .init_verbs = { alc880_volume_init_verbs,
3275 alc880_lg_init_verbs },
3276 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3277 .dac_nids = alc880_lg_dac_nids,
3278 .dig_out_nid = ALC880_DIGOUT_NID,
3279 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3280 .channel_mode = alc880_lg_ch_modes,
3282 .input_mux = &alc880_lg_capture_source,
3283 .unsol_event = alc880_lg_unsol_event,
3284 .init_hook = alc880_lg_automute,
3285 #ifdef CONFIG_SND_HDA_POWER_SAVE
3286 .loopbacks = alc880_lg_loopbacks,
3290 .mixers = { alc880_lg_lw_mixer },
3291 .init_verbs = { alc880_volume_init_verbs,
3292 alc880_lg_lw_init_verbs },
3293 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3294 .dac_nids = alc880_dac_nids,
3295 .dig_out_nid = ALC880_DIGOUT_NID,
3296 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3297 .channel_mode = alc880_lg_lw_modes,
3298 .input_mux = &alc880_lg_lw_capture_source,
3299 .unsol_event = alc880_lg_lw_unsol_event,
3300 .init_hook = alc880_lg_lw_automute,
3302 [ALC880_MEDION_RIM] = {
3303 .mixers = { alc880_medion_rim_mixer },
3304 .init_verbs = { alc880_volume_init_verbs,
3305 alc880_medion_rim_init_verbs,
3306 alc_gpio2_init_verbs },
3307 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3308 .dac_nids = alc880_dac_nids,
3309 .dig_out_nid = ALC880_DIGOUT_NID,
3310 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3311 .channel_mode = alc880_2_jack_modes,
3312 .input_mux = &alc880_medion_rim_capture_source,
3313 .unsol_event = alc880_medion_rim_unsol_event,
3314 .init_hook = alc880_medion_rim_automute,
3316 #ifdef CONFIG_SND_DEBUG
3318 .mixers = { alc880_test_mixer },
3319 .init_verbs = { alc880_test_init_verbs },
3320 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3321 .dac_nids = alc880_test_dac_nids,
3322 .dig_out_nid = ALC880_DIGOUT_NID,
3323 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3324 .channel_mode = alc880_test_modes,
3325 .input_mux = &alc880_test_capture_source,
3331 * Automatic parse of I/O pins from the BIOS configuration
3334 #define NUM_CONTROL_ALLOC 32
3335 #define NUM_VERB_ALLOC 32
3339 ALC_CTL_WIDGET_MUTE,
3342 static struct snd_kcontrol_new alc880_control_templates[] = {
3343 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3344 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3345 HDA_BIND_MUTE(NULL, 0, 0, 0),
3348 /* add dynamic controls */
3349 static int add_control(struct alc_spec *spec, int type, const char *name,
3352 struct snd_kcontrol_new *knew;
3354 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3355 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3357 /* array + terminator */
3358 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3361 if (spec->kctl_alloc) {
3362 memcpy(knew, spec->kctl_alloc,
3363 sizeof(*knew) * spec->num_kctl_alloc);
3364 kfree(spec->kctl_alloc);
3366 spec->kctl_alloc = knew;
3367 spec->num_kctl_alloc = num;
3370 knew = &spec->kctl_alloc[spec->num_kctl_used];
3371 *knew = alc880_control_templates[type];
3372 knew->name = kstrdup(name, GFP_KERNEL);
3375 knew->private_value = val;
3376 spec->num_kctl_used++;
3380 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3381 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3382 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3383 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3384 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3385 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3386 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3387 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3388 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3389 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3390 #define ALC880_PIN_CD_NID 0x1c
3392 /* fill in the dac_nids table from the parsed pin configuration */
3393 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3394 const struct auto_pin_cfg *cfg)
3400 memset(assigned, 0, sizeof(assigned));
3401 spec->multiout.dac_nids = spec->private_dac_nids;
3403 /* check the pins hardwired to audio widget */
3404 for (i = 0; i < cfg->line_outs; i++) {
3405 nid = cfg->line_out_pins[i];
3406 if (alc880_is_fixed_pin(nid)) {
3407 int idx = alc880_fixed_pin_idx(nid);
3408 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3412 /* left pins can be connect to any audio widget */
3413 for (i = 0; i < cfg->line_outs; i++) {
3414 nid = cfg->line_out_pins[i];
3415 if (alc880_is_fixed_pin(nid))
3417 /* search for an empty channel */
3418 for (j = 0; j < cfg->line_outs; j++) {
3420 spec->multiout.dac_nids[i] =
3421 alc880_idx_to_dac(j);
3427 spec->multiout.num_dacs = cfg->line_outs;
3431 /* add playback controls from the parsed DAC table */
3432 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3433 const struct auto_pin_cfg *cfg)
3436 static const char *chname[4] = {
3437 "Front", "Surround", NULL /*CLFE*/, "Side"
3442 for (i = 0; i < cfg->line_outs; i++) {
3443 if (!spec->multiout.dac_nids[i])
3445 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3448 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3449 "Center Playback Volume",
3450 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3454 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3455 "LFE Playback Volume",
3456 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3460 err = add_control(spec, ALC_CTL_BIND_MUTE,
3461 "Center Playback Switch",
3462 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3466 err = add_control(spec, ALC_CTL_BIND_MUTE,
3467 "LFE Playback Switch",
3468 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3473 sprintf(name, "%s Playback Volume", chname[i]);
3474 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3475 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3479 sprintf(name, "%s Playback Switch", chname[i]);
3480 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3481 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3490 /* add playback controls for speaker and HP outputs */
3491 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3501 if (alc880_is_fixed_pin(pin)) {
3502 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3503 /* specify the DAC as the extra output */
3504 if (!spec->multiout.hp_nid)
3505 spec->multiout.hp_nid = nid;
3507 spec->multiout.extra_out_nid[0] = nid;
3508 /* control HP volume/switch on the output mixer amp */
3509 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3510 sprintf(name, "%s Playback Volume", pfx);
3511 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3512 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3515 sprintf(name, "%s Playback Switch", pfx);
3516 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3517 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3520 } else if (alc880_is_multi_pin(pin)) {
3521 /* set manual connection */
3522 /* we have only a switch on HP-out PIN */
3523 sprintf(name, "%s Playback Switch", pfx);
3524 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3525 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3532 /* create input playback/capture controls for the given pin */
3533 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3534 const char *ctlname,
3535 int idx, hda_nid_t mix_nid)
3540 sprintf(name, "%s Playback Volume", ctlname);
3541 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3542 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3545 sprintf(name, "%s Playback Switch", ctlname);
3546 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3547 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3553 /* create playback/capture controls for input pins */
3554 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3555 const struct auto_pin_cfg *cfg)
3557 struct hda_input_mux *imux = &spec->private_imux;
3560 for (i = 0; i < AUTO_PIN_LAST; i++) {
3561 if (alc880_is_input_pin(cfg->input_pins[i])) {
3562 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3563 err = new_analog_input(spec, cfg->input_pins[i],
3564 auto_pin_cfg_labels[i],
3568 imux->items[imux->num_items].label =
3569 auto_pin_cfg_labels[i];
3570 imux->items[imux->num_items].index =
3571 alc880_input_pin_idx(cfg->input_pins[i]);
3578 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3579 unsigned int pin_type)
3581 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3584 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3588 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3589 hda_nid_t nid, int pin_type,
3592 alc_set_pin_output(codec, nid, pin_type);
3593 /* need the manual connection? */
3594 if (alc880_is_multi_pin(nid)) {
3595 struct alc_spec *spec = codec->spec;
3596 int idx = alc880_multi_pin_idx(nid);
3597 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3598 AC_VERB_SET_CONNECT_SEL,
3599 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3603 static int get_pin_type(int line_out_type)
3605 if (line_out_type == AUTO_PIN_HP_OUT)
3611 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3613 struct alc_spec *spec = codec->spec;
3616 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3617 for (i = 0; i < spec->autocfg.line_outs; i++) {
3618 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3619 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3620 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3624 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3626 struct alc_spec *spec = codec->spec;
3629 pin = spec->autocfg.speaker_pins[0];
3630 if (pin) /* connect to front */
3631 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3632 pin = spec->autocfg.hp_pins[0];
3633 if (pin) /* connect to front */
3634 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3637 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3639 struct alc_spec *spec = codec->spec;
3642 for (i = 0; i < AUTO_PIN_LAST; i++) {
3643 hda_nid_t nid = spec->autocfg.input_pins[i];
3644 if (alc880_is_input_pin(nid)) {
3645 snd_hda_codec_write(codec, nid, 0,
3646 AC_VERB_SET_PIN_WIDGET_CONTROL,
3647 i <= AUTO_PIN_FRONT_MIC ?
3648 PIN_VREF80 : PIN_IN);
3649 if (nid != ALC880_PIN_CD_NID)
3650 snd_hda_codec_write(codec, nid, 0,
3651 AC_VERB_SET_AMP_GAIN_MUTE,
3657 /* parse the BIOS configuration and set up the alc_spec */
3658 /* return 1 if successful, 0 if the proper config is not found,
3659 * or a negative error code
3661 static int alc880_parse_auto_config(struct hda_codec *codec)
3663 struct alc_spec *spec = codec->spec;
3665 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3667 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3671 if (!spec->autocfg.line_outs)
3672 return 0; /* can't find valid BIOS pin config */
3674 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3677 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3680 err = alc880_auto_create_extra_out(spec,
3681 spec->autocfg.speaker_pins[0],
3685 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3689 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3693 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3695 if (spec->autocfg.dig_out_pin)
3696 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3697 if (spec->autocfg.dig_in_pin)
3698 spec->dig_in_nid = ALC880_DIGIN_NID;
3700 if (spec->kctl_alloc)
3701 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3703 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3705 spec->num_mux_defs = 1;
3706 spec->input_mux = &spec->private_imux;
3711 /* additional initialization for auto-configuration model */
3712 static void alc880_auto_init(struct hda_codec *codec)
3714 struct alc_spec *spec = codec->spec;
3715 alc880_auto_init_multi_out(codec);
3716 alc880_auto_init_extra_out(codec);
3717 alc880_auto_init_analog_input(codec);
3718 if (spec->unsol_event)
3719 alc_sku_automute(codec);
3723 * OK, here we have finally the patch for ALC880
3726 static int patch_alc880(struct hda_codec *codec)
3728 struct alc_spec *spec;
3732 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3738 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3741 if (board_config < 0) {
3742 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3743 "trying auto-probe from BIOS...\n");
3744 board_config = ALC880_AUTO;
3747 if (board_config == ALC880_AUTO) {
3748 /* automatic parse from the BIOS config */
3749 err = alc880_parse_auto_config(codec);
3755 "hda_codec: Cannot set up configuration "
3756 "from BIOS. Using 3-stack mode...\n");
3757 board_config = ALC880_3ST;
3761 if (board_config != ALC880_AUTO)
3762 setup_preset(spec, &alc880_presets[board_config]);
3764 spec->stream_name_analog = "ALC880 Analog";
3765 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3766 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3767 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3769 spec->stream_name_digital = "ALC880 Digital";
3770 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3771 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3773 if (!spec->adc_nids && spec->input_mux) {
3774 /* check whether NID 0x07 is valid */
3775 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3777 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3778 if (wcap != AC_WID_AUD_IN) {
3779 spec->adc_nids = alc880_adc_nids_alt;
3780 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3781 spec->mixers[spec->num_mixers] =
3782 alc880_capture_alt_mixer;
3785 spec->adc_nids = alc880_adc_nids;
3786 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3787 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3792 spec->vmaster_nid = 0x0c;
3794 codec->patch_ops = alc_patch_ops;
3795 if (board_config == ALC880_AUTO)
3796 spec->init_hook = alc880_auto_init;
3797 #ifdef CONFIG_SND_HDA_POWER_SAVE
3798 if (!spec->loopback.amplist)
3799 spec->loopback.amplist = alc880_loopbacks;
3810 static hda_nid_t alc260_dac_nids[1] = {
3815 static hda_nid_t alc260_adc_nids[1] = {
3820 static hda_nid_t alc260_adc_nids_alt[1] = {
3825 static hda_nid_t alc260_hp_adc_nids[2] = {
3830 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3831 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3833 static hda_nid_t alc260_dual_adc_nids[2] = {
3838 #define ALC260_DIGOUT_NID 0x03
3839 #define ALC260_DIGIN_NID 0x06
3841 static struct hda_input_mux alc260_capture_source = {
3845 { "Front Mic", 0x1 },
3851 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3852 * headphone jack and the internal CD lines since these are the only pins at
3853 * which audio can appear. For flexibility, also allow the option of
3854 * recording the mixer output on the second ADC (ADC0 doesn't have a
3855 * connection to the mixer output).
3857 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3861 { "Mic/Line", 0x0 },
3863 { "Headphone", 0x2 },
3869 { "Mic/Line", 0x0 },
3871 { "Headphone", 0x2 },
3878 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3879 * the Fujitsu S702x, but jacks are marked differently.
3881 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3888 { "Headphone", 0x5 },
3897 { "Headphone", 0x6 },
3903 * This is just place-holder, so there's something for alc_build_pcms to look
3904 * at when it calculates the maximum number of channels. ALC260 has no mixer
3905 * element which allows changing the channel mode, so the verb list is
3908 static struct hda_channel_mode alc260_modes[1] = {
3913 /* Mixer combinations
3915 * basic: base_output + input + pc_beep + capture
3916 * HP: base_output + input + capture_alt
3917 * HP_3013: hp_3013 + input + capture
3918 * fujitsu: fujitsu + capture
3919 * acer: acer + capture
3922 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3923 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3924 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3925 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3926 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3927 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3928 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3932 static struct snd_kcontrol_new alc260_input_mixer[] = {
3933 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3934 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3935 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3936 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3938 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3944 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3945 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3946 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3950 /* update HP, line and mono out pins according to the master switch */
3951 static void alc260_hp_master_update(struct hda_codec *codec,
3952 hda_nid_t hp, hda_nid_t line,
3955 struct alc_spec *spec = codec->spec;
3956 unsigned int val = spec->master_sw ? PIN_HP : 0;
3957 /* change HP and line-out pins */
3958 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3960 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3962 /* mono (speaker) depending on the HP jack sense */
3963 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3964 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3968 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3969 struct snd_ctl_elem_value *ucontrol)
3971 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3972 struct alc_spec *spec = codec->spec;
3973 *ucontrol->value.integer.value = spec->master_sw;
3977 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3978 struct snd_ctl_elem_value *ucontrol)
3980 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3981 struct alc_spec *spec = codec->spec;
3982 int val = !!*ucontrol->value.integer.value;
3983 hda_nid_t hp, line, mono;
3985 if (val == spec->master_sw)
3987 spec->master_sw = val;
3988 hp = (kcontrol->private_value >> 16) & 0xff;
3989 line = (kcontrol->private_value >> 8) & 0xff;
3990 mono = kcontrol->private_value & 0xff;
3991 alc260_hp_master_update(codec, hp, line, mono);
3995 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
3997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3998 .name = "Master Playback Switch",
3999 .info = snd_ctl_boolean_mono_info,
4000 .get = alc260_hp_master_sw_get,
4001 .put = alc260_hp_master_sw_put,
4002 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4004 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4005 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4007 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4008 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4010 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4014 static struct hda_verb alc260_hp_unsol_verbs[] = {
4015 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4019 static void alc260_hp_automute(struct hda_codec *codec)
4021 struct alc_spec *spec = codec->spec;
4022 unsigned int present;
4024 present = snd_hda_codec_read(codec, 0x10, 0,
4025 AC_VERB_GET_PIN_SENSE, 0);
4026 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4027 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4030 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4032 if ((res >> 26) == ALC880_HP_EVENT)
4033 alc260_hp_automute(codec);
4036 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4038 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4039 .name = "Master Playback Switch",
4040 .info = snd_ctl_boolean_mono_info,
4041 .get = alc260_hp_master_sw_get,
4042 .put = alc260_hp_master_sw_put,
4043 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
4045 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4046 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4047 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4048 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4049 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4051 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4052 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4056 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4061 static void alc260_hp_3013_automute(struct hda_codec *codec)
4063 struct alc_spec *spec = codec->spec;
4064 unsigned int present;
4066 present = snd_hda_codec_read(codec, 0x15, 0,
4067 AC_VERB_GET_PIN_SENSE, 0);
4068 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4069 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
4072 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4075 if ((res >> 26) == ALC880_HP_EVENT)
4076 alc260_hp_3013_automute(codec);
4079 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4080 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4082 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4083 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4084 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4085 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4086 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4087 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4088 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4089 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4090 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4091 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4092 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4093 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4094 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4098 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4099 * versions of the ALC260 don't act on requests to enable mic bias from NID
4100 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4101 * datasheet doesn't mention this restriction. At this stage it's not clear
4102 * whether this behaviour is intentional or is a hardware bug in chip
4103 * revisions available in early 2006. Therefore for now allow the
4104 * "Headphone Jack Mode" control to span all choices, but if it turns out
4105 * that the lack of mic bias for this NID is intentional we could change the
4106 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4108 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4109 * don't appear to make the mic bias available from the "line" jack, even
4110 * though the NID used for this jack (0x14) can supply it. The theory is
4111 * that perhaps Acer have included blocking capacitors between the ALC260
4112 * and the output jack. If this turns out to be the case for all such
4113 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4114 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4116 * The C20x Tablet series have a mono internal speaker which is controlled
4117 * via the chip's Mono sum widget and pin complex, so include the necessary
4118 * controls for such models. On models without a "mono speaker" the control
4119 * won't do anything.
4121 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4122 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4123 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4124 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4125 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4127 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4129 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4130 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4132 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4133 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4134 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4135 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4136 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4137 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4138 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4142 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4143 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4145 static struct snd_kcontrol_new alc260_will_mixer[] = {
4146 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4147 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4149 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4150 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4151 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4152 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4153 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4154 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4155 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4156 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4157 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4161 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4162 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4164 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4165 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4166 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4168 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4169 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4170 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4171 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4172 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4173 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4174 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4178 /* capture mixer elements */
4179 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4180 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4181 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4182 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4183 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4185 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4186 /* The multiple "Capture Source" controls confuse alsamixer
4187 * So call somewhat different..
4189 /* .name = "Capture Source", */
4190 .name = "Input Source",
4192 .info = alc_mux_enum_info,
4193 .get = alc_mux_enum_get,
4194 .put = alc_mux_enum_put,
4199 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4200 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4201 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4204 /* The multiple "Capture Source" controls confuse alsamixer
4205 * So call somewhat different..
4207 /* .name = "Capture Source", */
4208 .name = "Input Source",
4210 .info = alc_mux_enum_info,
4211 .get = alc_mux_enum_get,
4212 .put = alc_mux_enum_put,
4218 * initialization verbs
4220 static struct hda_verb alc260_init_verbs[] = {
4221 /* Line In pin widget for input */
4222 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4223 /* CD pin widget for input */
4224 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4225 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4226 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4227 /* Mic2 (front panel) pin widget for input and vref at 80% */
4228 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4229 /* LINE-2 is used for line-out in rear */
4230 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4231 /* select line-out */
4232 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4234 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4236 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4238 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4239 /* mute capture amp left and right */
4240 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4241 /* set connection select to line in (default select for this ADC) */
4242 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4243 /* mute capture amp left and right */
4244 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4245 /* set connection select to line in (default select for this ADC) */
4246 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4247 /* set vol=0 Line-Out mixer amp left and right */
4248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4249 /* unmute pin widget amp left and right (no gain on this amp) */
4250 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4251 /* set vol=0 HP mixer amp left and right */
4252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4253 /* unmute pin widget amp left and right (no gain on this amp) */
4254 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4255 /* set vol=0 Mono mixer amp left and right */
4256 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4257 /* unmute pin widget amp left and right (no gain on this amp) */
4258 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4259 /* unmute LINE-2 out pin */
4260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4261 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4264 /* mute analog inputs */
4265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4270 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4271 /* mute Front out path */
4272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4274 /* mute Headphone out path */
4275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4277 /* mute Mono out path */
4278 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4279 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4283 #if 0 /* should be identical with alc260_init_verbs? */
4284 static struct hda_verb alc260_hp_init_verbs[] = {
4285 /* Headphone and output */
4286 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4288 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4289 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4290 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4291 /* Mic2 (front panel) pin widget for input and vref at 80% */
4292 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4293 /* Line In pin widget for input */
4294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4295 /* Line-2 pin widget for output */
4296 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4297 /* CD pin widget for input */
4298 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4299 /* unmute amp left and right */
4300 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4301 /* set connection select to line in (default select for this ADC) */
4302 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4303 /* unmute Line-Out mixer amp left and right (volume = 0) */
4304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4305 /* mute pin widget amp left and right (no gain on this amp) */
4306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4307 /* unmute HP mixer amp left and right (volume = 0) */
4308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4309 /* mute pin widget amp left and right (no gain on this amp) */
4310 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4311 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4314 /* mute analog inputs */
4315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4318 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4320 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4321 /* Unmute Front out path */
4322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4323 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4324 /* Unmute Headphone out path */
4325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4327 /* Unmute Mono out path */
4328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4329 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4334 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4335 /* Line out and output */
4336 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4338 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4339 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4340 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4341 /* Mic2 (front panel) pin widget for input and vref at 80% */
4342 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4343 /* Line In pin widget for input */
4344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4345 /* Headphone pin widget for output */
4346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4347 /* CD pin widget for input */
4348 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4349 /* unmute amp left and right */
4350 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4351 /* set connection select to line in (default select for this ADC) */
4352 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4353 /* unmute Line-Out mixer amp left and right (volume = 0) */
4354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4355 /* mute pin widget amp left and right (no gain on this amp) */
4356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4357 /* unmute HP mixer amp left and right (volume = 0) */
4358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4359 /* mute pin widget amp left and right (no gain on this amp) */
4360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4361 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4364 /* mute analog inputs */
4365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4370 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4371 /* Unmute Front out path */
4372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4374 /* Unmute Headphone out path */
4375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4377 /* Unmute Mono out path */
4378 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4379 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4383 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4384 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4385 * audio = 0x16, internal speaker = 0x10.
4387 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4388 /* Disable all GPIOs */
4389 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4390 /* Internal speaker is connected to headphone pin */
4391 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4392 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4393 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4394 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4395 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4396 /* Ensure all other unused pins are disabled and muted. */
4397 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4399 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4401 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4402 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4403 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4404 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4406 /* Disable digital (SPDIF) pins */
4407 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4408 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4410 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4411 * when acting as an output.
4413 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4415 /* Start with output sum widgets muted and their output gains at min */
4416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4422 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4423 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4424 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4426 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4428 /* Unmute Line1 pin widget output buffer since it starts as an output.
4429 * If the pin mode is changed by the user the pin mode control will
4430 * take care of enabling the pin's input/output buffers as needed.
4431 * Therefore there's no need to enable the input buffer at this
4434 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4435 /* Unmute input buffer of pin widget used for Line-in (no equiv
4438 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4440 /* Mute capture amp left and right */
4441 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4442 /* Set ADC connection select to match default mixer setting - line
4445 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4447 /* Do the same for the second ADC: mute capture input amp and
4448 * set ADC connection to line in (on mic1 pin)
4450 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4451 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4453 /* Mute all inputs to mixer widget (even unconnected ones) */
4454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4466 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4467 * similar laptops (adapted from Fujitsu init verbs).
4469 static struct hda_verb alc260_acer_init_verbs[] = {
4470 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4471 * the headphone jack. Turn this on and rely on the standard mute
4472 * methods whenever the user wants to turn these outputs off.
4474 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4475 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4476 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4477 /* Internal speaker/Headphone jack is connected to Line-out pin */
4478 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4479 /* Internal microphone/Mic jack is connected to Mic1 pin */
4480 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4481 /* Line In jack is connected to Line1 pin */
4482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4483 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4484 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4485 /* Ensure all other unused pins are disabled and muted. */
4486 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4488 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4489 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4490 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4492 /* Disable digital (SPDIF) pins */
4493 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4494 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4496 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4497 * bus when acting as outputs.
4499 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4500 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4502 /* Start with output sum widgets muted and their output gains at min */
4503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4509 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4510 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4513 /* Unmute Line-out pin widget amp left and right
4514 * (no equiv mixer ctrl)
4516 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4517 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4518 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4519 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4520 * inputs. If the pin mode is changed by the user the pin mode control
4521 * will take care of enabling the pin's input/output buffers as needed.
4522 * Therefore there's no need to enable the input buffer at this
4525 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4528 /* Mute capture amp left and right */
4529 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4530 /* Set ADC connection select to match default mixer setting - mic
4533 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4535 /* Do similar with the second ADC: mute capture input amp and
4536 * set ADC connection to mic to match ALSA's default state.
4538 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4539 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4541 /* Mute all inputs to mixer widget (even unconnected ones) */
4542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4554 static struct hda_verb alc260_will_verbs[] = {
4555 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4556 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4557 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4558 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4559 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4560 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4564 static struct hda_verb alc260_replacer_672v_verbs[] = {
4565 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4566 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4567 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4569 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4570 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4571 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4573 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4577 /* toggle speaker-output according to the hp-jack state */
4578 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4580 unsigned int present;
4582 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4583 present = snd_hda_codec_read(codec, 0x0f, 0,
4584 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4586 snd_hda_codec_write_cache(codec, 0x01, 0,
4587 AC_VERB_SET_GPIO_DATA, 1);
4588 snd_hda_codec_write_cache(codec, 0x0f, 0,
4589 AC_VERB_SET_PIN_WIDGET_CONTROL,
4592 snd_hda_codec_write_cache(codec, 0x01, 0,
4593 AC_VERB_SET_GPIO_DATA, 0);
4594 snd_hda_codec_write_cache(codec, 0x0f, 0,
4595 AC_VERB_SET_PIN_WIDGET_CONTROL,
4600 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4603 if ((res >> 26) == ALC880_HP_EVENT)
4604 alc260_replacer_672v_automute(codec);
4607 /* Test configuration for debugging, modelled after the ALC880 test
4610 #ifdef CONFIG_SND_DEBUG
4611 static hda_nid_t alc260_test_dac_nids[1] = {
4614 static hda_nid_t alc260_test_adc_nids[2] = {
4617 /* For testing the ALC260, each input MUX needs its own definition since
4618 * the signal assignments are different. This assumes that the first ADC
4621 static struct hda_input_mux alc260_test_capture_sources[2] = {
4625 { "MIC1 pin", 0x0 },
4626 { "MIC2 pin", 0x1 },
4627 { "LINE1 pin", 0x2 },
4628 { "LINE2 pin", 0x3 },
4630 { "LINE-OUT pin", 0x5 },
4631 { "HP-OUT pin", 0x6 },
4637 { "MIC1 pin", 0x0 },
4638 { "MIC2 pin", 0x1 },
4639 { "LINE1 pin", 0x2 },
4640 { "LINE2 pin", 0x3 },
4643 { "LINE-OUT pin", 0x6 },
4644 { "HP-OUT pin", 0x7 },
4648 static struct snd_kcontrol_new alc260_test_mixer[] = {
4649 /* Output driver widgets */
4650 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4651 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4652 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4653 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4654 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4655 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4657 /* Modes for retasking pin widgets
4658 * Note: the ALC260 doesn't seem to act on requests to enable mic
4659 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4660 * mention this restriction. At this stage it's not clear whether
4661 * this behaviour is intentional or is a hardware bug in chip
4662 * revisions available at least up until early 2006. Therefore for
4663 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4664 * choices, but if it turns out that the lack of mic bias for these
4665 * NIDs is intentional we could change their modes from
4666 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4668 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4669 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4670 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4671 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4672 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4673 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4675 /* Loopback mixer controls */
4676 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4677 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4678 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4679 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4680 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4681 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4682 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4683 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4684 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4685 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4686 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4687 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4688 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4689 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4690 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4691 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4693 /* Controls for GPIO pins, assuming they are configured as outputs */
4694 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4695 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4696 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4697 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4699 /* Switches to allow the digital IO pins to be enabled. The datasheet
4700 * is ambigious as to which NID is which; testing on laptops which
4701 * make this output available should provide clarification.
4703 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4704 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4706 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4707 * this output to turn on an external amplifier.
4709 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4710 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4714 static struct hda_verb alc260_test_init_verbs[] = {
4715 /* Enable all GPIOs as outputs with an initial value of 0 */
4716 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4717 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4718 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4720 /* Enable retasking pins as output, initially without power amp */
4721 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4722 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4725 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4726 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4728 /* Disable digital (SPDIF) pins initially, but users can enable
4729 * them via a mixer switch. In the case of SPDIF-out, this initverb
4730 * payload also sets the generation to 0, output to be in "consumer"
4731 * PCM format, copyright asserted, no pre-emphasis and no validity
4734 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4735 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4737 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4738 * OUT1 sum bus when acting as an output.
4740 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4741 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4742 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4743 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4745 /* Start with output sum widgets muted and their output gains at min */
4746 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4748 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4750 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4751 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4752 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4753 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4754 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4756 /* Unmute retasking pin widget output buffers since the default
4757 * state appears to be output. As the pin mode is changed by the
4758 * user the pin mode control will take care of enabling the pin's
4759 * input/output buffers as needed.
4761 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4765 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4766 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4767 /* Also unmute the mono-out pin widget */
4768 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4770 /* Mute capture amp left and right */
4771 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4772 /* Set ADC connection select to match default mixer setting (mic1
4775 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4777 /* Do the same for the second ADC: mute capture input amp and
4778 * set ADC connection to mic1 pin
4780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4781 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4783 /* Mute all inputs to mixer widget (even unconnected ones) */
4784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4786 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4787 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4789 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4790 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4797 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4798 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4800 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4801 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4804 * for BIOS auto-configuration
4807 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4811 unsigned long vol_val, sw_val;
4815 if (nid >= 0x0f && nid < 0x11) {
4816 nid_vol = nid - 0x7;
4817 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4818 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4819 } else if (nid == 0x11) {
4820 nid_vol = nid - 0x7;
4821 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4822 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4823 } else if (nid >= 0x12 && nid <= 0x15) {
4825 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4826 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4830 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4831 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4834 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4835 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4841 /* add playback controls from the parsed DAC table */
4842 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4843 const struct auto_pin_cfg *cfg)
4848 spec->multiout.num_dacs = 1;
4849 spec->multiout.dac_nids = spec->private_dac_nids;
4850 spec->multiout.dac_nids[0] = 0x02;
4852 nid = cfg->line_out_pins[0];
4854 err = alc260_add_playback_controls(spec, nid, "Front");
4859 nid = cfg->speaker_pins[0];
4861 err = alc260_add_playback_controls(spec, nid, "Speaker");
4866 nid = cfg->hp_pins[0];
4868 err = alc260_add_playback_controls(spec, nid, "Headphone");
4875 /* create playback/capture controls for input pins */
4876 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4877 const struct auto_pin_cfg *cfg)
4879 struct hda_input_mux *imux = &spec->private_imux;
4882 for (i = 0; i < AUTO_PIN_LAST; i++) {
4883 if (cfg->input_pins[i] >= 0x12) {
4884 idx = cfg->input_pins[i] - 0x12;
4885 err = new_analog_input(spec, cfg->input_pins[i],
4886 auto_pin_cfg_labels[i], idx,
4890 imux->items[imux->num_items].label =
4891 auto_pin_cfg_labels[i];
4892 imux->items[imux->num_items].index = idx;
4895 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4896 idx = cfg->input_pins[i] - 0x09;
4897 err = new_analog_input(spec, cfg->input_pins[i],
4898 auto_pin_cfg_labels[i], idx,
4902 imux->items[imux->num_items].label =
4903 auto_pin_cfg_labels[i];
4904 imux->items[imux->num_items].index = idx;
4911 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4912 hda_nid_t nid, int pin_type,
4915 alc_set_pin_output(codec, nid, pin_type);
4916 /* need the manual connection? */
4918 int idx = nid - 0x12;
4919 snd_hda_codec_write(codec, idx + 0x0b, 0,
4920 AC_VERB_SET_CONNECT_SEL, sel_idx);
4924 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4926 struct alc_spec *spec = codec->spec;
4929 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4930 nid = spec->autocfg.line_out_pins[0];
4932 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4933 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4936 nid = spec->autocfg.speaker_pins[0];
4938 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4940 nid = spec->autocfg.hp_pins[0];
4942 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4945 #define ALC260_PIN_CD_NID 0x16
4946 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4948 struct alc_spec *spec = codec->spec;
4951 for (i = 0; i < AUTO_PIN_LAST; i++) {
4952 hda_nid_t nid = spec->autocfg.input_pins[i];
4954 snd_hda_codec_write(codec, nid, 0,
4955 AC_VERB_SET_PIN_WIDGET_CONTROL,
4956 i <= AUTO_PIN_FRONT_MIC ?
4957 PIN_VREF80 : PIN_IN);
4958 if (nid != ALC260_PIN_CD_NID)
4959 snd_hda_codec_write(codec, nid, 0,
4960 AC_VERB_SET_AMP_GAIN_MUTE,
4967 * generic initialization of ADC, input mixers and output mixers
4969 static struct hda_verb alc260_volume_init_verbs[] = {
4971 * Unmute ADC0-1 and set the default input to mic-in
4973 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4974 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4975 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4976 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4978 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4980 * Note: PASD motherboards uses the Line In 2 as the input for
4981 * front panel mic (mic 2)
4983 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4984 /* mute analog inputs */
4985 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4989 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4992 * Set up output mixers (0x08 - 0x0a)
4994 /* set vol=0 to output mixers */
4995 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4997 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4998 /* set up input amps for analog loopback */
4999 /* Amp Indices: DAC = 0, mixer = 1 */
5000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5001 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5002 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5003 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5004 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5005 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5010 static int alc260_parse_auto_config(struct hda_codec *codec)
5012 struct alc_spec *spec = codec->spec;
5015 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5017 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5021 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5024 if (!spec->kctl_alloc)
5025 return 0; /* can't find valid BIOS pin config */
5026 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5030 spec->multiout.max_channels = 2;
5032 if (spec->autocfg.dig_out_pin)
5033 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5034 if (spec->kctl_alloc)
5035 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
5037 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
5039 spec->num_mux_defs = 1;
5040 spec->input_mux = &spec->private_imux;
5042 /* check whether NID 0x04 is valid */
5043 wcap = get_wcaps(codec, 0x04);
5044 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
5045 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
5046 spec->adc_nids = alc260_adc_nids_alt;
5047 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
5048 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
5050 spec->adc_nids = alc260_adc_nids;
5051 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
5052 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
5059 /* additional initialization for auto-configuration model */
5060 static void alc260_auto_init(struct hda_codec *codec)
5062 struct alc_spec *spec = codec->spec;
5063 alc260_auto_init_multi_out(codec);
5064 alc260_auto_init_analog_input(codec);
5065 if (spec->unsol_event)
5066 alc_sku_automute(codec);
5069 #ifdef CONFIG_SND_HDA_POWER_SAVE
5070 static struct hda_amp_list alc260_loopbacks[] = {
5071 { 0x07, HDA_INPUT, 0 },
5072 { 0x07, HDA_INPUT, 1 },
5073 { 0x07, HDA_INPUT, 2 },
5074 { 0x07, HDA_INPUT, 3 },
5075 { 0x07, HDA_INPUT, 4 },
5081 * ALC260 configurations
5083 static const char *alc260_models[ALC260_MODEL_LAST] = {
5084 [ALC260_BASIC] = "basic",
5086 [ALC260_HP_3013] = "hp-3013",
5087 [ALC260_FUJITSU_S702X] = "fujitsu",
5088 [ALC260_ACER] = "acer",
5089 [ALC260_WILL] = "will",
5090 [ALC260_REPLACER_672V] = "replacer",
5091 #ifdef CONFIG_SND_DEBUG
5092 [ALC260_TEST] = "test",
5094 [ALC260_AUTO] = "auto",
5097 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5098 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5099 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5100 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5101 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5102 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5103 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5104 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5105 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5106 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5107 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5108 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5109 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5110 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5111 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5112 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5113 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5114 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5115 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5119 static struct alc_config_preset alc260_presets[] = {
5121 .mixers = { alc260_base_output_mixer,
5123 alc260_pc_beep_mixer,
5124 alc260_capture_mixer },
5125 .init_verbs = { alc260_init_verbs },
5126 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5127 .dac_nids = alc260_dac_nids,
5128 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5129 .adc_nids = alc260_adc_nids,
5130 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5131 .channel_mode = alc260_modes,
5132 .input_mux = &alc260_capture_source,
5135 .mixers = { alc260_hp_output_mixer,
5137 alc260_capture_alt_mixer },
5138 .init_verbs = { alc260_init_verbs,
5139 alc260_hp_unsol_verbs },
5140 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5141 .dac_nids = alc260_dac_nids,
5142 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5143 .adc_nids = alc260_hp_adc_nids,
5144 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5145 .channel_mode = alc260_modes,
5146 .input_mux = &alc260_capture_source,
5147 .unsol_event = alc260_hp_unsol_event,
5148 .init_hook = alc260_hp_automute,
5150 [ALC260_HP_3013] = {
5151 .mixers = { alc260_hp_3013_mixer,
5153 alc260_capture_alt_mixer },
5154 .init_verbs = { alc260_hp_3013_init_verbs,
5155 alc260_hp_3013_unsol_verbs },
5156 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5157 .dac_nids = alc260_dac_nids,
5158 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5159 .adc_nids = alc260_hp_adc_nids,
5160 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5161 .channel_mode = alc260_modes,
5162 .input_mux = &alc260_capture_source,
5163 .unsol_event = alc260_hp_3013_unsol_event,
5164 .init_hook = alc260_hp_3013_automute,
5166 [ALC260_FUJITSU_S702X] = {
5167 .mixers = { alc260_fujitsu_mixer,
5168 alc260_capture_mixer },
5169 .init_verbs = { alc260_fujitsu_init_verbs },
5170 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5171 .dac_nids = alc260_dac_nids,
5172 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5173 .adc_nids = alc260_dual_adc_nids,
5174 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5175 .channel_mode = alc260_modes,
5176 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5177 .input_mux = alc260_fujitsu_capture_sources,
5180 .mixers = { alc260_acer_mixer,
5181 alc260_capture_mixer },
5182 .init_verbs = { alc260_acer_init_verbs },
5183 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5184 .dac_nids = alc260_dac_nids,
5185 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5186 .adc_nids = alc260_dual_adc_nids,
5187 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5188 .channel_mode = alc260_modes,
5189 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5190 .input_mux = alc260_acer_capture_sources,
5193 .mixers = { alc260_will_mixer,
5194 alc260_capture_mixer },
5195 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5196 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5197 .dac_nids = alc260_dac_nids,
5198 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5199 .adc_nids = alc260_adc_nids,
5200 .dig_out_nid = ALC260_DIGOUT_NID,
5201 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5202 .channel_mode = alc260_modes,
5203 .input_mux = &alc260_capture_source,
5205 [ALC260_REPLACER_672V] = {
5206 .mixers = { alc260_replacer_672v_mixer,
5207 alc260_capture_mixer },
5208 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5209 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5210 .dac_nids = alc260_dac_nids,
5211 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5212 .adc_nids = alc260_adc_nids,
5213 .dig_out_nid = ALC260_DIGOUT_NID,
5214 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5215 .channel_mode = alc260_modes,
5216 .input_mux = &alc260_capture_source,
5217 .unsol_event = alc260_replacer_672v_unsol_event,
5218 .init_hook = alc260_replacer_672v_automute,
5220 #ifdef CONFIG_SND_DEBUG
5222 .mixers = { alc260_test_mixer,
5223 alc260_capture_mixer },
5224 .init_verbs = { alc260_test_init_verbs },
5225 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5226 .dac_nids = alc260_test_dac_nids,
5227 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5228 .adc_nids = alc260_test_adc_nids,
5229 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5230 .channel_mode = alc260_modes,
5231 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5232 .input_mux = alc260_test_capture_sources,
5237 static int patch_alc260(struct hda_codec *codec)
5239 struct alc_spec *spec;
5240 int err, board_config;
5242 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5248 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5251 if (board_config < 0) {
5252 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5253 "trying auto-probe from BIOS...\n");
5254 board_config = ALC260_AUTO;
5257 if (board_config == ALC260_AUTO) {
5258 /* automatic parse from the BIOS config */
5259 err = alc260_parse_auto_config(codec);
5265 "hda_codec: Cannot set up configuration "
5266 "from BIOS. Using base mode...\n");
5267 board_config = ALC260_BASIC;
5271 if (board_config != ALC260_AUTO)
5272 setup_preset(spec, &alc260_presets[board_config]);
5274 spec->stream_name_analog = "ALC260 Analog";
5275 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5276 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5278 spec->stream_name_digital = "ALC260 Digital";
5279 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5280 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5282 spec->vmaster_nid = 0x08;
5284 codec->patch_ops = alc_patch_ops;
5285 if (board_config == ALC260_AUTO)
5286 spec->init_hook = alc260_auto_init;
5287 #ifdef CONFIG_SND_HDA_POWER_SAVE
5288 if (!spec->loopback.amplist)
5289 spec->loopback.amplist = alc260_loopbacks;
5299 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5300 * configuration. Each pin widget can choose any input DACs and a mixer.
5301 * Each ADC is connected from a mixer of all inputs. This makes possible
5302 * 6-channel independent captures.
5304 * In addition, an independent DAC for the multi-playback (not used in this
5307 #define ALC882_DIGOUT_NID 0x06
5308 #define ALC882_DIGIN_NID 0x0a
5310 static struct hda_channel_mode alc882_ch_modes[1] = {
5314 static hda_nid_t alc882_dac_nids[4] = {
5315 /* front, rear, clfe, rear_surr */
5316 0x02, 0x03, 0x04, 0x05
5319 /* identical with ALC880 */
5320 #define alc882_adc_nids alc880_adc_nids
5321 #define alc882_adc_nids_alt alc880_adc_nids_alt
5323 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5324 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5327 /* FIXME: should be a matrix-type input source selection */
5329 static struct hda_input_mux alc882_capture_source = {
5333 { "Front Mic", 0x1 },
5338 #define alc882_mux_enum_info alc_mux_enum_info
5339 #define alc882_mux_enum_get alc_mux_enum_get
5341 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5342 struct snd_ctl_elem_value *ucontrol)
5344 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5345 struct alc_spec *spec = codec->spec;
5346 const struct hda_input_mux *imux = spec->input_mux;
5347 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5348 hda_nid_t nid = spec->capsrc_nids ?
5349 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5350 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5351 unsigned int i, idx;
5353 idx = ucontrol->value.enumerated.item[0];
5354 if (idx >= imux->num_items)
5355 idx = imux->num_items - 1;
5356 if (*cur_val == idx)
5358 for (i = 0; i < imux->num_items; i++) {
5359 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5360 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5361 imux->items[i].index,
5371 static struct hda_verb alc882_3ST_ch2_init[] = {
5372 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5373 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5374 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5375 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5382 static struct hda_verb alc882_3ST_ch6_init[] = {
5383 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5384 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5385 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5386 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5387 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5388 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5392 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5393 { 2, alc882_3ST_ch2_init },
5394 { 6, alc882_3ST_ch6_init },
5400 static struct hda_verb alc882_sixstack_ch6_init[] = {
5401 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5402 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5403 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5404 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5411 static struct hda_verb alc882_sixstack_ch8_init[] = {
5412 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5413 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5414 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5415 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5419 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5420 { 6, alc882_sixstack_ch6_init },
5421 { 8, alc882_sixstack_ch8_init },
5425 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5431 static struct hda_verb alc885_mbp_ch2_init[] = {
5432 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5433 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5434 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5441 static struct hda_verb alc885_mbp_ch6_init[] = {
5442 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5443 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5444 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5445 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5446 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5450 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5451 { 2, alc885_mbp_ch2_init },
5452 { 6, alc885_mbp_ch6_init },
5456 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5457 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5459 static struct snd_kcontrol_new alc882_base_mixer[] = {
5460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5461 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5462 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5463 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5464 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5465 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5466 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5467 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5468 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5469 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5470 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5471 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5472 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5477 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5478 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5479 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5480 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5481 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5482 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5486 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5487 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5488 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5489 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5490 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5491 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5492 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5494 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5495 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5496 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5499 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5508 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5509 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5510 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5514 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5515 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5516 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5518 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5519 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5520 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5521 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5524 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5525 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5527 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5531 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5532 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5534 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5535 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5536 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5538 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5539 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5540 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5541 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5542 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5543 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5544 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5547 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5551 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5552 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5553 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5562 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5563 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5567 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5569 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5570 .name = "Channel Mode",
5571 .info = alc_ch_mode_info,
5572 .get = alc_ch_mode_get,
5573 .put = alc_ch_mode_put,
5578 static struct hda_verb alc882_init_verbs[] = {
5579 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5590 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 /* Front Pin: output 0 (0x0c) */
5597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5599 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5600 /* Rear Pin: output 1 (0x0d) */
5601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5603 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5604 /* CLFE Pin: output 2 (0x0e) */
5605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5606 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5607 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5608 /* Side Pin: output 3 (0x0f) */
5609 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5610 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5611 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5612 /* Mic (rear) pin: input vref at 80% */
5613 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5614 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5615 /* Front Mic pin: input vref at 80% */
5616 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5617 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5618 /* Line In pin: input */
5619 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5620 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5621 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5622 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5623 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5624 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5625 /* CD pin widget for input */
5626 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5628 /* FIXME: use matrix-type input source selection */
5629 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5630 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5633 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5645 /* ADC1: mute amp left and right */
5646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5647 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5648 /* ADC2: mute amp left and right */
5649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5650 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5651 /* ADC3: mute amp left and right */
5652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5653 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5658 static struct hda_verb alc882_eapd_verbs[] = {
5659 /* change to EAPD mode */
5660 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5661 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5666 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5667 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5668 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5669 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5670 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5671 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5672 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5673 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5677 static struct hda_verb alc882_macpro_init_verbs[] = {
5678 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5682 /* Front Pin: output 0 (0x0c) */
5683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5686 /* Front Mic pin: input vref at 80% */
5687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5689 /* Speaker: output */
5690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5691 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5692 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5693 /* Headphone output (output 0 - 0x0c) */
5694 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5696 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5698 /* FIXME: use matrix-type input source selection */
5699 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5700 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5712 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5715 /* ADC1: mute amp left and right */
5716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5717 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5718 /* ADC2: mute amp left and right */
5719 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5721 /* ADC3: mute amp left and right */
5722 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5728 /* Macbook Pro rev3 */
5729 static struct hda_verb alc885_mbp3_init_verbs[] = {
5730 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5737 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5738 /* Front Pin: output 0 (0x0c) */
5739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5741 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5742 /* HP Pin: output 0 (0x0d) */
5743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5745 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5746 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5747 /* Mic (rear) pin: input vref at 80% */
5748 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5750 /* Front Mic pin: input vref at 80% */
5751 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5752 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5753 /* Line In pin: use output 1 when in LineOut mode */
5754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5756 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5758 /* FIXME: use matrix-type input source selection */
5759 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5760 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5775 /* ADC1: mute amp left and right */
5776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5777 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5778 /* ADC2: mute amp left and right */
5779 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5780 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5781 /* ADC3: mute amp left and right */
5782 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5788 /* iMac 24 mixer. */
5789 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5790 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5791 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5795 /* iMac 24 init verbs. */
5796 static struct hda_verb alc885_imac24_init_verbs[] = {
5797 /* Internal speakers: output 0 (0x0c) */
5798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5800 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5801 /* Internal speakers: output 0 (0x0c) */
5802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5804 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5805 /* Headphone: output 0 (0x0c) */
5806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5809 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5810 /* Front Mic: input vref at 80% */
5811 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5816 /* Toggle speaker-output according to the hp-jack state */
5817 static void alc885_imac24_automute(struct hda_codec *codec)
5819 unsigned int present;
5821 present = snd_hda_codec_read(codec, 0x14, 0,
5822 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5823 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5824 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5825 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5826 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5829 /* Processes unsolicited events. */
5830 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5833 /* Headphone insertion or removal. */
5834 if ((res >> 26) == ALC880_HP_EVENT)
5835 alc885_imac24_automute(codec);
5838 static void alc885_mbp3_automute(struct hda_codec *codec)
5840 unsigned int present;
5842 present = snd_hda_codec_read(codec, 0x15, 0,
5843 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5844 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5845 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5846 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5847 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5850 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5853 /* Headphone insertion or removal. */
5854 if ((res >> 26) == ALC880_HP_EVENT)
5855 alc885_mbp3_automute(codec);
5859 static struct hda_verb alc882_targa_verbs[] = {
5860 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5861 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5863 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5864 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5866 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5867 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5868 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5870 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5871 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5872 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5873 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5877 /* toggle speaker-output according to the hp-jack state */
5878 static void alc882_targa_automute(struct hda_codec *codec)
5880 unsigned int present;
5882 present = snd_hda_codec_read(codec, 0x14, 0,
5883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5884 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5885 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5886 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5890 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5892 /* Looks like the unsol event is incompatible with the standard
5893 * definition. 4bit tag is placed at 26 bit!
5895 if (((res >> 26) == ALC880_HP_EVENT)) {
5896 alc882_targa_automute(codec);
5900 static struct hda_verb alc882_asus_a7j_verbs[] = {
5901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5906 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5908 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5909 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5910 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5912 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5913 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5914 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5918 static struct hda_verb alc882_asus_a7m_verbs[] = {
5919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5924 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5926 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5928 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5930 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5931 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5932 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5936 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5938 unsigned int gpiostate, gpiomask, gpiodir;
5940 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5941 AC_VERB_GET_GPIO_DATA, 0);
5944 gpiostate |= (1 << pin);
5946 gpiostate &= ~(1 << pin);
5948 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5949 AC_VERB_GET_GPIO_MASK, 0);
5950 gpiomask |= (1 << pin);
5952 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5953 AC_VERB_GET_GPIO_DIRECTION, 0);
5954 gpiodir |= (1 << pin);
5957 snd_hda_codec_write(codec, codec->afg, 0,
5958 AC_VERB_SET_GPIO_MASK, gpiomask);
5959 snd_hda_codec_write(codec, codec->afg, 0,
5960 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5964 snd_hda_codec_write(codec, codec->afg, 0,
5965 AC_VERB_SET_GPIO_DATA, gpiostate);
5968 /* set up GPIO at initialization */
5969 static void alc885_macpro_init_hook(struct hda_codec *codec)
5971 alc882_gpio_mute(codec, 0, 0);
5972 alc882_gpio_mute(codec, 1, 0);
5975 /* set up GPIO and update auto-muting at initialization */
5976 static void alc885_imac24_init_hook(struct hda_codec *codec)
5978 alc885_macpro_init_hook(codec);
5979 alc885_imac24_automute(codec);
5983 * generic initialization of ADC, input mixers and output mixers
5985 static struct hda_verb alc882_auto_init_verbs[] = {
5987 * Unmute ADC0-2 and set the default input to mic-in
5989 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5991 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5993 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5996 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5998 * Note: PASD motherboards uses the Line In 2 as the input for
5999 * front panel mic (mic 2)
6001 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6009 * Set up output mixers (0x0c - 0x0f)
6011 /* set vol=0 to output mixers */
6012 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6013 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6014 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6016 /* set up input amps for analog loopback */
6017 /* Amp Indices: DAC = 0, mixer = 1 */
6018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6024 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6025 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6026 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6027 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6029 /* FIXME: use matrix-type input source selection */
6030 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6031 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6032 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6033 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6034 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6035 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6037 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6038 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6042 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
6044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
6045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
6050 /* capture mixer elements */
6051 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
6052 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6053 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6054 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6055 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6057 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6058 /* The multiple "Capture Source" controls confuse alsamixer
6059 * So call somewhat different..
6061 /* .name = "Capture Source", */
6062 .name = "Input Source",
6064 .info = alc882_mux_enum_info,
6065 .get = alc882_mux_enum_get,
6066 .put = alc882_mux_enum_put,
6071 static struct snd_kcontrol_new alc882_capture_mixer[] = {
6072 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6073 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6074 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6075 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6076 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6077 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6080 /* The multiple "Capture Source" controls confuse alsamixer
6081 * So call somewhat different..
6083 /* .name = "Capture Source", */
6084 .name = "Input Source",
6086 .info = alc882_mux_enum_info,
6087 .get = alc882_mux_enum_get,
6088 .put = alc882_mux_enum_put,
6093 #ifdef CONFIG_SND_HDA_POWER_SAVE
6094 #define alc882_loopbacks alc880_loopbacks
6097 /* pcm configuration: identiacal with ALC880 */
6098 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6099 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6100 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6101 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6104 * configuration and preset
6106 static const char *alc882_models[ALC882_MODEL_LAST] = {
6107 [ALC882_3ST_DIG] = "3stack-dig",
6108 [ALC882_6ST_DIG] = "6stack-dig",
6109 [ALC882_ARIMA] = "arima",
6110 [ALC882_W2JC] = "w2jc",
6111 [ALC882_TARGA] = "targa",
6112 [ALC882_ASUS_A7J] = "asus-a7j",
6113 [ALC882_ASUS_A7M] = "asus-a7m",
6114 [ALC885_MACPRO] = "macpro",
6115 [ALC885_MBP3] = "mbp3",
6116 [ALC885_IMAC24] = "imac24",
6117 [ALC882_AUTO] = "auto",
6120 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6121 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6122 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6123 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6124 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6125 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6126 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6127 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6128 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6129 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6130 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6131 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6132 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6136 static struct alc_config_preset alc882_presets[] = {
6137 [ALC882_3ST_DIG] = {
6138 .mixers = { alc882_base_mixer },
6139 .init_verbs = { alc882_init_verbs },
6140 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6141 .dac_nids = alc882_dac_nids,
6142 .dig_out_nid = ALC882_DIGOUT_NID,
6143 .dig_in_nid = ALC882_DIGIN_NID,
6144 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6145 .channel_mode = alc882_ch_modes,
6147 .input_mux = &alc882_capture_source,
6149 [ALC882_6ST_DIG] = {
6150 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6151 .init_verbs = { alc882_init_verbs },
6152 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6153 .dac_nids = alc882_dac_nids,
6154 .dig_out_nid = ALC882_DIGOUT_NID,
6155 .dig_in_nid = ALC882_DIGIN_NID,
6156 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6157 .channel_mode = alc882_sixstack_modes,
6158 .input_mux = &alc882_capture_source,
6161 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6162 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6163 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6164 .dac_nids = alc882_dac_nids,
6165 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6166 .channel_mode = alc882_sixstack_modes,
6167 .input_mux = &alc882_capture_source,
6170 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6171 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6172 alc880_gpio1_init_verbs },
6173 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6174 .dac_nids = alc882_dac_nids,
6175 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6176 .channel_mode = alc880_threestack_modes,
6178 .input_mux = &alc882_capture_source,
6179 .dig_out_nid = ALC882_DIGOUT_NID,
6182 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6183 .init_verbs = { alc885_mbp3_init_verbs,
6184 alc880_gpio1_init_verbs },
6185 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6186 .dac_nids = alc882_dac_nids,
6187 .channel_mode = alc885_mbp_6ch_modes,
6188 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6189 .input_mux = &alc882_capture_source,
6190 .dig_out_nid = ALC882_DIGOUT_NID,
6191 .dig_in_nid = ALC882_DIGIN_NID,
6192 .unsol_event = alc885_mbp3_unsol_event,
6193 .init_hook = alc885_mbp3_automute,
6196 .mixers = { alc882_macpro_mixer },
6197 .init_verbs = { alc882_macpro_init_verbs },
6198 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6199 .dac_nids = alc882_dac_nids,
6200 .dig_out_nid = ALC882_DIGOUT_NID,
6201 .dig_in_nid = ALC882_DIGIN_NID,
6202 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6203 .channel_mode = alc882_ch_modes,
6204 .input_mux = &alc882_capture_source,
6205 .init_hook = alc885_macpro_init_hook,
6208 .mixers = { alc885_imac24_mixer },
6209 .init_verbs = { alc885_imac24_init_verbs },
6210 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6211 .dac_nids = alc882_dac_nids,
6212 .dig_out_nid = ALC882_DIGOUT_NID,
6213 .dig_in_nid = ALC882_DIGIN_NID,
6214 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6215 .channel_mode = alc882_ch_modes,
6216 .input_mux = &alc882_capture_source,
6217 .unsol_event = alc885_imac24_unsol_event,
6218 .init_hook = alc885_imac24_init_hook,
6221 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6222 alc882_capture_mixer },
6223 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6224 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6225 .dac_nids = alc882_dac_nids,
6226 .dig_out_nid = ALC882_DIGOUT_NID,
6227 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6228 .adc_nids = alc882_adc_nids,
6229 .capsrc_nids = alc882_capsrc_nids,
6230 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6231 .channel_mode = alc882_3ST_6ch_modes,
6233 .input_mux = &alc882_capture_source,
6234 .unsol_event = alc882_targa_unsol_event,
6235 .init_hook = alc882_targa_automute,
6237 [ALC882_ASUS_A7J] = {
6238 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6239 alc882_capture_mixer },
6240 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6241 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6242 .dac_nids = alc882_dac_nids,
6243 .dig_out_nid = ALC882_DIGOUT_NID,
6244 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6245 .adc_nids = alc882_adc_nids,
6246 .capsrc_nids = alc882_capsrc_nids,
6247 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6248 .channel_mode = alc882_3ST_6ch_modes,
6250 .input_mux = &alc882_capture_source,
6252 [ALC882_ASUS_A7M] = {
6253 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6254 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6255 alc880_gpio1_init_verbs,
6256 alc882_asus_a7m_verbs },
6257 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6258 .dac_nids = alc882_dac_nids,
6259 .dig_out_nid = ALC882_DIGOUT_NID,
6260 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6261 .channel_mode = alc880_threestack_modes,
6263 .input_mux = &alc882_capture_source,
6272 PINFIX_ABIT_AW9D_MAX
6275 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6276 { 0x15, 0x01080104 }, /* side */
6277 { 0x16, 0x01011012 }, /* rear */
6278 { 0x17, 0x01016011 }, /* clfe */
6282 static const struct alc_pincfg *alc882_pin_fixes[] = {
6283 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6286 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6287 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6292 * BIOS auto configuration
6294 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6295 hda_nid_t nid, int pin_type,
6299 struct alc_spec *spec = codec->spec;
6302 alc_set_pin_output(codec, nid, pin_type);
6303 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6306 idx = spec->multiout.dac_nids[dac_idx] - 2;
6307 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6311 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6313 struct alc_spec *spec = codec->spec;
6316 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6317 for (i = 0; i <= HDA_SIDE; i++) {
6318 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6319 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6321 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6326 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6328 struct alc_spec *spec = codec->spec;
6331 pin = spec->autocfg.hp_pins[0];
6332 if (pin) /* connect to front */
6334 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6335 pin = spec->autocfg.speaker_pins[0];
6337 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6340 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6341 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6343 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6345 struct alc_spec *spec = codec->spec;
6348 for (i = 0; i < AUTO_PIN_LAST; i++) {
6349 hda_nid_t nid = spec->autocfg.input_pins[i];
6354 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6355 if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) &
6359 snd_hda_codec_write(codec, nid, 0,
6360 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6361 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6362 snd_hda_codec_write(codec, nid, 0,
6363 AC_VERB_SET_AMP_GAIN_MUTE,
6368 /* add mic boosts if needed */
6369 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6371 struct alc_spec *spec = codec->spec;
6375 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6376 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6377 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6379 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6383 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6384 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6385 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6387 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6394 /* almost identical with ALC880 parser... */
6395 static int alc882_parse_auto_config(struct hda_codec *codec)
6397 struct alc_spec *spec = codec->spec;
6398 int err = alc880_parse_auto_config(codec);
6403 return 0; /* no config found */
6405 err = alc_auto_add_mic_boost(codec);
6409 /* hack - override the init verbs */
6410 spec->init_verbs[0] = alc882_auto_init_verbs;
6412 return 1; /* config found */
6415 /* additional initialization for auto-configuration model */
6416 static void alc882_auto_init(struct hda_codec *codec)
6418 struct alc_spec *spec = codec->spec;
6419 alc882_auto_init_multi_out(codec);
6420 alc882_auto_init_hp_out(codec);
6421 alc882_auto_init_analog_input(codec);
6422 if (spec->unsol_event)
6423 alc_sku_automute(codec);
6426 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6428 static int patch_alc882(struct hda_codec *codec)
6430 struct alc_spec *spec;
6431 int err, board_config;
6433 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6439 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6443 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6444 /* Pick up systems that don't supply PCI SSID */
6445 switch (codec->subsystem_id) {
6446 case 0x106b0c00: /* Mac Pro */
6447 board_config = ALC885_MACPRO;
6449 case 0x106b1000: /* iMac 24 */
6450 board_config = ALC885_IMAC24;
6452 case 0x106b00a1: /* Macbook */
6453 case 0x106b2c00: /* Macbook Pro rev3 */
6454 board_config = ALC885_MBP3;
6457 /* ALC889A is handled better as ALC888-compatible */
6458 if (codec->revision_id == 0x100103) {
6460 return patch_alc883(codec);
6462 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6463 "trying auto-probe from BIOS...\n");
6464 board_config = ALC882_AUTO;
6468 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6470 if (board_config == ALC882_AUTO) {
6471 /* automatic parse from the BIOS config */
6472 err = alc882_parse_auto_config(codec);
6478 "hda_codec: Cannot set up configuration "
6479 "from BIOS. Using base mode...\n");
6480 board_config = ALC882_3ST_DIG;
6484 if (board_config != ALC882_AUTO)
6485 setup_preset(spec, &alc882_presets[board_config]);
6487 spec->stream_name_analog = "ALC882 Analog";
6488 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6489 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6490 /* FIXME: setup DAC5 */
6491 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6492 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6494 spec->stream_name_digital = "ALC882 Digital";
6495 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6496 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6498 if (!spec->adc_nids && spec->input_mux) {
6499 /* check whether NID 0x07 is valid */
6500 unsigned int wcap = get_wcaps(codec, 0x07);
6502 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6503 if (wcap != AC_WID_AUD_IN) {
6504 spec->adc_nids = alc882_adc_nids_alt;
6505 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6506 spec->capsrc_nids = alc882_capsrc_nids_alt;
6507 spec->mixers[spec->num_mixers] =
6508 alc882_capture_alt_mixer;
6511 spec->adc_nids = alc882_adc_nids;
6512 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6513 spec->capsrc_nids = alc882_capsrc_nids;
6514 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6519 spec->vmaster_nid = 0x0c;
6521 codec->patch_ops = alc_patch_ops;
6522 if (board_config == ALC882_AUTO)
6523 spec->init_hook = alc882_auto_init;
6524 #ifdef CONFIG_SND_HDA_POWER_SAVE
6525 if (!spec->loopback.amplist)
6526 spec->loopback.amplist = alc882_loopbacks;
6535 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6536 * configuration. Each pin widget can choose any input DACs and a mixer.
6537 * Each ADC is connected from a mixer of all inputs. This makes possible
6538 * 6-channel independent captures.
6540 * In addition, an independent DAC for the multi-playback (not used in this
6543 #define ALC883_DIGOUT_NID 0x06
6544 #define ALC883_DIGIN_NID 0x0a
6546 static hda_nid_t alc883_dac_nids[4] = {
6547 /* front, rear, clfe, rear_surr */
6548 0x02, 0x03, 0x04, 0x05
6551 static hda_nid_t alc883_adc_nids[2] = {
6556 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6559 /* FIXME: should be a matrix-type input source selection */
6561 static struct hda_input_mux alc883_capture_source = {
6565 { "Front Mic", 0x1 },
6571 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6579 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6589 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6597 #define alc883_mux_enum_info alc_mux_enum_info
6598 #define alc883_mux_enum_get alc_mux_enum_get
6599 /* ALC883 has the ALC882-type input selection */
6600 #define alc883_mux_enum_put alc882_mux_enum_put
6605 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6612 static struct hda_verb alc883_3ST_ch2_init[] = {
6613 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6614 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6615 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6616 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6623 static struct hda_verb alc883_3ST_ch4_init[] = {
6624 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6625 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6626 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6627 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6628 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6635 static struct hda_verb alc883_3ST_ch6_init[] = {
6636 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6637 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6638 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6639 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6640 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6641 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6645 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6646 { 2, alc883_3ST_ch2_init },
6647 { 4, alc883_3ST_ch4_init },
6648 { 6, alc883_3ST_ch6_init },
6654 static struct hda_verb alc883_sixstack_ch6_init[] = {
6655 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6656 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6657 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6658 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6665 static struct hda_verb alc883_sixstack_ch8_init[] = {
6666 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6667 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6668 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6669 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6673 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6674 { 6, alc883_sixstack_ch6_init },
6675 { 8, alc883_sixstack_ch8_init },
6678 static struct hda_verb alc883_medion_eapd_verbs[] = {
6679 /* eanable EAPD on medion laptop */
6680 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6681 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6685 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6686 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6689 static struct snd_kcontrol_new alc883_base_mixer[] = {
6690 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6691 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6692 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6693 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6694 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6695 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6696 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6697 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6698 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6699 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6701 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6702 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6703 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6704 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6706 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6709 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6711 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6712 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6713 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6714 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6715 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6716 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6719 /* .name = "Capture Source", */
6720 .name = "Input Source",
6722 .info = alc883_mux_enum_info,
6723 .get = alc883_mux_enum_get,
6724 .put = alc883_mux_enum_put,
6729 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6730 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6731 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6732 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6733 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6734 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6735 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6736 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6738 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6741 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6742 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6743 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6744 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6745 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6746 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6749 /* .name = "Capture Source", */
6750 .name = "Input Source",
6752 .info = alc883_mux_enum_info,
6753 .get = alc883_mux_enum_get,
6754 .put = alc883_mux_enum_put,
6759 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6760 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6761 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6762 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6763 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6767 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6768 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6769 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6770 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6771 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6772 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6773 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6776 /* .name = "Capture Source", */
6777 .name = "Input Source",
6779 .info = alc883_mux_enum_info,
6780 .get = alc883_mux_enum_get,
6781 .put = alc883_mux_enum_put,
6786 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6787 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6788 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6789 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6790 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, 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("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6795 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6796 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6797 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6798 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6799 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6800 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6802 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6803 /* .name = "Capture Source", */
6804 .name = "Input Source",
6806 .info = alc883_mux_enum_info,
6807 .get = alc883_mux_enum_get,
6808 .put = alc883_mux_enum_put,
6813 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6814 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6815 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6817 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6818 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6825 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6827 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6828 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6829 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6830 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6831 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6832 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6834 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6835 /* .name = "Capture Source", */
6836 .name = "Input Source",
6838 .info = alc883_mux_enum_info,
6839 .get = alc883_mux_enum_get,
6840 .put = alc883_mux_enum_put,
6845 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6848 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6849 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6862 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6863 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6865 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6866 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6867 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6868 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6869 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6870 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6873 /* .name = "Capture Source", */
6874 .name = "Input Source",
6876 .info = alc883_mux_enum_info,
6877 .get = alc883_mux_enum_get,
6878 .put = alc883_mux_enum_put,
6883 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6885 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6887 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6890 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6891 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6893 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6894 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6898 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6900 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6901 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6903 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6904 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6905 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6906 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6910 /* .name = "Capture Source", */
6911 .name = "Input Source",
6913 .info = alc883_mux_enum_info,
6914 .get = alc883_mux_enum_get,
6915 .put = alc883_mux_enum_put,
6920 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6921 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6923 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6924 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6925 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6926 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6927 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6928 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6929 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6935 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6937 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6938 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6939 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6940 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6943 /* .name = "Capture Source", */
6944 .name = "Input Source",
6946 .info = alc883_mux_enum_info,
6947 .get = alc883_mux_enum_get,
6948 .put = alc883_mux_enum_put,
6953 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6956 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6957 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6958 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6960 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6961 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6962 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6964 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6965 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6966 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6967 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6968 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6971 /* .name = "Capture Source", */
6972 .name = "Input Source",
6974 .info = alc883_mux_enum_info,
6975 .get = alc883_mux_enum_get,
6976 .put = alc883_mux_enum_put,
6981 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6982 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6983 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6984 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6985 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6986 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6990 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6991 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6994 /* .name = "Capture Source", */
6995 .name = "Input Source",
6997 .info = alc883_mux_enum_info,
6998 .get = alc883_mux_enum_get,
6999 .put = alc883_mux_enum_put,
7004 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7006 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7012 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7013 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7014 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7015 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7016 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7017 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7020 /* .name = "Capture Source", */
7021 .name = "Input Source",
7023 .info = alc883_mux_enum_info,
7024 .get = alc883_mux_enum_get,
7025 .put = alc883_mux_enum_put,
7030 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7031 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7033 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7034 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7035 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7038 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7039 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7040 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7041 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7042 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7043 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7045 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7046 /* .name = "Capture Source", */
7047 .name = "Input Source",
7049 .info = alc883_mux_enum_info,
7050 .get = alc883_mux_enum_get,
7051 .put = alc883_mux_enum_put,
7056 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7065 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7066 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7067 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7068 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7071 /* .name = "Capture Source", */
7072 .name = "Input Source",
7074 .info = alc883_mux_enum_info,
7075 .get = alc883_mux_enum_get,
7076 .put = alc883_mux_enum_put,
7081 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7083 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7084 .name = "Channel Mode",
7085 .info = alc_ch_mode_info,
7086 .get = alc_ch_mode_get,
7087 .put = alc_ch_mode_put,
7092 static struct hda_verb alc883_init_verbs[] = {
7093 /* ADC1: mute amp left and right */
7094 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7095 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7096 /* ADC2: mute amp left and right */
7097 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7098 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7099 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7105 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7106 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7108 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7113 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7116 /* mute analog input loopbacks */
7117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7123 /* Front Pin: output 0 (0x0c) */
7124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7126 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7127 /* Rear Pin: output 1 (0x0d) */
7128 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7130 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7131 /* CLFE Pin: output 2 (0x0e) */
7132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7133 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7134 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7135 /* Side Pin: output 3 (0x0f) */
7136 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7138 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7139 /* Mic (rear) pin: input vref at 80% */
7140 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7141 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7142 /* Front Mic pin: input vref at 80% */
7143 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7144 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7145 /* Line In pin: input */
7146 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7147 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7148 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7149 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7150 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7151 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7152 /* CD pin widget for input */
7153 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7155 /* FIXME: use matrix-type input source selection */
7156 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7158 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7159 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7170 /* toggle speaker-output according to the hp-jack state */
7171 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7173 unsigned int present;
7175 present = snd_hda_codec_read(codec, 0x15, 0,
7176 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7177 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7178 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7179 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7180 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7183 /* auto-toggle front mic */
7185 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7187 unsigned int present;
7190 present = snd_hda_codec_read(codec, 0x18, 0,
7191 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7192 bits = present ? HDA_AMP_MUTE : 0;
7193 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7197 static void alc883_mitac_automute(struct hda_codec *codec)
7199 alc883_mitac_hp_automute(codec);
7200 /* alc883_mitac_mic_automute(codec); */
7203 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7206 switch (res >> 26) {
7207 case ALC880_HP_EVENT:
7208 alc883_mitac_hp_automute(codec);
7210 case ALC880_MIC_EVENT:
7211 /* alc883_mitac_mic_automute(codec); */
7216 static struct hda_verb alc883_mitac_verbs[] = {
7218 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7219 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7221 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7222 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7224 /* enable unsolicited event */
7225 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7226 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7231 static struct hda_verb alc883_clevo_m720_verbs[] = {
7233 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7236 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7239 /* enable unsolicited event */
7240 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7241 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7246 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7248 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7251 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7252 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7254 /* enable unsolicited event */
7255 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7260 static struct hda_verb alc883_tagra_verbs[] = {
7261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7265 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7267 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7268 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7269 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7271 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7272 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7273 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7274 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7279 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7280 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7281 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7286 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7289 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7290 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7294 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7298 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7299 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7303 static struct hda_verb alc883_haier_w66_verbs[] = {
7304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7309 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7310 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7311 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7312 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7316 static struct hda_verb alc888_3st_hp_verbs[] = {
7317 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7318 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7319 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7323 static struct hda_verb alc888_6st_dell_verbs[] = {
7324 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7328 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7329 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7330 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7331 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7332 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7336 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7337 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7338 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7339 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7340 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7344 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7345 { 2, alc888_3st_hp_2ch_init },
7346 { 6, alc888_3st_hp_6ch_init },
7349 /* toggle front-jack and RCA according to the hp-jack state */
7350 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7352 unsigned int present;
7354 present = snd_hda_codec_read(codec, 0x1b, 0,
7355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7356 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7357 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7358 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7359 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7362 /* toggle RCA according to the front-jack state */
7363 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7365 unsigned int present;
7367 present = snd_hda_codec_read(codec, 0x14, 0,
7368 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7369 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7370 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7373 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7376 if ((res >> 26) == ALC880_HP_EVENT)
7377 alc888_lenovo_ms7195_front_automute(codec);
7378 if ((res >> 26) == ALC880_FRONT_EVENT)
7379 alc888_lenovo_ms7195_rca_automute(codec);
7382 static struct hda_verb alc883_medion_md2_verbs[] = {
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7388 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7392 /* toggle speaker-output according to the hp-jack state */
7393 static void alc883_medion_md2_automute(struct hda_codec *codec)
7395 unsigned int present;
7397 present = snd_hda_codec_read(codec, 0x14, 0,
7398 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7399 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7400 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7403 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7406 if ((res >> 26) == ALC880_HP_EVENT)
7407 alc883_medion_md2_automute(codec);
7410 /* toggle speaker-output according to the hp-jack state */
7411 static void alc883_tagra_automute(struct hda_codec *codec)
7413 unsigned int present;
7416 present = snd_hda_codec_read(codec, 0x14, 0,
7417 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7418 bits = present ? HDA_AMP_MUTE : 0;
7419 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7420 HDA_AMP_MUTE, bits);
7421 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7425 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7427 if ((res >> 26) == ALC880_HP_EVENT)
7428 alc883_tagra_automute(codec);
7431 /* toggle speaker-output according to the hp-jack state */
7432 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7434 unsigned int present;
7437 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7438 & AC_PINSENSE_PRESENCE;
7439 bits = present ? HDA_AMP_MUTE : 0;
7440 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7441 HDA_AMP_MUTE, bits);
7444 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7446 unsigned int present;
7448 present = snd_hda_codec_read(codec, 0x18, 0,
7449 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7450 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7451 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7454 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7456 alc883_clevo_m720_hp_automute(codec);
7457 alc883_clevo_m720_mic_automute(codec);
7460 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7463 switch (res >> 26) {
7464 case ALC880_HP_EVENT:
7465 alc883_clevo_m720_hp_automute(codec);
7467 case ALC880_MIC_EVENT:
7468 alc883_clevo_m720_mic_automute(codec);
7473 /* toggle speaker-output according to the hp-jack state */
7474 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7476 unsigned int present;
7479 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7480 & AC_PINSENSE_PRESENCE;
7481 bits = present ? HDA_AMP_MUTE : 0;
7482 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7483 HDA_AMP_MUTE, bits);
7486 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7489 if ((res >> 26) == ALC880_HP_EVENT)
7490 alc883_2ch_fujitsu_pi2515_automute(codec);
7493 static void alc883_haier_w66_automute(struct hda_codec *codec)
7495 unsigned int present;
7498 present = snd_hda_codec_read(codec, 0x1b, 0,
7499 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7500 bits = present ? 0x80 : 0;
7501 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7505 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7508 if ((res >> 26) == ALC880_HP_EVENT)
7509 alc883_haier_w66_automute(codec);
7512 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7514 unsigned int present;
7517 present = snd_hda_codec_read(codec, 0x14, 0,
7518 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7519 bits = present ? HDA_AMP_MUTE : 0;
7520 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7521 HDA_AMP_MUTE, bits);
7524 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7526 unsigned int present;
7529 present = snd_hda_codec_read(codec, 0x1b, 0,
7530 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7531 bits = present ? HDA_AMP_MUTE : 0;
7532 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7533 HDA_AMP_MUTE, bits);
7534 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7535 HDA_AMP_MUTE, bits);
7538 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7541 if ((res >> 26) == ALC880_HP_EVENT)
7542 alc883_lenovo_101e_all_automute(codec);
7543 if ((res >> 26) == ALC880_FRONT_EVENT)
7544 alc883_lenovo_101e_ispeaker_automute(codec);
7547 /* toggle speaker-output according to the hp-jack state */
7548 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7550 unsigned int present;
7552 present = snd_hda_codec_read(codec, 0x14, 0,
7553 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7554 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7555 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7556 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7557 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7560 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7563 if ((res >> 26) == ALC880_HP_EVENT)
7564 alc883_acer_aspire_automute(codec);
7567 static struct hda_verb alc883_acer_eapd_verbs[] = {
7568 /* HP Pin: output 0 (0x0c) */
7569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7571 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7572 /* Front Pin: output 0 (0x0c) */
7573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7574 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7575 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7576 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7577 /* eanable EAPD on medion laptop */
7578 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7579 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7580 /* enable unsolicited event */
7581 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7585 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7587 unsigned int present;
7589 present = snd_hda_codec_read(codec, 0x1b, 0,
7590 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7591 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7592 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7593 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7594 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7595 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7596 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7597 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7598 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7601 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7604 switch (res >> 26) {
7605 case ALC880_HP_EVENT:
7606 printk("hp_event\n");
7607 alc888_6st_dell_front_automute(codec);
7613 * generic initialization of ADC, input mixers and output mixers
7615 static struct hda_verb alc883_auto_init_verbs[] = {
7617 * Unmute ADC0-2 and set the default input to mic-in
7619 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7620 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7621 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7624 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7626 * Note: PASD motherboards uses the Line In 2 as the input for
7627 * front panel mic (mic 2)
7629 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7637 * Set up output mixers (0x0c - 0x0f)
7639 /* set vol=0 to output mixers */
7640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7641 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7642 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7643 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7644 /* set up input amps for analog loopback */
7645 /* Amp Indices: DAC = 0, mixer = 1 */
7646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7650 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7652 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7653 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7654 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7655 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7657 /* FIXME: use matrix-type input source selection */
7658 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7663 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7669 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7675 /* capture mixer elements */
7676 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7677 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7678 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7679 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7680 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7683 /* The multiple "Capture Source" controls confuse alsamixer
7684 * So call somewhat different..
7686 /* .name = "Capture Source", */
7687 .name = "Input Source",
7689 .info = alc882_mux_enum_info,
7690 .get = alc882_mux_enum_get,
7691 .put = alc882_mux_enum_put,
7696 #ifdef CONFIG_SND_HDA_POWER_SAVE
7697 #define alc883_loopbacks alc880_loopbacks
7700 /* pcm configuration: identiacal with ALC880 */
7701 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7702 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7703 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7704 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7705 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7708 * configuration and preset
7710 static const char *alc883_models[ALC883_MODEL_LAST] = {
7711 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7712 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7713 [ALC883_3ST_6ch] = "3stack-6ch",
7714 [ALC883_6ST_DIG] = "6stack-dig",
7715 [ALC883_TARGA_DIG] = "targa-dig",
7716 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7717 [ALC883_ACER] = "acer",
7718 [ALC883_ACER_ASPIRE] = "acer-aspire",
7719 [ALC883_MEDION] = "medion",
7720 [ALC883_MEDION_MD2] = "medion-md2",
7721 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7722 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7723 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7724 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7725 [ALC883_HAIER_W66] = "haier-w66",
7726 [ALC888_3ST_HP] = "3stack-hp",
7727 [ALC888_6ST_DELL] = "6stack-dell",
7728 [ALC883_MITAC] = "mitac",
7729 [ALC883_CLEVO_M720] = "clevo-m720",
7730 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7731 [ALC883_AUTO] = "auto",
7734 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7735 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7736 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7737 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7738 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7739 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7740 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7741 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7742 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7743 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7744 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7745 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7746 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7747 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7748 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7749 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7750 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7751 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7752 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7753 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7754 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7755 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7756 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7757 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7758 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7759 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7760 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7761 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7762 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7763 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7764 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7765 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7766 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7767 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7768 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7769 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7770 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7771 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7772 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7773 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7774 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7775 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7776 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7777 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7778 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7779 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7780 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7781 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7782 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7783 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7784 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7785 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7786 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7787 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7791 static struct alc_config_preset alc883_presets[] = {
7792 [ALC883_3ST_2ch_DIG] = {
7793 .mixers = { alc883_3ST_2ch_mixer },
7794 .init_verbs = { alc883_init_verbs },
7795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7796 .dac_nids = alc883_dac_nids,
7797 .dig_out_nid = ALC883_DIGOUT_NID,
7798 .dig_in_nid = ALC883_DIGIN_NID,
7799 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7800 .channel_mode = alc883_3ST_2ch_modes,
7801 .input_mux = &alc883_capture_source,
7803 [ALC883_3ST_6ch_DIG] = {
7804 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7805 .init_verbs = { alc883_init_verbs },
7806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7807 .dac_nids = alc883_dac_nids,
7808 .dig_out_nid = ALC883_DIGOUT_NID,
7809 .dig_in_nid = ALC883_DIGIN_NID,
7810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7811 .channel_mode = alc883_3ST_6ch_modes,
7813 .input_mux = &alc883_capture_source,
7815 [ALC883_3ST_6ch] = {
7816 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7817 .init_verbs = { alc883_init_verbs },
7818 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7819 .dac_nids = alc883_dac_nids,
7820 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7821 .channel_mode = alc883_3ST_6ch_modes,
7823 .input_mux = &alc883_capture_source,
7825 [ALC883_6ST_DIG] = {
7826 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7827 .init_verbs = { alc883_init_verbs },
7828 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7829 .dac_nids = alc883_dac_nids,
7830 .dig_out_nid = ALC883_DIGOUT_NID,
7831 .dig_in_nid = ALC883_DIGIN_NID,
7832 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7833 .channel_mode = alc883_sixstack_modes,
7834 .input_mux = &alc883_capture_source,
7836 [ALC883_TARGA_DIG] = {
7837 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7838 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7839 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7840 .dac_nids = alc883_dac_nids,
7841 .dig_out_nid = ALC883_DIGOUT_NID,
7842 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7843 .channel_mode = alc883_3ST_6ch_modes,
7845 .input_mux = &alc883_capture_source,
7846 .unsol_event = alc883_tagra_unsol_event,
7847 .init_hook = alc883_tagra_automute,
7849 [ALC883_TARGA_2ch_DIG] = {
7850 .mixers = { alc883_tagra_2ch_mixer},
7851 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7852 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7853 .dac_nids = alc883_dac_nids,
7854 .dig_out_nid = ALC883_DIGOUT_NID,
7855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7856 .channel_mode = alc883_3ST_2ch_modes,
7857 .input_mux = &alc883_capture_source,
7858 .unsol_event = alc883_tagra_unsol_event,
7859 .init_hook = alc883_tagra_automute,
7862 .mixers = { alc883_base_mixer },
7863 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7864 * and the headphone jack. Turn this on and rely on the
7865 * standard mute methods whenever the user wants to turn
7866 * these outputs off.
7868 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7869 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7870 .dac_nids = alc883_dac_nids,
7871 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7872 .channel_mode = alc883_3ST_2ch_modes,
7873 .input_mux = &alc883_capture_source,
7875 [ALC883_ACER_ASPIRE] = {
7876 .mixers = { alc883_acer_aspire_mixer },
7877 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7878 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7879 .dac_nids = alc883_dac_nids,
7880 .dig_out_nid = ALC883_DIGOUT_NID,
7881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7882 .channel_mode = alc883_3ST_2ch_modes,
7883 .input_mux = &alc883_capture_source,
7884 .unsol_event = alc883_acer_aspire_unsol_event,
7885 .init_hook = alc883_acer_aspire_automute,
7888 .mixers = { alc883_fivestack_mixer,
7889 alc883_chmode_mixer },
7890 .init_verbs = { alc883_init_verbs,
7891 alc883_medion_eapd_verbs },
7892 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7893 .dac_nids = alc883_dac_nids,
7894 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7895 .channel_mode = alc883_sixstack_modes,
7896 .input_mux = &alc883_capture_source,
7898 [ALC883_MEDION_MD2] = {
7899 .mixers = { alc883_medion_md2_mixer},
7900 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7901 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7902 .dac_nids = alc883_dac_nids,
7903 .dig_out_nid = ALC883_DIGOUT_NID,
7904 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7905 .channel_mode = alc883_3ST_2ch_modes,
7906 .input_mux = &alc883_capture_source,
7907 .unsol_event = alc883_medion_md2_unsol_event,
7908 .init_hook = alc883_medion_md2_automute,
7910 [ALC883_LAPTOP_EAPD] = {
7911 .mixers = { alc883_base_mixer },
7912 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7913 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7914 .dac_nids = alc883_dac_nids,
7915 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7916 .channel_mode = alc883_3ST_2ch_modes,
7917 .input_mux = &alc883_capture_source,
7919 [ALC883_CLEVO_M720] = {
7920 .mixers = { alc883_clevo_m720_mixer },
7921 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
7922 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7923 .dac_nids = alc883_dac_nids,
7924 .dig_out_nid = ALC883_DIGOUT_NID,
7925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7926 .channel_mode = alc883_3ST_2ch_modes,
7927 .input_mux = &alc883_capture_source,
7928 .unsol_event = alc883_clevo_m720_unsol_event,
7929 .init_hook = alc883_clevo_m720_automute,
7931 [ALC883_LENOVO_101E_2ch] = {
7932 .mixers = { alc883_lenovo_101e_2ch_mixer},
7933 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7934 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7935 .dac_nids = alc883_dac_nids,
7936 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7937 .channel_mode = alc883_3ST_2ch_modes,
7938 .input_mux = &alc883_lenovo_101e_capture_source,
7939 .unsol_event = alc883_lenovo_101e_unsol_event,
7940 .init_hook = alc883_lenovo_101e_all_automute,
7942 [ALC883_LENOVO_NB0763] = {
7943 .mixers = { alc883_lenovo_nb0763_mixer },
7944 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7945 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7946 .dac_nids = alc883_dac_nids,
7947 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7948 .channel_mode = alc883_3ST_2ch_modes,
7950 .input_mux = &alc883_lenovo_nb0763_capture_source,
7951 .unsol_event = alc883_medion_md2_unsol_event,
7952 .init_hook = alc883_medion_md2_automute,
7954 [ALC888_LENOVO_MS7195_DIG] = {
7955 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7956 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7957 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7958 .dac_nids = alc883_dac_nids,
7959 .dig_out_nid = ALC883_DIGOUT_NID,
7960 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7961 .channel_mode = alc883_3ST_6ch_modes,
7963 .input_mux = &alc883_capture_source,
7964 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7965 .init_hook = alc888_lenovo_ms7195_front_automute,
7967 [ALC883_HAIER_W66] = {
7968 .mixers = { alc883_tagra_2ch_mixer},
7969 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7970 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7971 .dac_nids = alc883_dac_nids,
7972 .dig_out_nid = ALC883_DIGOUT_NID,
7973 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7974 .channel_mode = alc883_3ST_2ch_modes,
7975 .input_mux = &alc883_capture_source,
7976 .unsol_event = alc883_haier_w66_unsol_event,
7977 .init_hook = alc883_haier_w66_automute,
7980 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7981 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7982 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7983 .dac_nids = alc883_dac_nids,
7984 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7985 .channel_mode = alc888_3st_hp_modes,
7987 .input_mux = &alc883_capture_source,
7989 [ALC888_6ST_DELL] = {
7990 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7991 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7992 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7993 .dac_nids = alc883_dac_nids,
7994 .dig_out_nid = ALC883_DIGOUT_NID,
7995 .dig_in_nid = ALC883_DIGIN_NID,
7996 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7997 .channel_mode = alc883_sixstack_modes,
7998 .input_mux = &alc883_capture_source,
7999 .unsol_event = alc888_6st_dell_unsol_event,
8000 .init_hook = alc888_6st_dell_front_automute,
8003 .mixers = { alc883_mitac_mixer },
8004 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8006 .dac_nids = alc883_dac_nids,
8007 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8008 .channel_mode = alc883_3ST_2ch_modes,
8009 .input_mux = &alc883_capture_source,
8010 .unsol_event = alc883_mitac_unsol_event,
8011 .init_hook = alc883_mitac_automute,
8013 [ALC883_FUJITSU_PI2515] = {
8014 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8015 .init_verbs = { alc883_init_verbs,
8016 alc883_2ch_fujitsu_pi2515_verbs},
8017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8018 .dac_nids = alc883_dac_nids,
8019 .dig_out_nid = ALC883_DIGOUT_NID,
8020 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8021 .channel_mode = alc883_3ST_2ch_modes,
8022 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8023 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
8024 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
8030 * BIOS auto configuration
8032 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
8033 hda_nid_t nid, int pin_type,
8037 struct alc_spec *spec = codec->spec;
8040 alc_set_pin_output(codec, nid, pin_type);
8041 if (spec->multiout.dac_nids[dac_idx] == 0x25)
8044 idx = spec->multiout.dac_nids[dac_idx] - 2;
8045 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
8049 static void alc883_auto_init_multi_out(struct hda_codec *codec)
8051 struct alc_spec *spec = codec->spec;
8054 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
8055 for (i = 0; i <= HDA_SIDE; i++) {
8056 hda_nid_t nid = spec->autocfg.line_out_pins[i];
8057 int pin_type = get_pin_type(spec->autocfg.line_out_type);
8059 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
8064 static void alc883_auto_init_hp_out(struct hda_codec *codec)
8066 struct alc_spec *spec = codec->spec;
8069 pin = spec->autocfg.hp_pins[0];
8070 if (pin) /* connect to front */
8072 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
8073 pin = spec->autocfg.speaker_pins[0];
8075 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
8078 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8079 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8081 static void alc883_auto_init_analog_input(struct hda_codec *codec)
8083 struct alc_spec *spec = codec->spec;
8086 for (i = 0; i < AUTO_PIN_LAST; i++) {
8087 hda_nid_t nid = spec->autocfg.input_pins[i];
8088 if (alc883_is_input_pin(nid)) {
8089 snd_hda_codec_write(codec, nid, 0,
8090 AC_VERB_SET_PIN_WIDGET_CONTROL,
8091 (i <= AUTO_PIN_FRONT_MIC ?
8092 PIN_VREF80 : PIN_IN));
8093 if (nid != ALC883_PIN_CD_NID)
8094 snd_hda_codec_write(codec, nid, 0,
8095 AC_VERB_SET_AMP_GAIN_MUTE,
8101 /* almost identical with ALC880 parser... */
8102 static int alc883_parse_auto_config(struct hda_codec *codec)
8104 struct alc_spec *spec = codec->spec;
8105 int err = alc880_parse_auto_config(codec);
8110 return 0; /* no config found */
8112 err = alc_auto_add_mic_boost(codec);
8116 /* hack - override the init verbs */
8117 spec->init_verbs[0] = alc883_auto_init_verbs;
8118 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8121 return 1; /* config found */
8124 /* additional initialization for auto-configuration model */
8125 static void alc883_auto_init(struct hda_codec *codec)
8127 struct alc_spec *spec = codec->spec;
8128 alc883_auto_init_multi_out(codec);
8129 alc883_auto_init_hp_out(codec);
8130 alc883_auto_init_analog_input(codec);
8131 if (spec->unsol_event)
8132 alc_sku_automute(codec);
8135 static int patch_alc883(struct hda_codec *codec)
8137 struct alc_spec *spec;
8138 int err, board_config;
8140 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8146 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8149 if (board_config < 0) {
8150 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8151 "trying auto-probe from BIOS...\n");
8152 board_config = ALC883_AUTO;
8155 if (board_config == ALC883_AUTO) {
8156 /* automatic parse from the BIOS config */
8157 err = alc883_parse_auto_config(codec);
8163 "hda_codec: Cannot set up configuration "
8164 "from BIOS. Using base mode...\n");
8165 board_config = ALC883_3ST_2ch_DIG;
8169 if (board_config != ALC883_AUTO)
8170 setup_preset(spec, &alc883_presets[board_config]);
8172 spec->stream_name_analog = "ALC883 Analog";
8173 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8174 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8175 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8177 spec->stream_name_digital = "ALC883 Digital";
8178 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8179 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8181 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8182 spec->adc_nids = alc883_adc_nids;
8183 spec->capsrc_nids = alc883_capsrc_nids;
8185 spec->vmaster_nid = 0x0c;
8187 codec->patch_ops = alc_patch_ops;
8188 if (board_config == ALC883_AUTO)
8189 spec->init_hook = alc883_auto_init;
8190 #ifdef CONFIG_SND_HDA_POWER_SAVE
8191 if (!spec->loopback.amplist)
8192 spec->loopback.amplist = alc883_loopbacks;
8202 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8203 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8205 #define alc262_dac_nids alc260_dac_nids
8206 #define alc262_adc_nids alc882_adc_nids
8207 #define alc262_adc_nids_alt alc882_adc_nids_alt
8208 #define alc262_capsrc_nids alc882_capsrc_nids
8209 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8211 #define alc262_modes alc260_modes
8212 #define alc262_capture_source alc882_capture_source
8214 static struct snd_kcontrol_new alc262_base_mixer[] = {
8215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8216 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8226 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8227 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8228 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8231 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8232 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8236 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8238 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8239 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8240 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8242 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8249 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8250 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8251 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8256 /* update HP, line and mono-out pins according to the master switch */
8257 static void alc262_hp_master_update(struct hda_codec *codec)
8259 struct alc_spec *spec = codec->spec;
8260 int val = spec->master_sw;
8263 snd_hda_codec_write_cache(codec, 0x1b, 0,
8264 AC_VERB_SET_PIN_WIDGET_CONTROL,
8266 snd_hda_codec_write_cache(codec, 0x15, 0,
8267 AC_VERB_SET_PIN_WIDGET_CONTROL,
8269 /* mono (speaker) depending on the HP jack sense */
8270 val = val && !spec->jack_present;
8271 snd_hda_codec_write_cache(codec, 0x16, 0,
8272 AC_VERB_SET_PIN_WIDGET_CONTROL,
8276 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8278 struct alc_spec *spec = codec->spec;
8279 unsigned int presence;
8280 presence = snd_hda_codec_read(codec, 0x1b, 0,
8281 AC_VERB_GET_PIN_SENSE, 0);
8282 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8283 alc262_hp_master_update(codec);
8286 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8288 if ((res >> 26) != ALC880_HP_EVENT)
8290 alc262_hp_bpc_automute(codec);
8293 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8295 struct alc_spec *spec = codec->spec;
8296 unsigned int presence;
8297 presence = snd_hda_codec_read(codec, 0x15, 0,
8298 AC_VERB_GET_PIN_SENSE, 0);
8299 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8300 alc262_hp_master_update(codec);
8303 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8306 if ((res >> 26) != ALC880_HP_EVENT)
8308 alc262_hp_wildwest_automute(codec);
8311 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8312 struct snd_ctl_elem_value *ucontrol)
8314 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8315 struct alc_spec *spec = codec->spec;
8316 *ucontrol->value.integer.value = spec->master_sw;
8320 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8321 struct snd_ctl_elem_value *ucontrol)
8323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8324 struct alc_spec *spec = codec->spec;
8325 int val = !!*ucontrol->value.integer.value;
8327 if (val == spec->master_sw)
8329 spec->master_sw = val;
8330 alc262_hp_master_update(codec);
8334 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8337 .name = "Master Playback Switch",
8338 .info = snd_ctl_boolean_mono_info,
8339 .get = alc262_hp_master_sw_get,
8340 .put = alc262_hp_master_sw_put,
8342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8343 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8345 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8347 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8353 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8356 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8357 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8358 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8359 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8360 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8361 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8362 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8366 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8368 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8369 .name = "Master Playback Switch",
8370 .info = snd_ctl_boolean_mono_info,
8371 .get = alc262_hp_master_sw_get,
8372 .put = alc262_hp_master_sw_put,
8374 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8375 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8376 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8378 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8380 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8384 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8389 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8390 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8394 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8395 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8396 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8401 /* mute/unmute internal speaker according to the hp jack and mute state */
8402 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8404 struct alc_spec *spec = codec->spec;
8406 if (force || !spec->sense_updated) {
8407 unsigned int present;
8408 present = snd_hda_codec_read(codec, 0x15, 0,
8409 AC_VERB_GET_PIN_SENSE, 0);
8410 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8411 spec->sense_updated = 1;
8413 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8414 spec->jack_present ? HDA_AMP_MUTE : 0);
8417 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8420 if ((res >> 26) != ALC880_HP_EVENT)
8422 alc262_hp_t5735_automute(codec, 1);
8425 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8427 alc262_hp_t5735_automute(codec, 1);
8430 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8432 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8437 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8441 static struct hda_verb alc262_hp_t5735_verbs[] = {
8442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8443 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8445 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8449 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8450 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8452 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8453 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8455 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8459 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8460 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8461 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8462 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8463 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8464 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8465 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8467 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8473 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8480 /* bind hp and internal speaker mute (with plug check) */
8481 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8482 struct snd_ctl_elem_value *ucontrol)
8484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8485 long *valp = ucontrol->value.integer.value;
8488 /* change hp mute */
8489 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8491 valp[0] ? 0 : HDA_AMP_MUTE);
8492 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8494 valp[1] ? 0 : HDA_AMP_MUTE);
8496 /* change speaker according to HP jack state */
8497 struct alc_spec *spec = codec->spec;
8499 if (spec->jack_present)
8500 mute = HDA_AMP_MUTE;
8502 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8504 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8505 HDA_AMP_MUTE, mute);
8510 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8511 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8513 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8514 .name = "Master Playback Switch",
8515 .info = snd_hda_mixer_amp_switch_info,
8516 .get = snd_hda_mixer_amp_switch_get,
8517 .put = alc262_sony_master_sw_put,
8518 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8522 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8523 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8527 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8528 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8529 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8533 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8534 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8538 #define alc262_capture_mixer alc882_capture_mixer
8539 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8542 * generic initialization of ADC, input mixers and output mixers
8544 static struct hda_verb alc262_init_verbs[] = {
8546 * Unmute ADC0-2 and set the default input to mic-in
8548 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8550 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8552 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8555 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8557 * Note: PASD motherboards uses the Line In 2 as the input for
8558 * front panel mic (mic 2)
8560 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8568 * Set up output mixers (0x0c - 0x0e)
8570 /* set vol=0 to output mixers */
8571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8573 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8574 /* set up input amps for analog loopback */
8575 /* Amp Indices: DAC = 0, mixer = 1 */
8576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8587 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8588 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8592 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8594 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8596 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8597 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8599 /* FIXME: use matrix-type input source selection */
8600 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8601 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8608 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8609 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8620 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8622 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8626 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8628 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8631 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8632 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8636 static struct hda_verb alc262_sony_unsol_verbs[] = {
8637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8645 /* mute/unmute internal speaker according to the hp jack and mute state */
8646 static void alc262_hippo_automute(struct hda_codec *codec)
8648 struct alc_spec *spec = codec->spec;
8650 unsigned int present;
8652 /* need to execute and sync at first */
8653 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8654 present = snd_hda_codec_read(codec, 0x15, 0,
8655 AC_VERB_GET_PIN_SENSE, 0);
8656 spec->jack_present = (present & 0x80000000) != 0;
8657 if (spec->jack_present) {
8658 /* mute internal speaker */
8659 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8660 HDA_AMP_MUTE, HDA_AMP_MUTE);
8662 /* unmute internal speaker if necessary */
8663 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8664 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8665 HDA_AMP_MUTE, mute);
8669 /* unsolicited event for HP jack sensing */
8670 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8673 if ((res >> 26) != ALC880_HP_EVENT)
8675 alc262_hippo_automute(codec);
8678 static void alc262_hippo1_automute(struct hda_codec *codec)
8681 unsigned int present;
8683 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8684 present = snd_hda_codec_read(codec, 0x1b, 0,
8685 AC_VERB_GET_PIN_SENSE, 0);
8686 present = (present & 0x80000000) != 0;
8688 /* mute internal speaker */
8689 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8690 HDA_AMP_MUTE, HDA_AMP_MUTE);
8692 /* unmute internal speaker if necessary */
8693 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8694 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8695 HDA_AMP_MUTE, mute);
8699 /* unsolicited event for HP jack sensing */
8700 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8703 if ((res >> 26) != ALC880_HP_EVENT)
8705 alc262_hippo1_automute(codec);
8710 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8711 * 0x1b = port replicator headphone out
8714 #define ALC_HP_EVENT 0x37
8716 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8717 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8720 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8724 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8725 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8726 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8730 static struct hda_input_mux alc262_fujitsu_capture_source = {
8739 static struct hda_input_mux alc262_HP_capture_source = {
8743 { "Front Mic", 0x1 },
8750 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8754 { "Front Mic", 0x2 },
8760 /* mute/unmute internal speaker according to the hp jack and mute state */
8761 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8763 struct alc_spec *spec = codec->spec;
8766 if (force || !spec->sense_updated) {
8767 unsigned int present_int_hp, present_dock_hp;
8768 /* need to execute and sync at first */
8769 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8770 present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
8771 AC_VERB_GET_PIN_SENSE, 0);
8772 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
8773 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
8774 AC_VERB_GET_PIN_SENSE, 0);
8775 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8776 spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
8777 spec->sense_updated = 1;
8779 if (spec->jack_present) {
8780 /* mute internal speaker */
8781 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8782 HDA_AMP_MUTE, HDA_AMP_MUTE);
8784 /* unmute internal speaker if necessary */
8785 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8786 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8787 HDA_AMP_MUTE, mute);
8791 /* unsolicited event for HP jack sensing */
8792 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8795 if ((res >> 26) != ALC_HP_EVENT)
8797 alc262_fujitsu_automute(codec, 1);
8800 /* bind volumes of both NID 0x0c and 0x0d */
8801 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8802 .ops = &snd_hda_bind_vol,
8804 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8805 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8810 /* mute/unmute internal speaker according to the hp jack and mute state */
8811 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8813 struct alc_spec *spec = codec->spec;
8816 if (force || !spec->sense_updated) {
8817 unsigned int present_int_hp;
8818 /* need to execute and sync at first */
8819 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8820 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8821 AC_VERB_GET_PIN_SENSE, 0);
8822 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8823 spec->sense_updated = 1;
8825 if (spec->jack_present) {
8826 /* mute internal speaker */
8827 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8828 HDA_AMP_MUTE, HDA_AMP_MUTE);
8829 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8830 HDA_AMP_MUTE, HDA_AMP_MUTE);
8832 /* unmute internal speaker if necessary */
8833 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8834 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8835 HDA_AMP_MUTE, mute);
8836 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8837 HDA_AMP_MUTE, mute);
8841 /* unsolicited event for HP jack sensing */
8842 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8845 if ((res >> 26) != ALC_HP_EVENT)
8847 alc262_lenovo_3000_automute(codec, 1);
8850 /* bind hp and internal speaker mute (with plug check) */
8851 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8852 struct snd_ctl_elem_value *ucontrol)
8854 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8855 long *valp = ucontrol->value.integer.value;
8858 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8860 valp ? 0 : HDA_AMP_MUTE);
8861 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8863 valp ? 0 : HDA_AMP_MUTE);
8866 alc262_fujitsu_automute(codec, 0);
8870 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8871 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8873 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8874 .name = "Master Playback Switch",
8875 .info = snd_hda_mixer_amp_switch_info,
8876 .get = snd_hda_mixer_amp_switch_get,
8877 .put = alc262_fujitsu_master_sw_put,
8878 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8880 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8881 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8882 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
8883 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8887 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8888 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8889 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8893 /* bind hp and internal speaker mute (with plug check) */
8894 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8895 struct snd_ctl_elem_value *ucontrol)
8897 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8898 long *valp = ucontrol->value.integer.value;
8901 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8903 valp ? 0 : HDA_AMP_MUTE);
8906 alc262_lenovo_3000_automute(codec, 0);
8910 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8911 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8914 .name = "Master Playback Switch",
8915 .info = snd_hda_mixer_amp_switch_info,
8916 .get = snd_hda_mixer_amp_switch_get,
8917 .put = alc262_lenovo_3000_master_sw_put,
8918 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8920 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8921 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8924 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8926 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8927 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8931 /* additional init verbs for Benq laptops */
8932 static struct hda_verb alc262_EAPD_verbs[] = {
8933 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8934 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8938 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8940 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8942 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8943 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8947 /* Samsung Q1 Ultra Vista model setup */
8948 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8949 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8950 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8954 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8958 static struct hda_verb alc262_ultra_verbs[] = {
8960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8967 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8970 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8973 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8975 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8977 /* ADC, choose mic */
8978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
8991 /* mute/unmute internal speaker according to the hp jack and mute state */
8992 static void alc262_ultra_automute(struct hda_codec *codec)
8994 struct alc_spec *spec = codec->spec;
8998 /* auto-mute only when HP is used as HP */
8999 if (!spec->cur_mux[0]) {
9000 unsigned int present;
9001 /* need to execute and sync at first */
9002 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9003 present = snd_hda_codec_read(codec, 0x15, 0,
9004 AC_VERB_GET_PIN_SENSE, 0);
9005 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9006 if (spec->jack_present)
9007 mute = HDA_AMP_MUTE;
9009 /* mute/unmute internal speaker */
9010 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9011 HDA_AMP_MUTE, mute);
9012 /* mute/unmute HP */
9013 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9014 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
9017 /* unsolicited event for HP jack sensing */
9018 static void alc262_ultra_unsol_event(struct hda_codec *codec,
9021 if ((res >> 26) != ALC880_HP_EVENT)
9023 alc262_ultra_automute(codec);
9026 static struct hda_input_mux alc262_ultra_capture_source = {
9030 { "Headphone", 0x7 },
9034 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9035 struct snd_ctl_elem_value *ucontrol)
9037 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9038 struct alc_spec *spec = codec->spec;
9041 ret = alc882_mux_enum_put(kcontrol, ucontrol);
9044 /* reprogram the HP pin as mic or HP according to the input source */
9045 snd_hda_codec_write_cache(codec, 0x15, 0,
9046 AC_VERB_SET_PIN_WIDGET_CONTROL,
9047 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
9048 alc262_ultra_automute(codec); /* mute/unmute HP */
9052 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9053 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9054 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9056 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9057 .name = "Capture Source",
9058 .info = alc882_mux_enum_info,
9059 .get = alc882_mux_enum_get,
9060 .put = alc262_ultra_mux_enum_put,
9065 /* add playback controls from the parsed DAC table */
9066 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
9067 const struct auto_pin_cfg *cfg)
9072 spec->multiout.num_dacs = 1; /* only use one dac */
9073 spec->multiout.dac_nids = spec->private_dac_nids;
9074 spec->multiout.dac_nids[0] = 2;
9076 nid = cfg->line_out_pins[0];
9078 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9079 "Front Playback Volume",
9080 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
9083 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9084 "Front Playback Switch",
9085 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9090 nid = cfg->speaker_pins[0];
9093 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9094 "Speaker Playback Volume",
9095 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9099 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9100 "Speaker Playback Switch",
9101 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9106 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9107 "Speaker Playback Switch",
9108 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9114 nid = cfg->hp_pins[0];
9116 /* spec->multiout.hp_nid = 2; */
9118 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9119 "Headphone Playback Volume",
9120 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9124 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9125 "Headphone Playback Switch",
9126 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9131 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9132 "Headphone Playback Switch",
9133 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9142 /* identical with ALC880 */
9143 #define alc262_auto_create_analog_input_ctls \
9144 alc880_auto_create_analog_input_ctls
9147 * generic initialization of ADC, input mixers and output mixers
9149 static struct hda_verb alc262_volume_init_verbs[] = {
9151 * Unmute ADC0-2 and set the default input to mic-in
9153 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9154 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9155 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9157 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9160 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9162 * Note: PASD motherboards uses the Line In 2 as the input for
9163 * front panel mic (mic 2)
9165 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9167 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9168 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9173 * Set up output mixers (0x0c - 0x0f)
9175 /* set vol=0 to output mixers */
9176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9177 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9178 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9180 /* set up input amps for analog loopback */
9181 /* Amp Indices: DAC = 0, mixer = 1 */
9182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9184 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9185 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9186 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9187 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9189 /* FIXME: use matrix-type input source selection */
9190 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9191 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9197 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9210 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9212 * Unmute ADC0-2 and set the default input to mic-in
9214 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9215 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9216 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9217 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9218 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9221 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9223 * Note: PASD motherboards uses the Line In 2 as the input for
9224 * front panel mic (mic 2)
9226 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9236 * Set up output mixers (0x0c - 0x0e)
9238 /* set vol=0 to output mixers */
9239 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9240 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9241 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9243 /* set up input amps for analog loopback */
9244 /* Amp Indices: DAC = 0, mixer = 1 */
9245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9246 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9248 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9250 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9252 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9254 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9256 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9259 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9260 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9264 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9265 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9266 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9268 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9270 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9272 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9273 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9276 /* FIXME: use matrix-type input source selection */
9277 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9278 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9287 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9294 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9299 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9301 * Unmute ADC0-2 and set the default input to mic-in
9303 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9305 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9306 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9307 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9310 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9312 * Note: PASD motherboards uses the Line In 2 as the input for front
9315 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9325 * Set up output mixers (0x0c - 0x0e)
9327 /* set vol=0 to output mixers */
9328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9332 /* set up input amps for analog loopback */
9333 /* Amp Indices: DAC = 0, mixer = 1 */
9334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9339 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9347 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9348 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9353 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9356 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9360 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9361 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9363 /* FIXME: use matrix-type input source selection */
9364 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9365 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9371 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9379 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9387 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9395 #ifdef CONFIG_SND_HDA_POWER_SAVE
9396 #define alc262_loopbacks alc880_loopbacks
9399 /* pcm configuration: identiacal with ALC880 */
9400 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9401 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9402 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9403 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9406 * BIOS auto configuration
9408 static int alc262_parse_auto_config(struct hda_codec *codec)
9410 struct alc_spec *spec = codec->spec;
9412 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9414 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9418 if (!spec->autocfg.line_outs)
9419 return 0; /* can't find valid BIOS pin config */
9420 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9423 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9427 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9429 if (spec->autocfg.dig_out_pin)
9430 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9431 if (spec->autocfg.dig_in_pin)
9432 spec->dig_in_nid = ALC262_DIGIN_NID;
9434 if (spec->kctl_alloc)
9435 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9437 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9438 spec->num_mux_defs = 1;
9439 spec->input_mux = &spec->private_imux;
9441 err = alc_auto_add_mic_boost(codec);
9448 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9449 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9450 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9453 /* init callback for auto-configuration model -- overriding the default init */
9454 static void alc262_auto_init(struct hda_codec *codec)
9456 struct alc_spec *spec = codec->spec;
9457 alc262_auto_init_multi_out(codec);
9458 alc262_auto_init_hp_out(codec);
9459 alc262_auto_init_analog_input(codec);
9460 if (spec->unsol_event)
9461 alc_sku_automute(codec);
9465 * configuration and preset
9467 static const char *alc262_models[ALC262_MODEL_LAST] = {
9468 [ALC262_BASIC] = "basic",
9469 [ALC262_HIPPO] = "hippo",
9470 [ALC262_HIPPO_1] = "hippo_1",
9471 [ALC262_FUJITSU] = "fujitsu",
9472 [ALC262_HP_BPC] = "hp-bpc",
9473 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9474 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9475 [ALC262_HP_RP5700] = "hp-rp5700",
9476 [ALC262_BENQ_ED8] = "benq",
9477 [ALC262_BENQ_T31] = "benq-t31",
9478 [ALC262_SONY_ASSAMD] = "sony-assamd",
9479 [ALC262_ULTRA] = "ultra",
9480 [ALC262_LENOVO_3000] = "lenovo-3000",
9481 [ALC262_AUTO] = "auto",
9484 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9485 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9486 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9487 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9488 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9489 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9490 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9491 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9492 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9493 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9494 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9495 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9496 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9497 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9498 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9499 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9500 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9501 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9502 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9503 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9504 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9505 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9506 ALC262_HP_TC_T5735),
9507 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9508 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9509 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9510 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9511 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9512 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9513 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9514 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9515 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9516 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9517 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9518 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9519 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9520 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9524 static struct alc_config_preset alc262_presets[] = {
9526 .mixers = { alc262_base_mixer },
9527 .init_verbs = { alc262_init_verbs },
9528 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9529 .dac_nids = alc262_dac_nids,
9531 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9532 .channel_mode = alc262_modes,
9533 .input_mux = &alc262_capture_source,
9536 .mixers = { alc262_base_mixer },
9537 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9538 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9539 .dac_nids = alc262_dac_nids,
9541 .dig_out_nid = ALC262_DIGOUT_NID,
9542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9543 .channel_mode = alc262_modes,
9544 .input_mux = &alc262_capture_source,
9545 .unsol_event = alc262_hippo_unsol_event,
9546 .init_hook = alc262_hippo_automute,
9548 [ALC262_HIPPO_1] = {
9549 .mixers = { alc262_hippo1_mixer },
9550 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9551 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9552 .dac_nids = alc262_dac_nids,
9554 .dig_out_nid = ALC262_DIGOUT_NID,
9555 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9556 .channel_mode = alc262_modes,
9557 .input_mux = &alc262_capture_source,
9558 .unsol_event = alc262_hippo1_unsol_event,
9559 .init_hook = alc262_hippo1_automute,
9561 [ALC262_FUJITSU] = {
9562 .mixers = { alc262_fujitsu_mixer },
9563 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9564 alc262_fujitsu_unsol_verbs },
9565 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9566 .dac_nids = alc262_dac_nids,
9568 .dig_out_nid = ALC262_DIGOUT_NID,
9569 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9570 .channel_mode = alc262_modes,
9571 .input_mux = &alc262_fujitsu_capture_source,
9572 .unsol_event = alc262_fujitsu_unsol_event,
9575 .mixers = { alc262_HP_BPC_mixer },
9576 .init_verbs = { alc262_HP_BPC_init_verbs },
9577 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9578 .dac_nids = alc262_dac_nids,
9580 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9581 .channel_mode = alc262_modes,
9582 .input_mux = &alc262_HP_capture_source,
9583 .unsol_event = alc262_hp_bpc_unsol_event,
9584 .init_hook = alc262_hp_bpc_automute,
9586 [ALC262_HP_BPC_D7000_WF] = {
9587 .mixers = { alc262_HP_BPC_WildWest_mixer },
9588 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9589 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9590 .dac_nids = alc262_dac_nids,
9592 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9593 .channel_mode = alc262_modes,
9594 .input_mux = &alc262_HP_D7000_capture_source,
9595 .unsol_event = alc262_hp_wildwest_unsol_event,
9596 .init_hook = alc262_hp_wildwest_automute,
9598 [ALC262_HP_BPC_D7000_WL] = {
9599 .mixers = { alc262_HP_BPC_WildWest_mixer,
9600 alc262_HP_BPC_WildWest_option_mixer },
9601 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9602 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9603 .dac_nids = alc262_dac_nids,
9605 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9606 .channel_mode = alc262_modes,
9607 .input_mux = &alc262_HP_D7000_capture_source,
9608 .unsol_event = alc262_hp_wildwest_unsol_event,
9609 .init_hook = alc262_hp_wildwest_automute,
9611 [ALC262_HP_TC_T5735] = {
9612 .mixers = { alc262_hp_t5735_mixer },
9613 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9614 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9615 .dac_nids = alc262_dac_nids,
9617 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9618 .channel_mode = alc262_modes,
9619 .input_mux = &alc262_capture_source,
9620 .unsol_event = alc262_hp_t5735_unsol_event,
9621 .init_hook = alc262_hp_t5735_init_hook,
9623 [ALC262_HP_RP5700] = {
9624 .mixers = { alc262_hp_rp5700_mixer },
9625 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9626 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9627 .dac_nids = alc262_dac_nids,
9628 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9629 .channel_mode = alc262_modes,
9630 .input_mux = &alc262_hp_rp5700_capture_source,
9632 [ALC262_BENQ_ED8] = {
9633 .mixers = { alc262_base_mixer },
9634 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9635 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9636 .dac_nids = alc262_dac_nids,
9638 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9639 .channel_mode = alc262_modes,
9640 .input_mux = &alc262_capture_source,
9642 [ALC262_SONY_ASSAMD] = {
9643 .mixers = { alc262_sony_mixer },
9644 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9645 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9646 .dac_nids = alc262_dac_nids,
9648 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9649 .channel_mode = alc262_modes,
9650 .input_mux = &alc262_capture_source,
9651 .unsol_event = alc262_hippo_unsol_event,
9652 .init_hook = alc262_hippo_automute,
9654 [ALC262_BENQ_T31] = {
9655 .mixers = { alc262_benq_t31_mixer },
9656 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9657 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9658 .dac_nids = alc262_dac_nids,
9660 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9661 .channel_mode = alc262_modes,
9662 .input_mux = &alc262_capture_source,
9663 .unsol_event = alc262_hippo_unsol_event,
9664 .init_hook = alc262_hippo_automute,
9667 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9668 .init_verbs = { alc262_ultra_verbs },
9669 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9670 .dac_nids = alc262_dac_nids,
9671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9672 .channel_mode = alc262_modes,
9673 .input_mux = &alc262_ultra_capture_source,
9674 .adc_nids = alc262_adc_nids, /* ADC0 */
9675 .capsrc_nids = alc262_capsrc_nids,
9676 .num_adc_nids = 1, /* single ADC */
9677 .unsol_event = alc262_ultra_unsol_event,
9678 .init_hook = alc262_ultra_automute,
9680 [ALC262_LENOVO_3000] = {
9681 .mixers = { alc262_lenovo_3000_mixer },
9682 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9683 alc262_lenovo_3000_unsol_verbs },
9684 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9685 .dac_nids = alc262_dac_nids,
9687 .dig_out_nid = ALC262_DIGOUT_NID,
9688 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9689 .channel_mode = alc262_modes,
9690 .input_mux = &alc262_fujitsu_capture_source,
9691 .unsol_event = alc262_lenovo_3000_unsol_event,
9695 static int patch_alc262(struct hda_codec *codec)
9697 struct alc_spec *spec;
9701 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9707 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9712 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9713 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9714 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9715 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9719 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9723 if (board_config < 0) {
9724 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9725 "trying auto-probe from BIOS...\n");
9726 board_config = ALC262_AUTO;
9729 if (board_config == ALC262_AUTO) {
9730 /* automatic parse from the BIOS config */
9731 err = alc262_parse_auto_config(codec);
9737 "hda_codec: Cannot set up configuration "
9738 "from BIOS. Using base mode...\n");
9739 board_config = ALC262_BASIC;
9743 if (board_config != ALC262_AUTO)
9744 setup_preset(spec, &alc262_presets[board_config]);
9746 spec->stream_name_analog = "ALC262 Analog";
9747 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9748 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9750 spec->stream_name_digital = "ALC262 Digital";
9751 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9752 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9754 if (!spec->adc_nids && spec->input_mux) {
9755 /* check whether NID 0x07 is valid */
9756 unsigned int wcap = get_wcaps(codec, 0x07);
9759 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9760 if (wcap != AC_WID_AUD_IN) {
9761 spec->adc_nids = alc262_adc_nids_alt;
9762 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9763 spec->capsrc_nids = alc262_capsrc_nids_alt;
9764 spec->mixers[spec->num_mixers] =
9765 alc262_capture_alt_mixer;
9768 spec->adc_nids = alc262_adc_nids;
9769 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9770 spec->capsrc_nids = alc262_capsrc_nids;
9771 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9776 spec->vmaster_nid = 0x0c;
9778 codec->patch_ops = alc_patch_ops;
9779 if (board_config == ALC262_AUTO)
9780 spec->init_hook = alc262_auto_init;
9781 #ifdef CONFIG_SND_HDA_POWER_SAVE
9782 if (!spec->loopback.amplist)
9783 spec->loopback.amplist = alc262_loopbacks;
9790 * ALC268 channel source setting (2 channel)
9792 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9793 #define alc268_modes alc260_modes
9795 static hda_nid_t alc268_dac_nids[2] = {
9800 static hda_nid_t alc268_adc_nids[2] = {
9805 static hda_nid_t alc268_adc_nids_alt[1] = {
9810 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9812 static struct snd_kcontrol_new alc268_base_mixer[] = {
9813 /* output mixer control */
9814 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9815 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9818 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9820 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9824 /* bind Beep switches of both NID 0x0f and 0x10 */
9825 static struct hda_bind_ctls alc268_bind_beep_sw = {
9826 .ops = &snd_hda_bind_sw,
9828 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9829 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9834 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9835 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9836 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9840 static struct hda_verb alc268_eapd_verbs[] = {
9841 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9842 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9846 /* Toshiba specific */
9847 #define alc268_toshiba_automute alc262_hippo_automute
9849 static struct hda_verb alc268_toshiba_verbs[] = {
9850 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9855 /* bind volumes of both NID 0x02 and 0x03 */
9856 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9857 .ops = &snd_hda_bind_vol,
9859 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9860 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9865 /* mute/unmute internal speaker according to the hp jack and mute state */
9866 static void alc268_acer_automute(struct hda_codec *codec, int force)
9868 struct alc_spec *spec = codec->spec;
9871 if (force || !spec->sense_updated) {
9872 unsigned int present;
9873 present = snd_hda_codec_read(codec, 0x14, 0,
9874 AC_VERB_GET_PIN_SENSE, 0);
9875 spec->jack_present = (present & 0x80000000) != 0;
9876 spec->sense_updated = 1;
9878 if (spec->jack_present)
9879 mute = HDA_AMP_MUTE; /* mute internal speaker */
9880 else /* unmute internal speaker if necessary */
9881 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9882 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9883 HDA_AMP_MUTE, mute);
9887 /* bind hp and internal speaker mute (with plug check) */
9888 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9889 struct snd_ctl_elem_value *ucontrol)
9891 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9892 long *valp = ucontrol->value.integer.value;
9895 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9897 valp[0] ? 0 : HDA_AMP_MUTE);
9898 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9900 valp[1] ? 0 : HDA_AMP_MUTE);
9902 alc268_acer_automute(codec, 0);
9906 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9907 /* output mixer control */
9908 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9911 .name = "Master Playback Switch",
9912 .info = snd_hda_mixer_amp_switch_info,
9913 .get = snd_hda_mixer_amp_switch_get,
9914 .put = alc268_acer_master_sw_put,
9915 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9918 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9919 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9923 static struct hda_verb alc268_acer_verbs[] = {
9924 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9925 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9931 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9935 /* unsolicited event for HP jack sensing */
9936 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9939 if ((res >> 26) != ALC880_HP_EVENT)
9941 alc268_toshiba_automute(codec);
9944 static void alc268_acer_unsol_event(struct hda_codec *codec,
9947 if ((res >> 26) != ALC880_HP_EVENT)
9949 alc268_acer_automute(codec, 1);
9952 static void alc268_acer_init_hook(struct hda_codec *codec)
9954 alc268_acer_automute(codec, 1);
9957 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9958 /* output mixer control */
9959 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9960 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9961 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9964 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9968 static struct hda_verb alc268_dell_verbs[] = {
9969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9971 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9975 /* mute/unmute internal speaker according to the hp jack and mute state */
9976 static void alc268_dell_automute(struct hda_codec *codec)
9978 unsigned int present;
9981 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9982 if (present & 0x80000000)
9983 mute = HDA_AMP_MUTE;
9985 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9986 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9987 HDA_AMP_MUTE, mute);
9990 static void alc268_dell_unsol_event(struct hda_codec *codec,
9993 if ((res >> 26) != ALC880_HP_EVENT)
9995 alc268_dell_automute(codec);
9998 #define alc268_dell_init_hook alc268_dell_automute
10000 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
10001 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10002 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10005 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10006 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
10007 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
10008 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10012 static struct hda_verb alc267_quanta_il1_verbs[] = {
10013 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10014 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
10018 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
10020 unsigned int present;
10022 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
10023 & AC_PINSENSE_PRESENCE;
10024 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10025 present ? 0 : PIN_OUT);
10028 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
10030 unsigned int present;
10032 present = snd_hda_codec_read(codec, 0x18, 0,
10033 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10034 snd_hda_codec_write(codec, 0x23, 0,
10035 AC_VERB_SET_CONNECT_SEL,
10036 present ? 0x00 : 0x01);
10039 static void alc267_quanta_il1_automute(struct hda_codec *codec)
10041 alc267_quanta_il1_hp_automute(codec);
10042 alc267_quanta_il1_mic_automute(codec);
10045 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
10048 switch (res >> 26) {
10049 case ALC880_HP_EVENT:
10050 alc267_quanta_il1_hp_automute(codec);
10052 case ALC880_MIC_EVENT:
10053 alc267_quanta_il1_mic_automute(codec);
10059 * generic initialization of ADC, input mixers and output mixers
10061 static struct hda_verb alc268_base_init_verbs[] = {
10062 /* Unmute DAC0-1 and set vol = 0 */
10063 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10064 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10065 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10066 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10067 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10068 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10071 * Set up output mixers (0x0c - 0x0e)
10073 /* set vol=0 to output mixers */
10074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10077 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
10079 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10080 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10082 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10084 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10085 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10086 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10087 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10088 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10089 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10091 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10094 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10095 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10097 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10099 /* set PCBEEP vol = 0, mute connections */
10100 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10101 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10102 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10104 /* Unmute Selector 23h,24h and set the default input to mic-in */
10106 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10108 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10115 * generic initialization of ADC, input mixers and output mixers
10117 static struct hda_verb alc268_volume_init_verbs[] = {
10118 /* set output DAC */
10119 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10120 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10121 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10122 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10124 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10126 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10127 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10128 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10131 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10133 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10134 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10136 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10139 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10141 /* set PCBEEP vol = 0, mute connections */
10142 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10144 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10149 #define alc268_mux_enum_info alc_mux_enum_info
10150 #define alc268_mux_enum_get alc_mux_enum_get
10151 #define alc268_mux_enum_put alc_mux_enum_put
10153 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10154 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10155 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10157 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10158 /* The multiple "Capture Source" controls confuse alsamixer
10159 * So call somewhat different..
10161 /* .name = "Capture Source", */
10162 .name = "Input Source",
10164 .info = alc268_mux_enum_info,
10165 .get = alc268_mux_enum_get,
10166 .put = alc268_mux_enum_put,
10171 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10172 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10173 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10174 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10175 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10177 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10178 /* The multiple "Capture Source" controls confuse alsamixer
10179 * So call somewhat different..
10181 /* .name = "Capture Source", */
10182 .name = "Input Source",
10184 .info = alc268_mux_enum_info,
10185 .get = alc268_mux_enum_get,
10186 .put = alc268_mux_enum_put,
10191 static struct hda_input_mux alc268_capture_source = {
10195 { "Front Mic", 0x1 },
10201 static struct hda_input_mux alc268_acer_capture_source = {
10205 { "Internal Mic", 0x6 },
10210 #ifdef CONFIG_SND_DEBUG
10211 static struct snd_kcontrol_new alc268_test_mixer[] = {
10212 /* Volume widgets */
10213 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10214 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10215 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10216 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10217 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10218 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10219 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10220 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10221 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10222 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10223 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10224 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10225 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10226 /* The below appears problematic on some hardwares */
10227 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10228 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10229 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10230 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10231 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10233 /* Modes for retasking pin widgets */
10234 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10235 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10236 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10237 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10239 /* Controls for GPIO pins, assuming they are configured as outputs */
10240 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10241 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10242 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10243 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10245 /* Switches to allow the digital SPDIF output pin to be enabled.
10246 * The ALC268 does not have an SPDIF input.
10248 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10250 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10251 * this output to turn on an external amplifier.
10253 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10254 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10260 /* create input playback/capture controls for the given pin */
10261 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10262 const char *ctlname, int idx)
10267 sprintf(name, "%s Playback Volume", ctlname);
10269 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10270 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10274 } else if (nid == 0x15) {
10275 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10276 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10282 sprintf(name, "%s Playback Switch", ctlname);
10283 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10284 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10290 /* add playback controls from the parsed DAC table */
10291 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10292 const struct auto_pin_cfg *cfg)
10297 spec->multiout.num_dacs = 2; /* only use one dac */
10298 spec->multiout.dac_nids = spec->private_dac_nids;
10299 spec->multiout.dac_nids[0] = 2;
10300 spec->multiout.dac_nids[1] = 3;
10302 nid = cfg->line_out_pins[0];
10304 alc268_new_analog_output(spec, nid, "Front", 0);
10306 nid = cfg->speaker_pins[0];
10308 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10309 "Speaker Playback Volume",
10310 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10314 nid = cfg->hp_pins[0];
10316 alc268_new_analog_output(spec, nid, "Headphone", 0);
10318 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10320 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10321 "Mono Playback Switch",
10322 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10329 /* create playback/capture controls for input pins */
10330 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10331 const struct auto_pin_cfg *cfg)
10333 struct hda_input_mux *imux = &spec->private_imux;
10336 for (i = 0; i < AUTO_PIN_LAST; i++) {
10337 switch(cfg->input_pins[i]) {
10339 idx1 = 0; /* Mic 1 */
10342 idx1 = 1; /* Mic 2 */
10345 idx1 = 2; /* Line In */
10352 idx1 = 6; /* digital mics */
10357 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10358 imux->items[imux->num_items].index = idx1;
10364 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10366 struct alc_spec *spec = codec->spec;
10367 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10368 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10369 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10370 unsigned int dac_vol1, dac_vol2;
10373 snd_hda_codec_write(codec, speaker_nid, 0,
10374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10375 snd_hda_codec_write(codec, 0x0f, 0,
10376 AC_VERB_SET_AMP_GAIN_MUTE,
10378 snd_hda_codec_write(codec, 0x10, 0,
10379 AC_VERB_SET_AMP_GAIN_MUTE,
10382 snd_hda_codec_write(codec, 0x0f, 0,
10383 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10384 snd_hda_codec_write(codec, 0x10, 0,
10385 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10388 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10389 if (line_nid == 0x14)
10390 dac_vol2 = AMP_OUT_ZERO;
10391 else if (line_nid == 0x15)
10392 dac_vol1 = AMP_OUT_ZERO;
10393 if (hp_nid == 0x14)
10394 dac_vol2 = AMP_OUT_ZERO;
10395 else if (hp_nid == 0x15)
10396 dac_vol1 = AMP_OUT_ZERO;
10397 if (line_nid != 0x16 || hp_nid != 0x16 ||
10398 spec->autocfg.line_out_pins[1] != 0x16 ||
10399 spec->autocfg.line_out_pins[2] != 0x16)
10400 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10402 snd_hda_codec_write(codec, 0x02, 0,
10403 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10404 snd_hda_codec_write(codec, 0x03, 0,
10405 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10408 /* pcm configuration: identiacal with ALC880 */
10409 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10410 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10411 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10412 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10415 * BIOS auto configuration
10417 static int alc268_parse_auto_config(struct hda_codec *codec)
10419 struct alc_spec *spec = codec->spec;
10421 static hda_nid_t alc268_ignore[] = { 0 };
10423 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10427 if (!spec->autocfg.line_outs)
10428 return 0; /* can't find valid BIOS pin config */
10430 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10433 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10437 spec->multiout.max_channels = 2;
10439 /* digital only support output */
10440 if (spec->autocfg.dig_out_pin)
10441 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10443 if (spec->kctl_alloc)
10444 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10446 if (spec->autocfg.speaker_pins[0] != 0x1d)
10447 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10449 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10450 spec->num_mux_defs = 1;
10451 spec->input_mux = &spec->private_imux;
10453 err = alc_auto_add_mic_boost(codec);
10460 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10461 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10462 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10464 /* init callback for auto-configuration model -- overriding the default init */
10465 static void alc268_auto_init(struct hda_codec *codec)
10467 struct alc_spec *spec = codec->spec;
10468 alc268_auto_init_multi_out(codec);
10469 alc268_auto_init_hp_out(codec);
10470 alc268_auto_init_mono_speaker_out(codec);
10471 alc268_auto_init_analog_input(codec);
10472 if (spec->unsol_event)
10473 alc_sku_automute(codec);
10477 * configuration and preset
10479 static const char *alc268_models[ALC268_MODEL_LAST] = {
10480 [ALC267_QUANTA_IL1] = "quanta-il1",
10481 [ALC268_3ST] = "3stack",
10482 [ALC268_TOSHIBA] = "toshiba",
10483 [ALC268_ACER] = "acer",
10484 [ALC268_DELL] = "dell",
10485 [ALC268_ZEPTO] = "zepto",
10486 #ifdef CONFIG_SND_DEBUG
10487 [ALC268_TEST] = "test",
10489 [ALC268_AUTO] = "auto",
10492 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10493 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10494 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10495 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10496 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10497 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10498 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10499 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10500 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10501 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10502 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10503 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10504 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10505 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10509 static struct alc_config_preset alc268_presets[] = {
10510 [ALC267_QUANTA_IL1] = {
10511 .mixers = { alc267_quanta_il1_mixer },
10512 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10513 alc267_quanta_il1_verbs },
10514 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10515 .dac_nids = alc268_dac_nids,
10516 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10517 .adc_nids = alc268_adc_nids_alt,
10519 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10520 .channel_mode = alc268_modes,
10521 .input_mux = &alc268_capture_source,
10522 .unsol_event = alc267_quanta_il1_unsol_event,
10523 .init_hook = alc267_quanta_il1_automute,
10526 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10527 alc268_beep_mixer },
10528 .init_verbs = { alc268_base_init_verbs },
10529 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10530 .dac_nids = alc268_dac_nids,
10531 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10532 .adc_nids = alc268_adc_nids_alt,
10533 .capsrc_nids = alc268_capsrc_nids,
10535 .dig_out_nid = ALC268_DIGOUT_NID,
10536 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10537 .channel_mode = alc268_modes,
10538 .input_mux = &alc268_capture_source,
10540 [ALC268_TOSHIBA] = {
10541 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10542 alc268_beep_mixer },
10543 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10544 alc268_toshiba_verbs },
10545 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10546 .dac_nids = alc268_dac_nids,
10547 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10548 .adc_nids = alc268_adc_nids_alt,
10549 .capsrc_nids = alc268_capsrc_nids,
10551 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10552 .channel_mode = alc268_modes,
10553 .input_mux = &alc268_capture_source,
10554 .unsol_event = alc268_toshiba_unsol_event,
10555 .init_hook = alc268_toshiba_automute,
10558 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10559 alc268_beep_mixer },
10560 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10561 alc268_acer_verbs },
10562 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10563 .dac_nids = alc268_dac_nids,
10564 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10565 .adc_nids = alc268_adc_nids_alt,
10566 .capsrc_nids = alc268_capsrc_nids,
10568 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10569 .channel_mode = alc268_modes,
10570 .input_mux = &alc268_acer_capture_source,
10571 .unsol_event = alc268_acer_unsol_event,
10572 .init_hook = alc268_acer_init_hook,
10575 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10576 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10577 alc268_dell_verbs },
10578 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10579 .dac_nids = alc268_dac_nids,
10581 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10582 .channel_mode = alc268_modes,
10583 .unsol_event = alc268_dell_unsol_event,
10584 .init_hook = alc268_dell_init_hook,
10585 .input_mux = &alc268_capture_source,
10588 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10589 alc268_beep_mixer },
10590 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10591 alc268_toshiba_verbs },
10592 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10593 .dac_nids = alc268_dac_nids,
10594 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10595 .adc_nids = alc268_adc_nids_alt,
10596 .capsrc_nids = alc268_capsrc_nids,
10598 .dig_out_nid = ALC268_DIGOUT_NID,
10599 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10600 .channel_mode = alc268_modes,
10601 .input_mux = &alc268_capture_source,
10602 .unsol_event = alc268_toshiba_unsol_event,
10603 .init_hook = alc268_toshiba_automute
10605 #ifdef CONFIG_SND_DEBUG
10607 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10608 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10609 alc268_volume_init_verbs },
10610 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10611 .dac_nids = alc268_dac_nids,
10612 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10613 .adc_nids = alc268_adc_nids_alt,
10614 .capsrc_nids = alc268_capsrc_nids,
10616 .dig_out_nid = ALC268_DIGOUT_NID,
10617 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10618 .channel_mode = alc268_modes,
10619 .input_mux = &alc268_capture_source,
10624 static int patch_alc268(struct hda_codec *codec)
10626 struct alc_spec *spec;
10630 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10634 codec->spec = spec;
10636 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10640 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10641 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10642 "trying auto-probe from BIOS...\n");
10643 board_config = ALC268_AUTO;
10646 if (board_config == ALC268_AUTO) {
10647 /* automatic parse from the BIOS config */
10648 err = alc268_parse_auto_config(codec);
10654 "hda_codec: Cannot set up configuration "
10655 "from BIOS. Using base mode...\n");
10656 board_config = ALC268_3ST;
10660 if (board_config != ALC268_AUTO)
10661 setup_preset(spec, &alc268_presets[board_config]);
10663 spec->stream_name_analog = "ALC268 Analog";
10664 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10665 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10666 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10668 spec->stream_name_digital = "ALC268 Digital";
10669 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10671 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10672 /* override the amp caps for beep generator */
10673 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10674 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10675 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10676 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10677 (0 << AC_AMPCAP_MUTE_SHIFT));
10679 if (!spec->adc_nids && spec->input_mux) {
10680 /* check whether NID 0x07 is valid */
10681 unsigned int wcap = get_wcaps(codec, 0x07);
10685 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10686 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10687 spec->adc_nids = alc268_adc_nids_alt;
10688 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10689 spec->mixers[spec->num_mixers] =
10690 alc268_capture_alt_mixer;
10691 spec->num_mixers++;
10693 spec->adc_nids = alc268_adc_nids;
10694 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10695 spec->mixers[spec->num_mixers] =
10696 alc268_capture_mixer;
10697 spec->num_mixers++;
10699 spec->capsrc_nids = alc268_capsrc_nids;
10700 /* set default input source */
10701 for (i = 0; i < spec->num_adc_nids; i++)
10702 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10703 0, AC_VERB_SET_CONNECT_SEL,
10704 spec->input_mux->items[0].index);
10707 spec->vmaster_nid = 0x02;
10709 codec->patch_ops = alc_patch_ops;
10710 if (board_config == ALC268_AUTO)
10711 spec->init_hook = alc268_auto_init;
10717 * ALC269 channel source setting (2 channel)
10719 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10721 #define alc269_dac_nids alc260_dac_nids
10723 static hda_nid_t alc269_adc_nids[1] = {
10728 #define alc269_modes alc260_modes
10729 #define alc269_capture_source alc880_lg_lw_capture_source
10731 static struct snd_kcontrol_new alc269_base_mixer[] = {
10732 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10733 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10734 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10735 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10736 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10738 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10739 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10741 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10743 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10747 /* capture mixer elements */
10748 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10749 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10750 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10752 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10753 /* The multiple "Capture Source" controls confuse alsamixer
10754 * So call somewhat different..
10756 /* .name = "Capture Source", */
10757 .name = "Input Source",
10759 .info = alc_mux_enum_info,
10760 .get = alc_mux_enum_get,
10761 .put = alc_mux_enum_put,
10767 * generic initialization of ADC, input mixers and output mixers
10769 static struct hda_verb alc269_init_verbs[] = {
10771 * Unmute ADC0 and set the default input to mic-in
10773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10775 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10776 * analog-loopback mixer widget
10777 * Note: PASD motherboards uses the Line In 2 as the input for
10778 * front panel mic (mic 2)
10780 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10781 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10782 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10783 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10784 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10785 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10788 * Set up output mixers (0x0c - 0x0e)
10790 /* set vol=0 to output mixers */
10791 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10792 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10794 /* set up input amps for analog loopback */
10795 /* Amp Indices: DAC = 0, mixer = 1 */
10796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10805 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10806 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10809 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10813 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10814 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10815 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10819 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10820 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10822 /* FIXME: use matrix-type input source selection */
10823 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10824 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10825 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10826 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10827 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10828 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10831 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10832 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10836 /* add playback controls from the parsed DAC table */
10837 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10838 const struct auto_pin_cfg *cfg)
10843 spec->multiout.num_dacs = 1; /* only use one dac */
10844 spec->multiout.dac_nids = spec->private_dac_nids;
10845 spec->multiout.dac_nids[0] = 2;
10847 nid = cfg->line_out_pins[0];
10849 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10850 "Front Playback Volume",
10851 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10854 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10855 "Front Playback Switch",
10856 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10861 nid = cfg->speaker_pins[0];
10863 if (!cfg->line_out_pins[0]) {
10864 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10865 "Speaker Playback Volume",
10866 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10872 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10873 "Speaker Playback Switch",
10874 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10879 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10880 "Speaker Playback Switch",
10881 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10887 nid = cfg->hp_pins[0];
10889 /* spec->multiout.hp_nid = 2; */
10890 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10891 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10892 "Headphone Playback Volume",
10893 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10899 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10900 "Headphone Playback Switch",
10901 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10906 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10907 "Headphone Playback Switch",
10908 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10917 #define alc269_auto_create_analog_input_ctls \
10918 alc880_auto_create_analog_input_ctls
10920 #ifdef CONFIG_SND_HDA_POWER_SAVE
10921 #define alc269_loopbacks alc880_loopbacks
10924 /* pcm configuration: identiacal with ALC880 */
10925 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10926 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10927 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10928 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10931 * BIOS auto configuration
10933 static int alc269_parse_auto_config(struct hda_codec *codec)
10935 struct alc_spec *spec = codec->spec;
10937 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10939 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10944 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10947 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10951 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10953 if (spec->autocfg.dig_out_pin)
10954 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10956 if (spec->kctl_alloc)
10957 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10959 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10960 spec->num_mux_defs = 1;
10961 spec->input_mux = &spec->private_imux;
10963 err = alc_auto_add_mic_boost(codec);
10970 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10971 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10972 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10975 /* init callback for auto-configuration model -- overriding the default init */
10976 static void alc269_auto_init(struct hda_codec *codec)
10978 struct alc_spec *spec = codec->spec;
10979 alc269_auto_init_multi_out(codec);
10980 alc269_auto_init_hp_out(codec);
10981 alc269_auto_init_analog_input(codec);
10982 if (spec->unsol_event)
10983 alc_sku_automute(codec);
10987 * configuration and preset
10989 static const char *alc269_models[ALC269_MODEL_LAST] = {
10990 [ALC269_BASIC] = "basic",
10993 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10997 static struct alc_config_preset alc269_presets[] = {
10999 .mixers = { alc269_base_mixer },
11000 .init_verbs = { alc269_init_verbs },
11001 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
11002 .dac_nids = alc269_dac_nids,
11004 .num_channel_mode = ARRAY_SIZE(alc269_modes),
11005 .channel_mode = alc269_modes,
11006 .input_mux = &alc269_capture_source,
11010 static int patch_alc269(struct hda_codec *codec)
11012 struct alc_spec *spec;
11016 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11020 codec->spec = spec;
11022 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
11026 if (board_config < 0) {
11027 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
11028 "trying auto-probe from BIOS...\n");
11029 board_config = ALC269_AUTO;
11032 if (board_config == ALC269_AUTO) {
11033 /* automatic parse from the BIOS config */
11034 err = alc269_parse_auto_config(codec);
11040 "hda_codec: Cannot set up configuration "
11041 "from BIOS. Using base mode...\n");
11042 board_config = ALC269_BASIC;
11046 if (board_config != ALC269_AUTO)
11047 setup_preset(spec, &alc269_presets[board_config]);
11049 spec->stream_name_analog = "ALC269 Analog";
11050 spec->stream_analog_playback = &alc269_pcm_analog_playback;
11051 spec->stream_analog_capture = &alc269_pcm_analog_capture;
11053 spec->stream_name_digital = "ALC269 Digital";
11054 spec->stream_digital_playback = &alc269_pcm_digital_playback;
11055 spec->stream_digital_capture = &alc269_pcm_digital_capture;
11057 spec->adc_nids = alc269_adc_nids;
11058 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
11059 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
11060 spec->num_mixers++;
11062 codec->patch_ops = alc_patch_ops;
11063 if (board_config == ALC269_AUTO)
11064 spec->init_hook = alc269_auto_init;
11065 #ifdef CONFIG_SND_HDA_POWER_SAVE
11066 if (!spec->loopback.amplist)
11067 spec->loopback.amplist = alc269_loopbacks;
11074 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11078 * set the path ways for 2 channel output
11079 * need to set the codec line out and mic 1 pin widgets to inputs
11081 static struct hda_verb alc861_threestack_ch2_init[] = {
11082 /* set pin widget 1Ah (line in) for input */
11083 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11084 /* set pin widget 18h (mic1/2) for input, for mic also enable
11087 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11089 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11091 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11092 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11098 * need to set the codec line out and mic 1 pin widgets to outputs
11100 static struct hda_verb alc861_threestack_ch6_init[] = {
11101 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11102 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11103 /* set pin widget 18h (mic1) for output (CLFE)*/
11104 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11106 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11107 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11109 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11111 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11112 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11117 static struct hda_channel_mode alc861_threestack_modes[2] = {
11118 { 2, alc861_threestack_ch2_init },
11119 { 6, alc861_threestack_ch6_init },
11121 /* Set mic1 as input and unmute the mixer */
11122 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11123 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11124 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11127 /* Set mic1 as output and mute mixer */
11128 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11129 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11130 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11134 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11135 { 2, alc861_uniwill_m31_ch2_init },
11136 { 4, alc861_uniwill_m31_ch4_init },
11139 /* Set mic1 and line-in as input and unmute the mixer */
11140 static struct hda_verb alc861_asus_ch2_init[] = {
11141 /* set pin widget 1Ah (line in) for input */
11142 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11143 /* set pin widget 18h (mic1/2) for input, for mic also enable
11146 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11148 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11150 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11151 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11155 /* Set mic1 nad line-in as output and mute mixer */
11156 static struct hda_verb alc861_asus_ch6_init[] = {
11157 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11158 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11159 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11160 /* set pin widget 18h (mic1) for output (CLFE)*/
11161 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11162 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11163 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11164 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11166 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11168 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11169 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11174 static struct hda_channel_mode alc861_asus_modes[2] = {
11175 { 2, alc861_asus_ch2_init },
11176 { 6, alc861_asus_ch6_init },
11181 static struct snd_kcontrol_new alc861_base_mixer[] = {
11182 /* output mixer control */
11183 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11184 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11185 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11186 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11187 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11189 /*Input mixer control */
11190 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11191 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11192 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11193 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11194 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11195 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11197 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11201 /* Capture mixer control */
11202 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11203 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11206 .name = "Capture Source",
11208 .info = alc_mux_enum_info,
11209 .get = alc_mux_enum_get,
11210 .put = alc_mux_enum_put,
11215 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11216 /* output mixer control */
11217 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11218 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11219 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11220 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11221 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11223 /* Input mixer control */
11224 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11225 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11226 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11227 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11228 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11229 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11231 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11232 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11235 /* Capture mixer control */
11236 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11237 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11240 .name = "Capture Source",
11242 .info = alc_mux_enum_info,
11243 .get = alc_mux_enum_get,
11244 .put = alc_mux_enum_put,
11247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11248 .name = "Channel Mode",
11249 .info = alc_ch_mode_info,
11250 .get = alc_ch_mode_get,
11251 .put = alc_ch_mode_put,
11252 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11257 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11258 /* output mixer control */
11259 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11260 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11261 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11263 /*Capture mixer control */
11264 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11265 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11268 .name = "Capture Source",
11270 .info = alc_mux_enum_info,
11271 .get = alc_mux_enum_get,
11272 .put = alc_mux_enum_put,
11278 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11279 /* output mixer control */
11280 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11281 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11282 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11283 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11284 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11286 /* Input mixer control */
11287 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11288 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11289 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11290 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11291 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11292 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11294 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11295 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11296 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11298 /* Capture mixer control */
11299 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11300 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11302 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11303 .name = "Capture Source",
11305 .info = alc_mux_enum_info,
11306 .get = alc_mux_enum_get,
11307 .put = alc_mux_enum_put,
11310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11311 .name = "Channel Mode",
11312 .info = alc_ch_mode_info,
11313 .get = alc_ch_mode_get,
11314 .put = alc_ch_mode_put,
11315 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11320 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11321 /* output mixer control */
11322 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11323 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11324 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11325 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11326 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11328 /* Input mixer control */
11329 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11330 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11331 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11332 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11333 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11334 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11336 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11337 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11340 /* Capture mixer control */
11341 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11342 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11345 .name = "Capture Source",
11347 .info = alc_mux_enum_info,
11348 .get = alc_mux_enum_get,
11349 .put = alc_mux_enum_put,
11352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11353 .name = "Channel Mode",
11354 .info = alc_ch_mode_info,
11355 .get = alc_ch_mode_get,
11356 .put = alc_ch_mode_put,
11357 .private_value = ARRAY_SIZE(alc861_asus_modes),
11362 /* additional mixer */
11363 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11364 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11365 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11366 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11367 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11372 * generic initialization of ADC, input mixers and output mixers
11374 static struct hda_verb alc861_base_init_verbs[] = {
11376 * Unmute ADC0 and set the default input to mic-in
11378 /* port-A for surround (rear panel) */
11379 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11380 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11381 /* port-B for mic-in (rear panel) with vref */
11382 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11383 /* port-C for line-in (rear panel) */
11384 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11385 /* port-D for Front */
11386 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11387 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11388 /* port-E for HP out (front panel) */
11389 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11390 /* route front PCM to HP */
11391 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11392 /* port-F for mic-in (front panel) with vref */
11393 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11394 /* port-G for CLFE (rear panel) */
11395 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11396 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11397 /* port-H for side (rear panel) */
11398 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11399 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11401 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11402 /* route front mic to ADC1*/
11403 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11404 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 /* Unmute DAC0~3 & spdif out*/
11407 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11408 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11409 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11410 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11413 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11414 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11415 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11416 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11417 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11419 /* Unmute Stereo Mixer 15 */
11420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11425 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11426 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11427 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11428 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11429 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11431 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11432 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11433 /* hp used DAC 3 (Front) */
11434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11440 static struct hda_verb alc861_threestack_init_verbs[] = {
11442 * Unmute ADC0 and set the default input to mic-in
11444 /* port-A for surround (rear panel) */
11445 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11446 /* port-B for mic-in (rear panel) with vref */
11447 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11448 /* port-C for line-in (rear panel) */
11449 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11450 /* port-D for Front */
11451 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11452 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11453 /* port-E for HP out (front panel) */
11454 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11455 /* route front PCM to HP */
11456 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11457 /* port-F for mic-in (front panel) with vref */
11458 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11459 /* port-G for CLFE (rear panel) */
11460 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11461 /* port-H for side (rear panel) */
11462 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11464 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11465 /* route front mic to ADC1*/
11466 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11467 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11468 /* Unmute DAC0~3 & spdif out*/
11469 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11470 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11471 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11472 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11475 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11476 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11477 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11478 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11479 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11481 /* Unmute Stereo Mixer 15 */
11482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11485 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11487 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11489 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11490 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11491 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11492 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11493 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11494 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11495 /* hp used DAC 3 (Front) */
11496 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11497 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11501 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11503 * Unmute ADC0 and set the default input to mic-in
11505 /* port-A for surround (rear panel) */
11506 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11507 /* port-B for mic-in (rear panel) with vref */
11508 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11509 /* port-C for line-in (rear panel) */
11510 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11511 /* port-D for Front */
11512 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11513 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11514 /* port-E for HP out (front panel) */
11515 /* this has to be set to VREF80 */
11516 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11517 /* route front PCM to HP */
11518 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11519 /* port-F for mic-in (front panel) with vref */
11520 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11521 /* port-G for CLFE (rear panel) */
11522 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11523 /* port-H for side (rear panel) */
11524 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11526 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11527 /* route front mic to ADC1*/
11528 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11530 /* Unmute DAC0~3 & spdif out*/
11531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11532 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11533 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11534 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11537 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11538 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11539 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11540 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11541 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11543 /* Unmute Stereo Mixer 15 */
11544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11545 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11546 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11547 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11549 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11551 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11552 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11553 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11554 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11556 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11557 /* hp used DAC 3 (Front) */
11558 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11559 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11563 static struct hda_verb alc861_asus_init_verbs[] = {
11565 * Unmute ADC0 and set the default input to mic-in
11567 /* port-A for surround (rear panel)
11568 * according to codec#0 this is the HP jack
11570 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11571 /* route front PCM to HP */
11572 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11573 /* port-B for mic-in (rear panel) with vref */
11574 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11575 /* port-C for line-in (rear panel) */
11576 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11577 /* port-D for Front */
11578 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11579 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11580 /* port-E for HP out (front panel) */
11581 /* this has to be set to VREF80 */
11582 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11583 /* route front PCM to HP */
11584 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11585 /* port-F for mic-in (front panel) with vref */
11586 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11587 /* port-G for CLFE (rear panel) */
11588 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11589 /* port-H for side (rear panel) */
11590 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11592 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11593 /* route front mic to ADC1*/
11594 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11596 /* Unmute DAC0~3 & spdif out*/
11597 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11598 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11599 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11600 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11602 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11603 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11604 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11605 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11606 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11608 /* Unmute Stereo Mixer 15 */
11609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11614 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11617 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11618 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11620 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11621 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11622 /* hp used DAC 3 (Front) */
11623 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11628 /* additional init verbs for ASUS laptops */
11629 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11630 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11631 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11636 * generic initialization of ADC, input mixers and output mixers
11638 static struct hda_verb alc861_auto_init_verbs[] = {
11640 * Unmute ADC0 and set the default input to mic-in
11642 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11643 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11645 /* Unmute DAC0~3 & spdif out*/
11646 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11647 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11648 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11649 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11652 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11653 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11654 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11655 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11656 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11658 /* Unmute Stereo Mixer 15 */
11659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11664 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11666 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11667 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11668 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11669 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11670 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11671 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11675 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11676 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11677 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11680 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11682 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11687 static struct hda_verb alc861_toshiba_init_verbs[] = {
11688 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11693 /* toggle speaker-output according to the hp-jack state */
11694 static void alc861_toshiba_automute(struct hda_codec *codec)
11696 unsigned int present;
11698 present = snd_hda_codec_read(codec, 0x0f, 0,
11699 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11700 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11701 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11702 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11703 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11706 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11709 if ((res >> 26) == ALC880_HP_EVENT)
11710 alc861_toshiba_automute(codec);
11713 /* pcm configuration: identiacal with ALC880 */
11714 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11715 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11716 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11717 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11720 #define ALC861_DIGOUT_NID 0x07
11722 static struct hda_channel_mode alc861_8ch_modes[1] = {
11726 static hda_nid_t alc861_dac_nids[4] = {
11727 /* front, surround, clfe, side */
11728 0x03, 0x06, 0x05, 0x04
11731 static hda_nid_t alc660_dac_nids[3] = {
11732 /* front, clfe, surround */
11736 static hda_nid_t alc861_adc_nids[1] = {
11741 static struct hda_input_mux alc861_capture_source = {
11745 { "Front Mic", 0x3 },
11752 /* fill in the dac_nids table from the parsed pin configuration */
11753 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11754 const struct auto_pin_cfg *cfg)
11759 spec->multiout.dac_nids = spec->private_dac_nids;
11760 for (i = 0; i < cfg->line_outs; i++) {
11761 nid = cfg->line_out_pins[i];
11763 if (i >= ARRAY_SIZE(alc861_dac_nids))
11765 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11768 spec->multiout.num_dacs = cfg->line_outs;
11772 /* add playback controls from the parsed DAC table */
11773 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11774 const struct auto_pin_cfg *cfg)
11777 static const char *chname[4] = {
11778 "Front", "Surround", NULL /*CLFE*/, "Side"
11783 for (i = 0; i < cfg->line_outs; i++) {
11784 nid = spec->multiout.dac_nids[i];
11789 err = add_control(spec, ALC_CTL_BIND_MUTE,
11790 "Center Playback Switch",
11791 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11795 err = add_control(spec, ALC_CTL_BIND_MUTE,
11796 "LFE Playback Switch",
11797 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11802 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11804 if (nid == alc861_dac_nids[idx])
11806 sprintf(name, "%s Playback Switch", chname[idx]);
11807 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11808 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11817 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11825 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11827 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11828 "Headphone Playback Switch",
11829 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11832 spec->multiout.hp_nid = nid;
11837 /* create playback/capture controls for input pins */
11838 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11839 const struct auto_pin_cfg *cfg)
11841 struct hda_input_mux *imux = &spec->private_imux;
11842 int i, err, idx, idx1;
11844 for (i = 0; i < AUTO_PIN_LAST; i++) {
11845 switch (cfg->input_pins[i]) {
11848 idx = 2; /* Line In */
11852 idx = 2; /* Line In */
11856 idx = 1; /* Mic In */
11860 idx = 1; /* Mic In */
11870 err = new_analog_input(spec, cfg->input_pins[i],
11871 auto_pin_cfg_labels[i], idx, 0x15);
11875 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11876 imux->items[imux->num_items].index = idx1;
11882 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11883 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11884 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11888 /* The multiple "Capture Source" controls confuse alsamixer
11889 * So call somewhat different..
11891 /* .name = "Capture Source", */
11892 .name = "Input Source",
11894 .info = alc_mux_enum_info,
11895 .get = alc_mux_enum_get,
11896 .put = alc_mux_enum_put,
11901 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11903 int pin_type, int dac_idx)
11905 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11907 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11911 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11913 struct alc_spec *spec = codec->spec;
11916 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11917 for (i = 0; i < spec->autocfg.line_outs; i++) {
11918 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11919 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11921 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11922 spec->multiout.dac_nids[i]);
11926 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11928 struct alc_spec *spec = codec->spec;
11931 pin = spec->autocfg.hp_pins[0];
11932 if (pin) /* connect to front */
11933 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11934 spec->multiout.dac_nids[0]);
11935 pin = spec->autocfg.speaker_pins[0];
11937 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11940 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11942 struct alc_spec *spec = codec->spec;
11945 for (i = 0; i < AUTO_PIN_LAST; i++) {
11946 hda_nid_t nid = spec->autocfg.input_pins[i];
11947 if (nid >= 0x0c && nid <= 0x11) {
11948 snd_hda_codec_write(codec, nid, 0,
11949 AC_VERB_SET_PIN_WIDGET_CONTROL,
11950 i <= AUTO_PIN_FRONT_MIC ?
11951 PIN_VREF80 : PIN_IN);
11956 /* parse the BIOS configuration and set up the alc_spec */
11957 /* return 1 if successful, 0 if the proper config is not found,
11958 * or a negative error code
11960 static int alc861_parse_auto_config(struct hda_codec *codec)
11962 struct alc_spec *spec = codec->spec;
11964 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11966 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11970 if (!spec->autocfg.line_outs)
11971 return 0; /* can't find valid BIOS pin config */
11973 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11976 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11979 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11982 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11986 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11988 if (spec->autocfg.dig_out_pin)
11989 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11991 if (spec->kctl_alloc)
11992 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11994 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11996 spec->num_mux_defs = 1;
11997 spec->input_mux = &spec->private_imux;
11999 spec->adc_nids = alc861_adc_nids;
12000 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
12001 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
12002 spec->num_mixers++;
12007 /* additional initialization for auto-configuration model */
12008 static void alc861_auto_init(struct hda_codec *codec)
12010 struct alc_spec *spec = codec->spec;
12011 alc861_auto_init_multi_out(codec);
12012 alc861_auto_init_hp_out(codec);
12013 alc861_auto_init_analog_input(codec);
12014 if (spec->unsol_event)
12015 alc_sku_automute(codec);
12018 #ifdef CONFIG_SND_HDA_POWER_SAVE
12019 static struct hda_amp_list alc861_loopbacks[] = {
12020 { 0x15, HDA_INPUT, 0 },
12021 { 0x15, HDA_INPUT, 1 },
12022 { 0x15, HDA_INPUT, 2 },
12023 { 0x15, HDA_INPUT, 3 },
12030 * configuration and preset
12032 static const char *alc861_models[ALC861_MODEL_LAST] = {
12033 [ALC861_3ST] = "3stack",
12034 [ALC660_3ST] = "3stack-660",
12035 [ALC861_3ST_DIG] = "3stack-dig",
12036 [ALC861_6ST_DIG] = "6stack-dig",
12037 [ALC861_UNIWILL_M31] = "uniwill-m31",
12038 [ALC861_TOSHIBA] = "toshiba",
12039 [ALC861_ASUS] = "asus",
12040 [ALC861_ASUS_LAPTOP] = "asus-laptop",
12041 [ALC861_AUTO] = "auto",
12044 static struct snd_pci_quirk alc861_cfg_tbl[] = {
12045 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
12046 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12047 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
12048 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
12049 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
12050 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
12051 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
12052 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12053 * Any other models that need this preset?
12055 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12056 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
12057 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
12058 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
12059 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
12060 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
12061 /* FIXME: the below seems conflict */
12062 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12063 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
12064 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
12068 static struct alc_config_preset alc861_presets[] = {
12070 .mixers = { alc861_3ST_mixer },
12071 .init_verbs = { alc861_threestack_init_verbs },
12072 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12073 .dac_nids = alc861_dac_nids,
12074 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12075 .channel_mode = alc861_threestack_modes,
12077 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12078 .adc_nids = alc861_adc_nids,
12079 .input_mux = &alc861_capture_source,
12081 [ALC861_3ST_DIG] = {
12082 .mixers = { alc861_base_mixer },
12083 .init_verbs = { alc861_threestack_init_verbs },
12084 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12085 .dac_nids = alc861_dac_nids,
12086 .dig_out_nid = ALC861_DIGOUT_NID,
12087 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12088 .channel_mode = alc861_threestack_modes,
12090 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12091 .adc_nids = alc861_adc_nids,
12092 .input_mux = &alc861_capture_source,
12094 [ALC861_6ST_DIG] = {
12095 .mixers = { alc861_base_mixer },
12096 .init_verbs = { alc861_base_init_verbs },
12097 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12098 .dac_nids = alc861_dac_nids,
12099 .dig_out_nid = ALC861_DIGOUT_NID,
12100 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12101 .channel_mode = alc861_8ch_modes,
12102 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12103 .adc_nids = alc861_adc_nids,
12104 .input_mux = &alc861_capture_source,
12107 .mixers = { alc861_3ST_mixer },
12108 .init_verbs = { alc861_threestack_init_verbs },
12109 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12110 .dac_nids = alc660_dac_nids,
12111 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12112 .channel_mode = alc861_threestack_modes,
12114 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12115 .adc_nids = alc861_adc_nids,
12116 .input_mux = &alc861_capture_source,
12118 [ALC861_UNIWILL_M31] = {
12119 .mixers = { alc861_uniwill_m31_mixer },
12120 .init_verbs = { alc861_uniwill_m31_init_verbs },
12121 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12122 .dac_nids = alc861_dac_nids,
12123 .dig_out_nid = ALC861_DIGOUT_NID,
12124 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12125 .channel_mode = alc861_uniwill_m31_modes,
12127 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12128 .adc_nids = alc861_adc_nids,
12129 .input_mux = &alc861_capture_source,
12131 [ALC861_TOSHIBA] = {
12132 .mixers = { alc861_toshiba_mixer },
12133 .init_verbs = { alc861_base_init_verbs,
12134 alc861_toshiba_init_verbs },
12135 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12136 .dac_nids = alc861_dac_nids,
12137 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12138 .channel_mode = alc883_3ST_2ch_modes,
12139 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12140 .adc_nids = alc861_adc_nids,
12141 .input_mux = &alc861_capture_source,
12142 .unsol_event = alc861_toshiba_unsol_event,
12143 .init_hook = alc861_toshiba_automute,
12146 .mixers = { alc861_asus_mixer },
12147 .init_verbs = { alc861_asus_init_verbs },
12148 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12149 .dac_nids = alc861_dac_nids,
12150 .dig_out_nid = ALC861_DIGOUT_NID,
12151 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12152 .channel_mode = alc861_asus_modes,
12155 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12156 .adc_nids = alc861_adc_nids,
12157 .input_mux = &alc861_capture_source,
12159 [ALC861_ASUS_LAPTOP] = {
12160 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12161 .init_verbs = { alc861_asus_init_verbs,
12162 alc861_asus_laptop_init_verbs },
12163 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12164 .dac_nids = alc861_dac_nids,
12165 .dig_out_nid = ALC861_DIGOUT_NID,
12166 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12167 .channel_mode = alc883_3ST_2ch_modes,
12169 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12170 .adc_nids = alc861_adc_nids,
12171 .input_mux = &alc861_capture_source,
12176 static int patch_alc861(struct hda_codec *codec)
12178 struct alc_spec *spec;
12182 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12186 codec->spec = spec;
12188 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12192 if (board_config < 0) {
12193 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12194 "trying auto-probe from BIOS...\n");
12195 board_config = ALC861_AUTO;
12198 if (board_config == ALC861_AUTO) {
12199 /* automatic parse from the BIOS config */
12200 err = alc861_parse_auto_config(codec);
12206 "hda_codec: Cannot set up configuration "
12207 "from BIOS. Using base mode...\n");
12208 board_config = ALC861_3ST_DIG;
12212 if (board_config != ALC861_AUTO)
12213 setup_preset(spec, &alc861_presets[board_config]);
12215 spec->stream_name_analog = "ALC861 Analog";
12216 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12217 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12219 spec->stream_name_digital = "ALC861 Digital";
12220 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12221 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12223 spec->vmaster_nid = 0x03;
12225 codec->patch_ops = alc_patch_ops;
12226 if (board_config == ALC861_AUTO)
12227 spec->init_hook = alc861_auto_init;
12228 #ifdef CONFIG_SND_HDA_POWER_SAVE
12229 if (!spec->loopback.amplist)
12230 spec->loopback.amplist = alc861_loopbacks;
12237 * ALC861-VD support
12241 * In addition, an independent DAC
12243 #define ALC861VD_DIGOUT_NID 0x06
12245 static hda_nid_t alc861vd_dac_nids[4] = {
12246 /* front, surr, clfe, side surr */
12247 0x02, 0x03, 0x04, 0x05
12250 /* dac_nids for ALC660vd are in a different order - according to
12251 * Realtek's driver.
12252 * This should probably tesult in a different mixer for 6stack models
12253 * of ALC660vd codecs, but for now there is only 3stack mixer
12254 * - and it is the same as in 861vd.
12255 * adc_nids in ALC660vd are (is) the same as in 861vd
12257 static hda_nid_t alc660vd_dac_nids[3] = {
12258 /* front, rear, clfe, rear_surr */
12262 static hda_nid_t alc861vd_adc_nids[1] = {
12267 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12270 /* FIXME: should be a matrix-type input source selection */
12271 static struct hda_input_mux alc861vd_capture_source = {
12275 { "Front Mic", 0x1 },
12281 static struct hda_input_mux alc861vd_dallas_capture_source = {
12284 { "Ext Mic", 0x0 },
12285 { "Int Mic", 0x1 },
12289 static struct hda_input_mux alc861vd_hp_capture_source = {
12292 { "Front Mic", 0x0 },
12293 { "ATAPI Mic", 0x1 },
12297 #define alc861vd_mux_enum_info alc_mux_enum_info
12298 #define alc861vd_mux_enum_get alc_mux_enum_get
12299 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12300 #define alc861vd_mux_enum_put alc882_mux_enum_put
12305 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12312 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12313 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12314 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12315 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12316 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12323 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12324 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12325 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12326 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12327 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12331 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12332 { 6, alc861vd_6stack_ch6_init },
12333 { 8, alc861vd_6stack_ch8_init },
12336 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12338 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12339 .name = "Channel Mode",
12340 .info = alc_ch_mode_info,
12341 .get = alc_ch_mode_get,
12342 .put = alc_ch_mode_put,
12347 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12348 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12349 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12353 /* The multiple "Capture Source" controls confuse alsamixer
12354 * So call somewhat different..
12356 /* .name = "Capture Source", */
12357 .name = "Input Source",
12359 .info = alc861vd_mux_enum_info,
12360 .get = alc861vd_mux_enum_get,
12361 .put = alc861vd_mux_enum_put,
12366 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12367 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12369 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12370 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12371 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12373 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12374 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12376 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12378 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12380 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12381 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12383 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12384 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12388 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12392 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12402 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12403 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12408 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12409 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12410 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12418 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12419 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12420 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12422 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12423 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12425 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12426 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12428 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12429 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12434 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12435 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12436 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12437 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12441 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12442 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12443 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12445 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12447 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12455 /* Pin assignment: Speaker=0x14, HP = 0x15,
12456 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12458 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12460 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12461 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12462 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12463 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12464 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12465 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12466 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12467 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12468 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12469 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12470 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12474 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12475 * Front Mic=0x18, ATAPI Mic = 0x19,
12477 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12478 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12479 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12480 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12481 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12482 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12483 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12484 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12485 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12491 * generic initialization of ADC, input mixers and output mixers
12493 static struct hda_verb alc861vd_volume_init_verbs[] = {
12495 * Unmute ADC0 and set the default input to mic-in
12497 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12500 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12501 * the analog-loopback mixer widget
12503 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12510 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12517 * Set up output mixers (0x02 - 0x05)
12519 /* set vol=0 to output mixers */
12520 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12521 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12522 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12523 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12525 /* set up input amps for analog loopback */
12526 /* Amp Indices: DAC = 0, mixer = 1 */
12527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12530 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12533 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12534 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12540 * 3-stack pin configuration:
12541 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12543 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12545 * Set pin mode and muting
12547 /* set front pin widgets 0x14 for output */
12548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12550 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12552 /* Mic (rear) pin: input vref at 80% */
12553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12554 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12555 /* Front Mic pin: input vref at 80% */
12556 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12557 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12558 /* Line In pin: input */
12559 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12560 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12561 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12562 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12563 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12564 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12565 /* CD pin widget for input */
12566 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12572 * 6-stack pin configuration:
12574 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12576 * Set pin mode and muting
12578 /* set front pin widgets 0x14 for output */
12579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12581 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12583 /* Rear Pin: output 1 (0x0d) */
12584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12587 /* CLFE Pin: output 2 (0x0e) */
12588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12589 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12590 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12591 /* Side Pin: output 3 (0x0f) */
12592 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12593 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12594 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12596 /* Mic (rear) pin: input vref at 80% */
12597 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12598 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12599 /* Front Mic pin: input vref at 80% */
12600 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12601 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12602 /* Line In pin: input */
12603 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12604 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12605 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12606 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12607 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12608 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12609 /* CD pin widget for input */
12610 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12615 static struct hda_verb alc861vd_eapd_verbs[] = {
12616 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12620 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12624 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12625 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12629 /* toggle speaker-output according to the hp-jack state */
12630 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12632 unsigned int present;
12633 unsigned char bits;
12635 present = snd_hda_codec_read(codec, 0x1b, 0,
12636 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12637 bits = present ? HDA_AMP_MUTE : 0;
12638 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12639 HDA_AMP_MUTE, bits);
12642 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12644 unsigned int present;
12645 unsigned char bits;
12647 present = snd_hda_codec_read(codec, 0x18, 0,
12648 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12649 bits = present ? HDA_AMP_MUTE : 0;
12650 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12651 HDA_AMP_MUTE, bits);
12654 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12656 alc861vd_lenovo_hp_automute(codec);
12657 alc861vd_lenovo_mic_automute(codec);
12660 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12663 switch (res >> 26) {
12664 case ALC880_HP_EVENT:
12665 alc861vd_lenovo_hp_automute(codec);
12667 case ALC880_MIC_EVENT:
12668 alc861vd_lenovo_mic_automute(codec);
12673 static struct hda_verb alc861vd_dallas_verbs[] = {
12674 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12675 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12676 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12677 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12681 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12682 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12685 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12686 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12695 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12697 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12699 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12700 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12701 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12702 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12703 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12704 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12711 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12712 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12718 /* toggle speaker-output according to the hp-jack state */
12719 static void alc861vd_dallas_automute(struct hda_codec *codec)
12721 unsigned int present;
12723 present = snd_hda_codec_read(codec, 0x15, 0,
12724 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12725 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12726 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12729 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12731 if ((res >> 26) == ALC880_HP_EVENT)
12732 alc861vd_dallas_automute(codec);
12735 #ifdef CONFIG_SND_HDA_POWER_SAVE
12736 #define alc861vd_loopbacks alc880_loopbacks
12739 /* pcm configuration: identiacal with ALC880 */
12740 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12741 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12742 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12743 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12746 * configuration and preset
12748 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12749 [ALC660VD_3ST] = "3stack-660",
12750 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12751 [ALC861VD_3ST] = "3stack",
12752 [ALC861VD_3ST_DIG] = "3stack-digout",
12753 [ALC861VD_6ST_DIG] = "6stack-digout",
12754 [ALC861VD_LENOVO] = "lenovo",
12755 [ALC861VD_DALLAS] = "dallas",
12756 [ALC861VD_HP] = "hp",
12757 [ALC861VD_AUTO] = "auto",
12760 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12761 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12762 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12763 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12764 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12765 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12766 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12767 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12768 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12769 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12770 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12771 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12772 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12773 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12774 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12775 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12779 static struct alc_config_preset alc861vd_presets[] = {
12781 .mixers = { alc861vd_3st_mixer },
12782 .init_verbs = { alc861vd_volume_init_verbs,
12783 alc861vd_3stack_init_verbs },
12784 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12785 .dac_nids = alc660vd_dac_nids,
12786 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12787 .channel_mode = alc861vd_3stack_2ch_modes,
12788 .input_mux = &alc861vd_capture_source,
12790 [ALC660VD_3ST_DIG] = {
12791 .mixers = { alc861vd_3st_mixer },
12792 .init_verbs = { alc861vd_volume_init_verbs,
12793 alc861vd_3stack_init_verbs },
12794 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12795 .dac_nids = alc660vd_dac_nids,
12796 .dig_out_nid = ALC861VD_DIGOUT_NID,
12797 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12798 .channel_mode = alc861vd_3stack_2ch_modes,
12799 .input_mux = &alc861vd_capture_source,
12802 .mixers = { alc861vd_3st_mixer },
12803 .init_verbs = { alc861vd_volume_init_verbs,
12804 alc861vd_3stack_init_verbs },
12805 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12806 .dac_nids = alc861vd_dac_nids,
12807 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12808 .channel_mode = alc861vd_3stack_2ch_modes,
12809 .input_mux = &alc861vd_capture_source,
12811 [ALC861VD_3ST_DIG] = {
12812 .mixers = { alc861vd_3st_mixer },
12813 .init_verbs = { alc861vd_volume_init_verbs,
12814 alc861vd_3stack_init_verbs },
12815 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12816 .dac_nids = alc861vd_dac_nids,
12817 .dig_out_nid = ALC861VD_DIGOUT_NID,
12818 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12819 .channel_mode = alc861vd_3stack_2ch_modes,
12820 .input_mux = &alc861vd_capture_source,
12822 [ALC861VD_6ST_DIG] = {
12823 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12824 .init_verbs = { alc861vd_volume_init_verbs,
12825 alc861vd_6stack_init_verbs },
12826 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12827 .dac_nids = alc861vd_dac_nids,
12828 .dig_out_nid = ALC861VD_DIGOUT_NID,
12829 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12830 .channel_mode = alc861vd_6stack_modes,
12831 .input_mux = &alc861vd_capture_source,
12833 [ALC861VD_LENOVO] = {
12834 .mixers = { alc861vd_lenovo_mixer },
12835 .init_verbs = { alc861vd_volume_init_verbs,
12836 alc861vd_3stack_init_verbs,
12837 alc861vd_eapd_verbs,
12838 alc861vd_lenovo_unsol_verbs },
12839 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12840 .dac_nids = alc660vd_dac_nids,
12841 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12842 .channel_mode = alc861vd_3stack_2ch_modes,
12843 .input_mux = &alc861vd_capture_source,
12844 .unsol_event = alc861vd_lenovo_unsol_event,
12845 .init_hook = alc861vd_lenovo_automute,
12847 [ALC861VD_DALLAS] = {
12848 .mixers = { alc861vd_dallas_mixer },
12849 .init_verbs = { alc861vd_dallas_verbs },
12850 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12851 .dac_nids = alc861vd_dac_nids,
12852 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12853 .channel_mode = alc861vd_3stack_2ch_modes,
12854 .input_mux = &alc861vd_dallas_capture_source,
12855 .unsol_event = alc861vd_dallas_unsol_event,
12856 .init_hook = alc861vd_dallas_automute,
12859 .mixers = { alc861vd_hp_mixer },
12860 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12861 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12862 .dac_nids = alc861vd_dac_nids,
12863 .dig_out_nid = ALC861VD_DIGOUT_NID,
12864 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12865 .channel_mode = alc861vd_3stack_2ch_modes,
12866 .input_mux = &alc861vd_hp_capture_source,
12867 .unsol_event = alc861vd_dallas_unsol_event,
12868 .init_hook = alc861vd_dallas_automute,
12873 * BIOS auto configuration
12875 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12876 hda_nid_t nid, int pin_type, int dac_idx)
12878 alc_set_pin_output(codec, nid, pin_type);
12881 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12883 struct alc_spec *spec = codec->spec;
12886 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12887 for (i = 0; i <= HDA_SIDE; i++) {
12888 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12889 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12891 alc861vd_auto_set_output_and_unmute(codec, nid,
12897 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12899 struct alc_spec *spec = codec->spec;
12902 pin = spec->autocfg.hp_pins[0];
12903 if (pin) /* connect to front and use dac 0 */
12904 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12905 pin = spec->autocfg.speaker_pins[0];
12907 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12910 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12911 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12913 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12915 struct alc_spec *spec = codec->spec;
12918 for (i = 0; i < AUTO_PIN_LAST; i++) {
12919 hda_nid_t nid = spec->autocfg.input_pins[i];
12920 if (alc861vd_is_input_pin(nid)) {
12921 snd_hda_codec_write(codec, nid, 0,
12922 AC_VERB_SET_PIN_WIDGET_CONTROL,
12923 i <= AUTO_PIN_FRONT_MIC ?
12924 PIN_VREF80 : PIN_IN);
12925 if (nid != ALC861VD_PIN_CD_NID)
12926 snd_hda_codec_write(codec, nid, 0,
12927 AC_VERB_SET_AMP_GAIN_MUTE,
12933 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12934 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12936 /* add playback controls from the parsed DAC table */
12937 /* Based on ALC880 version. But ALC861VD has separate,
12938 * different NIDs for mute/unmute switch and volume control */
12939 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12940 const struct auto_pin_cfg *cfg)
12943 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12944 hda_nid_t nid_v, nid_s;
12947 for (i = 0; i < cfg->line_outs; i++) {
12948 if (!spec->multiout.dac_nids[i])
12950 nid_v = alc861vd_idx_to_mixer_vol(
12952 spec->multiout.dac_nids[i]));
12953 nid_s = alc861vd_idx_to_mixer_switch(
12955 spec->multiout.dac_nids[i]));
12959 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12960 "Center Playback Volume",
12961 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12965 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12966 "LFE Playback Volume",
12967 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12971 err = add_control(spec, ALC_CTL_BIND_MUTE,
12972 "Center Playback Switch",
12973 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12977 err = add_control(spec, ALC_CTL_BIND_MUTE,
12978 "LFE Playback Switch",
12979 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12984 sprintf(name, "%s Playback Volume", chname[i]);
12985 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12986 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12990 sprintf(name, "%s Playback Switch", chname[i]);
12991 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12992 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
13001 /* add playback controls for speaker and HP outputs */
13002 /* Based on ALC880 version. But ALC861VD has separate,
13003 * different NIDs for mute/unmute switch and volume control */
13004 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
13005 hda_nid_t pin, const char *pfx)
13007 hda_nid_t nid_v, nid_s;
13014 if (alc880_is_fixed_pin(pin)) {
13015 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13016 /* specify the DAC as the extra output */
13017 if (!spec->multiout.hp_nid)
13018 spec->multiout.hp_nid = nid_v;
13020 spec->multiout.extra_out_nid[0] = nid_v;
13021 /* control HP volume/switch on the output mixer amp */
13022 nid_v = alc861vd_idx_to_mixer_vol(
13023 alc880_fixed_pin_idx(pin));
13024 nid_s = alc861vd_idx_to_mixer_switch(
13025 alc880_fixed_pin_idx(pin));
13027 sprintf(name, "%s Playback Volume", pfx);
13028 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13029 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
13032 sprintf(name, "%s Playback Switch", pfx);
13033 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13034 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
13037 } else if (alc880_is_multi_pin(pin)) {
13038 /* set manual connection */
13039 /* we have only a switch on HP-out PIN */
13040 sprintf(name, "%s Playback Switch", pfx);
13041 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13042 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13049 /* parse the BIOS configuration and set up the alc_spec
13050 * return 1 if successful, 0 if the proper config is not found,
13051 * or a negative error code
13052 * Based on ALC880 version - had to change it to override
13053 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13054 static int alc861vd_parse_auto_config(struct hda_codec *codec)
13056 struct alc_spec *spec = codec->spec;
13058 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
13060 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13064 if (!spec->autocfg.line_outs)
13065 return 0; /* can't find valid BIOS pin config */
13067 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13070 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
13073 err = alc861vd_auto_create_extra_out(spec,
13074 spec->autocfg.speaker_pins[0],
13078 err = alc861vd_auto_create_extra_out(spec,
13079 spec->autocfg.hp_pins[0],
13083 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
13087 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13089 if (spec->autocfg.dig_out_pin)
13090 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13092 if (spec->kctl_alloc)
13093 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13095 spec->init_verbs[spec->num_init_verbs++]
13096 = alc861vd_volume_init_verbs;
13098 spec->num_mux_defs = 1;
13099 spec->input_mux = &spec->private_imux;
13101 err = alc_auto_add_mic_boost(codec);
13108 /* additional initialization for auto-configuration model */
13109 static void alc861vd_auto_init(struct hda_codec *codec)
13111 struct alc_spec *spec = codec->spec;
13112 alc861vd_auto_init_multi_out(codec);
13113 alc861vd_auto_init_hp_out(codec);
13114 alc861vd_auto_init_analog_input(codec);
13115 if (spec->unsol_event)
13116 alc_sku_automute(codec);
13119 static int patch_alc861vd(struct hda_codec *codec)
13121 struct alc_spec *spec;
13122 int err, board_config;
13124 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13128 codec->spec = spec;
13130 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13134 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13135 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13136 "ALC861VD, trying auto-probe from BIOS...\n");
13137 board_config = ALC861VD_AUTO;
13140 if (board_config == ALC861VD_AUTO) {
13141 /* automatic parse from the BIOS config */
13142 err = alc861vd_parse_auto_config(codec);
13148 "hda_codec: Cannot set up configuration "
13149 "from BIOS. Using base mode...\n");
13150 board_config = ALC861VD_3ST;
13154 if (board_config != ALC861VD_AUTO)
13155 setup_preset(spec, &alc861vd_presets[board_config]);
13157 spec->stream_name_analog = "ALC861VD Analog";
13158 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13159 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13161 spec->stream_name_digital = "ALC861VD Digital";
13162 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13163 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13165 spec->adc_nids = alc861vd_adc_nids;
13166 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13167 spec->capsrc_nids = alc861vd_capsrc_nids;
13169 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13170 spec->num_mixers++;
13172 spec->vmaster_nid = 0x02;
13174 codec->patch_ops = alc_patch_ops;
13176 if (board_config == ALC861VD_AUTO)
13177 spec->init_hook = alc861vd_auto_init;
13178 #ifdef CONFIG_SND_HDA_POWER_SAVE
13179 if (!spec->loopback.amplist)
13180 spec->loopback.amplist = alc861vd_loopbacks;
13189 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13190 * configuration. Each pin widget can choose any input DACs and a mixer.
13191 * Each ADC is connected from a mixer of all inputs. This makes possible
13192 * 6-channel independent captures.
13194 * In addition, an independent DAC for the multi-playback (not used in this
13197 #define ALC662_DIGOUT_NID 0x06
13198 #define ALC662_DIGIN_NID 0x0a
13200 static hda_nid_t alc662_dac_nids[4] = {
13201 /* front, rear, clfe, rear_surr */
13205 static hda_nid_t alc662_adc_nids[1] = {
13210 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13213 /* FIXME: should be a matrix-type input source selection */
13214 static struct hda_input_mux alc662_capture_source = {
13218 { "Front Mic", 0x1 },
13224 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13232 static struct hda_input_mux alc662_eeepc_capture_source = {
13240 #define alc662_mux_enum_info alc_mux_enum_info
13241 #define alc662_mux_enum_get alc_mux_enum_get
13242 #define alc662_mux_enum_put alc882_mux_enum_put
13247 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13254 static struct hda_verb alc662_3ST_ch2_init[] = {
13255 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13256 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13257 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13258 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13265 static struct hda_verb alc662_3ST_ch6_init[] = {
13266 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13267 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13268 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13269 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13270 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13271 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13275 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13276 { 2, alc662_3ST_ch2_init },
13277 { 6, alc662_3ST_ch6_init },
13283 static struct hda_verb alc662_sixstack_ch6_init[] = {
13284 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13285 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13286 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13293 static struct hda_verb alc662_sixstack_ch8_init[] = {
13294 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13295 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13296 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13300 static struct hda_channel_mode alc662_5stack_modes[2] = {
13301 { 2, alc662_sixstack_ch6_init },
13302 { 6, alc662_sixstack_ch8_init },
13305 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13306 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13309 static struct snd_kcontrol_new alc662_base_mixer[] = {
13310 /* output mixer control */
13311 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13312 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13313 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13314 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13315 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13316 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13317 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13318 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13321 /*Input mixer control */
13322 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13323 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13324 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13325 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13326 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13327 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13328 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13329 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13333 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13334 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13335 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13337 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13338 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13343 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13344 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13345 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13346 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13350 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13351 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13352 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13353 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13354 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13355 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13356 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13357 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13358 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13362 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13363 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13366 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13367 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13368 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13369 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13373 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13374 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13375 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13377 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13386 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13387 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13389 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13390 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13392 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13393 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13394 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13396 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13397 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13398 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13402 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13403 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13404 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13405 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13406 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13407 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13408 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13409 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13410 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13411 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13412 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13420 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13422 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13423 .name = "Channel Mode",
13424 .info = alc_ch_mode_info,
13425 .get = alc_ch_mode_get,
13426 .put = alc_ch_mode_put,
13431 static struct hda_verb alc662_init_verbs[] = {
13432 /* ADC: mute amp left and right */
13433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13434 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13435 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13443 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13445 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13450 /* Front Pin: output 0 (0x0c) */
13451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13452 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13454 /* Rear Pin: output 1 (0x0d) */
13455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13458 /* CLFE Pin: output 2 (0x0e) */
13459 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13460 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13462 /* Mic (rear) pin: input vref at 80% */
13463 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13464 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13465 /* Front Mic pin: input vref at 80% */
13466 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13467 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13468 /* Line In pin: input */
13469 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13471 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13472 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13473 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13474 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13475 /* CD pin widget for input */
13476 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13478 /* FIXME: use matrix-type input source selection */
13479 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13493 static struct hda_verb alc662_sue_init_verbs[] = {
13494 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13499 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13500 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13501 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13505 /* Set Unsolicited Event*/
13506 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13508 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13513 * generic initialization of ADC, input mixers and output mixers
13515 static struct hda_verb alc662_auto_init_verbs[] = {
13517 * Unmute ADC and set the default input to mic-in
13519 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13522 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13524 * Note: PASD motherboards uses the Line In 2 as the input for front
13525 * panel mic (mic 2)
13527 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13535 * Set up output mixers (0x0c - 0x0f)
13537 /* set vol=0 to output mixers */
13538 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13539 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13540 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13542 /* set up input amps for analog loopback */
13543 /* Amp Indices: DAC = 0, mixer = 1 */
13544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13546 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13548 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13552 /* FIXME: use matrix-type input source selection */
13553 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13560 /* capture mixer elements */
13561 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13562 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13563 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13565 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13566 /* The multiple "Capture Source" controls confuse alsamixer
13567 * So call somewhat different..
13569 /* .name = "Capture Source", */
13570 .name = "Input Source",
13572 .info = alc662_mux_enum_info,
13573 .get = alc662_mux_enum_get,
13574 .put = alc662_mux_enum_put,
13579 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13581 unsigned int present;
13582 unsigned char bits;
13584 present = snd_hda_codec_read(codec, 0x14, 0,
13585 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13586 bits = present ? HDA_AMP_MUTE : 0;
13587 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13588 HDA_AMP_MUTE, bits);
13591 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13593 unsigned int present;
13594 unsigned char bits;
13596 present = snd_hda_codec_read(codec, 0x1b, 0,
13597 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13598 bits = present ? HDA_AMP_MUTE : 0;
13599 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13600 HDA_AMP_MUTE, bits);
13601 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13602 HDA_AMP_MUTE, bits);
13605 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13608 if ((res >> 26) == ALC880_HP_EVENT)
13609 alc662_lenovo_101e_all_automute(codec);
13610 if ((res >> 26) == ALC880_FRONT_EVENT)
13611 alc662_lenovo_101e_ispeaker_automute(codec);
13614 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13616 unsigned int present;
13618 present = snd_hda_codec_read(codec, 0x18, 0,
13619 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13620 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13621 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13622 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13623 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13624 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13625 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13626 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13627 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13630 /* unsolicited event for HP jack sensing */
13631 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13634 if ((res >> 26) == ALC880_HP_EVENT)
13635 alc262_hippo1_automute( codec );
13637 if ((res >> 26) == ALC880_MIC_EVENT)
13638 alc662_eeepc_mic_automute(codec);
13641 static void alc662_eeepc_inithook(struct hda_codec *codec)
13643 alc262_hippo1_automute( codec );
13644 alc662_eeepc_mic_automute(codec);
13647 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13650 unsigned int present;
13652 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13653 present = snd_hda_codec_read(codec, 0x14, 0,
13654 AC_VERB_GET_PIN_SENSE, 0);
13655 present = (present & 0x80000000) != 0;
13657 /* mute internal speaker */
13658 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13659 HDA_AMP_MUTE, HDA_AMP_MUTE);
13661 /* unmute internal speaker if necessary */
13662 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13663 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13664 HDA_AMP_MUTE, mute);
13668 /* unsolicited event for HP jack sensing */
13669 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13672 if ((res >> 26) == ALC880_HP_EVENT)
13673 alc662_eeepc_ep20_automute(codec);
13676 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13678 alc662_eeepc_ep20_automute(codec);
13681 #ifdef CONFIG_SND_HDA_POWER_SAVE
13682 #define alc662_loopbacks alc880_loopbacks
13686 /* pcm configuration: identiacal with ALC880 */
13687 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13688 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13689 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13690 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13693 * configuration and preset
13695 static const char *alc662_models[ALC662_MODEL_LAST] = {
13696 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13697 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13698 [ALC662_3ST_6ch] = "3stack-6ch",
13699 [ALC662_5ST_DIG] = "6stack-dig",
13700 [ALC662_LENOVO_101E] = "lenovo-101e",
13701 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13702 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13703 [ALC662_AUTO] = "auto",
13706 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13707 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13708 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13709 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13710 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13714 static struct alc_config_preset alc662_presets[] = {
13715 [ALC662_3ST_2ch_DIG] = {
13716 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13717 .init_verbs = { alc662_init_verbs },
13718 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13719 .dac_nids = alc662_dac_nids,
13720 .dig_out_nid = ALC662_DIGOUT_NID,
13721 .dig_in_nid = ALC662_DIGIN_NID,
13722 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13723 .channel_mode = alc662_3ST_2ch_modes,
13724 .input_mux = &alc662_capture_source,
13726 [ALC662_3ST_6ch_DIG] = {
13727 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13728 alc662_capture_mixer },
13729 .init_verbs = { alc662_init_verbs },
13730 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13731 .dac_nids = alc662_dac_nids,
13732 .dig_out_nid = ALC662_DIGOUT_NID,
13733 .dig_in_nid = ALC662_DIGIN_NID,
13734 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13735 .channel_mode = alc662_3ST_6ch_modes,
13737 .input_mux = &alc662_capture_source,
13739 [ALC662_3ST_6ch] = {
13740 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13741 alc662_capture_mixer },
13742 .init_verbs = { alc662_init_verbs },
13743 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13744 .dac_nids = alc662_dac_nids,
13745 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13746 .channel_mode = alc662_3ST_6ch_modes,
13748 .input_mux = &alc662_capture_source,
13750 [ALC662_5ST_DIG] = {
13751 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13752 alc662_capture_mixer },
13753 .init_verbs = { alc662_init_verbs },
13754 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13755 .dac_nids = alc662_dac_nids,
13756 .dig_out_nid = ALC662_DIGOUT_NID,
13757 .dig_in_nid = ALC662_DIGIN_NID,
13758 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13759 .channel_mode = alc662_5stack_modes,
13760 .input_mux = &alc662_capture_source,
13762 [ALC662_LENOVO_101E] = {
13763 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13764 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13765 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13766 .dac_nids = alc662_dac_nids,
13767 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13768 .channel_mode = alc662_3ST_2ch_modes,
13769 .input_mux = &alc662_lenovo_101e_capture_source,
13770 .unsol_event = alc662_lenovo_101e_unsol_event,
13771 .init_hook = alc662_lenovo_101e_all_automute,
13773 [ALC662_ASUS_EEEPC_P701] = {
13774 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13775 .init_verbs = { alc662_init_verbs,
13776 alc662_eeepc_sue_init_verbs },
13777 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13778 .dac_nids = alc662_dac_nids,
13779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13780 .channel_mode = alc662_3ST_2ch_modes,
13781 .input_mux = &alc662_eeepc_capture_source,
13782 .unsol_event = alc662_eeepc_unsol_event,
13783 .init_hook = alc662_eeepc_inithook,
13785 [ALC662_ASUS_EEEPC_EP20] = {
13786 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13787 alc662_chmode_mixer },
13788 .init_verbs = { alc662_init_verbs,
13789 alc662_eeepc_ep20_sue_init_verbs },
13790 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13791 .dac_nids = alc662_dac_nids,
13792 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13793 .channel_mode = alc662_3ST_6ch_modes,
13794 .input_mux = &alc662_lenovo_101e_capture_source,
13795 .unsol_event = alc662_eeepc_ep20_unsol_event,
13796 .init_hook = alc662_eeepc_ep20_inithook,
13803 * BIOS auto configuration
13806 /* add playback controls from the parsed DAC table */
13807 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13808 const struct auto_pin_cfg *cfg)
13811 static const char *chname[4] = {
13812 "Front", "Surround", NULL /*CLFE*/, "Side"
13817 for (i = 0; i < cfg->line_outs; i++) {
13818 if (!spec->multiout.dac_nids[i])
13820 nid = alc880_idx_to_dac(i);
13823 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13824 "Center Playback Volume",
13825 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13829 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13830 "LFE Playback Volume",
13831 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13835 err = add_control(spec, ALC_CTL_BIND_MUTE,
13836 "Center Playback Switch",
13837 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13841 err = add_control(spec, ALC_CTL_BIND_MUTE,
13842 "LFE Playback Switch",
13843 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13848 sprintf(name, "%s Playback Volume", chname[i]);
13849 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13850 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13854 sprintf(name, "%s Playback Switch", chname[i]);
13855 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13856 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13865 /* add playback controls for speaker and HP outputs */
13866 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13876 if (alc880_is_fixed_pin(pin)) {
13877 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13878 /* printk("DAC nid=%x\n",nid); */
13879 /* specify the DAC as the extra output */
13880 if (!spec->multiout.hp_nid)
13881 spec->multiout.hp_nid = nid;
13883 spec->multiout.extra_out_nid[0] = nid;
13884 /* control HP volume/switch on the output mixer amp */
13885 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13886 sprintf(name, "%s Playback Volume", pfx);
13887 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13888 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13891 sprintf(name, "%s Playback Switch", pfx);
13892 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13893 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13896 } else if (alc880_is_multi_pin(pin)) {
13897 /* set manual connection */
13898 /* we have only a switch on HP-out PIN */
13899 sprintf(name, "%s Playback Switch", pfx);
13900 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13901 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13908 /* create playback/capture controls for input pins */
13909 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13910 const struct auto_pin_cfg *cfg)
13912 struct hda_input_mux *imux = &spec->private_imux;
13915 for (i = 0; i < AUTO_PIN_LAST; i++) {
13916 if (alc880_is_input_pin(cfg->input_pins[i])) {
13917 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13918 err = new_analog_input(spec, cfg->input_pins[i],
13919 auto_pin_cfg_labels[i],
13923 imux->items[imux->num_items].label =
13924 auto_pin_cfg_labels[i];
13925 imux->items[imux->num_items].index =
13926 alc880_input_pin_idx(cfg->input_pins[i]);
13933 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13934 hda_nid_t nid, int pin_type,
13937 alc_set_pin_output(codec, nid, pin_type);
13938 /* need the manual connection? */
13939 if (alc880_is_multi_pin(nid)) {
13940 struct alc_spec *spec = codec->spec;
13941 int idx = alc880_multi_pin_idx(nid);
13942 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13943 AC_VERB_SET_CONNECT_SEL,
13944 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13948 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13950 struct alc_spec *spec = codec->spec;
13953 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13954 for (i = 0; i <= HDA_SIDE; i++) {
13955 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13956 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13958 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13963 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13965 struct alc_spec *spec = codec->spec;
13968 pin = spec->autocfg.hp_pins[0];
13969 if (pin) /* connect to front */
13971 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13972 pin = spec->autocfg.speaker_pins[0];
13974 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13977 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13978 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13980 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13982 struct alc_spec *spec = codec->spec;
13985 for (i = 0; i < AUTO_PIN_LAST; i++) {
13986 hda_nid_t nid = spec->autocfg.input_pins[i];
13987 if (alc662_is_input_pin(nid)) {
13988 snd_hda_codec_write(codec, nid, 0,
13989 AC_VERB_SET_PIN_WIDGET_CONTROL,
13990 (i <= AUTO_PIN_FRONT_MIC ?
13991 PIN_VREF80 : PIN_IN));
13992 if (nid != ALC662_PIN_CD_NID)
13993 snd_hda_codec_write(codec, nid, 0,
13994 AC_VERB_SET_AMP_GAIN_MUTE,
14000 static int alc662_parse_auto_config(struct hda_codec *codec)
14002 struct alc_spec *spec = codec->spec;
14004 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
14006 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14010 if (!spec->autocfg.line_outs)
14011 return 0; /* can't find valid BIOS pin config */
14013 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
14016 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
14019 err = alc662_auto_create_extra_out(spec,
14020 spec->autocfg.speaker_pins[0],
14024 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
14028 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
14032 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14034 if (spec->autocfg.dig_out_pin)
14035 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
14037 if (spec->kctl_alloc)
14038 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
14040 spec->num_mux_defs = 1;
14041 spec->input_mux = &spec->private_imux;
14043 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
14044 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
14045 spec->num_mixers++;
14049 /* additional initialization for auto-configuration model */
14050 static void alc662_auto_init(struct hda_codec *codec)
14052 struct alc_spec *spec = codec->spec;
14053 alc662_auto_init_multi_out(codec);
14054 alc662_auto_init_hp_out(codec);
14055 alc662_auto_init_analog_input(codec);
14056 if (spec->unsol_event)
14057 alc_sku_automute(codec);
14060 static int patch_alc662(struct hda_codec *codec)
14062 struct alc_spec *spec;
14063 int err, board_config;
14065 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14069 codec->spec = spec;
14071 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
14074 if (board_config < 0) {
14075 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
14076 "trying auto-probe from BIOS...\n");
14077 board_config = ALC662_AUTO;
14080 if (board_config == ALC662_AUTO) {
14081 /* automatic parse from the BIOS config */
14082 err = alc662_parse_auto_config(codec);
14088 "hda_codec: Cannot set up configuration "
14089 "from BIOS. Using base mode...\n");
14090 board_config = ALC662_3ST_2ch_DIG;
14094 if (board_config != ALC662_AUTO)
14095 setup_preset(spec, &alc662_presets[board_config]);
14097 spec->stream_name_analog = "ALC662 Analog";
14098 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14099 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14101 spec->stream_name_digital = "ALC662 Digital";
14102 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14103 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14105 spec->adc_nids = alc662_adc_nids;
14106 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14107 spec->capsrc_nids = alc662_capsrc_nids;
14109 spec->vmaster_nid = 0x02;
14111 codec->patch_ops = alc_patch_ops;
14112 if (board_config == ALC662_AUTO)
14113 spec->init_hook = alc662_auto_init;
14114 #ifdef CONFIG_SND_HDA_POWER_SAVE
14115 if (!spec->loopback.amplist)
14116 spec->loopback.amplist = alc662_loopbacks;
14125 struct hda_codec_preset snd_hda_preset_realtek[] = {
14126 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14127 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14128 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14129 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14130 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14131 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14132 .patch = patch_alc861 },
14133 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14134 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14135 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14136 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14137 .patch = patch_alc883 },
14138 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14139 .patch = patch_alc662 },
14140 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14141 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14142 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14143 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14144 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14145 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14146 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14147 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14148 {} /* terminator */