2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
62 #ifdef CONFIG_SND_DEBUG
66 ALC880_MODEL_LAST /* last tag */
78 #ifdef CONFIG_SND_DEBUG
82 ALC260_MODEL_LAST /* last tag */
92 ALC262_HP_BPC_D7000_WL,
93 ALC262_HP_BPC_D7000_WF,
101 ALC262_MODEL_LAST /* last tag */
110 #ifdef CONFIG_SND_DEBUG
114 ALC268_MODEL_LAST /* last tag */
121 ALC269_MODEL_LAST /* last tag */
138 /* ALC861-VD models */
159 ALC662_ASUS_EEEPC_P701,
160 ALC662_ASUS_EEEPC_EP20,
188 ALC883_TARGA_2ch_DIG,
194 ALC883_LENOVO_101E_2ch,
195 ALC883_LENOVO_NB0763,
196 ALC888_LENOVO_MS7195_DIG,
207 #define GPIO_MASK 0x03
210 /* codec parameterization */
211 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
212 unsigned int num_mixers;
214 const struct hda_verb *init_verbs[5]; /* initialization verbs
218 unsigned int num_init_verbs;
220 char *stream_name_analog; /* analog PCM stream */
221 struct hda_pcm_stream *stream_analog_playback;
222 struct hda_pcm_stream *stream_analog_capture;
223 struct hda_pcm_stream *stream_analog_alt_playback;
224 struct hda_pcm_stream *stream_analog_alt_capture;
226 char *stream_name_digital; /* digital PCM stream */
227 struct hda_pcm_stream *stream_digital_playback;
228 struct hda_pcm_stream *stream_digital_capture;
231 struct hda_multi_out multiout; /* playback set-up
232 * max_channels, dacs must be set
233 * dig_out_nid and hp_nid are optional
235 hda_nid_t alt_dac_nid;
238 unsigned int num_adc_nids;
240 hda_nid_t dig_in_nid; /* digital-in NID; optional */
243 unsigned int num_mux_defs;
244 const struct hda_input_mux *input_mux;
245 unsigned int cur_mux[3];
248 const struct hda_channel_mode *channel_mode;
249 int num_channel_mode;
252 /* PCM information */
253 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
255 /* dynamic controls, init_verbs and input_mux */
256 struct auto_pin_cfg autocfg;
257 unsigned int num_kctl_alloc, num_kctl_used;
258 struct snd_kcontrol_new *kctl_alloc;
259 struct hda_input_mux private_imux;
260 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
263 void (*init_hook)(struct hda_codec *codec);
264 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
266 /* for pin sensing */
267 unsigned int sense_updated: 1;
268 unsigned int jack_present: 1;
270 /* for virtual master */
271 hda_nid_t vmaster_nid;
273 #ifdef CONFIG_SND_HDA_POWER_SAVE
274 struct hda_loopback_check loopback;
279 * configuration template - to be copied to the spec instance
281 struct alc_config_preset {
282 struct snd_kcontrol_new *mixers[5]; /* should be identical size
285 const struct hda_verb *init_verbs[5];
286 unsigned int num_dacs;
288 hda_nid_t dig_out_nid; /* optional */
289 hda_nid_t hp_nid; /* optional */
290 unsigned int num_adc_nids;
292 hda_nid_t dig_in_nid;
293 unsigned int num_channel_mode;
294 const struct hda_channel_mode *channel_mode;
296 unsigned int num_mux_defs;
297 const struct hda_input_mux *input_mux;
298 void (*unsol_event)(struct hda_codec *, unsigned int);
299 void (*init_hook)(struct hda_codec *);
300 #ifdef CONFIG_SND_HDA_POWER_SAVE
301 struct hda_amp_list *loopbacks;
309 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
310 struct snd_ctl_elem_info *uinfo)
312 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
313 struct alc_spec *spec = codec->spec;
314 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
315 if (mux_idx >= spec->num_mux_defs)
317 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
320 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
321 struct snd_ctl_elem_value *ucontrol)
323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
324 struct alc_spec *spec = codec->spec;
325 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
327 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
331 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
332 struct snd_ctl_elem_value *ucontrol)
334 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
335 struct alc_spec *spec = codec->spec;
336 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
337 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
338 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
339 spec->adc_nids[adc_idx],
340 &spec->cur_mux[adc_idx]);
345 * channel mode setting
347 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_info *uinfo)
350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
351 struct alc_spec *spec = codec->spec;
352 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
353 spec->num_channel_mode);
356 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
357 struct snd_ctl_elem_value *ucontrol)
359 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
360 struct alc_spec *spec = codec->spec;
361 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
362 spec->num_channel_mode,
363 spec->multiout.max_channels);
366 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
367 struct snd_ctl_elem_value *ucontrol)
369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
370 struct alc_spec *spec = codec->spec;
371 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
372 spec->num_channel_mode,
373 &spec->multiout.max_channels);
374 if (err >= 0 && spec->need_dac_fix)
375 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
380 * Control the mode of pin widget settings via the mixer. "pc" is used
381 * instead of "%" to avoid consequences of accidently treating the % as
382 * being part of a format specifier. Maximum allowed length of a value is
383 * 63 characters plus NULL terminator.
385 * Note: some retasking pin complexes seem to ignore requests for input
386 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
387 * are requested. Therefore order this list so that this behaviour will not
388 * cause problems when mixer clients move through the enum sequentially.
389 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
392 static char *alc_pin_mode_names[] = {
393 "Mic 50pc bias", "Mic 80pc bias",
394 "Line in", "Line out", "Headphone out",
396 static unsigned char alc_pin_mode_values[] = {
397 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
399 /* The control can present all 5 options, or it can limit the options based
400 * in the pin being assumed to be exclusively an input or an output pin. In
401 * addition, "input" pins may or may not process the mic bias option
402 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
403 * accept requests for bias as of chip versions up to March 2006) and/or
404 * wiring in the computer.
406 #define ALC_PIN_DIR_IN 0x00
407 #define ALC_PIN_DIR_OUT 0x01
408 #define ALC_PIN_DIR_INOUT 0x02
409 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
410 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
412 /* Info about the pin modes supported by the different pin direction modes.
413 * For each direction the minimum and maximum values are given.
415 static signed char alc_pin_mode_dir_info[5][2] = {
416 { 0, 2 }, /* ALC_PIN_DIR_IN */
417 { 3, 4 }, /* ALC_PIN_DIR_OUT */
418 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
419 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
420 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
422 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
423 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
424 #define alc_pin_mode_n_items(_dir) \
425 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
427 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
428 struct snd_ctl_elem_info *uinfo)
430 unsigned int item_num = uinfo->value.enumerated.item;
431 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
433 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
435 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
437 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
438 item_num = alc_pin_mode_min(dir);
439 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
443 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
444 struct snd_ctl_elem_value *ucontrol)
447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
448 hda_nid_t nid = kcontrol->private_value & 0xffff;
449 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
450 long *valp = ucontrol->value.integer.value;
451 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
452 AC_VERB_GET_PIN_WIDGET_CONTROL,
455 /* Find enumerated value for current pinctl setting */
456 i = alc_pin_mode_min(dir);
457 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
459 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
463 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
464 struct snd_ctl_elem_value *ucontrol)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 hda_nid_t nid = kcontrol->private_value & 0xffff;
469 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
470 long val = *ucontrol->value.integer.value;
471 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
472 AC_VERB_GET_PIN_WIDGET_CONTROL,
475 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
476 val = alc_pin_mode_min(dir);
478 change = pinctl != alc_pin_mode_values[val];
480 /* Set pin mode to that requested */
481 snd_hda_codec_write_cache(codec, nid, 0,
482 AC_VERB_SET_PIN_WIDGET_CONTROL,
483 alc_pin_mode_values[val]);
485 /* Also enable the retasking pin's input/output as required
486 * for the requested pin mode. Enum values of 2 or less are
489 * Dynamically switching the input/output buffers probably
490 * reduces noise slightly (particularly on input) so we'll
491 * do it. However, having both input and output buffers
492 * enabled simultaneously doesn't seem to be problematic if
493 * this turns out to be necessary in the future.
496 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
497 HDA_AMP_MUTE, HDA_AMP_MUTE);
498 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
501 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
502 HDA_AMP_MUTE, HDA_AMP_MUTE);
503 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
510 #define ALC_PIN_MODE(xname, nid, dir) \
511 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
512 .info = alc_pin_mode_info, \
513 .get = alc_pin_mode_get, \
514 .put = alc_pin_mode_put, \
515 .private_value = nid | (dir<<16) }
517 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
518 * together using a mask with more than one bit set. This control is
519 * currently used only by the ALC260 test model. At this stage they are not
520 * needed for any "production" models.
522 #ifdef CONFIG_SND_DEBUG
523 #define alc_gpio_data_info snd_ctl_boolean_mono_info
525 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_value *ucontrol)
528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
529 hda_nid_t nid = kcontrol->private_value & 0xffff;
530 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
531 long *valp = ucontrol->value.integer.value;
532 unsigned int val = snd_hda_codec_read(codec, nid, 0,
533 AC_VERB_GET_GPIO_DATA, 0x00);
535 *valp = (val & mask) != 0;
538 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
539 struct snd_ctl_elem_value *ucontrol)
542 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
543 hda_nid_t nid = kcontrol->private_value & 0xffff;
544 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
545 long val = *ucontrol->value.integer.value;
546 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
547 AC_VERB_GET_GPIO_DATA,
550 /* Set/unset the masked GPIO bit(s) as needed */
551 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
556 snd_hda_codec_write_cache(codec, nid, 0,
557 AC_VERB_SET_GPIO_DATA, gpio_data);
561 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
562 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
563 .info = alc_gpio_data_info, \
564 .get = alc_gpio_data_get, \
565 .put = alc_gpio_data_put, \
566 .private_value = nid | (mask<<16) }
567 #endif /* CONFIG_SND_DEBUG */
569 /* A switch control to allow the enabling of the digital IO pins on the
570 * ALC260. This is incredibly simplistic; the intention of this control is
571 * to provide something in the test model allowing digital outputs to be
572 * identified if present. If models are found which can utilise these
573 * outputs a more complete mixer control can be devised for those models if
576 #ifdef CONFIG_SND_DEBUG
577 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
579 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
580 struct snd_ctl_elem_value *ucontrol)
582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
583 hda_nid_t nid = kcontrol->private_value & 0xffff;
584 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
585 long *valp = ucontrol->value.integer.value;
586 unsigned int val = snd_hda_codec_read(codec, nid, 0,
587 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
589 *valp = (val & mask) != 0;
592 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
593 struct snd_ctl_elem_value *ucontrol)
596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
597 hda_nid_t nid = kcontrol->private_value & 0xffff;
598 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
599 long val = *ucontrol->value.integer.value;
600 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
601 AC_VERB_GET_DIGI_CONVERT_1,
604 /* Set/unset the masked control bit(s) as needed */
605 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
610 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
615 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
616 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
617 .info = alc_spdif_ctrl_info, \
618 .get = alc_spdif_ctrl_get, \
619 .put = alc_spdif_ctrl_put, \
620 .private_value = nid | (mask<<16) }
621 #endif /* CONFIG_SND_DEBUG */
623 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
624 * Again, this is only used in the ALC26x test models to help identify when
625 * the EAPD line must be asserted for features to work.
627 #ifdef CONFIG_SND_DEBUG
628 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
630 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
631 struct snd_ctl_elem_value *ucontrol)
633 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
634 hda_nid_t nid = kcontrol->private_value & 0xffff;
635 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
636 long *valp = ucontrol->value.integer.value;
637 unsigned int val = snd_hda_codec_read(codec, nid, 0,
638 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
640 *valp = (val & mask) != 0;
644 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
645 struct snd_ctl_elem_value *ucontrol)
648 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
649 hda_nid_t nid = kcontrol->private_value & 0xffff;
650 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
651 long val = *ucontrol->value.integer.value;
652 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
653 AC_VERB_GET_EAPD_BTLENABLE,
656 /* Set/unset the masked control bit(s) as needed */
657 change = (!val ? 0 : mask) != (ctrl_data & mask);
662 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
668 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
669 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
670 .info = alc_eapd_ctrl_info, \
671 .get = alc_eapd_ctrl_get, \
672 .put = alc_eapd_ctrl_put, \
673 .private_value = nid | (mask<<16) }
674 #endif /* CONFIG_SND_DEBUG */
677 * set up from the preset table
679 static void setup_preset(struct alc_spec *spec,
680 const struct alc_config_preset *preset)
684 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
685 spec->mixers[spec->num_mixers++] = preset->mixers[i];
686 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
688 spec->init_verbs[spec->num_init_verbs++] =
689 preset->init_verbs[i];
691 spec->channel_mode = preset->channel_mode;
692 spec->num_channel_mode = preset->num_channel_mode;
693 spec->need_dac_fix = preset->need_dac_fix;
695 spec->multiout.max_channels = spec->channel_mode[0].channels;
697 spec->multiout.num_dacs = preset->num_dacs;
698 spec->multiout.dac_nids = preset->dac_nids;
699 spec->multiout.dig_out_nid = preset->dig_out_nid;
700 spec->multiout.hp_nid = preset->hp_nid;
702 spec->num_mux_defs = preset->num_mux_defs;
703 if (!spec->num_mux_defs)
704 spec->num_mux_defs = 1;
705 spec->input_mux = preset->input_mux;
707 spec->num_adc_nids = preset->num_adc_nids;
708 spec->adc_nids = preset->adc_nids;
709 spec->dig_in_nid = preset->dig_in_nid;
711 spec->unsol_event = preset->unsol_event;
712 spec->init_hook = preset->init_hook;
713 #ifdef CONFIG_SND_HDA_POWER_SAVE
714 spec->loopback.amplist = preset->loopbacks;
718 /* Enable GPIO mask and set output */
719 static struct hda_verb alc_gpio1_init_verbs[] = {
720 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
721 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
722 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
726 static struct hda_verb alc_gpio2_init_verbs[] = {
727 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
728 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
729 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
733 static struct hda_verb alc_gpio3_init_verbs[] = {
734 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
735 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
736 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
740 static void alc_sku_automute(struct hda_codec *codec)
742 struct alc_spec *spec = codec->spec;
744 unsigned int present;
745 unsigned int hp_nid = spec->autocfg.hp_pins[0];
746 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
748 /* need to execute and sync at first */
749 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
750 present = snd_hda_codec_read(codec, hp_nid, 0,
751 AC_VERB_GET_PIN_SENSE, 0);
752 spec->jack_present = (present & 0x80000000) != 0;
753 if (spec->jack_present) {
754 /* mute internal speaker */
755 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
756 HDA_AMP_MUTE, HDA_AMP_MUTE);
758 /* unmute internal speaker if necessary */
759 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
760 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
765 /* unsolicited event for HP jack sensing */
766 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
768 if (codec->vendor_id == 0x10ec0880)
772 if (res != ALC880_HP_EVENT)
775 alc_sku_automute(codec);
778 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
779 * 31 ~ 16 : Manufacture ID
781 * 7 ~ 0 : Assembly ID
782 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
784 static void alc_subsystem_id(struct hda_codec *codec,
785 unsigned int porta, unsigned int porte,
788 unsigned int ass, tmp, i;
790 struct alc_spec *spec = codec->spec;
792 ass = codec->subsystem_id & 0xffff;
793 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
797 * 31~30 : port conetcivity
800 * 19~16 : Check sum (15:1)
805 if (codec->vendor_id == 0x10ec0260)
807 ass = snd_hda_codec_read(codec, nid, 0,
808 AC_VERB_GET_CONFIG_DEFAULT, 0);
809 if (!(ass & 1) && !(ass & 0x100000))
811 if ((ass >> 30) != 1) /* no physical connection */
816 for (i = 1; i < 16; i++) {
820 if (((ass >> 16) & 0xf) != tmp)
826 * 2 : 0 --> Desktop, 1 --> Laptop
827 * 3~5 : External Amplifier control
830 tmp = (ass & 0x38) >> 3; /* external Amp control */
833 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
836 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
839 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
841 case 5: /* set EAPD output high */
842 switch (codec->vendor_id) {
844 snd_hda_codec_write(codec, 0x0f, 0,
845 AC_VERB_SET_EAPD_BTLENABLE, 2);
846 snd_hda_codec_write(codec, 0x10, 0,
847 AC_VERB_SET_EAPD_BTLENABLE, 2);
855 snd_hda_codec_write(codec, 0x14, 0,
856 AC_VERB_SET_EAPD_BTLENABLE, 2);
857 snd_hda_codec_write(codec, 0x15, 0,
858 AC_VERB_SET_EAPD_BTLENABLE, 2);
861 switch (codec->vendor_id) {
863 snd_hda_codec_write(codec, 0x1a, 0,
864 AC_VERB_SET_COEF_INDEX, 7);
865 tmp = snd_hda_codec_read(codec, 0x1a, 0,
866 AC_VERB_GET_PROC_COEF, 0);
867 snd_hda_codec_write(codec, 0x1a, 0,
868 AC_VERB_SET_COEF_INDEX, 7);
869 snd_hda_codec_write(codec, 0x1a, 0,
870 AC_VERB_SET_PROC_COEF,
879 snd_hda_codec_write(codec, 0x20, 0,
880 AC_VERB_SET_COEF_INDEX, 7);
881 tmp = snd_hda_codec_read(codec, 0x20, 0,
882 AC_VERB_GET_PROC_COEF, 0);
883 snd_hda_codec_write(codec, 0x20, 0,
884 AC_VERB_SET_COEF_INDEX, 7);
885 snd_hda_codec_write(codec, 0x20, 0,
886 AC_VERB_SET_PROC_COEF,
891 snd_hda_codec_write(codec, 0x20, 0,
892 AC_VERB_SET_COEF_INDEX, 7);
893 tmp = snd_hda_codec_read(codec, 0x20, 0,
894 AC_VERB_GET_PROC_COEF, 0);
895 snd_hda_codec_write(codec, 0x20, 0,
896 AC_VERB_SET_COEF_INDEX, 7);
897 snd_hda_codec_write(codec, 0x20, 0,
898 AC_VERB_SET_PROC_COEF,
906 /* is laptop or Desktop and enable the function "Mute internal speaker
907 * when the external headphone out jack is plugged"
912 * 10~8 : Jack location
913 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
915 * 15 : 1 --> enable the function "Mute internal speaker
916 * when the external headphone out jack is plugged"
918 if (!spec->autocfg.speaker_pins[0]) {
919 if (spec->autocfg.line_out_pins[0])
920 spec->autocfg.speaker_pins[0] =
921 spec->autocfg.line_out_pins[0];
926 if (!spec->autocfg.hp_pins[0]) {
927 tmp = (ass >> 11) & 0x3; /* HP to chassis */
929 spec->autocfg.hp_pins[0] = porta;
931 spec->autocfg.hp_pins[0] = porte;
933 spec->autocfg.hp_pins[0] = portd;
938 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
939 AC_VERB_SET_UNSOLICITED_ENABLE,
940 AC_USRSP_EN | ALC880_HP_EVENT);
941 spec->unsol_event = alc_sku_unsol_event;
942 spec->init_hook = alc_sku_automute;
946 * Fix-up pin default configurations
954 static void alc_fix_pincfg(struct hda_codec *codec,
955 const struct snd_pci_quirk *quirk,
956 const struct alc_pincfg **pinfix)
958 const struct alc_pincfg *cfg;
960 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
964 cfg = pinfix[quirk->value];
965 for (; cfg->nid; cfg++) {
968 for (i = 0; i < 4; i++) {
969 snd_hda_codec_write(codec, cfg->nid, 0,
970 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
978 * ALC880 3-stack model
980 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
981 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
982 * F-Mic = 0x1b, HP = 0x19
985 static hda_nid_t alc880_dac_nids[4] = {
986 /* front, rear, clfe, rear_surr */
987 0x02, 0x05, 0x04, 0x03
990 static hda_nid_t alc880_adc_nids[3] = {
995 /* The datasheet says the node 0x07 is connected from inputs,
996 * but it shows zero connection in the real implementation on some devices.
997 * Note: this is a 915GAV bug, fixed on 915GLV
999 static hda_nid_t alc880_adc_nids_alt[2] = {
1004 #define ALC880_DIGOUT_NID 0x06
1005 #define ALC880_DIGIN_NID 0x0a
1007 static struct hda_input_mux alc880_capture_source = {
1011 { "Front Mic", 0x3 },
1017 /* channel source setting (2/6 channel selection for 3-stack) */
1019 static struct hda_verb alc880_threestack_ch2_init[] = {
1020 /* set line-in to input, mute it */
1021 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1022 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1023 /* set mic-in to input vref 80%, mute it */
1024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1025 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1030 static struct hda_verb alc880_threestack_ch6_init[] = {
1031 /* set line-in to output, unmute it */
1032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1034 /* set mic-in to output, unmute it */
1035 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1036 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1040 static struct hda_channel_mode alc880_threestack_modes[2] = {
1041 { 2, alc880_threestack_ch2_init },
1042 { 6, alc880_threestack_ch6_init },
1045 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1046 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1047 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1048 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1049 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1050 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1051 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1052 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1053 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1054 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1055 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1060 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1062 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1063 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1067 .name = "Channel Mode",
1068 .info = alc_ch_mode_info,
1069 .get = alc_ch_mode_get,
1070 .put = alc_ch_mode_put,
1075 /* capture mixer elements */
1076 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1079 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1080 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1081 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1082 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1085 /* The multiple "Capture Source" controls confuse alsamixer
1086 * So call somewhat different..
1088 /* .name = "Capture Source", */
1089 .name = "Input Source",
1091 .info = alc_mux_enum_info,
1092 .get = alc_mux_enum_get,
1093 .put = alc_mux_enum_put,
1098 /* capture mixer elements (in case NID 0x07 not available) */
1099 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1100 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1101 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1102 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1103 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1106 /* The multiple "Capture Source" controls confuse alsamixer
1107 * So call somewhat different..
1109 /* .name = "Capture Source", */
1110 .name = "Input Source",
1112 .info = alc_mux_enum_info,
1113 .get = alc_mux_enum_get,
1114 .put = alc_mux_enum_put,
1122 * ALC880 5-stack model
1124 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1126 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1127 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1130 /* additional mixers to alc880_three_stack_mixer */
1131 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1132 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1133 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1137 /* channel source setting (6/8 channel selection for 5-stack) */
1139 static struct hda_verb alc880_fivestack_ch6_init[] = {
1140 /* set line-in to input, mute it */
1141 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1142 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1147 static struct hda_verb alc880_fivestack_ch8_init[] = {
1148 /* set line-in to output, unmute it */
1149 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1150 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1154 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1155 { 6, alc880_fivestack_ch6_init },
1156 { 8, alc880_fivestack_ch8_init },
1161 * ALC880 6-stack model
1163 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1164 * Side = 0x05 (0x0f)
1165 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1166 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1169 static hda_nid_t alc880_6st_dac_nids[4] = {
1170 /* front, rear, clfe, rear_surr */
1171 0x02, 0x03, 0x04, 0x05
1174 static struct hda_input_mux alc880_6stack_capture_source = {
1178 { "Front Mic", 0x1 },
1184 /* fixed 8-channels */
1185 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1189 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1192 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1193 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1194 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1195 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1197 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1199 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1206 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1208 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1209 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1212 .name = "Channel Mode",
1213 .info = alc_ch_mode_info,
1214 .get = alc_ch_mode_get,
1215 .put = alc_ch_mode_put,
1224 * W810 has rear IO for:
1227 * Center/LFE (DAC 04)
1230 * The system also has a pair of internal speakers, and a headphone jack.
1231 * These are both connected to Line2 on the codec, hence to DAC 02.
1233 * There is a variable resistor to control the speaker or headphone
1234 * volume. This is a hardware-only device without a software API.
1236 * Plugging headphones in will disable the internal speakers. This is
1237 * implemented in hardware, not via the driver using jack sense. In
1238 * a similar fashion, plugging into the rear socket marked "front" will
1239 * disable both the speakers and headphones.
1241 * For input, there's a microphone jack, and an "audio in" jack.
1242 * These may not do anything useful with this driver yet, because I
1243 * haven't setup any initialization verbs for these yet...
1246 static hda_nid_t alc880_w810_dac_nids[3] = {
1247 /* front, rear/surround, clfe */
1251 /* fixed 6 channels */
1252 static struct hda_channel_mode alc880_w810_modes[1] = {
1256 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1257 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1274 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1275 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1279 static hda_nid_t alc880_z71v_dac_nids[1] = {
1282 #define ALC880_Z71V_HP_DAC 0x03
1284 /* fixed 2 channels */
1285 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1289 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1293 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1303 * ALC880 F1734 model
1305 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1306 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1309 static hda_nid_t alc880_f1734_dac_nids[1] = {
1312 #define ALC880_F1734_HP_DAC 0x02
1314 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1315 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1316 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1317 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1318 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1330 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1331 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1332 * Mic = 0x18, Line = 0x1a
1335 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1336 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1338 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1340 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1341 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1342 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1343 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1345 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1355 .name = "Channel Mode",
1356 .info = alc_ch_mode_info,
1357 .get = alc_ch_mode_get,
1358 .put = alc_ch_mode_put,
1364 * ALC880 ASUS W1V model
1366 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1367 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1368 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1371 /* additional mixers to alc880_asus_mixer */
1372 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1373 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1374 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1378 /* additional mixers to alc880_asus_mixer */
1379 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1380 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1381 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1386 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1387 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1388 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1391 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1394 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1395 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1398 /* The multiple "Capture Source" controls confuse alsamixer
1399 * So call somewhat different..
1401 /* .name = "Capture Source", */
1402 .name = "Input Source",
1404 .info = alc_mux_enum_info,
1405 .get = alc_mux_enum_get,
1406 .put = alc_mux_enum_put,
1412 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1413 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1414 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1415 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1416 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1417 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1418 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1419 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1420 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1421 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1422 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1423 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1424 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1425 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1429 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1430 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1432 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1433 .name = "Channel Mode",
1434 .info = alc_ch_mode_info,
1435 .get = alc_ch_mode_get,
1436 .put = alc_ch_mode_put,
1441 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1443 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1444 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1445 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1446 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1447 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1448 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1449 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1450 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1451 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1455 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1456 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1457 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1459 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1466 * virtual master controls
1470 * slave controls for virtual master
1472 static const char *alc_slave_vols[] = {
1473 "Front Playback Volume",
1474 "Surround Playback Volume",
1475 "Center Playback Volume",
1476 "LFE Playback Volume",
1477 "Side Playback Volume",
1478 "Headphone Playback Volume",
1479 "Speaker Playback Volume",
1480 "Mono Playback Volume",
1481 "iSpeaker Playback Volume",
1482 "Line-Out Playback Volume",
1486 static const char *alc_slave_sws[] = {
1487 "Front Playback Switch",
1488 "Surround Playback Switch",
1489 "Center Playback Switch",
1490 "LFE Playback Switch",
1491 "Side Playback Switch",
1492 "Headphone Playback Switch",
1493 "Speaker Playback Switch",
1494 "Mono Playback Switch",
1495 "iSpeaker Playback Switch",
1500 * build control elements
1502 static int alc_build_controls(struct hda_codec *codec)
1504 struct alc_spec *spec = codec->spec;
1508 for (i = 0; i < spec->num_mixers; i++) {
1509 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1514 if (spec->multiout.dig_out_nid) {
1515 err = snd_hda_create_spdif_out_ctls(codec,
1516 spec->multiout.dig_out_nid);
1520 if (spec->dig_in_nid) {
1521 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1526 /* if we have no master control, let's create it */
1527 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1528 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1529 HDA_OUTPUT, spec->vmaster_tlv);
1530 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1531 spec->vmaster_tlv, alc_slave_vols);
1535 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1536 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1537 NULL, alc_slave_sws);
1547 * initialize the codec volumes, etc
1551 * generic initialization of ADC, input mixers and output mixers
1553 static struct hda_verb alc880_volume_init_verbs[] = {
1555 * Unmute ADC0-2 and set the default input to mic-in
1557 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1559 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1561 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1564 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1566 * Note: PASD motherboards uses the Line In 2 as the input for front
1569 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1579 * Set up output mixers (0x0c - 0x0f)
1581 /* set vol=0 to output mixers */
1582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1584 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1585 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1586 /* set up input amps for analog loopback */
1587 /* Amp Indices: DAC = 0, mixer = 1 */
1588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1595 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1601 * 3-stack pin configuration:
1602 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1604 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1606 * preset connection lists of input pins
1607 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1609 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1610 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1611 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1614 * Set pin mode and muting
1616 /* set front pin widgets 0x14 for output */
1617 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1618 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1619 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1621 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1622 /* Mic2 (as headphone out) for HP output */
1623 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1624 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1625 /* Line In pin widget for input */
1626 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1627 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1628 /* Line2 (as front mic) pin widget for input and vref at 80% */
1629 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1630 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1631 /* CD pin widget for input */
1632 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1638 * 5-stack pin configuration:
1639 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1640 * line-in/side = 0x1a, f-mic = 0x1b
1642 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1644 * preset connection lists of input pins
1645 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1647 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1648 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1651 * Set pin mode and muting
1653 /* set pin widgets 0x14-0x17 for output */
1654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1656 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1657 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 /* unmute pins for output (no gain on this amp) */
1659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1661 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1662 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1666 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1667 /* Mic2 (as headphone out) for HP output */
1668 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1669 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1670 /* Line In pin widget for input */
1671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1673 /* Line2 (as front mic) pin widget for input and vref at 80% */
1674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1675 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1676 /* CD pin widget for input */
1677 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1683 * W810 pin configuration:
1684 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1686 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1687 /* hphone/speaker input selector: front DAC */
1688 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1697 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1698 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1704 * Z71V pin configuration:
1705 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1707 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1708 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1709 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1711 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1713 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1715 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1716 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1722 * 6-stack pin configuration:
1723 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1724 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1726 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1727 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1734 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1735 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1736 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1743 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1746 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1752 * Uniwill pin configuration:
1753 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1756 static struct hda_verb alc880_uniwill_init_verbs[] = {
1757 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1759 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1761 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1762 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1763 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1764 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1765 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1766 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1768 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1769 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1770 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1771 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1774 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1776 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1780 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1781 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1782 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1784 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1785 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1792 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1794 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1795 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1805 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1807 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1817 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1818 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1823 static struct hda_verb alc880_beep_init_verbs[] = {
1824 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1828 /* toggle speaker-output according to the hp-jack state */
1829 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1831 unsigned int present;
1834 present = snd_hda_codec_read(codec, 0x14, 0,
1835 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1836 bits = present ? HDA_AMP_MUTE : 0;
1837 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1838 HDA_AMP_MUTE, bits);
1839 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1840 HDA_AMP_MUTE, bits);
1843 /* auto-toggle front mic */
1844 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1846 unsigned int present;
1849 present = snd_hda_codec_read(codec, 0x18, 0,
1850 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1851 bits = present ? HDA_AMP_MUTE : 0;
1852 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1855 static void alc880_uniwill_automute(struct hda_codec *codec)
1857 alc880_uniwill_hp_automute(codec);
1858 alc880_uniwill_mic_automute(codec);
1861 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1864 /* Looks like the unsol event is incompatible with the standard
1865 * definition. 4bit tag is placed at 28 bit!
1867 switch (res >> 28) {
1868 case ALC880_HP_EVENT:
1869 alc880_uniwill_hp_automute(codec);
1871 case ALC880_MIC_EVENT:
1872 alc880_uniwill_mic_automute(codec);
1877 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1879 unsigned int present;
1882 present = snd_hda_codec_read(codec, 0x14, 0,
1883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1884 bits = present ? HDA_AMP_MUTE : 0;
1885 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1888 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1890 unsigned int present;
1892 present = snd_hda_codec_read(codec, 0x21, 0,
1893 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1894 present &= HDA_AMP_VOLMASK;
1895 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1896 HDA_AMP_VOLMASK, present);
1897 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1898 HDA_AMP_VOLMASK, present);
1901 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1904 /* Looks like the unsol event is incompatible with the standard
1905 * definition. 4bit tag is placed at 28 bit!
1907 if ((res >> 28) == ALC880_HP_EVENT)
1908 alc880_uniwill_p53_hp_automute(codec);
1909 if ((res >> 28) == ALC880_DCVOL_EVENT)
1910 alc880_uniwill_p53_dcvol_automute(codec);
1914 * F1734 pin configuration:
1915 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1917 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1918 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1919 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1920 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1921 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1932 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1936 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1942 * ASUS pin configuration:
1943 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1945 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1946 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1947 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1948 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1949 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1952 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1955 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1956 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1957 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1958 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1960 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1961 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1963 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1964 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1966 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1968 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1973 /* Enable GPIO mask and set output */
1974 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1975 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1977 /* Clevo m520g init */
1978 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1979 /* headphone output */
1980 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1985 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1986 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1989 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1990 /* Mic1 (rear panel) */
1991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1993 /* Mic2 (front panel) */
1994 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1995 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1998 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1999 /* change to EAPD mode */
2000 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2001 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2006 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2007 /* change to EAPD mode */
2008 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2009 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2011 /* Headphone output */
2012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2015 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2017 /* Line In pin widget for input */
2018 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2019 /* CD pin widget for input */
2020 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2021 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2022 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2024 /* change to EAPD mode */
2025 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2026 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2032 * LG m1 express dual
2035 * Rear Line-In/Out (blue): 0x14
2036 * Build-in Mic-In: 0x15
2038 * HP-Out (green): 0x1b
2039 * Mic-In/Out (red): 0x19
2043 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2044 static hda_nid_t alc880_lg_dac_nids[3] = {
2048 /* seems analog CD is not working */
2049 static struct hda_input_mux alc880_lg_capture_source = {
2054 { "Internal Mic", 0x6 },
2058 /* 2,4,6 channel modes */
2059 static struct hda_verb alc880_lg_ch2_init[] = {
2060 /* set line-in and mic-in to input */
2061 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2062 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2066 static struct hda_verb alc880_lg_ch4_init[] = {
2067 /* set line-in to out and mic-in to input */
2068 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2069 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2073 static struct hda_verb alc880_lg_ch6_init[] = {
2074 /* set line-in and mic-in to output */
2075 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2076 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2080 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2081 { 2, alc880_lg_ch2_init },
2082 { 4, alc880_lg_ch4_init },
2083 { 6, alc880_lg_ch6_init },
2086 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2088 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2089 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2090 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2091 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2092 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2093 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2094 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2099 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2100 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2102 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2103 .name = "Channel Mode",
2104 .info = alc_ch_mode_info,
2105 .get = alc_ch_mode_get,
2106 .put = alc_ch_mode_put,
2111 static struct hda_verb alc880_lg_init_verbs[] = {
2112 /* set capture source to mic-in */
2113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2115 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2116 /* mute all amp mixer inputs */
2117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2120 /* line-in to input */
2121 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2122 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2124 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2125 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2127 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2128 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2129 /* mic-in to input */
2130 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2132 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2134 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2135 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2136 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2138 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2142 /* toggle speaker-output according to the hp-jack state */
2143 static void alc880_lg_automute(struct hda_codec *codec)
2145 unsigned int present;
2148 present = snd_hda_codec_read(codec, 0x1b, 0,
2149 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2150 bits = present ? HDA_AMP_MUTE : 0;
2151 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2152 HDA_AMP_MUTE, bits);
2155 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2157 /* Looks like the unsol event is incompatible with the standard
2158 * definition. 4bit tag is placed at 28 bit!
2160 if ((res >> 28) == 0x01)
2161 alc880_lg_automute(codec);
2170 * Built-in Mic-In: 0x19
2176 static struct hda_input_mux alc880_lg_lw_capture_source = {
2180 { "Internal Mic", 0x1 },
2185 #define alc880_lg_lw_modes alc880_threestack_modes
2187 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2190 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2191 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2192 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2193 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2194 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2195 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2200 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2201 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2204 .name = "Channel Mode",
2205 .info = alc_ch_mode_info,
2206 .get = alc_ch_mode_get,
2207 .put = alc_ch_mode_put,
2212 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2213 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2214 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2215 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2217 /* set capture source to mic-in */
2218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2219 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2220 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2221 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2226 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2227 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2228 /* mic-in to input */
2229 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2230 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2232 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2233 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2235 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2239 /* toggle speaker-output according to the hp-jack state */
2240 static void alc880_lg_lw_automute(struct hda_codec *codec)
2242 unsigned int present;
2245 present = snd_hda_codec_read(codec, 0x1b, 0,
2246 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2247 bits = present ? HDA_AMP_MUTE : 0;
2248 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2249 HDA_AMP_MUTE, bits);
2252 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2254 /* Looks like the unsol event is incompatible with the standard
2255 * definition. 4bit tag is placed at 28 bit!
2257 if ((res >> 28) == 0x01)
2258 alc880_lg_lw_automute(codec);
2261 #ifdef CONFIG_SND_HDA_POWER_SAVE
2262 static struct hda_amp_list alc880_loopbacks[] = {
2263 { 0x0b, HDA_INPUT, 0 },
2264 { 0x0b, HDA_INPUT, 1 },
2265 { 0x0b, HDA_INPUT, 2 },
2266 { 0x0b, HDA_INPUT, 3 },
2267 { 0x0b, HDA_INPUT, 4 },
2271 static struct hda_amp_list alc880_lg_loopbacks[] = {
2272 { 0x0b, HDA_INPUT, 1 },
2273 { 0x0b, HDA_INPUT, 6 },
2274 { 0x0b, HDA_INPUT, 7 },
2283 static int alc_init(struct hda_codec *codec)
2285 struct alc_spec *spec = codec->spec;
2288 for (i = 0; i < spec->num_init_verbs; i++)
2289 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2291 if (spec->init_hook)
2292 spec->init_hook(codec);
2297 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2299 struct alc_spec *spec = codec->spec;
2301 if (spec->unsol_event)
2302 spec->unsol_event(codec, res);
2305 #ifdef CONFIG_SND_HDA_POWER_SAVE
2306 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2308 struct alc_spec *spec = codec->spec;
2309 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2314 * Analog playback callbacks
2316 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2317 struct hda_codec *codec,
2318 struct snd_pcm_substream *substream)
2320 struct alc_spec *spec = codec->spec;
2321 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2324 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2325 struct hda_codec *codec,
2326 unsigned int stream_tag,
2327 unsigned int format,
2328 struct snd_pcm_substream *substream)
2330 struct alc_spec *spec = codec->spec;
2331 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2332 stream_tag, format, substream);
2335 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2336 struct hda_codec *codec,
2337 struct snd_pcm_substream *substream)
2339 struct alc_spec *spec = codec->spec;
2340 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2346 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2347 struct hda_codec *codec,
2348 struct snd_pcm_substream *substream)
2350 struct alc_spec *spec = codec->spec;
2351 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2354 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2355 struct hda_codec *codec,
2356 unsigned int stream_tag,
2357 unsigned int format,
2358 struct snd_pcm_substream *substream)
2360 struct alc_spec *spec = codec->spec;
2361 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2362 stream_tag, format, substream);
2365 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2366 struct hda_codec *codec,
2367 struct snd_pcm_substream *substream)
2369 struct alc_spec *spec = codec->spec;
2370 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2376 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2377 struct hda_codec *codec,
2378 unsigned int stream_tag,
2379 unsigned int format,
2380 struct snd_pcm_substream *substream)
2382 struct alc_spec *spec = codec->spec;
2384 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2385 stream_tag, 0, format);
2389 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2390 struct hda_codec *codec,
2391 struct snd_pcm_substream *substream)
2393 struct alc_spec *spec = codec->spec;
2395 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2403 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2407 /* NID is set in alc_build_pcms */
2409 .open = alc880_playback_pcm_open,
2410 .prepare = alc880_playback_pcm_prepare,
2411 .cleanup = alc880_playback_pcm_cleanup
2415 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2419 /* NID is set in alc_build_pcms */
2422 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2426 /* NID is set in alc_build_pcms */
2429 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2430 .substreams = 2, /* can be overridden */
2433 /* NID is set in alc_build_pcms */
2435 .prepare = alc880_alt_capture_pcm_prepare,
2436 .cleanup = alc880_alt_capture_pcm_cleanup
2440 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2444 /* NID is set in alc_build_pcms */
2446 .open = alc880_dig_playback_pcm_open,
2447 .close = alc880_dig_playback_pcm_close,
2448 .prepare = alc880_dig_playback_pcm_prepare
2452 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2456 /* NID is set in alc_build_pcms */
2459 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2460 static struct hda_pcm_stream alc_pcm_null_stream = {
2466 static int alc_build_pcms(struct hda_codec *codec)
2468 struct alc_spec *spec = codec->spec;
2469 struct hda_pcm *info = spec->pcm_rec;
2472 codec->num_pcms = 1;
2473 codec->pcm_info = info;
2475 info->name = spec->stream_name_analog;
2476 if (spec->stream_analog_playback) {
2477 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2478 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2479 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2481 if (spec->stream_analog_capture) {
2482 snd_assert(spec->adc_nids, return -EINVAL);
2483 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2484 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2487 if (spec->channel_mode) {
2488 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2489 for (i = 0; i < spec->num_channel_mode; i++) {
2490 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2491 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2496 /* SPDIF for stream index #1 */
2497 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2498 codec->num_pcms = 2;
2499 info = spec->pcm_rec + 1;
2500 info->name = spec->stream_name_digital;
2501 if (spec->multiout.dig_out_nid &&
2502 spec->stream_digital_playback) {
2503 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2504 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2506 if (spec->dig_in_nid &&
2507 spec->stream_digital_capture) {
2508 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2509 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2513 /* If the use of more than one ADC is requested for the current
2514 * model, configure a second analog capture-only PCM.
2516 /* Additional Analaog capture for index #2 */
2517 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2518 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2519 codec->num_pcms = 3;
2520 info = spec->pcm_rec + 2;
2521 info->name = spec->stream_name_analog;
2522 if (spec->alt_dac_nid) {
2523 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2524 *spec->stream_analog_alt_playback;
2525 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2528 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2529 alc_pcm_null_stream;
2530 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2532 if (spec->num_adc_nids > 1) {
2533 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2534 *spec->stream_analog_alt_capture;
2535 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2537 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2538 spec->num_adc_nids - 1;
2540 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2541 alc_pcm_null_stream;
2542 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2549 static void alc_free(struct hda_codec *codec)
2551 struct alc_spec *spec = codec->spec;
2557 if (spec->kctl_alloc) {
2558 for (i = 0; i < spec->num_kctl_used; i++)
2559 kfree(spec->kctl_alloc[i].name);
2560 kfree(spec->kctl_alloc);
2567 static struct hda_codec_ops alc_patch_ops = {
2568 .build_controls = alc_build_controls,
2569 .build_pcms = alc_build_pcms,
2572 .unsol_event = alc_unsol_event,
2573 #ifdef CONFIG_SND_HDA_POWER_SAVE
2574 .check_power_status = alc_check_power_status,
2580 * Test configuration for debugging
2582 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2585 #ifdef CONFIG_SND_DEBUG
2586 static hda_nid_t alc880_test_dac_nids[4] = {
2587 0x02, 0x03, 0x04, 0x05
2590 static struct hda_input_mux alc880_test_capture_source = {
2599 { "Surround", 0x6 },
2603 static struct hda_channel_mode alc880_test_modes[4] = {
2610 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2611 struct snd_ctl_elem_info *uinfo)
2613 static char *texts[] = {
2614 "N/A", "Line Out", "HP Out",
2615 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2617 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2619 uinfo->value.enumerated.items = 8;
2620 if (uinfo->value.enumerated.item >= 8)
2621 uinfo->value.enumerated.item = 7;
2622 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2626 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2627 struct snd_ctl_elem_value *ucontrol)
2629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2630 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2631 unsigned int pin_ctl, item = 0;
2633 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2634 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2635 if (pin_ctl & AC_PINCTL_OUT_EN) {
2636 if (pin_ctl & AC_PINCTL_HP_EN)
2640 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2641 switch (pin_ctl & AC_PINCTL_VREFEN) {
2642 case AC_PINCTL_VREF_HIZ: item = 3; break;
2643 case AC_PINCTL_VREF_50: item = 4; break;
2644 case AC_PINCTL_VREF_GRD: item = 5; break;
2645 case AC_PINCTL_VREF_80: item = 6; break;
2646 case AC_PINCTL_VREF_100: item = 7; break;
2649 ucontrol->value.enumerated.item[0] = item;
2653 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2654 struct snd_ctl_elem_value *ucontrol)
2656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2657 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2658 static unsigned int ctls[] = {
2659 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2660 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2661 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2662 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2663 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2664 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2666 unsigned int old_ctl, new_ctl;
2668 old_ctl = snd_hda_codec_read(codec, nid, 0,
2669 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2670 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2671 if (old_ctl != new_ctl) {
2673 snd_hda_codec_write_cache(codec, nid, 0,
2674 AC_VERB_SET_PIN_WIDGET_CONTROL,
2676 val = ucontrol->value.enumerated.item[0] >= 3 ?
2678 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2685 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2686 struct snd_ctl_elem_info *uinfo)
2688 static char *texts[] = {
2689 "Front", "Surround", "CLFE", "Side"
2691 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2693 uinfo->value.enumerated.items = 4;
2694 if (uinfo->value.enumerated.item >= 4)
2695 uinfo->value.enumerated.item = 3;
2696 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2700 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2701 struct snd_ctl_elem_value *ucontrol)
2703 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2704 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2707 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2708 ucontrol->value.enumerated.item[0] = sel & 3;
2712 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2713 struct snd_ctl_elem_value *ucontrol)
2715 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2716 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2719 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2720 if (ucontrol->value.enumerated.item[0] != sel) {
2721 sel = ucontrol->value.enumerated.item[0] & 3;
2722 snd_hda_codec_write_cache(codec, nid, 0,
2723 AC_VERB_SET_CONNECT_SEL, sel);
2729 #define PIN_CTL_TEST(xname,nid) { \
2730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2732 .info = alc_test_pin_ctl_info, \
2733 .get = alc_test_pin_ctl_get, \
2734 .put = alc_test_pin_ctl_put, \
2735 .private_value = nid \
2738 #define PIN_SRC_TEST(xname,nid) { \
2739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2741 .info = alc_test_pin_src_info, \
2742 .get = alc_test_pin_src_get, \
2743 .put = alc_test_pin_src_put, \
2744 .private_value = nid \
2747 static struct snd_kcontrol_new alc880_test_mixer[] = {
2748 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2749 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2750 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2751 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2752 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2753 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2754 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2755 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2756 PIN_CTL_TEST("Front Pin Mode", 0x14),
2757 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2758 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2759 PIN_CTL_TEST("Side Pin Mode", 0x17),
2760 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2761 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2762 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2763 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2764 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2765 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2766 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2767 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2768 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2769 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2770 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2771 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2772 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2773 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2774 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2775 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2776 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2777 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2780 .name = "Channel Mode",
2781 .info = alc_ch_mode_info,
2782 .get = alc_ch_mode_get,
2783 .put = alc_ch_mode_put,
2788 static struct hda_verb alc880_test_init_verbs[] = {
2789 /* Unmute inputs of 0x0c - 0x0f */
2790 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2794 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2795 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2797 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2798 /* Vol output for 0x0c-0x0f */
2799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2800 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2801 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2803 /* Set output pins 0x14-0x17 */
2804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 /* Unmute output pins 0x14-0x17 */
2809 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2813 /* Set input pins 0x18-0x1c */
2814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2815 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2816 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2818 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2819 /* Mute input pins 0x18-0x1b */
2820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2821 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2823 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2826 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2827 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2828 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2829 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2830 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2831 /* Analog input/passthru */
2832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2844 static const char *alc880_models[ALC880_MODEL_LAST] = {
2845 [ALC880_3ST] = "3stack",
2846 [ALC880_TCL_S700] = "tcl",
2847 [ALC880_3ST_DIG] = "3stack-digout",
2848 [ALC880_CLEVO] = "clevo",
2849 [ALC880_5ST] = "5stack",
2850 [ALC880_5ST_DIG] = "5stack-digout",
2851 [ALC880_W810] = "w810",
2852 [ALC880_Z71V] = "z71v",
2853 [ALC880_6ST] = "6stack",
2854 [ALC880_6ST_DIG] = "6stack-digout",
2855 [ALC880_ASUS] = "asus",
2856 [ALC880_ASUS_W1V] = "asus-w1v",
2857 [ALC880_ASUS_DIG] = "asus-dig",
2858 [ALC880_ASUS_DIG2] = "asus-dig2",
2859 [ALC880_UNIWILL_DIG] = "uniwill",
2860 [ALC880_UNIWILL_P53] = "uniwill-p53",
2861 [ALC880_FUJITSU] = "fujitsu",
2862 [ALC880_F1734] = "F1734",
2864 [ALC880_LG_LW] = "lg-lw",
2865 #ifdef CONFIG_SND_DEBUG
2866 [ALC880_TEST] = "test",
2868 [ALC880_AUTO] = "auto",
2871 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2872 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2873 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2874 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2875 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2876 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2877 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2878 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2879 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2880 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2881 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2882 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2883 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2884 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2885 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2886 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2887 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2888 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2889 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2890 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2891 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2892 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2893 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2894 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2895 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2896 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2897 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2898 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2899 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2900 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2901 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2902 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2903 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2904 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2905 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2906 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2907 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2908 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2909 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2910 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2911 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2912 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2913 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2914 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2915 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2916 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2917 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2918 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2919 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2920 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2921 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2922 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2923 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2924 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2925 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2926 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2927 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2928 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2929 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2930 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2931 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2932 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2933 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2934 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2935 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2936 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2937 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2938 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2939 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2940 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2945 * ALC880 codec presets
2947 static struct alc_config_preset alc880_presets[] = {
2949 .mixers = { alc880_three_stack_mixer },
2950 .init_verbs = { alc880_volume_init_verbs,
2951 alc880_pin_3stack_init_verbs },
2952 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2953 .dac_nids = alc880_dac_nids,
2954 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2955 .channel_mode = alc880_threestack_modes,
2957 .input_mux = &alc880_capture_source,
2959 [ALC880_3ST_DIG] = {
2960 .mixers = { alc880_three_stack_mixer },
2961 .init_verbs = { alc880_volume_init_verbs,
2962 alc880_pin_3stack_init_verbs },
2963 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2964 .dac_nids = alc880_dac_nids,
2965 .dig_out_nid = ALC880_DIGOUT_NID,
2966 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2967 .channel_mode = alc880_threestack_modes,
2969 .input_mux = &alc880_capture_source,
2971 [ALC880_TCL_S700] = {
2972 .mixers = { alc880_tcl_s700_mixer },
2973 .init_verbs = { alc880_volume_init_verbs,
2974 alc880_pin_tcl_S700_init_verbs,
2975 alc880_gpio2_init_verbs },
2976 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2977 .dac_nids = alc880_dac_nids,
2979 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2980 .channel_mode = alc880_2_jack_modes,
2981 .input_mux = &alc880_capture_source,
2984 .mixers = { alc880_three_stack_mixer,
2985 alc880_five_stack_mixer},
2986 .init_verbs = { alc880_volume_init_verbs,
2987 alc880_pin_5stack_init_verbs },
2988 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2989 .dac_nids = alc880_dac_nids,
2990 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2991 .channel_mode = alc880_fivestack_modes,
2992 .input_mux = &alc880_capture_source,
2994 [ALC880_5ST_DIG] = {
2995 .mixers = { alc880_three_stack_mixer,
2996 alc880_five_stack_mixer },
2997 .init_verbs = { alc880_volume_init_verbs,
2998 alc880_pin_5stack_init_verbs },
2999 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3000 .dac_nids = alc880_dac_nids,
3001 .dig_out_nid = ALC880_DIGOUT_NID,
3002 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3003 .channel_mode = alc880_fivestack_modes,
3004 .input_mux = &alc880_capture_source,
3007 .mixers = { alc880_six_stack_mixer },
3008 .init_verbs = { alc880_volume_init_verbs,
3009 alc880_pin_6stack_init_verbs },
3010 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3011 .dac_nids = alc880_6st_dac_nids,
3012 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3013 .channel_mode = alc880_sixstack_modes,
3014 .input_mux = &alc880_6stack_capture_source,
3016 [ALC880_6ST_DIG] = {
3017 .mixers = { alc880_six_stack_mixer },
3018 .init_verbs = { alc880_volume_init_verbs,
3019 alc880_pin_6stack_init_verbs },
3020 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3021 .dac_nids = alc880_6st_dac_nids,
3022 .dig_out_nid = ALC880_DIGOUT_NID,
3023 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3024 .channel_mode = alc880_sixstack_modes,
3025 .input_mux = &alc880_6stack_capture_source,
3028 .mixers = { alc880_w810_base_mixer },
3029 .init_verbs = { alc880_volume_init_verbs,
3030 alc880_pin_w810_init_verbs,
3031 alc880_gpio2_init_verbs },
3032 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3033 .dac_nids = alc880_w810_dac_nids,
3034 .dig_out_nid = ALC880_DIGOUT_NID,
3035 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3036 .channel_mode = alc880_w810_modes,
3037 .input_mux = &alc880_capture_source,
3040 .mixers = { alc880_z71v_mixer },
3041 .init_verbs = { alc880_volume_init_verbs,
3042 alc880_pin_z71v_init_verbs },
3043 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3044 .dac_nids = alc880_z71v_dac_nids,
3045 .dig_out_nid = ALC880_DIGOUT_NID,
3047 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3048 .channel_mode = alc880_2_jack_modes,
3049 .input_mux = &alc880_capture_source,
3052 .mixers = { alc880_f1734_mixer },
3053 .init_verbs = { alc880_volume_init_verbs,
3054 alc880_pin_f1734_init_verbs },
3055 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3056 .dac_nids = alc880_f1734_dac_nids,
3058 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3059 .channel_mode = alc880_2_jack_modes,
3060 .input_mux = &alc880_capture_source,
3063 .mixers = { alc880_asus_mixer },
3064 .init_verbs = { alc880_volume_init_verbs,
3065 alc880_pin_asus_init_verbs,
3066 alc880_gpio1_init_verbs },
3067 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3068 .dac_nids = alc880_asus_dac_nids,
3069 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3070 .channel_mode = alc880_asus_modes,
3072 .input_mux = &alc880_capture_source,
3074 [ALC880_ASUS_DIG] = {
3075 .mixers = { alc880_asus_mixer },
3076 .init_verbs = { alc880_volume_init_verbs,
3077 alc880_pin_asus_init_verbs,
3078 alc880_gpio1_init_verbs },
3079 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3080 .dac_nids = alc880_asus_dac_nids,
3081 .dig_out_nid = ALC880_DIGOUT_NID,
3082 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3083 .channel_mode = alc880_asus_modes,
3085 .input_mux = &alc880_capture_source,
3087 [ALC880_ASUS_DIG2] = {
3088 .mixers = { alc880_asus_mixer },
3089 .init_verbs = { alc880_volume_init_verbs,
3090 alc880_pin_asus_init_verbs,
3091 alc880_gpio2_init_verbs }, /* use GPIO2 */
3092 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3093 .dac_nids = alc880_asus_dac_nids,
3094 .dig_out_nid = ALC880_DIGOUT_NID,
3095 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3096 .channel_mode = alc880_asus_modes,
3098 .input_mux = &alc880_capture_source,
3100 [ALC880_ASUS_W1V] = {
3101 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3102 .init_verbs = { alc880_volume_init_verbs,
3103 alc880_pin_asus_init_verbs,
3104 alc880_gpio1_init_verbs },
3105 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3106 .dac_nids = alc880_asus_dac_nids,
3107 .dig_out_nid = ALC880_DIGOUT_NID,
3108 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3109 .channel_mode = alc880_asus_modes,
3111 .input_mux = &alc880_capture_source,
3113 [ALC880_UNIWILL_DIG] = {
3114 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3115 .init_verbs = { alc880_volume_init_verbs,
3116 alc880_pin_asus_init_verbs },
3117 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3118 .dac_nids = alc880_asus_dac_nids,
3119 .dig_out_nid = ALC880_DIGOUT_NID,
3120 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3121 .channel_mode = alc880_asus_modes,
3123 .input_mux = &alc880_capture_source,
3125 [ALC880_UNIWILL] = {
3126 .mixers = { alc880_uniwill_mixer },
3127 .init_verbs = { alc880_volume_init_verbs,
3128 alc880_uniwill_init_verbs },
3129 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3130 .dac_nids = alc880_asus_dac_nids,
3131 .dig_out_nid = ALC880_DIGOUT_NID,
3132 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3133 .channel_mode = alc880_threestack_modes,
3135 .input_mux = &alc880_capture_source,
3136 .unsol_event = alc880_uniwill_unsol_event,
3137 .init_hook = alc880_uniwill_automute,
3139 [ALC880_UNIWILL_P53] = {
3140 .mixers = { alc880_uniwill_p53_mixer },
3141 .init_verbs = { alc880_volume_init_verbs,
3142 alc880_uniwill_p53_init_verbs },
3143 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3144 .dac_nids = alc880_asus_dac_nids,
3145 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3146 .channel_mode = alc880_threestack_modes,
3147 .input_mux = &alc880_capture_source,
3148 .unsol_event = alc880_uniwill_p53_unsol_event,
3149 .init_hook = alc880_uniwill_p53_hp_automute,
3151 [ALC880_FUJITSU] = {
3152 .mixers = { alc880_fujitsu_mixer,
3153 alc880_pcbeep_mixer, },
3154 .init_verbs = { alc880_volume_init_verbs,
3155 alc880_uniwill_p53_init_verbs,
3156 alc880_beep_init_verbs },
3157 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3158 .dac_nids = alc880_dac_nids,
3159 .dig_out_nid = ALC880_DIGOUT_NID,
3160 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3161 .channel_mode = alc880_2_jack_modes,
3162 .input_mux = &alc880_capture_source,
3163 .unsol_event = alc880_uniwill_p53_unsol_event,
3164 .init_hook = alc880_uniwill_p53_hp_automute,
3167 .mixers = { alc880_three_stack_mixer },
3168 .init_verbs = { alc880_volume_init_verbs,
3169 alc880_pin_clevo_init_verbs },
3170 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3171 .dac_nids = alc880_dac_nids,
3173 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3174 .channel_mode = alc880_threestack_modes,
3176 .input_mux = &alc880_capture_source,
3179 .mixers = { alc880_lg_mixer },
3180 .init_verbs = { alc880_volume_init_verbs,
3181 alc880_lg_init_verbs },
3182 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3183 .dac_nids = alc880_lg_dac_nids,
3184 .dig_out_nid = ALC880_DIGOUT_NID,
3185 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3186 .channel_mode = alc880_lg_ch_modes,
3188 .input_mux = &alc880_lg_capture_source,
3189 .unsol_event = alc880_lg_unsol_event,
3190 .init_hook = alc880_lg_automute,
3191 #ifdef CONFIG_SND_HDA_POWER_SAVE
3192 .loopbacks = alc880_lg_loopbacks,
3196 .mixers = { alc880_lg_lw_mixer },
3197 .init_verbs = { alc880_volume_init_verbs,
3198 alc880_lg_lw_init_verbs },
3199 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3200 .dac_nids = alc880_dac_nids,
3201 .dig_out_nid = ALC880_DIGOUT_NID,
3202 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3203 .channel_mode = alc880_lg_lw_modes,
3204 .input_mux = &alc880_lg_lw_capture_source,
3205 .unsol_event = alc880_lg_lw_unsol_event,
3206 .init_hook = alc880_lg_lw_automute,
3208 #ifdef CONFIG_SND_DEBUG
3210 .mixers = { alc880_test_mixer },
3211 .init_verbs = { alc880_test_init_verbs },
3212 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3213 .dac_nids = alc880_test_dac_nids,
3214 .dig_out_nid = ALC880_DIGOUT_NID,
3215 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3216 .channel_mode = alc880_test_modes,
3217 .input_mux = &alc880_test_capture_source,
3223 * Automatic parse of I/O pins from the BIOS configuration
3226 #define NUM_CONTROL_ALLOC 32
3227 #define NUM_VERB_ALLOC 32
3231 ALC_CTL_WIDGET_MUTE,
3234 static struct snd_kcontrol_new alc880_control_templates[] = {
3235 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3236 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3237 HDA_BIND_MUTE(NULL, 0, 0, 0),
3240 /* add dynamic controls */
3241 static int add_control(struct alc_spec *spec, int type, const char *name,
3244 struct snd_kcontrol_new *knew;
3246 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3247 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3249 /* array + terminator */
3250 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3253 if (spec->kctl_alloc) {
3254 memcpy(knew, spec->kctl_alloc,
3255 sizeof(*knew) * spec->num_kctl_alloc);
3256 kfree(spec->kctl_alloc);
3258 spec->kctl_alloc = knew;
3259 spec->num_kctl_alloc = num;
3262 knew = &spec->kctl_alloc[spec->num_kctl_used];
3263 *knew = alc880_control_templates[type];
3264 knew->name = kstrdup(name, GFP_KERNEL);
3267 knew->private_value = val;
3268 spec->num_kctl_used++;
3272 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3273 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3274 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3275 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3276 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3277 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3278 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3279 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3280 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3281 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3282 #define ALC880_PIN_CD_NID 0x1c
3284 /* fill in the dac_nids table from the parsed pin configuration */
3285 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3286 const struct auto_pin_cfg *cfg)
3292 memset(assigned, 0, sizeof(assigned));
3293 spec->multiout.dac_nids = spec->private_dac_nids;
3295 /* check the pins hardwired to audio widget */
3296 for (i = 0; i < cfg->line_outs; i++) {
3297 nid = cfg->line_out_pins[i];
3298 if (alc880_is_fixed_pin(nid)) {
3299 int idx = alc880_fixed_pin_idx(nid);
3300 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3304 /* left pins can be connect to any audio widget */
3305 for (i = 0; i < cfg->line_outs; i++) {
3306 nid = cfg->line_out_pins[i];
3307 if (alc880_is_fixed_pin(nid))
3309 /* search for an empty channel */
3310 for (j = 0; j < cfg->line_outs; j++) {
3312 spec->multiout.dac_nids[i] =
3313 alc880_idx_to_dac(j);
3319 spec->multiout.num_dacs = cfg->line_outs;
3323 /* add playback controls from the parsed DAC table */
3324 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3325 const struct auto_pin_cfg *cfg)
3328 static const char *chname[4] = {
3329 "Front", "Surround", NULL /*CLFE*/, "Side"
3334 for (i = 0; i < cfg->line_outs; i++) {
3335 if (!spec->multiout.dac_nids[i])
3337 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3340 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3341 "Center Playback Volume",
3342 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3346 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3347 "LFE Playback Volume",
3348 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3352 err = add_control(spec, ALC_CTL_BIND_MUTE,
3353 "Center Playback Switch",
3354 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3358 err = add_control(spec, ALC_CTL_BIND_MUTE,
3359 "LFE Playback Switch",
3360 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3365 sprintf(name, "%s Playback Volume", chname[i]);
3366 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3367 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3371 sprintf(name, "%s Playback Switch", chname[i]);
3372 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3373 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3382 /* add playback controls for speaker and HP outputs */
3383 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3393 if (alc880_is_fixed_pin(pin)) {
3394 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3395 /* specify the DAC as the extra output */
3396 if (!spec->multiout.hp_nid)
3397 spec->multiout.hp_nid = nid;
3399 spec->multiout.extra_out_nid[0] = nid;
3400 /* control HP volume/switch on the output mixer amp */
3401 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3402 sprintf(name, "%s Playback Volume", pfx);
3403 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3404 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3407 sprintf(name, "%s Playback Switch", pfx);
3408 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3409 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3412 } else if (alc880_is_multi_pin(pin)) {
3413 /* set manual connection */
3414 /* we have only a switch on HP-out PIN */
3415 sprintf(name, "%s Playback Switch", pfx);
3416 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3417 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3424 /* create input playback/capture controls for the given pin */
3425 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3426 const char *ctlname,
3427 int idx, hda_nid_t mix_nid)
3432 sprintf(name, "%s Playback Volume", ctlname);
3433 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3434 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3437 sprintf(name, "%s Playback Switch", ctlname);
3438 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3439 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3445 /* create playback/capture controls for input pins */
3446 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3447 const struct auto_pin_cfg *cfg)
3449 struct hda_input_mux *imux = &spec->private_imux;
3452 for (i = 0; i < AUTO_PIN_LAST; i++) {
3453 if (alc880_is_input_pin(cfg->input_pins[i])) {
3454 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3455 err = new_analog_input(spec, cfg->input_pins[i],
3456 auto_pin_cfg_labels[i],
3460 imux->items[imux->num_items].label =
3461 auto_pin_cfg_labels[i];
3462 imux->items[imux->num_items].index =
3463 alc880_input_pin_idx(cfg->input_pins[i]);
3470 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3471 hda_nid_t nid, int pin_type,
3475 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3477 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3479 /* need the manual connection? */
3480 if (alc880_is_multi_pin(nid)) {
3481 struct alc_spec *spec = codec->spec;
3482 int idx = alc880_multi_pin_idx(nid);
3483 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3484 AC_VERB_SET_CONNECT_SEL,
3485 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3489 static int get_pin_type(int line_out_type)
3491 if (line_out_type == AUTO_PIN_HP_OUT)
3497 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3499 struct alc_spec *spec = codec->spec;
3502 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3503 for (i = 0; i < spec->autocfg.line_outs; i++) {
3504 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3505 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3506 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3510 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3512 struct alc_spec *spec = codec->spec;
3515 pin = spec->autocfg.speaker_pins[0];
3516 if (pin) /* connect to front */
3517 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3518 pin = spec->autocfg.hp_pins[0];
3519 if (pin) /* connect to front */
3520 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3523 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3525 struct alc_spec *spec = codec->spec;
3528 for (i = 0; i < AUTO_PIN_LAST; i++) {
3529 hda_nid_t nid = spec->autocfg.input_pins[i];
3530 if (alc880_is_input_pin(nid)) {
3531 snd_hda_codec_write(codec, nid, 0,
3532 AC_VERB_SET_PIN_WIDGET_CONTROL,
3533 i <= AUTO_PIN_FRONT_MIC ?
3534 PIN_VREF80 : PIN_IN);
3535 if (nid != ALC880_PIN_CD_NID)
3536 snd_hda_codec_write(codec, nid, 0,
3537 AC_VERB_SET_AMP_GAIN_MUTE,
3543 /* parse the BIOS configuration and set up the alc_spec */
3544 /* return 1 if successful, 0 if the proper config is not found,
3545 * or a negative error code
3547 static int alc880_parse_auto_config(struct hda_codec *codec)
3549 struct alc_spec *spec = codec->spec;
3551 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3553 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3557 if (!spec->autocfg.line_outs)
3558 return 0; /* can't find valid BIOS pin config */
3560 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3563 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3566 err = alc880_auto_create_extra_out(spec,
3567 spec->autocfg.speaker_pins[0],
3571 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3575 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3579 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3581 if (spec->autocfg.dig_out_pin)
3582 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3583 if (spec->autocfg.dig_in_pin)
3584 spec->dig_in_nid = ALC880_DIGIN_NID;
3586 if (spec->kctl_alloc)
3587 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3589 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3591 spec->num_mux_defs = 1;
3592 spec->input_mux = &spec->private_imux;
3597 /* additional initialization for auto-configuration model */
3598 static void alc880_auto_init(struct hda_codec *codec)
3600 alc880_auto_init_multi_out(codec);
3601 alc880_auto_init_extra_out(codec);
3602 alc880_auto_init_analog_input(codec);
3606 * OK, here we have finally the patch for ALC880
3609 static int patch_alc880(struct hda_codec *codec)
3611 struct alc_spec *spec;
3615 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3621 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3624 if (board_config < 0) {
3625 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3626 "trying auto-probe from BIOS...\n");
3627 board_config = ALC880_AUTO;
3630 if (board_config == ALC880_AUTO) {
3631 /* automatic parse from the BIOS config */
3632 err = alc880_parse_auto_config(codec);
3638 "hda_codec: Cannot set up configuration "
3639 "from BIOS. Using 3-stack mode...\n");
3640 board_config = ALC880_3ST;
3644 if (board_config != ALC880_AUTO)
3645 setup_preset(spec, &alc880_presets[board_config]);
3647 spec->stream_name_analog = "ALC880 Analog";
3648 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3649 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3650 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3652 spec->stream_name_digital = "ALC880 Digital";
3653 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3654 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3656 if (!spec->adc_nids && spec->input_mux) {
3657 /* check whether NID 0x07 is valid */
3658 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3660 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3661 if (wcap != AC_WID_AUD_IN) {
3662 spec->adc_nids = alc880_adc_nids_alt;
3663 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3664 spec->mixers[spec->num_mixers] =
3665 alc880_capture_alt_mixer;
3668 spec->adc_nids = alc880_adc_nids;
3669 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3670 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3675 spec->vmaster_nid = 0x0c;
3677 codec->patch_ops = alc_patch_ops;
3678 if (board_config == ALC880_AUTO)
3679 spec->init_hook = alc880_auto_init;
3680 #ifdef CONFIG_SND_HDA_POWER_SAVE
3681 if (!spec->loopback.amplist)
3682 spec->loopback.amplist = alc880_loopbacks;
3693 static hda_nid_t alc260_dac_nids[1] = {
3698 static hda_nid_t alc260_adc_nids[1] = {
3703 static hda_nid_t alc260_adc_nids_alt[1] = {
3708 static hda_nid_t alc260_hp_adc_nids[2] = {
3713 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3714 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3716 static hda_nid_t alc260_dual_adc_nids[2] = {
3721 #define ALC260_DIGOUT_NID 0x03
3722 #define ALC260_DIGIN_NID 0x06
3724 static struct hda_input_mux alc260_capture_source = {
3728 { "Front Mic", 0x1 },
3734 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3735 * headphone jack and the internal CD lines since these are the only pins at
3736 * which audio can appear. For flexibility, also allow the option of
3737 * recording the mixer output on the second ADC (ADC0 doesn't have a
3738 * connection to the mixer output).
3740 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3744 { "Mic/Line", 0x0 },
3746 { "Headphone", 0x2 },
3752 { "Mic/Line", 0x0 },
3754 { "Headphone", 0x2 },
3761 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3762 * the Fujitsu S702x, but jacks are marked differently.
3764 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3771 { "Headphone", 0x5 },
3780 { "Headphone", 0x6 },
3786 * This is just place-holder, so there's something for alc_build_pcms to look
3787 * at when it calculates the maximum number of channels. ALC260 has no mixer
3788 * element which allows changing the channel mode, so the verb list is
3791 static struct hda_channel_mode alc260_modes[1] = {
3796 /* Mixer combinations
3798 * basic: base_output + input + pc_beep + capture
3799 * HP: base_output + input + capture_alt
3800 * HP_3013: hp_3013 + input + capture
3801 * fujitsu: fujitsu + capture
3802 * acer: acer + capture
3805 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3806 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3807 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3808 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3809 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3810 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3811 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3815 static struct snd_kcontrol_new alc260_input_mixer[] = {
3816 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3817 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3818 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3819 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3821 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3827 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3828 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3829 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3833 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3834 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3835 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3836 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3837 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3838 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3839 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3840 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3841 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3845 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3846 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3848 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3849 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3850 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3851 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3852 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3853 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3854 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3855 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3856 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3857 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3858 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3859 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3860 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3864 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3865 * versions of the ALC260 don't act on requests to enable mic bias from NID
3866 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3867 * datasheet doesn't mention this restriction. At this stage it's not clear
3868 * whether this behaviour is intentional or is a hardware bug in chip
3869 * revisions available in early 2006. Therefore for now allow the
3870 * "Headphone Jack Mode" control to span all choices, but if it turns out
3871 * that the lack of mic bias for this NID is intentional we could change the
3872 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3874 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3875 * don't appear to make the mic bias available from the "line" jack, even
3876 * though the NID used for this jack (0x14) can supply it. The theory is
3877 * that perhaps Acer have included blocking capacitors between the ALC260
3878 * and the output jack. If this turns out to be the case for all such
3879 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3880 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3882 * The C20x Tablet series have a mono internal speaker which is controlled
3883 * via the chip's Mono sum widget and pin complex, so include the necessary
3884 * controls for such models. On models without a "mono speaker" the control
3885 * won't do anything.
3887 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3888 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3889 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3890 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3891 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3893 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3895 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3896 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3898 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3899 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3900 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3901 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3902 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3903 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3904 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3908 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3909 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3911 static struct snd_kcontrol_new alc260_will_mixer[] = {
3912 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3913 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3914 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3915 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3916 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3917 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3918 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3919 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3920 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3921 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3922 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3923 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3927 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3928 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3930 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3931 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3932 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3934 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3935 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3936 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3937 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3938 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3939 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3940 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3944 /* capture mixer elements */
3945 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3946 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3947 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3948 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3949 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3952 /* The multiple "Capture Source" controls confuse alsamixer
3953 * So call somewhat different..
3955 /* .name = "Capture Source", */
3956 .name = "Input Source",
3958 .info = alc_mux_enum_info,
3959 .get = alc_mux_enum_get,
3960 .put = alc_mux_enum_put,
3965 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3966 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3967 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3970 /* The multiple "Capture Source" controls confuse alsamixer
3971 * So call somewhat different..
3973 /* .name = "Capture Source", */
3974 .name = "Input Source",
3976 .info = alc_mux_enum_info,
3977 .get = alc_mux_enum_get,
3978 .put = alc_mux_enum_put,
3984 * initialization verbs
3986 static struct hda_verb alc260_init_verbs[] = {
3987 /* Line In pin widget for input */
3988 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3989 /* CD pin widget for input */
3990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3991 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3992 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3993 /* Mic2 (front panel) pin widget for input and vref at 80% */
3994 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3995 /* LINE-2 is used for line-out in rear */
3996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3997 /* select line-out */
3998 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4000 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4002 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4004 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4005 /* mute capture amp left and right */
4006 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4007 /* set connection select to line in (default select for this ADC) */
4008 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4009 /* mute capture amp left and right */
4010 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4011 /* set connection select to line in (default select for this ADC) */
4012 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4013 /* set vol=0 Line-Out mixer amp left and right */
4014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4015 /* unmute pin widget amp left and right (no gain on this amp) */
4016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4017 /* set vol=0 HP mixer amp left and right */
4018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4019 /* unmute pin widget amp left and right (no gain on this amp) */
4020 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4021 /* set vol=0 Mono mixer amp left and right */
4022 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4023 /* unmute pin widget amp left and right (no gain on this amp) */
4024 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4025 /* unmute LINE-2 out pin */
4026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4027 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4030 /* mute analog inputs */
4031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4036 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4037 /* mute Front out path */
4038 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4040 /* mute Headphone out path */
4041 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4043 /* mute Mono out path */
4044 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4045 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4049 #if 0 /* should be identical with alc260_init_verbs? */
4050 static struct hda_verb alc260_hp_init_verbs[] = {
4051 /* Headphone and output */
4052 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4054 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4055 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4056 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4057 /* Mic2 (front panel) pin widget for input and vref at 80% */
4058 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4059 /* Line In pin widget for input */
4060 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4061 /* Line-2 pin widget for output */
4062 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4063 /* CD pin widget for input */
4064 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4065 /* unmute amp left and right */
4066 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4067 /* set connection select to line in (default select for this ADC) */
4068 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4069 /* unmute Line-Out mixer amp left and right (volume = 0) */
4070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4071 /* mute pin widget amp left and right (no gain on this amp) */
4072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4073 /* unmute HP mixer amp left and right (volume = 0) */
4074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4075 /* mute pin widget amp left and right (no gain on this amp) */
4076 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4077 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4080 /* mute analog inputs */
4081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4086 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4087 /* Unmute Front out path */
4088 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4090 /* Unmute Headphone out path */
4091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4092 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4093 /* Unmute Mono out path */
4094 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4095 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4100 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4101 /* Line out and output */
4102 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4104 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4105 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4106 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4107 /* Mic2 (front panel) pin widget for input and vref at 80% */
4108 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4109 /* Line In pin widget for input */
4110 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4111 /* Headphone pin widget for output */
4112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4113 /* CD pin widget for input */
4114 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4115 /* unmute amp left and right */
4116 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4117 /* set connection select to line in (default select for this ADC) */
4118 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4119 /* unmute Line-Out mixer amp left and right (volume = 0) */
4120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4121 /* mute pin widget amp left and right (no gain on this amp) */
4122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4123 /* unmute HP mixer amp left and right (volume = 0) */
4124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4125 /* mute pin widget amp left and right (no gain on this amp) */
4126 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4127 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4130 /* mute analog inputs */
4131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4136 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4137 /* Unmute Front out path */
4138 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4139 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4140 /* Unmute Headphone out path */
4141 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4142 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4143 /* Unmute Mono out path */
4144 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4145 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4149 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4150 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4151 * audio = 0x16, internal speaker = 0x10.
4153 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4154 /* Disable all GPIOs */
4155 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4156 /* Internal speaker is connected to headphone pin */
4157 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4158 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4160 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4161 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4162 /* Ensure all other unused pins are disabled and muted. */
4163 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4164 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4165 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4166 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4167 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4168 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4172 /* Disable digital (SPDIF) pins */
4173 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4174 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4176 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4177 * when acting as an output.
4179 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4181 /* Start with output sum widgets muted and their output gains at min */
4182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4183 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4184 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4185 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4186 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4187 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4188 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4189 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4190 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4192 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4193 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4194 /* Unmute Line1 pin widget output buffer since it starts as an output.
4195 * If the pin mode is changed by the user the pin mode control will
4196 * take care of enabling the pin's input/output buffers as needed.
4197 * Therefore there's no need to enable the input buffer at this
4200 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4201 /* Unmute input buffer of pin widget used for Line-in (no equiv
4204 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4206 /* Mute capture amp left and right */
4207 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4208 /* Set ADC connection select to match default mixer setting - line
4211 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4213 /* Do the same for the second ADC: mute capture input amp and
4214 * set ADC connection to line in (on mic1 pin)
4216 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4217 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4219 /* Mute all inputs to mixer widget (even unconnected ones) */
4220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4226 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4232 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4233 * similar laptops (adapted from Fujitsu init verbs).
4235 static struct hda_verb alc260_acer_init_verbs[] = {
4236 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4237 * the headphone jack. Turn this on and rely on the standard mute
4238 * methods whenever the user wants to turn these outputs off.
4240 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4241 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4242 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4243 /* Internal speaker/Headphone jack is connected to Line-out pin */
4244 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4245 /* Internal microphone/Mic jack is connected to Mic1 pin */
4246 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4247 /* Line In jack is connected to Line1 pin */
4248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4249 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4250 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4251 /* Ensure all other unused pins are disabled and muted. */
4252 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4253 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4254 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4255 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4258 /* Disable digital (SPDIF) pins */
4259 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4260 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4262 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4263 * bus when acting as outputs.
4265 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4266 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4268 /* Start with output sum widgets muted and their output gains at min */
4269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4271 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4275 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4276 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4277 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4279 /* Unmute Line-out pin widget amp left and right
4280 * (no equiv mixer ctrl)
4282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4283 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4284 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4285 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4286 * inputs. If the pin mode is changed by the user the pin mode control
4287 * will take care of enabling the pin's input/output buffers as needed.
4288 * Therefore there's no need to enable the input buffer at this
4291 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4294 /* Mute capture amp left and right */
4295 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4296 /* Set ADC connection select to match default mixer setting - mic
4299 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4301 /* Do similar with the second ADC: mute capture input amp and
4302 * set ADC connection to mic to match ALSA's default state.
4304 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4305 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4307 /* Mute all inputs to mixer widget (even unconnected ones) */
4308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4320 static struct hda_verb alc260_will_verbs[] = {
4321 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4322 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4323 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4324 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4325 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4326 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4330 static struct hda_verb alc260_replacer_672v_verbs[] = {
4331 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4332 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4333 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4335 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4336 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4337 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4339 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4343 /* toggle speaker-output according to the hp-jack state */
4344 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4346 unsigned int present;
4348 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4349 present = snd_hda_codec_read(codec, 0x0f, 0,
4350 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4352 snd_hda_codec_write_cache(codec, 0x01, 0,
4353 AC_VERB_SET_GPIO_DATA, 1);
4354 snd_hda_codec_write_cache(codec, 0x0f, 0,
4355 AC_VERB_SET_PIN_WIDGET_CONTROL,
4358 snd_hda_codec_write_cache(codec, 0x01, 0,
4359 AC_VERB_SET_GPIO_DATA, 0);
4360 snd_hda_codec_write_cache(codec, 0x0f, 0,
4361 AC_VERB_SET_PIN_WIDGET_CONTROL,
4366 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4369 if ((res >> 26) == ALC880_HP_EVENT)
4370 alc260_replacer_672v_automute(codec);
4373 /* Test configuration for debugging, modelled after the ALC880 test
4376 #ifdef CONFIG_SND_DEBUG
4377 static hda_nid_t alc260_test_dac_nids[1] = {
4380 static hda_nid_t alc260_test_adc_nids[2] = {
4383 /* For testing the ALC260, each input MUX needs its own definition since
4384 * the signal assignments are different. This assumes that the first ADC
4387 static struct hda_input_mux alc260_test_capture_sources[2] = {
4391 { "MIC1 pin", 0x0 },
4392 { "MIC2 pin", 0x1 },
4393 { "LINE1 pin", 0x2 },
4394 { "LINE2 pin", 0x3 },
4396 { "LINE-OUT pin", 0x5 },
4397 { "HP-OUT pin", 0x6 },
4403 { "MIC1 pin", 0x0 },
4404 { "MIC2 pin", 0x1 },
4405 { "LINE1 pin", 0x2 },
4406 { "LINE2 pin", 0x3 },
4409 { "LINE-OUT pin", 0x6 },
4410 { "HP-OUT pin", 0x7 },
4414 static struct snd_kcontrol_new alc260_test_mixer[] = {
4415 /* Output driver widgets */
4416 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4417 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4418 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4419 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4420 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4421 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4423 /* Modes for retasking pin widgets
4424 * Note: the ALC260 doesn't seem to act on requests to enable mic
4425 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4426 * mention this restriction. At this stage it's not clear whether
4427 * this behaviour is intentional or is a hardware bug in chip
4428 * revisions available at least up until early 2006. Therefore for
4429 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4430 * choices, but if it turns out that the lack of mic bias for these
4431 * NIDs is intentional we could change their modes from
4432 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4434 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4435 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4436 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4437 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4438 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4439 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4441 /* Loopback mixer controls */
4442 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4443 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4444 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4445 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4446 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4447 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4448 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4449 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4450 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4451 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4452 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4453 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4454 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4455 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4456 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4457 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4459 /* Controls for GPIO pins, assuming they are configured as outputs */
4460 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4461 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4462 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4463 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4465 /* Switches to allow the digital IO pins to be enabled. The datasheet
4466 * is ambigious as to which NID is which; testing on laptops which
4467 * make this output available should provide clarification.
4469 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4470 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4472 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4473 * this output to turn on an external amplifier.
4475 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4476 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4480 static struct hda_verb alc260_test_init_verbs[] = {
4481 /* Enable all GPIOs as outputs with an initial value of 0 */
4482 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4483 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4484 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4486 /* Enable retasking pins as output, initially without power amp */
4487 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4488 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4491 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4492 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4494 /* Disable digital (SPDIF) pins initially, but users can enable
4495 * them via a mixer switch. In the case of SPDIF-out, this initverb
4496 * payload also sets the generation to 0, output to be in "consumer"
4497 * PCM format, copyright asserted, no pre-emphasis and no validity
4500 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4501 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4503 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4504 * OUT1 sum bus when acting as an output.
4506 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4507 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4508 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4509 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4511 /* Start with output sum widgets muted and their output gains at min */
4512 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4513 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4518 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4519 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4520 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4522 /* Unmute retasking pin widget output buffers since the default
4523 * state appears to be output. As the pin mode is changed by the
4524 * user the pin mode control will take care of enabling the pin's
4525 * input/output buffers as needed.
4527 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4528 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4529 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4531 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4532 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4533 /* Also unmute the mono-out pin widget */
4534 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4536 /* Mute capture amp left and right */
4537 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4538 /* Set ADC connection select to match default mixer setting (mic1
4541 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4543 /* Do the same for the second ADC: mute capture input amp and
4544 * set ADC connection to mic1 pin
4546 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4547 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4549 /* Mute all inputs to mixer widget (even unconnected ones) */
4550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4563 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4564 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4566 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4567 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4570 * for BIOS auto-configuration
4573 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4577 unsigned long vol_val, sw_val;
4581 if (nid >= 0x0f && nid < 0x11) {
4582 nid_vol = nid - 0x7;
4583 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4584 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4585 } else if (nid == 0x11) {
4586 nid_vol = nid - 0x7;
4587 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4588 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4589 } else if (nid >= 0x12 && nid <= 0x15) {
4591 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4592 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4596 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4597 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4600 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4601 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4607 /* add playback controls from the parsed DAC table */
4608 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4609 const struct auto_pin_cfg *cfg)
4614 spec->multiout.num_dacs = 1;
4615 spec->multiout.dac_nids = spec->private_dac_nids;
4616 spec->multiout.dac_nids[0] = 0x02;
4618 nid = cfg->line_out_pins[0];
4620 err = alc260_add_playback_controls(spec, nid, "Front");
4625 nid = cfg->speaker_pins[0];
4627 err = alc260_add_playback_controls(spec, nid, "Speaker");
4632 nid = cfg->hp_pins[0];
4634 err = alc260_add_playback_controls(spec, nid, "Headphone");
4641 /* create playback/capture controls for input pins */
4642 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4643 const struct auto_pin_cfg *cfg)
4645 struct hda_input_mux *imux = &spec->private_imux;
4648 for (i = 0; i < AUTO_PIN_LAST; i++) {
4649 if (cfg->input_pins[i] >= 0x12) {
4650 idx = cfg->input_pins[i] - 0x12;
4651 err = new_analog_input(spec, cfg->input_pins[i],
4652 auto_pin_cfg_labels[i], idx,
4656 imux->items[imux->num_items].label =
4657 auto_pin_cfg_labels[i];
4658 imux->items[imux->num_items].index = idx;
4661 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4662 idx = cfg->input_pins[i] - 0x09;
4663 err = new_analog_input(spec, cfg->input_pins[i],
4664 auto_pin_cfg_labels[i], idx,
4668 imux->items[imux->num_items].label =
4669 auto_pin_cfg_labels[i];
4670 imux->items[imux->num_items].index = idx;
4677 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4678 hda_nid_t nid, int pin_type,
4682 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4684 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4686 /* need the manual connection? */
4688 int idx = nid - 0x12;
4689 snd_hda_codec_write(codec, idx + 0x0b, 0,
4690 AC_VERB_SET_CONNECT_SEL, sel_idx);
4694 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4696 struct alc_spec *spec = codec->spec;
4699 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4700 nid = spec->autocfg.line_out_pins[0];
4702 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4703 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4706 nid = spec->autocfg.speaker_pins[0];
4708 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4710 nid = spec->autocfg.hp_pins[0];
4712 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4715 #define ALC260_PIN_CD_NID 0x16
4716 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4718 struct alc_spec *spec = codec->spec;
4721 for (i = 0; i < AUTO_PIN_LAST; i++) {
4722 hda_nid_t nid = spec->autocfg.input_pins[i];
4724 snd_hda_codec_write(codec, nid, 0,
4725 AC_VERB_SET_PIN_WIDGET_CONTROL,
4726 i <= AUTO_PIN_FRONT_MIC ?
4727 PIN_VREF80 : PIN_IN);
4728 if (nid != ALC260_PIN_CD_NID)
4729 snd_hda_codec_write(codec, nid, 0,
4730 AC_VERB_SET_AMP_GAIN_MUTE,
4737 * generic initialization of ADC, input mixers and output mixers
4739 static struct hda_verb alc260_volume_init_verbs[] = {
4741 * Unmute ADC0-1 and set the default input to mic-in
4743 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4744 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4745 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4746 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4748 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4750 * Note: PASD motherboards uses the Line In 2 as the input for
4751 * front panel mic (mic 2)
4753 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4754 /* mute analog inputs */
4755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4762 * Set up output mixers (0x08 - 0x0a)
4764 /* set vol=0 to output mixers */
4765 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4766 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4767 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4768 /* set up input amps for analog loopback */
4769 /* Amp Indices: DAC = 0, mixer = 1 */
4770 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4771 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4772 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4773 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4774 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4775 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4780 static int alc260_parse_auto_config(struct hda_codec *codec)
4782 struct alc_spec *spec = codec->spec;
4785 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4787 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4791 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4794 if (!spec->kctl_alloc)
4795 return 0; /* can't find valid BIOS pin config */
4796 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4800 spec->multiout.max_channels = 2;
4802 if (spec->autocfg.dig_out_pin)
4803 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4804 if (spec->kctl_alloc)
4805 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4807 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4809 spec->num_mux_defs = 1;
4810 spec->input_mux = &spec->private_imux;
4812 /* check whether NID 0x04 is valid */
4813 wcap = get_wcaps(codec, 0x04);
4814 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4815 if (wcap != AC_WID_AUD_IN) {
4816 spec->adc_nids = alc260_adc_nids_alt;
4817 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4818 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4820 spec->adc_nids = alc260_adc_nids;
4821 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4822 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4829 /* additional initialization for auto-configuration model */
4830 static void alc260_auto_init(struct hda_codec *codec)
4832 alc260_auto_init_multi_out(codec);
4833 alc260_auto_init_analog_input(codec);
4836 #ifdef CONFIG_SND_HDA_POWER_SAVE
4837 static struct hda_amp_list alc260_loopbacks[] = {
4838 { 0x07, HDA_INPUT, 0 },
4839 { 0x07, HDA_INPUT, 1 },
4840 { 0x07, HDA_INPUT, 2 },
4841 { 0x07, HDA_INPUT, 3 },
4842 { 0x07, HDA_INPUT, 4 },
4848 * ALC260 configurations
4850 static const char *alc260_models[ALC260_MODEL_LAST] = {
4851 [ALC260_BASIC] = "basic",
4853 [ALC260_HP_3013] = "hp-3013",
4854 [ALC260_FUJITSU_S702X] = "fujitsu",
4855 [ALC260_ACER] = "acer",
4856 [ALC260_WILL] = "will",
4857 [ALC260_REPLACER_672V] = "replacer",
4858 #ifdef CONFIG_SND_DEBUG
4859 [ALC260_TEST] = "test",
4861 [ALC260_AUTO] = "auto",
4864 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4865 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4866 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4867 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4868 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4869 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4870 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4871 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4872 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4873 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4874 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4875 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4876 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4877 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4878 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4879 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4880 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4881 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4882 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4886 static struct alc_config_preset alc260_presets[] = {
4888 .mixers = { alc260_base_output_mixer,
4890 alc260_pc_beep_mixer,
4891 alc260_capture_mixer },
4892 .init_verbs = { alc260_init_verbs },
4893 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4894 .dac_nids = alc260_dac_nids,
4895 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4896 .adc_nids = alc260_adc_nids,
4897 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4898 .channel_mode = alc260_modes,
4899 .input_mux = &alc260_capture_source,
4902 .mixers = { alc260_base_output_mixer,
4904 alc260_capture_alt_mixer },
4905 .init_verbs = { alc260_init_verbs },
4906 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4907 .dac_nids = alc260_dac_nids,
4908 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4909 .adc_nids = alc260_hp_adc_nids,
4910 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4911 .channel_mode = alc260_modes,
4912 .input_mux = &alc260_capture_source,
4914 [ALC260_HP_3013] = {
4915 .mixers = { alc260_hp_3013_mixer,
4917 alc260_capture_alt_mixer },
4918 .init_verbs = { alc260_hp_3013_init_verbs },
4919 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4920 .dac_nids = alc260_dac_nids,
4921 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4922 .adc_nids = alc260_hp_adc_nids,
4923 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4924 .channel_mode = alc260_modes,
4925 .input_mux = &alc260_capture_source,
4927 [ALC260_FUJITSU_S702X] = {
4928 .mixers = { alc260_fujitsu_mixer,
4929 alc260_capture_mixer },
4930 .init_verbs = { alc260_fujitsu_init_verbs },
4931 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4932 .dac_nids = alc260_dac_nids,
4933 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4934 .adc_nids = alc260_dual_adc_nids,
4935 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4936 .channel_mode = alc260_modes,
4937 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4938 .input_mux = alc260_fujitsu_capture_sources,
4941 .mixers = { alc260_acer_mixer,
4942 alc260_capture_mixer },
4943 .init_verbs = { alc260_acer_init_verbs },
4944 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4945 .dac_nids = alc260_dac_nids,
4946 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4947 .adc_nids = alc260_dual_adc_nids,
4948 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4949 .channel_mode = alc260_modes,
4950 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4951 .input_mux = alc260_acer_capture_sources,
4954 .mixers = { alc260_will_mixer,
4955 alc260_capture_mixer },
4956 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4957 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4958 .dac_nids = alc260_dac_nids,
4959 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4960 .adc_nids = alc260_adc_nids,
4961 .dig_out_nid = ALC260_DIGOUT_NID,
4962 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4963 .channel_mode = alc260_modes,
4964 .input_mux = &alc260_capture_source,
4966 [ALC260_REPLACER_672V] = {
4967 .mixers = { alc260_replacer_672v_mixer,
4968 alc260_capture_mixer },
4969 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4970 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4971 .dac_nids = alc260_dac_nids,
4972 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4973 .adc_nids = alc260_adc_nids,
4974 .dig_out_nid = ALC260_DIGOUT_NID,
4975 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4976 .channel_mode = alc260_modes,
4977 .input_mux = &alc260_capture_source,
4978 .unsol_event = alc260_replacer_672v_unsol_event,
4979 .init_hook = alc260_replacer_672v_automute,
4981 #ifdef CONFIG_SND_DEBUG
4983 .mixers = { alc260_test_mixer,
4984 alc260_capture_mixer },
4985 .init_verbs = { alc260_test_init_verbs },
4986 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4987 .dac_nids = alc260_test_dac_nids,
4988 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4989 .adc_nids = alc260_test_adc_nids,
4990 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4991 .channel_mode = alc260_modes,
4992 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4993 .input_mux = alc260_test_capture_sources,
4998 static int patch_alc260(struct hda_codec *codec)
5000 struct alc_spec *spec;
5001 int err, board_config;
5003 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5009 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5012 if (board_config < 0) {
5013 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5014 "trying auto-probe from BIOS...\n");
5015 board_config = ALC260_AUTO;
5018 if (board_config == ALC260_AUTO) {
5019 /* automatic parse from the BIOS config */
5020 err = alc260_parse_auto_config(codec);
5026 "hda_codec: Cannot set up configuration "
5027 "from BIOS. Using base mode...\n");
5028 board_config = ALC260_BASIC;
5032 if (board_config != ALC260_AUTO)
5033 setup_preset(spec, &alc260_presets[board_config]);
5035 spec->stream_name_analog = "ALC260 Analog";
5036 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5037 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5039 spec->stream_name_digital = "ALC260 Digital";
5040 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5041 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5043 spec->vmaster_nid = 0x08;
5045 codec->patch_ops = alc_patch_ops;
5046 if (board_config == ALC260_AUTO)
5047 spec->init_hook = alc260_auto_init;
5048 #ifdef CONFIG_SND_HDA_POWER_SAVE
5049 if (!spec->loopback.amplist)
5050 spec->loopback.amplist = alc260_loopbacks;
5060 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5061 * configuration. Each pin widget can choose any input DACs and a mixer.
5062 * Each ADC is connected from a mixer of all inputs. This makes possible
5063 * 6-channel independent captures.
5065 * In addition, an independent DAC for the multi-playback (not used in this
5068 #define ALC882_DIGOUT_NID 0x06
5069 #define ALC882_DIGIN_NID 0x0a
5071 static struct hda_channel_mode alc882_ch_modes[1] = {
5075 static hda_nid_t alc882_dac_nids[4] = {
5076 /* front, rear, clfe, rear_surr */
5077 0x02, 0x03, 0x04, 0x05
5080 /* identical with ALC880 */
5081 #define alc882_adc_nids alc880_adc_nids
5082 #define alc882_adc_nids_alt alc880_adc_nids_alt
5085 /* FIXME: should be a matrix-type input source selection */
5087 static struct hda_input_mux alc882_capture_source = {
5091 { "Front Mic", 0x1 },
5096 #define alc882_mux_enum_info alc_mux_enum_info
5097 #define alc882_mux_enum_get alc_mux_enum_get
5099 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5100 struct snd_ctl_elem_value *ucontrol)
5102 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5103 struct alc_spec *spec = codec->spec;
5104 const struct hda_input_mux *imux = spec->input_mux;
5105 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5106 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5107 hda_nid_t nid = capture_mixers[adc_idx];
5108 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5109 unsigned int i, idx;
5111 idx = ucontrol->value.enumerated.item[0];
5112 if (idx >= imux->num_items)
5113 idx = imux->num_items - 1;
5114 if (*cur_val == idx)
5116 for (i = 0; i < imux->num_items; i++) {
5117 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5118 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5119 imux->items[i].index,
5129 static struct hda_verb alc882_3ST_ch2_init[] = {
5130 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5131 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5132 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5133 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5140 static struct hda_verb alc882_3ST_ch6_init[] = {
5141 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5142 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5143 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5144 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5145 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5146 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5150 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5151 { 2, alc882_3ST_ch2_init },
5152 { 6, alc882_3ST_ch6_init },
5158 static struct hda_verb alc882_sixstack_ch6_init[] = {
5159 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5160 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5161 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5169 static struct hda_verb alc882_sixstack_ch8_init[] = {
5170 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5171 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5172 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5173 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5177 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5178 { 6, alc882_sixstack_ch6_init },
5179 { 8, alc882_sixstack_ch8_init },
5183 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5189 static struct hda_verb alc885_mbp_ch2_init[] = {
5190 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5191 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5192 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5199 static struct hda_verb alc885_mbp_ch6_init[] = {
5200 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5201 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5202 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5203 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5204 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5208 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5209 { 2, alc885_mbp_ch2_init },
5210 { 6, alc885_mbp_ch6_init },
5214 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5215 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5217 static struct snd_kcontrol_new alc882_base_mixer[] = {
5218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5220 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5221 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5222 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5223 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5224 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5225 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5226 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5227 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5229 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5230 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5237 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5238 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5239 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5240 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5244 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5246 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5247 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5248 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5250 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5252 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5253 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5257 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5267 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5268 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5272 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5282 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5283 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5285 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5289 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5290 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5292 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5294 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5296 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5297 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5298 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5299 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5300 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5301 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5302 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5305 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5309 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5310 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5311 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5318 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5320 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5321 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5325 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5328 .name = "Channel Mode",
5329 .info = alc_ch_mode_info,
5330 .get = alc_ch_mode_get,
5331 .put = alc_ch_mode_put,
5336 static struct hda_verb alc882_init_verbs[] = {
5337 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5342 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5343 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5344 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5351 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5354 /* Front Pin: output 0 (0x0c) */
5355 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5357 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5358 /* Rear Pin: output 1 (0x0d) */
5359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5361 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5362 /* CLFE Pin: output 2 (0x0e) */
5363 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5364 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5365 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5366 /* Side Pin: output 3 (0x0f) */
5367 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5368 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5369 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5370 /* Mic (rear) pin: input vref at 80% */
5371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5373 /* Front Mic pin: input vref at 80% */
5374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5376 /* Line In pin: input */
5377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5379 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5380 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5381 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5382 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5383 /* CD pin widget for input */
5384 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5386 /* FIXME: use matrix-type input source selection */
5387 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5388 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5389 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5391 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5403 /* ADC1: mute amp left and right */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5406 /* ADC2: mute amp left and right */
5407 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5409 /* ADC3: mute amp left and right */
5410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5411 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5416 static struct hda_verb alc882_eapd_verbs[] = {
5417 /* change to EAPD mode */
5418 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5419 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5424 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5430 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5431 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5435 static struct hda_verb alc882_macpro_init_verbs[] = {
5436 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5440 /* Front Pin: output 0 (0x0c) */
5441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5443 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5444 /* Front Mic pin: input vref at 80% */
5445 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5446 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5447 /* Speaker: output */
5448 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5450 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5451 /* Headphone output (output 0 - 0x0c) */
5452 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5453 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5454 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5456 /* FIXME: use matrix-type input source selection */
5457 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5458 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5473 /* ADC1: mute amp left and right */
5474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5475 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5476 /* ADC2: mute amp left and right */
5477 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5478 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5479 /* ADC3: mute amp left and right */
5480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5481 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5486 /* Macbook Pro rev3 */
5487 static struct hda_verb alc885_mbp3_init_verbs[] = {
5488 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5496 /* Front Pin: output 0 (0x0c) */
5497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5499 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5500 /* HP Pin: output 0 (0x0d) */
5501 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5502 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5504 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5505 /* Mic (rear) pin: input vref at 80% */
5506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5508 /* Front Mic pin: input vref at 80% */
5509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5510 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5511 /* Line In pin: use output 1 when in LineOut mode */
5512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5513 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5514 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5516 /* FIXME: use matrix-type input source selection */
5517 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5518 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5526 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5533 /* ADC1: mute amp left and right */
5534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5535 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5536 /* ADC2: mute amp left and right */
5537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5538 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5539 /* ADC3: mute amp left and right */
5540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5541 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5546 /* iMac 24 mixer. */
5547 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5548 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5549 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5553 /* iMac 24 init verbs. */
5554 static struct hda_verb alc885_imac24_init_verbs[] = {
5555 /* Internal speakers: output 0 (0x0c) */
5556 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5557 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5558 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5559 /* Internal speakers: output 0 (0x0c) */
5560 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5562 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5563 /* Headphone: output 0 (0x0c) */
5564 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5565 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5566 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5567 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5568 /* Front Mic: input vref at 80% */
5569 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5574 /* Toggle speaker-output according to the hp-jack state */
5575 static void alc885_imac24_automute(struct hda_codec *codec)
5577 unsigned int present;
5579 present = snd_hda_codec_read(codec, 0x14, 0,
5580 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5581 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5582 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5583 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5584 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5587 /* Processes unsolicited events. */
5588 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5591 /* Headphone insertion or removal. */
5592 if ((res >> 26) == ALC880_HP_EVENT)
5593 alc885_imac24_automute(codec);
5596 static void alc885_mbp3_automute(struct hda_codec *codec)
5598 unsigned int present;
5600 present = snd_hda_codec_read(codec, 0x15, 0,
5601 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5602 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5603 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5604 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5605 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5608 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5611 /* Headphone insertion or removal. */
5612 if ((res >> 26) == ALC880_HP_EVENT)
5613 alc885_mbp3_automute(codec);
5617 static struct hda_verb alc882_targa_verbs[] = {
5618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5622 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5624 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5625 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5626 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5628 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5629 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5630 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5631 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5635 /* toggle speaker-output according to the hp-jack state */
5636 static void alc882_targa_automute(struct hda_codec *codec)
5638 unsigned int present;
5640 present = snd_hda_codec_read(codec, 0x14, 0,
5641 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5642 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5643 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5644 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5648 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5650 /* Looks like the unsol event is incompatible with the standard
5651 * definition. 4bit tag is placed at 26 bit!
5653 if (((res >> 26) == ALC880_HP_EVENT)) {
5654 alc882_targa_automute(codec);
5658 static struct hda_verb alc882_asus_a7j_verbs[] = {
5659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5663 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5666 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5668 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5670 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5671 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5672 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5676 static struct hda_verb alc882_asus_a7m_verbs[] = {
5677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5684 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5685 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5686 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5688 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5689 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5690 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5694 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5696 unsigned int gpiostate, gpiomask, gpiodir;
5698 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5699 AC_VERB_GET_GPIO_DATA, 0);
5702 gpiostate |= (1 << pin);
5704 gpiostate &= ~(1 << pin);
5706 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5707 AC_VERB_GET_GPIO_MASK, 0);
5708 gpiomask |= (1 << pin);
5710 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5711 AC_VERB_GET_GPIO_DIRECTION, 0);
5712 gpiodir |= (1 << pin);
5715 snd_hda_codec_write(codec, codec->afg, 0,
5716 AC_VERB_SET_GPIO_MASK, gpiomask);
5717 snd_hda_codec_write(codec, codec->afg, 0,
5718 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5722 snd_hda_codec_write(codec, codec->afg, 0,
5723 AC_VERB_SET_GPIO_DATA, gpiostate);
5726 /* set up GPIO at initialization */
5727 static void alc885_macpro_init_hook(struct hda_codec *codec)
5729 alc882_gpio_mute(codec, 0, 0);
5730 alc882_gpio_mute(codec, 1, 0);
5733 /* set up GPIO and update auto-muting at initialization */
5734 static void alc885_imac24_init_hook(struct hda_codec *codec)
5736 alc885_macpro_init_hook(codec);
5737 alc885_imac24_automute(codec);
5741 * generic initialization of ADC, input mixers and output mixers
5743 static struct hda_verb alc882_auto_init_verbs[] = {
5745 * Unmute ADC0-2 and set the default input to mic-in
5747 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5749 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5750 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5751 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5752 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5754 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5756 * Note: PASD motherboards uses the Line In 2 as the input for
5757 * front panel mic (mic 2)
5759 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5767 * Set up output mixers (0x0c - 0x0f)
5769 /* set vol=0 to output mixers */
5770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5771 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5772 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5773 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5774 /* set up input amps for analog loopback */
5775 /* Amp Indices: DAC = 0, mixer = 1 */
5776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5780 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5782 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5783 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5784 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5785 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5787 /* FIXME: use matrix-type input source selection */
5788 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5789 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5790 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5791 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5792 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5793 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5795 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5796 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5797 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5800 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5808 /* capture mixer elements */
5809 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5810 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5811 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5812 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5813 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5816 /* The multiple "Capture Source" controls confuse alsamixer
5817 * So call somewhat different..
5819 /* .name = "Capture Source", */
5820 .name = "Input Source",
5822 .info = alc882_mux_enum_info,
5823 .get = alc882_mux_enum_get,
5824 .put = alc882_mux_enum_put,
5829 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5830 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5831 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5832 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5833 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5834 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5835 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5838 /* The multiple "Capture Source" controls confuse alsamixer
5839 * So call somewhat different..
5841 /* .name = "Capture Source", */
5842 .name = "Input Source",
5844 .info = alc882_mux_enum_info,
5845 .get = alc882_mux_enum_get,
5846 .put = alc882_mux_enum_put,
5851 #ifdef CONFIG_SND_HDA_POWER_SAVE
5852 #define alc882_loopbacks alc880_loopbacks
5855 /* pcm configuration: identiacal with ALC880 */
5856 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5857 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5858 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5859 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5862 * configuration and preset
5864 static const char *alc882_models[ALC882_MODEL_LAST] = {
5865 [ALC882_3ST_DIG] = "3stack-dig",
5866 [ALC882_6ST_DIG] = "6stack-dig",
5867 [ALC882_ARIMA] = "arima",
5868 [ALC882_W2JC] = "w2jc",
5869 [ALC882_TARGA] = "targa",
5870 [ALC882_ASUS_A7J] = "asus-a7j",
5871 [ALC882_ASUS_A7M] = "asus-a7m",
5872 [ALC885_MACPRO] = "macpro",
5873 [ALC885_MBP3] = "mbp3",
5874 [ALC885_IMAC24] = "imac24",
5875 [ALC882_AUTO] = "auto",
5878 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5879 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5880 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5881 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5882 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5883 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5884 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5885 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5886 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5887 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5888 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5889 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5893 static struct alc_config_preset alc882_presets[] = {
5894 [ALC882_3ST_DIG] = {
5895 .mixers = { alc882_base_mixer },
5896 .init_verbs = { alc882_init_verbs },
5897 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5898 .dac_nids = alc882_dac_nids,
5899 .dig_out_nid = ALC882_DIGOUT_NID,
5900 .dig_in_nid = ALC882_DIGIN_NID,
5901 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5902 .channel_mode = alc882_ch_modes,
5904 .input_mux = &alc882_capture_source,
5906 [ALC882_6ST_DIG] = {
5907 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5908 .init_verbs = { alc882_init_verbs },
5909 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5910 .dac_nids = alc882_dac_nids,
5911 .dig_out_nid = ALC882_DIGOUT_NID,
5912 .dig_in_nid = ALC882_DIGIN_NID,
5913 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5914 .channel_mode = alc882_sixstack_modes,
5915 .input_mux = &alc882_capture_source,
5918 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5919 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5920 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5921 .dac_nids = alc882_dac_nids,
5922 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5923 .channel_mode = alc882_sixstack_modes,
5924 .input_mux = &alc882_capture_source,
5927 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5928 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5929 alc880_gpio1_init_verbs },
5930 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5931 .dac_nids = alc882_dac_nids,
5932 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5933 .channel_mode = alc880_threestack_modes,
5935 .input_mux = &alc882_capture_source,
5936 .dig_out_nid = ALC882_DIGOUT_NID,
5939 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5940 .init_verbs = { alc885_mbp3_init_verbs,
5941 alc880_gpio1_init_verbs },
5942 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5943 .dac_nids = alc882_dac_nids,
5944 .channel_mode = alc885_mbp_6ch_modes,
5945 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5946 .input_mux = &alc882_capture_source,
5947 .dig_out_nid = ALC882_DIGOUT_NID,
5948 .dig_in_nid = ALC882_DIGIN_NID,
5949 .unsol_event = alc885_mbp3_unsol_event,
5950 .init_hook = alc885_mbp3_automute,
5953 .mixers = { alc882_macpro_mixer },
5954 .init_verbs = { alc882_macpro_init_verbs },
5955 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5956 .dac_nids = alc882_dac_nids,
5957 .dig_out_nid = ALC882_DIGOUT_NID,
5958 .dig_in_nid = ALC882_DIGIN_NID,
5959 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5960 .channel_mode = alc882_ch_modes,
5961 .input_mux = &alc882_capture_source,
5962 .init_hook = alc885_macpro_init_hook,
5965 .mixers = { alc885_imac24_mixer },
5966 .init_verbs = { alc885_imac24_init_verbs },
5967 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5968 .dac_nids = alc882_dac_nids,
5969 .dig_out_nid = ALC882_DIGOUT_NID,
5970 .dig_in_nid = ALC882_DIGIN_NID,
5971 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5972 .channel_mode = alc882_ch_modes,
5973 .input_mux = &alc882_capture_source,
5974 .unsol_event = alc885_imac24_unsol_event,
5975 .init_hook = alc885_imac24_init_hook,
5978 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5979 alc882_capture_mixer },
5980 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5981 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5982 .dac_nids = alc882_dac_nids,
5983 .dig_out_nid = ALC882_DIGOUT_NID,
5984 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5985 .adc_nids = alc882_adc_nids,
5986 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5987 .channel_mode = alc882_3ST_6ch_modes,
5989 .input_mux = &alc882_capture_source,
5990 .unsol_event = alc882_targa_unsol_event,
5991 .init_hook = alc882_targa_automute,
5993 [ALC882_ASUS_A7J] = {
5994 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5995 alc882_capture_mixer },
5996 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5997 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5998 .dac_nids = alc882_dac_nids,
5999 .dig_out_nid = ALC882_DIGOUT_NID,
6000 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6001 .adc_nids = alc882_adc_nids,
6002 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6003 .channel_mode = alc882_3ST_6ch_modes,
6005 .input_mux = &alc882_capture_source,
6007 [ALC882_ASUS_A7M] = {
6008 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6009 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6010 alc880_gpio1_init_verbs,
6011 alc882_asus_a7m_verbs },
6012 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6013 .dac_nids = alc882_dac_nids,
6014 .dig_out_nid = ALC882_DIGOUT_NID,
6015 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6016 .channel_mode = alc880_threestack_modes,
6018 .input_mux = &alc882_capture_source,
6027 PINFIX_ABIT_AW9D_MAX
6030 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6031 { 0x15, 0x01080104 }, /* side */
6032 { 0x16, 0x01011012 }, /* rear */
6033 { 0x17, 0x01016011 }, /* clfe */
6037 static const struct alc_pincfg *alc882_pin_fixes[] = {
6038 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6041 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6042 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6047 * BIOS auto configuration
6049 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6050 hda_nid_t nid, int pin_type,
6054 struct alc_spec *spec = codec->spec;
6057 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6060 idx = spec->multiout.dac_nids[dac_idx] - 2;
6062 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6064 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6066 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6070 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6072 struct alc_spec *spec = codec->spec;
6075 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6076 for (i = 0; i <= HDA_SIDE; i++) {
6077 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6078 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6080 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6085 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6087 struct alc_spec *spec = codec->spec;
6090 pin = spec->autocfg.hp_pins[0];
6091 if (pin) /* connect to front */
6093 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6096 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6097 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6099 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6101 struct alc_spec *spec = codec->spec;
6104 for (i = 0; i < AUTO_PIN_LAST; i++) {
6105 hda_nid_t nid = spec->autocfg.input_pins[i];
6106 if (alc882_is_input_pin(nid)) {
6107 snd_hda_codec_write(codec, nid, 0,
6108 AC_VERB_SET_PIN_WIDGET_CONTROL,
6109 i <= AUTO_PIN_FRONT_MIC ?
6110 PIN_VREF80 : PIN_IN);
6111 if (nid != ALC882_PIN_CD_NID)
6112 snd_hda_codec_write(codec, nid, 0,
6113 AC_VERB_SET_AMP_GAIN_MUTE,
6119 /* add mic boosts if needed */
6120 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6122 struct alc_spec *spec = codec->spec;
6126 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6127 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6128 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6130 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6134 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6135 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6136 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6138 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6145 /* almost identical with ALC880 parser... */
6146 static int alc882_parse_auto_config(struct hda_codec *codec)
6148 struct alc_spec *spec = codec->spec;
6149 int err = alc880_parse_auto_config(codec);
6154 return 0; /* no config found */
6156 err = alc_auto_add_mic_boost(codec);
6160 /* hack - override the init verbs */
6161 spec->init_verbs[0] = alc882_auto_init_verbs;
6163 return 1; /* config found */
6166 /* additional initialization for auto-configuration model */
6167 static void alc882_auto_init(struct hda_codec *codec)
6169 alc882_auto_init_multi_out(codec);
6170 alc882_auto_init_hp_out(codec);
6171 alc882_auto_init_analog_input(codec);
6174 static int patch_alc882(struct hda_codec *codec)
6176 struct alc_spec *spec;
6177 int err, board_config;
6179 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6185 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6189 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6190 /* Pick up systems that don't supply PCI SSID */
6191 switch (codec->subsystem_id) {
6192 case 0x106b0c00: /* Mac Pro */
6193 board_config = ALC885_MACPRO;
6195 case 0x106b1000: /* iMac 24 */
6196 board_config = ALC885_IMAC24;
6198 case 0x106b00a1: /* Macbook */
6199 case 0x106b2c00: /* Macbook Pro rev3 */
6200 board_config = ALC885_MBP3;
6203 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6204 "trying auto-probe from BIOS...\n");
6205 board_config = ALC882_AUTO;
6209 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6211 if (board_config == ALC882_AUTO) {
6212 /* automatic parse from the BIOS config */
6213 err = alc882_parse_auto_config(codec);
6219 "hda_codec: Cannot set up configuration "
6220 "from BIOS. Using base mode...\n");
6221 board_config = ALC882_3ST_DIG;
6225 if (board_config != ALC882_AUTO)
6226 setup_preset(spec, &alc882_presets[board_config]);
6228 spec->stream_name_analog = "ALC882 Analog";
6229 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6230 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6231 /* FIXME: setup DAC5 */
6232 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6233 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6235 spec->stream_name_digital = "ALC882 Digital";
6236 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6237 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6239 if (!spec->adc_nids && spec->input_mux) {
6240 /* check whether NID 0x07 is valid */
6241 unsigned int wcap = get_wcaps(codec, 0x07);
6243 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6244 if (wcap != AC_WID_AUD_IN) {
6245 spec->adc_nids = alc882_adc_nids_alt;
6246 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6247 spec->mixers[spec->num_mixers] =
6248 alc882_capture_alt_mixer;
6251 spec->adc_nids = alc882_adc_nids;
6252 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6253 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6258 spec->vmaster_nid = 0x0c;
6260 codec->patch_ops = alc_patch_ops;
6261 if (board_config == ALC882_AUTO)
6262 spec->init_hook = alc882_auto_init;
6263 #ifdef CONFIG_SND_HDA_POWER_SAVE
6264 if (!spec->loopback.amplist)
6265 spec->loopback.amplist = alc882_loopbacks;
6274 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6275 * configuration. Each pin widget can choose any input DACs and a mixer.
6276 * Each ADC is connected from a mixer of all inputs. This makes possible
6277 * 6-channel independent captures.
6279 * In addition, an independent DAC for the multi-playback (not used in this
6282 #define ALC883_DIGOUT_NID 0x06
6283 #define ALC883_DIGIN_NID 0x0a
6285 static hda_nid_t alc883_dac_nids[4] = {
6286 /* front, rear, clfe, rear_surr */
6287 0x02, 0x04, 0x03, 0x05
6290 static hda_nid_t alc883_adc_nids[2] = {
6296 /* FIXME: should be a matrix-type input source selection */
6298 static struct hda_input_mux alc883_capture_source = {
6302 { "Front Mic", 0x1 },
6308 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6316 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6326 #define alc883_mux_enum_info alc_mux_enum_info
6327 #define alc883_mux_enum_get alc_mux_enum_get
6329 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6330 struct snd_ctl_elem_value *ucontrol)
6332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6333 struct alc_spec *spec = codec->spec;
6334 const struct hda_input_mux *imux = spec->input_mux;
6335 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6336 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6337 hda_nid_t nid = capture_mixers[adc_idx];
6338 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6339 unsigned int i, idx;
6341 idx = ucontrol->value.enumerated.item[0];
6342 if (idx >= imux->num_items)
6343 idx = imux->num_items - 1;
6344 if (*cur_val == idx)
6346 for (i = 0; i < imux->num_items; i++) {
6347 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6348 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6349 imux->items[i].index,
6359 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6366 static struct hda_verb alc883_3ST_ch2_init[] = {
6367 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6368 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6369 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6370 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6377 static struct hda_verb alc883_3ST_ch4_init[] = {
6378 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6379 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6380 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6381 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6382 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6389 static struct hda_verb alc883_3ST_ch6_init[] = {
6390 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6391 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6392 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6393 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6394 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6395 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6399 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6400 { 2, alc883_3ST_ch2_init },
6401 { 4, alc883_3ST_ch4_init },
6402 { 6, alc883_3ST_ch6_init },
6408 static struct hda_verb alc883_sixstack_ch6_init[] = {
6409 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6410 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6411 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6412 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6419 static struct hda_verb alc883_sixstack_ch8_init[] = {
6420 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6421 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6422 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6423 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6427 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6428 { 6, alc883_sixstack_ch6_init },
6429 { 8, alc883_sixstack_ch8_init },
6432 static struct hda_verb alc883_medion_eapd_verbs[] = {
6433 /* eanable EAPD on medion laptop */
6434 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6435 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6439 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6440 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6443 static struct snd_kcontrol_new alc883_base_mixer[] = {
6444 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6445 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6446 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6447 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6448 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6449 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6450 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6451 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6452 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6453 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6454 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6457 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6458 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6460 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6462 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6463 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6465 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6466 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6467 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6468 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6469 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6470 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6472 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6473 /* .name = "Capture Source", */
6474 .name = "Input Source",
6476 .info = alc883_mux_enum_info,
6477 .get = alc883_mux_enum_get,
6478 .put = alc883_mux_enum_put,
6483 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6485 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6486 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6487 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6488 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6489 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6490 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6494 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6495 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6496 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6497 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6498 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6499 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6500 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6502 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6503 /* .name = "Capture Source", */
6504 .name = "Input Source",
6506 .info = alc883_mux_enum_info,
6507 .get = alc883_mux_enum_get,
6508 .put = alc883_mux_enum_put,
6513 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6514 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6515 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6517 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6518 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6519 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6520 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6521 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6524 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6525 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6527 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6528 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6529 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6530 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6531 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6532 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6534 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6535 /* .name = "Capture Source", */
6536 .name = "Input Source",
6538 .info = alc883_mux_enum_info,
6539 .get = alc883_mux_enum_get,
6540 .put = alc883_mux_enum_put,
6545 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6546 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6547 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6548 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6549 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6550 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6551 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6552 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6553 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6562 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6563 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6565 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6566 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6567 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6568 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6569 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6570 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6572 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6573 /* .name = "Capture Source", */
6574 .name = "Input Source",
6576 .info = alc883_mux_enum_info,
6577 .get = alc883_mux_enum_get,
6578 .put = alc883_mux_enum_put,
6583 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6584 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6585 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6586 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6587 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6588 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6589 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6590 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6591 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6593 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6594 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6595 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6596 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6598 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6599 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6600 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6601 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6602 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6603 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6604 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6605 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6606 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6609 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6610 /* .name = "Capture Source", */
6611 .name = "Input Source",
6613 .info = alc883_mux_enum_info,
6614 .get = alc883_mux_enum_get,
6615 .put = alc883_mux_enum_put,
6620 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6622 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6623 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6624 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6625 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6626 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6628 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6629 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6630 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6631 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6635 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6637 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6638 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6639 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6640 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6643 /* .name = "Capture Source", */
6644 .name = "Input Source",
6646 .info = alc883_mux_enum_info,
6647 .get = alc883_mux_enum_get,
6648 .put = alc883_mux_enum_put,
6653 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6654 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6656 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6657 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6658 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6660 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6662 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6663 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6664 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6665 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6668 /* .name = "Capture Source", */
6669 .name = "Input Source",
6671 .info = alc883_mux_enum_info,
6672 .get = alc883_mux_enum_get,
6673 .put = alc883_mux_enum_put,
6678 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6679 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6680 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6681 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6682 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6683 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6685 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6687 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6688 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6690 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6691 /* .name = "Capture Source", */
6692 .name = "Input Source",
6694 .info = alc883_mux_enum_info,
6695 .get = alc883_mux_enum_get,
6696 .put = alc883_mux_enum_put,
6701 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6702 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6703 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6705 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6706 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6709 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6710 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6711 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6712 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6713 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6714 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6717 /* .name = "Capture Source", */
6718 .name = "Input Source",
6720 .info = alc883_mux_enum_info,
6721 .get = alc883_mux_enum_get,
6722 .put = alc883_mux_enum_put,
6727 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6729 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6730 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6735 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6736 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6737 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6738 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6739 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6740 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6743 /* .name = "Capture Source", */
6744 .name = "Input Source",
6746 .info = alc883_mux_enum_info,
6747 .get = alc883_mux_enum_get,
6748 .put = alc883_mux_enum_put,
6753 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6756 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6757 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6758 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6759 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6760 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6761 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6762 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6763 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6767 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6768 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6770 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6772 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6773 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6774 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6775 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6776 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6777 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6778 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6779 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6780 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6783 /* .name = "Capture Source", */
6784 .name = "Input Source",
6786 .info = alc883_mux_enum_info,
6787 .get = alc883_mux_enum_get,
6788 .put = alc883_mux_enum_put,
6793 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6794 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6795 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6796 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6797 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6798 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6799 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6800 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6801 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6811 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6813 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6814 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6815 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6816 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6817 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6818 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6821 /* .name = "Capture Source", */
6822 .name = "Input Source",
6824 .info = alc883_mux_enum_info,
6825 .get = alc883_mux_enum_get,
6826 .put = alc883_mux_enum_put,
6831 static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {
6832 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6833 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6834 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6835 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6836 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6837 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6838 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6839 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6840 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6841 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6843 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6844 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6845 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6846 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6848 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6850 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6851 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6852 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6853 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6854 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6855 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6856 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6857 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6858 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6861 /* .name = "Capture Source", */
6862 .name = "Input Source",
6864 .info = alc883_mux_enum_info,
6865 .get = alc883_mux_enum_get,
6866 .put = alc883_mux_enum_put,
6871 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6872 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6873 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6874 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6875 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6876 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6878 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6880 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6881 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6882 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6883 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6885 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6886 /* .name = "Capture Source", */
6887 .name = "Input Source",
6889 .info = alc883_mux_enum_info,
6890 .get = alc883_mux_enum_get,
6891 .put = alc883_mux_enum_put,
6896 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6899 .name = "Channel Mode",
6900 .info = alc_ch_mode_info,
6901 .get = alc_ch_mode_get,
6902 .put = alc_ch_mode_put,
6907 static struct hda_verb alc883_init_verbs[] = {
6908 /* ADC1: mute amp left and right */
6909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6910 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6911 /* ADC2: mute amp left and right */
6912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6913 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6914 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6921 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6924 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6925 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6927 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6928 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6929 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6931 /* mute analog input loopbacks */
6932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6938 /* Front Pin: output 0 (0x0c) */
6939 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6940 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6941 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6942 /* Rear Pin: output 1 (0x0d) */
6943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6944 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6945 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6946 /* CLFE Pin: output 2 (0x0e) */
6947 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6948 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6949 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6950 /* Side Pin: output 3 (0x0f) */
6951 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6952 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6953 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6954 /* Mic (rear) pin: input vref at 80% */
6955 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6957 /* Front Mic pin: input vref at 80% */
6958 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6959 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6960 /* Line In pin: input */
6961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6962 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6963 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6965 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6966 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6967 /* CD pin widget for input */
6968 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6970 /* FIXME: use matrix-type input source selection */
6971 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6985 /* toggle speaker-output according to the hp-jack state */
6986 static void alc883_mitac_hp_automute(struct hda_codec *codec)
6988 unsigned int present;
6990 present = snd_hda_codec_read(codec, 0x15, 0,
6991 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6992 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6993 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6994 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
6995 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6998 /* auto-toggle front mic */
7000 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7002 unsigned int present;
7005 present = snd_hda_codec_read(codec, 0x18, 0,
7006 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7007 bits = present ? HDA_AMP_MUTE : 0;
7008 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7012 static void alc883_mitac_automute(struct hda_codec *codec)
7014 alc883_mitac_hp_automute(codec);
7015 /* alc883_mitac_mic_automute(codec); */
7018 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7021 switch (res >> 26) {
7022 case ALC880_HP_EVENT:
7023 alc883_mitac_hp_automute(codec);
7025 case ALC880_MIC_EVENT:
7026 /* alc883_mitac_mic_automute(codec); */
7031 static struct hda_verb alc883_mitac_verbs[] = {
7033 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7036 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7037 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7039 /* enable unsolicited event */
7040 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7041 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7046 static struct hda_verb alc883_tagra_verbs[] = {
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7050 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7053 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7054 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7055 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7057 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7058 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7059 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7060 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7065 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7067 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7068 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7072 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7075 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7080 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7085 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7089 static struct hda_verb alc883_haier_w66_verbs[] = {
7090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7093 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7095 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7097 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7098 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7102 static struct hda_verb alc888_6st_hp_verbs[] = {
7103 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7104 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7105 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7106 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7110 static struct hda_verb alc888_3st_hp_verbs[] = {
7111 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7112 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7113 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7117 static struct hda_verb alc888_6st_dell_verbs[] = {
7118 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */
7120 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */
7121 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7122 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7126 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7127 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7128 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7129 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7130 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7134 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7135 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7136 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7137 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7138 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7142 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7143 { 2, alc888_3st_hp_2ch_init },
7144 { 6, alc888_3st_hp_6ch_init },
7147 /* toggle front-jack and RCA according to the hp-jack state */
7148 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7150 unsigned int present;
7152 present = snd_hda_codec_read(codec, 0x1b, 0,
7153 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7154 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7155 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7156 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7157 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7160 /* toggle RCA according to the front-jack state */
7161 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7163 unsigned int present;
7165 present = snd_hda_codec_read(codec, 0x14, 0,
7166 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7167 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7168 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7171 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7174 if ((res >> 26) == ALC880_HP_EVENT)
7175 alc888_lenovo_ms7195_front_automute(codec);
7176 if ((res >> 26) == ALC880_FRONT_EVENT)
7177 alc888_lenovo_ms7195_rca_automute(codec);
7180 static struct hda_verb alc883_medion_md2_verbs[] = {
7181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7184 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7186 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7190 /* toggle speaker-output according to the hp-jack state */
7191 static void alc883_medion_md2_automute(struct hda_codec *codec)
7193 unsigned int present;
7195 present = snd_hda_codec_read(codec, 0x14, 0,
7196 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7197 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7198 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7201 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7204 if ((res >> 26) == ALC880_HP_EVENT)
7205 alc883_medion_md2_automute(codec);
7208 /* toggle speaker-output according to the hp-jack state */
7209 static void alc883_tagra_automute(struct hda_codec *codec)
7211 unsigned int present;
7214 present = snd_hda_codec_read(codec, 0x14, 0,
7215 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7216 bits = present ? HDA_AMP_MUTE : 0;
7217 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7218 HDA_AMP_MUTE, bits);
7219 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7223 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7225 if ((res >> 26) == ALC880_HP_EVENT)
7226 alc883_tagra_automute(codec);
7229 static void alc883_haier_w66_automute(struct hda_codec *codec)
7231 unsigned int present;
7234 present = snd_hda_codec_read(codec, 0x1b, 0,
7235 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7236 bits = present ? 0x80 : 0;
7237 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7241 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7244 if ((res >> 26) == ALC880_HP_EVENT)
7245 alc883_haier_w66_automute(codec);
7248 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7250 unsigned int present;
7253 present = snd_hda_codec_read(codec, 0x14, 0,
7254 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7255 bits = present ? HDA_AMP_MUTE : 0;
7256 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7257 HDA_AMP_MUTE, bits);
7260 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7262 unsigned int present;
7265 present = snd_hda_codec_read(codec, 0x1b, 0,
7266 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7267 bits = present ? HDA_AMP_MUTE : 0;
7268 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7269 HDA_AMP_MUTE, bits);
7270 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7271 HDA_AMP_MUTE, bits);
7274 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7277 if ((res >> 26) == ALC880_HP_EVENT)
7278 alc883_lenovo_101e_all_automute(codec);
7279 if ((res >> 26) == ALC880_FRONT_EVENT)
7280 alc883_lenovo_101e_ispeaker_automute(codec);
7283 /* toggle speaker-output according to the hp-jack state */
7284 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7286 unsigned int present;
7288 present = snd_hda_codec_read(codec, 0x14, 0,
7289 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7290 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7291 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7292 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7293 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7296 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7299 if ((res >> 26) == ALC880_HP_EVENT)
7300 alc883_acer_aspire_automute(codec);
7303 static struct hda_verb alc883_acer_eapd_verbs[] = {
7304 /* HP Pin: output 0 (0x0c) */
7305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7307 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7308 /* Front Pin: output 0 (0x0c) */
7309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7312 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7313 /* eanable EAPD on medion laptop */
7314 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7315 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7316 /* enable unsolicited event */
7317 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7321 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7323 unsigned int present;
7325 present = snd_hda_codec_read(codec, 0x1b, 0,
7326 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7327 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7328 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7329 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7330 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7331 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7332 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7333 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7334 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7337 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7340 switch (res >> 26) {
7341 case ALC880_HP_EVENT:
7342 printk("hp_event\n");
7343 alc888_6st_dell_front_automute(codec);
7349 * generic initialization of ADC, input mixers and output mixers
7351 static struct hda_verb alc883_auto_init_verbs[] = {
7353 * Unmute ADC0-2 and set the default input to mic-in
7355 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7357 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7360 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7362 * Note: PASD motherboards uses the Line In 2 as the input for
7363 * front panel mic (mic 2)
7365 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7373 * Set up output mixers (0x0c - 0x0f)
7375 /* set vol=0 to output mixers */
7376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7378 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7379 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7380 /* set up input amps for analog loopback */
7381 /* Amp Indices: DAC = 0, mixer = 1 */
7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7385 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7388 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7390 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7391 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7393 /* FIXME: use matrix-type input source selection */
7394 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7399 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7405 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7411 /* capture mixer elements */
7412 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7413 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7414 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7415 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7416 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7419 /* The multiple "Capture Source" controls confuse alsamixer
7420 * So call somewhat different..
7422 /* .name = "Capture Source", */
7423 .name = "Input Source",
7425 .info = alc882_mux_enum_info,
7426 .get = alc882_mux_enum_get,
7427 .put = alc882_mux_enum_put,
7432 #ifdef CONFIG_SND_HDA_POWER_SAVE
7433 #define alc883_loopbacks alc880_loopbacks
7436 /* pcm configuration: identiacal with ALC880 */
7437 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7438 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7439 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7440 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7441 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7444 * configuration and preset
7446 static const char *alc883_models[ALC883_MODEL_LAST] = {
7447 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7448 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7449 [ALC883_3ST_6ch] = "3stack-6ch",
7450 [ALC883_6ST_DIG] = "6stack-dig",
7451 [ALC883_TARGA_DIG] = "targa-dig",
7452 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7453 [ALC883_ACER] = "acer",
7454 [ALC883_ACER_ASPIRE] = "acer-aspire",
7455 [ALC883_MEDION] = "medion",
7456 [ALC883_MEDION_MD2] = "medion-md2",
7457 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7458 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7459 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7460 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7461 [ALC883_HAIER_W66] = "haier-w66",
7462 [ALC888_6ST_HP] = "6stack-hp",
7463 [ALC888_3ST_HP] = "3stack-hp",
7464 [ALC888_6ST_DELL] = "6stack-dell",
7465 [ALC883_MITAC] = "mitac",
7466 [ALC883_AUTO] = "auto",
7469 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7470 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7471 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7472 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7473 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7474 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7475 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7476 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7477 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7478 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7479 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7480 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7481 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7482 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7483 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7484 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7485 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7486 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7487 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7488 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7489 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7490 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7491 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7492 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7493 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7494 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7495 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7496 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7497 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7498 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7499 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7500 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7501 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7502 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7503 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7504 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7505 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7506 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7507 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7508 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7509 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7510 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7511 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7512 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7513 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7514 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7515 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7519 static struct alc_config_preset alc883_presets[] = {
7520 [ALC883_3ST_2ch_DIG] = {
7521 .mixers = { alc883_3ST_2ch_mixer },
7522 .init_verbs = { alc883_init_verbs },
7523 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7524 .dac_nids = alc883_dac_nids,
7525 .dig_out_nid = ALC883_DIGOUT_NID,
7526 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7527 .adc_nids = alc883_adc_nids,
7528 .dig_in_nid = ALC883_DIGIN_NID,
7529 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7530 .channel_mode = alc883_3ST_2ch_modes,
7531 .input_mux = &alc883_capture_source,
7533 [ALC883_3ST_6ch_DIG] = {
7534 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7535 .init_verbs = { alc883_init_verbs },
7536 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7537 .dac_nids = alc883_dac_nids,
7538 .dig_out_nid = ALC883_DIGOUT_NID,
7539 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7540 .adc_nids = alc883_adc_nids,
7541 .dig_in_nid = ALC883_DIGIN_NID,
7542 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7543 .channel_mode = alc883_3ST_6ch_modes,
7545 .input_mux = &alc883_capture_source,
7547 [ALC883_3ST_6ch] = {
7548 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7549 .init_verbs = { alc883_init_verbs },
7550 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7551 .dac_nids = alc883_dac_nids,
7552 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7553 .adc_nids = alc883_adc_nids,
7554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7555 .channel_mode = alc883_3ST_6ch_modes,
7557 .input_mux = &alc883_capture_source,
7559 [ALC883_6ST_DIG] = {
7560 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7561 .init_verbs = { alc883_init_verbs },
7562 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7563 .dac_nids = alc883_dac_nids,
7564 .dig_out_nid = ALC883_DIGOUT_NID,
7565 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7566 .adc_nids = alc883_adc_nids,
7567 .dig_in_nid = ALC883_DIGIN_NID,
7568 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7569 .channel_mode = alc883_sixstack_modes,
7570 .input_mux = &alc883_capture_source,
7572 [ALC883_TARGA_DIG] = {
7573 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7574 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7575 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7576 .dac_nids = alc883_dac_nids,
7577 .dig_out_nid = ALC883_DIGOUT_NID,
7578 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7579 .adc_nids = alc883_adc_nids,
7580 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7581 .channel_mode = alc883_3ST_6ch_modes,
7583 .input_mux = &alc883_capture_source,
7584 .unsol_event = alc883_tagra_unsol_event,
7585 .init_hook = alc883_tagra_automute,
7587 [ALC883_TARGA_2ch_DIG] = {
7588 .mixers = { alc883_tagra_2ch_mixer},
7589 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7590 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7591 .dac_nids = alc883_dac_nids,
7592 .dig_out_nid = ALC883_DIGOUT_NID,
7593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7594 .adc_nids = alc883_adc_nids,
7595 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7596 .channel_mode = alc883_3ST_2ch_modes,
7597 .input_mux = &alc883_capture_source,
7598 .unsol_event = alc883_tagra_unsol_event,
7599 .init_hook = alc883_tagra_automute,
7602 .mixers = { alc883_base_mixer },
7603 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7604 * and the headphone jack. Turn this on and rely on the
7605 * standard mute methods whenever the user wants to turn
7606 * these outputs off.
7608 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7609 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7610 .dac_nids = alc883_dac_nids,
7611 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7612 .adc_nids = alc883_adc_nids,
7613 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7614 .channel_mode = alc883_3ST_2ch_modes,
7615 .input_mux = &alc883_capture_source,
7617 [ALC883_ACER_ASPIRE] = {
7618 .mixers = { alc883_acer_aspire_mixer },
7619 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7621 .dac_nids = alc883_dac_nids,
7622 .dig_out_nid = ALC883_DIGOUT_NID,
7623 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7624 .adc_nids = alc883_adc_nids,
7625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7626 .channel_mode = alc883_3ST_2ch_modes,
7627 .input_mux = &alc883_capture_source,
7628 .unsol_event = alc883_acer_aspire_unsol_event,
7629 .init_hook = alc883_acer_aspire_automute,
7632 .mixers = { alc883_fivestack_mixer,
7633 alc883_chmode_mixer },
7634 .init_verbs = { alc883_init_verbs,
7635 alc883_medion_eapd_verbs },
7636 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7637 .dac_nids = alc883_dac_nids,
7638 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7639 .adc_nids = alc883_adc_nids,
7640 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7641 .channel_mode = alc883_sixstack_modes,
7642 .input_mux = &alc883_capture_source,
7644 [ALC883_MEDION_MD2] = {
7645 .mixers = { alc883_medion_md2_mixer},
7646 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7648 .dac_nids = alc883_dac_nids,
7649 .dig_out_nid = ALC883_DIGOUT_NID,
7650 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7651 .adc_nids = alc883_adc_nids,
7652 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7653 .channel_mode = alc883_3ST_2ch_modes,
7654 .input_mux = &alc883_capture_source,
7655 .unsol_event = alc883_medion_md2_unsol_event,
7656 .init_hook = alc883_medion_md2_automute,
7658 [ALC883_LAPTOP_EAPD] = {
7659 .mixers = { alc883_base_mixer },
7660 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7662 .dac_nids = alc883_dac_nids,
7663 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7664 .adc_nids = alc883_adc_nids,
7665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7666 .channel_mode = alc883_3ST_2ch_modes,
7667 .input_mux = &alc883_capture_source,
7669 [ALC883_LENOVO_101E_2ch] = {
7670 .mixers = { alc883_lenovo_101e_2ch_mixer},
7671 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7672 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7673 .dac_nids = alc883_dac_nids,
7674 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7675 .adc_nids = alc883_adc_nids,
7676 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7677 .channel_mode = alc883_3ST_2ch_modes,
7678 .input_mux = &alc883_lenovo_101e_capture_source,
7679 .unsol_event = alc883_lenovo_101e_unsol_event,
7680 .init_hook = alc883_lenovo_101e_all_automute,
7682 [ALC883_LENOVO_NB0763] = {
7683 .mixers = { alc883_lenovo_nb0763_mixer },
7684 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7685 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7686 .dac_nids = alc883_dac_nids,
7687 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7688 .adc_nids = alc883_adc_nids,
7689 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7690 .channel_mode = alc883_3ST_2ch_modes,
7692 .input_mux = &alc883_lenovo_nb0763_capture_source,
7693 .unsol_event = alc883_medion_md2_unsol_event,
7694 .init_hook = alc883_medion_md2_automute,
7696 [ALC888_LENOVO_MS7195_DIG] = {
7697 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7698 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7699 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7700 .dac_nids = alc883_dac_nids,
7701 .dig_out_nid = ALC883_DIGOUT_NID,
7702 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7703 .adc_nids = alc883_adc_nids,
7704 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7705 .channel_mode = alc883_3ST_6ch_modes,
7707 .input_mux = &alc883_capture_source,
7708 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7709 .init_hook = alc888_lenovo_ms7195_front_automute,
7711 [ALC883_HAIER_W66] = {
7712 .mixers = { alc883_tagra_2ch_mixer},
7713 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7714 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7715 .dac_nids = alc883_dac_nids,
7716 .dig_out_nid = ALC883_DIGOUT_NID,
7717 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7718 .adc_nids = alc883_adc_nids,
7719 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7720 .channel_mode = alc883_3ST_2ch_modes,
7721 .input_mux = &alc883_capture_source,
7722 .unsol_event = alc883_haier_w66_unsol_event,
7723 .init_hook = alc883_haier_w66_automute,
7726 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7727 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7729 .dac_nids = alc883_dac_nids,
7730 .dig_out_nid = ALC883_DIGOUT_NID,
7731 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7732 .adc_nids = alc883_adc_nids,
7733 .dig_in_nid = ALC883_DIGIN_NID,
7734 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7735 .channel_mode = alc883_sixstack_modes,
7736 .input_mux = &alc883_capture_source,
7739 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7740 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7741 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7742 .dac_nids = alc883_dac_nids,
7743 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7744 .adc_nids = alc883_adc_nids,
7745 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7746 .channel_mode = alc888_3st_hp_modes,
7748 .input_mux = &alc883_capture_source,
7750 [ALC888_6ST_DELL] = {
7751 .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer },
7752 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7754 .dac_nids = alc883_dac_nids,
7755 .dig_out_nid = ALC883_DIGOUT_NID,
7756 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7757 .adc_nids = alc883_adc_nids,
7758 .dig_in_nid = ALC883_DIGIN_NID,
7759 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7760 .channel_mode = alc883_sixstack_modes,
7761 .input_mux = &alc883_capture_source,
7762 .unsol_event = alc888_6st_dell_unsol_event,
7763 .init_hook = alc888_6st_dell_front_automute,
7766 .mixers = { alc883_mitac_mixer },
7767 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7768 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7769 .dac_nids = alc883_dac_nids,
7770 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7771 .adc_nids = alc883_adc_nids,
7772 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7773 .channel_mode = alc883_3ST_2ch_modes,
7774 .input_mux = &alc883_capture_source,
7775 .unsol_event = alc883_mitac_unsol_event,
7776 .init_hook = alc883_mitac_automute,
7782 * BIOS auto configuration
7784 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7785 hda_nid_t nid, int pin_type,
7789 struct alc_spec *spec = codec->spec;
7792 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7795 idx = spec->multiout.dac_nids[dac_idx] - 2;
7797 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7799 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7801 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7805 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7807 struct alc_spec *spec = codec->spec;
7810 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7811 for (i = 0; i <= HDA_SIDE; i++) {
7812 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7813 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7815 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7820 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7822 struct alc_spec *spec = codec->spec;
7825 pin = spec->autocfg.hp_pins[0];
7826 if (pin) /* connect to front */
7828 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7831 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7832 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7834 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7836 struct alc_spec *spec = codec->spec;
7839 for (i = 0; i < AUTO_PIN_LAST; i++) {
7840 hda_nid_t nid = spec->autocfg.input_pins[i];
7841 if (alc883_is_input_pin(nid)) {
7842 snd_hda_codec_write(codec, nid, 0,
7843 AC_VERB_SET_PIN_WIDGET_CONTROL,
7844 (i <= AUTO_PIN_FRONT_MIC ?
7845 PIN_VREF80 : PIN_IN));
7846 if (nid != ALC883_PIN_CD_NID)
7847 snd_hda_codec_write(codec, nid, 0,
7848 AC_VERB_SET_AMP_GAIN_MUTE,
7854 /* almost identical with ALC880 parser... */
7855 static int alc883_parse_auto_config(struct hda_codec *codec)
7857 struct alc_spec *spec = codec->spec;
7858 int err = alc880_parse_auto_config(codec);
7863 return 0; /* no config found */
7865 err = alc_auto_add_mic_boost(codec);
7869 /* hack - override the init verbs */
7870 spec->init_verbs[0] = alc883_auto_init_verbs;
7871 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7874 return 1; /* config found */
7877 /* additional initialization for auto-configuration model */
7878 static void alc883_auto_init(struct hda_codec *codec)
7880 alc883_auto_init_multi_out(codec);
7881 alc883_auto_init_hp_out(codec);
7882 alc883_auto_init_analog_input(codec);
7885 static int patch_alc883(struct hda_codec *codec)
7887 struct alc_spec *spec;
7888 int err, board_config;
7890 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7896 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7899 if (board_config < 0) {
7900 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7901 "trying auto-probe from BIOS...\n");
7902 board_config = ALC883_AUTO;
7905 if (board_config == ALC883_AUTO) {
7906 /* automatic parse from the BIOS config */
7907 err = alc883_parse_auto_config(codec);
7913 "hda_codec: Cannot set up configuration "
7914 "from BIOS. Using base mode...\n");
7915 board_config = ALC883_3ST_2ch_DIG;
7919 if (board_config != ALC883_AUTO)
7920 setup_preset(spec, &alc883_presets[board_config]);
7922 spec->stream_name_analog = "ALC883 Analog";
7923 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7924 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7925 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
7927 spec->stream_name_digital = "ALC883 Digital";
7928 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7929 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7931 if (!spec->adc_nids && spec->input_mux) {
7932 spec->adc_nids = alc883_adc_nids;
7933 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7936 spec->vmaster_nid = 0x0c;
7938 codec->patch_ops = alc_patch_ops;
7939 if (board_config == ALC883_AUTO)
7940 spec->init_hook = alc883_auto_init;
7941 #ifdef CONFIG_SND_HDA_POWER_SAVE
7942 if (!spec->loopback.amplist)
7943 spec->loopback.amplist = alc883_loopbacks;
7953 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7954 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7956 #define alc262_dac_nids alc260_dac_nids
7957 #define alc262_adc_nids alc882_adc_nids
7958 #define alc262_adc_nids_alt alc882_adc_nids_alt
7960 #define alc262_modes alc260_modes
7961 #define alc262_capture_source alc882_capture_source
7963 static struct snd_kcontrol_new alc262_base_mixer[] = {
7964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7965 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7966 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7967 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7968 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7969 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7974 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7975 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7976 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7977 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7978 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7980 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7981 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7985 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7987 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7998 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7999 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8000 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8005 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8009 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8010 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8013 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8016 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8019 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8022 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8023 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8024 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8025 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8029 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8030 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8032 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8034 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8035 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8036 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8037 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8040 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8043 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8044 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8048 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8049 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8050 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8055 static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = {
8056 .ops = &snd_hda_bind_vol,
8058 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8059 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8064 static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = {
8065 .ops = &snd_hda_bind_sw,
8067 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8068 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8073 /* mute/unmute internal speaker according to the hp jack and mute state */
8074 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8076 struct alc_spec *spec = codec->spec;
8079 if (force || !spec->sense_updated) {
8080 unsigned int present;
8081 present = snd_hda_codec_read(codec, 0x15, 0,
8082 AC_VERB_GET_PIN_SENSE, 0);
8083 spec->jack_present = (present & 0x80000000) != 0;
8084 spec->sense_updated = 1;
8086 if (spec->jack_present)
8087 mute = (0x7080 | ((0)<<8)); /* mute internal speaker */
8088 else /* unmute internal speaker if necessary */
8089 mute = (0x7000 | ((0)<<8));
8090 snd_hda_codec_write(codec, 0x0c, 0,
8091 AC_VERB_SET_AMP_GAIN_MUTE, mute );
8094 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8097 if ((res >> 26) != ALC880_HP_EVENT)
8099 alc262_hp_t5735_automute(codec, 1);
8102 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8104 alc262_hp_t5735_automute(codec, 1);
8107 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8108 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol),
8109 HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw),
8110 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8111 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8113 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8122 static struct hda_verb alc262_hp_t5735_verbs[] = {
8123 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8124 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8130 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_vol = {
8131 .ops = &snd_hda_bind_vol,
8133 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8134 HDA_COMPOSE_AMP_VAL(0x0e, 3, 0, HDA_OUTPUT),
8139 static struct hda_bind_ctls alc262_hp_rp5700_bind_front_sw = {
8140 .ops = &snd_hda_bind_sw,
8142 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8143 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
8148 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8149 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_rp5700_bind_front_vol),
8150 HDA_BIND_SW("PCM Playback Switch", &alc262_hp_rp5700_bind_front_sw),
8151 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8152 HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8153 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8154 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8155 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8156 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8160 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8161 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8166 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8174 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8181 /* bind hp and internal speaker mute (with plug check) */
8182 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8183 struct snd_ctl_elem_value *ucontrol)
8185 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8186 long *valp = ucontrol->value.integer.value;
8189 /* change hp mute */
8190 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8192 valp[0] ? 0 : HDA_AMP_MUTE);
8193 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8195 valp[1] ? 0 : HDA_AMP_MUTE);
8197 /* change speaker according to HP jack state */
8198 struct alc_spec *spec = codec->spec;
8200 if (spec->jack_present)
8201 mute = HDA_AMP_MUTE;
8203 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8205 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8206 HDA_AMP_MUTE, mute);
8211 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8212 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8214 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8215 .name = "Master Playback Switch",
8216 .info = snd_hda_mixer_amp_switch_info,
8217 .get = snd_hda_mixer_amp_switch_get,
8218 .put = alc262_sony_master_sw_put,
8219 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
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("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8224 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8228 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8230 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8231 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8234 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8235 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8239 #define alc262_capture_mixer alc882_capture_mixer
8240 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8243 * generic initialization of ADC, input mixers and output mixers
8245 static struct hda_verb alc262_init_verbs[] = {
8247 * Unmute ADC0-2 and set the default input to mic-in
8249 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8251 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8253 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8256 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8258 * Note: PASD motherboards uses the Line In 2 as the input for
8259 * front panel mic (mic 2)
8261 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8264 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8266 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8269 * Set up output mixers (0x0c - 0x0e)
8271 /* set vol=0 to output mixers */
8272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8275 /* set up input amps for analog loopback */
8276 /* Amp Indices: DAC = 0, mixer = 1 */
8277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8281 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8286 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8288 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8289 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8291 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8297 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8300 /* FIXME: use matrix-type input source selection */
8301 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8302 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8321 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8322 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8327 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8328 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8329 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8330 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8332 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8337 static struct hda_verb alc262_sony_unsol_verbs[] = {
8338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8346 /* mute/unmute internal speaker according to the hp jack and mute state */
8347 static void alc262_hippo_automute(struct hda_codec *codec)
8349 struct alc_spec *spec = codec->spec;
8351 unsigned int present;
8353 /* need to execute and sync at first */
8354 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8355 present = snd_hda_codec_read(codec, 0x15, 0,
8356 AC_VERB_GET_PIN_SENSE, 0);
8357 spec->jack_present = (present & 0x80000000) != 0;
8358 if (spec->jack_present) {
8359 /* mute internal speaker */
8360 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8361 HDA_AMP_MUTE, HDA_AMP_MUTE);
8363 /* unmute internal speaker if necessary */
8364 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8365 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8366 HDA_AMP_MUTE, mute);
8370 /* unsolicited event for HP jack sensing */
8371 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8374 if ((res >> 26) != ALC880_HP_EVENT)
8376 alc262_hippo_automute(codec);
8379 static void alc262_hippo1_automute(struct hda_codec *codec)
8382 unsigned int present;
8384 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8385 present = snd_hda_codec_read(codec, 0x1b, 0,
8386 AC_VERB_GET_PIN_SENSE, 0);
8387 present = (present & 0x80000000) != 0;
8389 /* mute internal speaker */
8390 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8391 HDA_AMP_MUTE, HDA_AMP_MUTE);
8393 /* unmute internal speaker if necessary */
8394 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8395 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8396 HDA_AMP_MUTE, mute);
8400 /* unsolicited event for HP jack sensing */
8401 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8404 if ((res >> 26) != ALC880_HP_EVENT)
8406 alc262_hippo1_automute(codec);
8411 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8414 #define ALC_HP_EVENT 0x37
8416 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8417 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8422 static struct hda_input_mux alc262_fujitsu_capture_source = {
8431 static struct hda_input_mux alc262_HP_capture_source = {
8435 { "Front Mic", 0x1 },
8442 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8446 { "Front Mic", 0x2 },
8452 /* mute/unmute internal speaker according to the hp jack and mute state */
8453 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8455 struct alc_spec *spec = codec->spec;
8458 if (force || !spec->sense_updated) {
8459 unsigned int present;
8460 /* need to execute and sync at first */
8461 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8462 present = snd_hda_codec_read(codec, 0x14, 0,
8463 AC_VERB_GET_PIN_SENSE, 0);
8464 spec->jack_present = (present & 0x80000000) != 0;
8465 spec->sense_updated = 1;
8467 if (spec->jack_present) {
8468 /* mute internal speaker */
8469 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8470 HDA_AMP_MUTE, HDA_AMP_MUTE);
8472 /* unmute internal speaker if necessary */
8473 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8474 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8475 HDA_AMP_MUTE, mute);
8479 /* unsolicited event for HP jack sensing */
8480 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8483 if ((res >> 26) != ALC_HP_EVENT)
8485 alc262_fujitsu_automute(codec, 1);
8488 /* bind volumes of both NID 0x0c and 0x0d */
8489 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8490 .ops = &snd_hda_bind_vol,
8492 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8493 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8498 /* bind hp and internal speaker mute (with plug check) */
8499 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8500 struct snd_ctl_elem_value *ucontrol)
8502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8503 long *valp = ucontrol->value.integer.value;
8506 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8508 valp[0] ? 0 : HDA_AMP_MUTE);
8509 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8511 valp[1] ? 0 : HDA_AMP_MUTE);
8513 alc262_fujitsu_automute(codec, 0);
8517 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8518 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8521 .name = "Master Playback Switch",
8522 .info = snd_hda_mixer_amp_switch_info,
8523 .get = snd_hda_mixer_amp_switch_get,
8524 .put = alc262_fujitsu_master_sw_put,
8525 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8528 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8532 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8533 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8534 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8538 /* additional init verbs for Benq laptops */
8539 static struct hda_verb alc262_EAPD_verbs[] = {
8540 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8541 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8545 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8546 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8547 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8549 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8550 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8554 /* Samsung Q1 Ultra Vista model setup */
8555 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8556 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8557 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8560 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8561 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8565 static struct hda_verb alc262_ultra_verbs[] = {
8566 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8569 /* Mic is on Node 0x19 */
8570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8571 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8573 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8575 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8580 static struct hda_input_mux alc262_ultra_capture_source = {
8587 /* mute/unmute internal speaker according to the hp jack and mute state */
8588 static void alc262_ultra_automute(struct hda_codec *codec)
8590 struct alc_spec *spec = codec->spec;
8592 unsigned int present;
8594 /* need to execute and sync at first */
8595 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8596 present = snd_hda_codec_read(codec, 0x15, 0,
8597 AC_VERB_GET_PIN_SENSE, 0);
8598 spec->jack_present = (present & 0x80000000) != 0;
8599 if (spec->jack_present) {
8600 /* mute internal speaker */
8601 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8602 HDA_AMP_MUTE, HDA_AMP_MUTE);
8604 /* unmute internal speaker if necessary */
8605 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8606 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8607 HDA_AMP_MUTE, mute);
8611 /* unsolicited event for HP jack sensing */
8612 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8615 if ((res >> 26) != ALC880_HP_EVENT)
8617 alc262_ultra_automute(codec);
8620 /* add playback controls from the parsed DAC table */
8621 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8622 const struct auto_pin_cfg *cfg)
8627 spec->multiout.num_dacs = 1; /* only use one dac */
8628 spec->multiout.dac_nids = spec->private_dac_nids;
8629 spec->multiout.dac_nids[0] = 2;
8631 nid = cfg->line_out_pins[0];
8633 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8634 "Front Playback Volume",
8635 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8638 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8639 "Front Playback Switch",
8640 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8645 nid = cfg->speaker_pins[0];
8648 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8649 "Speaker Playback Volume",
8650 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8654 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8655 "Speaker Playback Switch",
8656 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8661 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8662 "Speaker Playback Switch",
8663 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8669 nid = cfg->hp_pins[0];
8671 /* spec->multiout.hp_nid = 2; */
8673 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8674 "Headphone Playback Volume",
8675 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8679 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8680 "Headphone Playback Switch",
8681 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8686 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8687 "Headphone Playback Switch",
8688 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8697 /* identical with ALC880 */
8698 #define alc262_auto_create_analog_input_ctls \
8699 alc880_auto_create_analog_input_ctls
8702 * generic initialization of ADC, input mixers and output mixers
8704 static struct hda_verb alc262_volume_init_verbs[] = {
8706 * Unmute ADC0-2 and set the default input to mic-in
8708 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8710 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8712 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8715 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8717 * Note: PASD motherboards uses the Line In 2 as the input for
8718 * front panel mic (mic 2)
8720 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8728 * Set up output mixers (0x0c - 0x0f)
8730 /* set vol=0 to output mixers */
8731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8733 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8735 /* set up input amps for analog loopback */
8736 /* Amp Indices: DAC = 0, mixer = 1 */
8737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8744 /* FIXME: use matrix-type input source selection */
8745 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8746 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8765 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8767 * Unmute ADC0-2 and set the default input to mic-in
8769 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8771 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8772 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8773 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8774 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8776 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8778 * Note: PASD motherboards uses the Line In 2 as the input for
8779 * front panel mic (mic 2)
8781 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8782 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8783 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8784 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8785 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8786 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8787 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8788 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8791 * Set up output mixers (0x0c - 0x0e)
8793 /* set vol=0 to output mixers */
8794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8795 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8796 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8798 /* set up input amps for analog loopback */
8799 /* Amp Indices: DAC = 0, mixer = 1 */
8800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8801 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8814 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8815 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8818 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8819 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8826 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8827 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8828 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8831 /* FIXME: use matrix-type input source selection */
8832 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8833 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8852 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8854 * Unmute ADC0-2 and set the default input to mic-in
8856 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8858 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8860 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8861 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8863 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8865 * Note: PASD motherboards uses the Line In 2 as the input for front
8868 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8878 * Set up output mixers (0x0c - 0x0e)
8880 /* set vol=0 to output mixers */
8881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8882 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8883 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8885 /* set up input amps for analog loopback */
8886 /* Amp Indices: DAC = 0, mixer = 1 */
8887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8896 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8897 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8898 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8899 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8901 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8906 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8907 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8909 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8910 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8911 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8913 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8914 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8916 /* FIXME: use matrix-type input source selection */
8917 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8918 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8919 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8920 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8923 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8924 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8925 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8929 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8930 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8931 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8932 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8933 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8940 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8941 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8946 #ifdef CONFIG_SND_HDA_POWER_SAVE
8947 #define alc262_loopbacks alc880_loopbacks
8950 /* pcm configuration: identiacal with ALC880 */
8951 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8952 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8953 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8954 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8957 * BIOS auto configuration
8959 static int alc262_parse_auto_config(struct hda_codec *codec)
8961 struct alc_spec *spec = codec->spec;
8963 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8965 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8969 if (!spec->autocfg.line_outs)
8970 return 0; /* can't find valid BIOS pin config */
8971 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8974 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8978 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8980 if (spec->autocfg.dig_out_pin)
8981 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8982 if (spec->autocfg.dig_in_pin)
8983 spec->dig_in_nid = ALC262_DIGIN_NID;
8985 if (spec->kctl_alloc)
8986 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8988 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8989 spec->num_mux_defs = 1;
8990 spec->input_mux = &spec->private_imux;
8992 err = alc_auto_add_mic_boost(codec);
8999 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9000 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9001 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9004 /* init callback for auto-configuration model -- overriding the default init */
9005 static void alc262_auto_init(struct hda_codec *codec)
9007 alc262_auto_init_multi_out(codec);
9008 alc262_auto_init_hp_out(codec);
9009 alc262_auto_init_analog_input(codec);
9013 * configuration and preset
9015 static const char *alc262_models[ALC262_MODEL_LAST] = {
9016 [ALC262_BASIC] = "basic",
9017 [ALC262_HIPPO] = "hippo",
9018 [ALC262_HIPPO_1] = "hippo_1",
9019 [ALC262_FUJITSU] = "fujitsu",
9020 [ALC262_HP_BPC] = "hp-bpc",
9021 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9022 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9023 [ALC262_HP_RP5700] = "hp-rp5700",
9024 [ALC262_BENQ_ED8] = "benq",
9025 [ALC262_BENQ_T31] = "benq-t31",
9026 [ALC262_SONY_ASSAMD] = "sony-assamd",
9027 [ALC262_ULTRA] = "ultra",
9028 [ALC262_AUTO] = "auto",
9031 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9032 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9033 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9034 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9035 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9036 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9037 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9038 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9039 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9040 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9041 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9042 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9043 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9044 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9045 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9046 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9047 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9048 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9049 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9050 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9051 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9052 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9053 ALC262_HP_TC_T5735),
9054 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9055 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9056 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9057 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9058 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9059 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9060 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9061 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9062 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9063 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9064 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9068 static struct alc_config_preset alc262_presets[] = {
9070 .mixers = { alc262_base_mixer },
9071 .init_verbs = { alc262_init_verbs },
9072 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9073 .dac_nids = alc262_dac_nids,
9075 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9076 .channel_mode = alc262_modes,
9077 .input_mux = &alc262_capture_source,
9080 .mixers = { alc262_base_mixer },
9081 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9082 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9083 .dac_nids = alc262_dac_nids,
9085 .dig_out_nid = ALC262_DIGOUT_NID,
9086 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9087 .channel_mode = alc262_modes,
9088 .input_mux = &alc262_capture_source,
9089 .unsol_event = alc262_hippo_unsol_event,
9090 .init_hook = alc262_hippo_automute,
9092 [ALC262_HIPPO_1] = {
9093 .mixers = { alc262_hippo1_mixer },
9094 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9095 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9096 .dac_nids = alc262_dac_nids,
9098 .dig_out_nid = ALC262_DIGOUT_NID,
9099 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9100 .channel_mode = alc262_modes,
9101 .input_mux = &alc262_capture_source,
9102 .unsol_event = alc262_hippo1_unsol_event,
9103 .init_hook = alc262_hippo1_automute,
9105 [ALC262_FUJITSU] = {
9106 .mixers = { alc262_fujitsu_mixer },
9107 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9108 alc262_fujitsu_unsol_verbs },
9109 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9110 .dac_nids = alc262_dac_nids,
9112 .dig_out_nid = ALC262_DIGOUT_NID,
9113 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9114 .channel_mode = alc262_modes,
9115 .input_mux = &alc262_fujitsu_capture_source,
9116 .unsol_event = alc262_fujitsu_unsol_event,
9119 .mixers = { alc262_HP_BPC_mixer },
9120 .init_verbs = { alc262_HP_BPC_init_verbs },
9121 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9122 .dac_nids = alc262_dac_nids,
9124 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9125 .channel_mode = alc262_modes,
9126 .input_mux = &alc262_HP_capture_source,
9128 [ALC262_HP_BPC_D7000_WF] = {
9129 .mixers = { alc262_HP_BPC_WildWest_mixer },
9130 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9131 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9132 .dac_nids = alc262_dac_nids,
9134 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9135 .channel_mode = alc262_modes,
9136 .input_mux = &alc262_HP_D7000_capture_source,
9138 [ALC262_HP_BPC_D7000_WL] = {
9139 .mixers = { alc262_HP_BPC_WildWest_mixer,
9140 alc262_HP_BPC_WildWest_option_mixer },
9141 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9142 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9143 .dac_nids = alc262_dac_nids,
9145 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9146 .channel_mode = alc262_modes,
9147 .input_mux = &alc262_HP_D7000_capture_source,
9149 [ALC262_HP_TC_T5735] = {
9150 .mixers = { alc262_hp_t5735_mixer },
9151 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9152 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9153 .dac_nids = alc262_dac_nids,
9155 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9156 .channel_mode = alc262_modes,
9157 .input_mux = &alc262_capture_source,
9158 .unsol_event = alc262_hp_t5735_unsol_event,
9159 .init_hook = alc262_hp_t5735_init_hook,
9161 [ALC262_HP_RP5700] = {
9162 .mixers = { alc262_hp_rp5700_mixer },
9163 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9164 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9165 .dac_nids = alc262_dac_nids,
9166 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9167 .channel_mode = alc262_modes,
9168 .input_mux = &alc262_hp_rp5700_capture_source,
9170 [ALC262_BENQ_ED8] = {
9171 .mixers = { alc262_base_mixer },
9172 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9173 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9174 .dac_nids = alc262_dac_nids,
9176 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9177 .channel_mode = alc262_modes,
9178 .input_mux = &alc262_capture_source,
9180 [ALC262_SONY_ASSAMD] = {
9181 .mixers = { alc262_sony_mixer },
9182 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9183 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9184 .dac_nids = alc262_dac_nids,
9186 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9187 .channel_mode = alc262_modes,
9188 .input_mux = &alc262_capture_source,
9189 .unsol_event = alc262_hippo_unsol_event,
9190 .init_hook = alc262_hippo_automute,
9192 [ALC262_BENQ_T31] = {
9193 .mixers = { alc262_benq_t31_mixer },
9194 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9195 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9196 .dac_nids = alc262_dac_nids,
9198 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9199 .channel_mode = alc262_modes,
9200 .input_mux = &alc262_capture_source,
9201 .unsol_event = alc262_hippo_unsol_event,
9202 .init_hook = alc262_hippo_automute,
9205 .mixers = { alc262_ultra_mixer },
9206 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
9207 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9208 .dac_nids = alc262_dac_nids,
9210 .dig_out_nid = ALC262_DIGOUT_NID,
9211 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9212 .channel_mode = alc262_modes,
9213 .input_mux = &alc262_ultra_capture_source,
9214 .unsol_event = alc262_ultra_unsol_event,
9215 .init_hook = alc262_ultra_automute,
9219 static int patch_alc262(struct hda_codec *codec)
9221 struct alc_spec *spec;
9225 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9231 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9236 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9237 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9238 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9239 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9243 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9247 if (board_config < 0) {
9248 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9249 "trying auto-probe from BIOS...\n");
9250 board_config = ALC262_AUTO;
9253 if (board_config == ALC262_AUTO) {
9254 /* automatic parse from the BIOS config */
9255 err = alc262_parse_auto_config(codec);
9261 "hda_codec: Cannot set up configuration "
9262 "from BIOS. Using base mode...\n");
9263 board_config = ALC262_BASIC;
9267 if (board_config != ALC262_AUTO)
9268 setup_preset(spec, &alc262_presets[board_config]);
9270 spec->stream_name_analog = "ALC262 Analog";
9271 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9272 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9274 spec->stream_name_digital = "ALC262 Digital";
9275 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9276 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9278 if (!spec->adc_nids && spec->input_mux) {
9279 /* check whether NID 0x07 is valid */
9280 unsigned int wcap = get_wcaps(codec, 0x07);
9283 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9284 if (wcap != AC_WID_AUD_IN) {
9285 spec->adc_nids = alc262_adc_nids_alt;
9286 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9287 spec->mixers[spec->num_mixers] =
9288 alc262_capture_alt_mixer;
9291 spec->adc_nids = alc262_adc_nids;
9292 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9293 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9298 spec->vmaster_nid = 0x0c;
9300 codec->patch_ops = alc_patch_ops;
9301 if (board_config == ALC262_AUTO)
9302 spec->init_hook = alc262_auto_init;
9303 #ifdef CONFIG_SND_HDA_POWER_SAVE
9304 if (!spec->loopback.amplist)
9305 spec->loopback.amplist = alc262_loopbacks;
9312 * ALC268 channel source setting (2 channel)
9314 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9315 #define alc268_modes alc260_modes
9317 static hda_nid_t alc268_dac_nids[2] = {
9322 static hda_nid_t alc268_adc_nids[2] = {
9327 static hda_nid_t alc268_adc_nids_alt[1] = {
9332 static struct snd_kcontrol_new alc268_base_mixer[] = {
9333 /* output mixer control */
9334 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9335 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9336 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9338 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9339 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9340 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9344 static struct hda_verb alc268_eapd_verbs[] = {
9345 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9346 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9350 /* Toshiba specific */
9351 #define alc268_toshiba_automute alc262_hippo_automute
9353 static struct hda_verb alc268_toshiba_verbs[] = {
9354 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9359 /* bind volumes of both NID 0x02 and 0x03 */
9360 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9361 .ops = &snd_hda_bind_vol,
9363 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9364 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9369 /* mute/unmute internal speaker according to the hp jack and mute state */
9370 static void alc268_acer_automute(struct hda_codec *codec, int force)
9372 struct alc_spec *spec = codec->spec;
9375 if (force || !spec->sense_updated) {
9376 unsigned int present;
9377 present = snd_hda_codec_read(codec, 0x14, 0,
9378 AC_VERB_GET_PIN_SENSE, 0);
9379 spec->jack_present = (present & 0x80000000) != 0;
9380 spec->sense_updated = 1;
9382 if (spec->jack_present)
9383 mute = HDA_AMP_MUTE; /* mute internal speaker */
9384 else /* unmute internal speaker if necessary */
9385 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9386 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9387 HDA_AMP_MUTE, mute);
9391 /* bind hp and internal speaker mute (with plug check) */
9392 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9393 struct snd_ctl_elem_value *ucontrol)
9395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9396 long *valp = ucontrol->value.integer.value;
9399 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9401 valp[0] ? 0 : HDA_AMP_MUTE);
9402 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9404 valp[1] ? 0 : HDA_AMP_MUTE);
9406 alc268_acer_automute(codec, 0);
9410 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9411 /* output mixer control */
9412 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9415 .name = "Master Playback Switch",
9416 .info = snd_hda_mixer_amp_switch_info,
9417 .get = snd_hda_mixer_amp_switch_get,
9418 .put = alc268_acer_master_sw_put,
9419 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9423 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9427 static struct hda_verb alc268_acer_verbs[] = {
9428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9429 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9431 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9435 /* unsolicited event for HP jack sensing */
9436 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9439 if ((res >> 26) != ALC880_HP_EVENT)
9441 alc268_toshiba_automute(codec);
9444 static void alc268_acer_unsol_event(struct hda_codec *codec,
9447 if ((res >> 26) != ALC880_HP_EVENT)
9449 alc268_acer_automute(codec, 1);
9452 static void alc268_acer_init_hook(struct hda_codec *codec)
9454 alc268_acer_automute(codec, 1);
9457 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9458 /* output mixer control */
9459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9460 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9461 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9463 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9464 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9468 static struct hda_verb alc268_dell_verbs[] = {
9469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9471 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9475 /* mute/unmute internal speaker according to the hp jack and mute state */
9476 static void alc268_dell_automute(struct hda_codec *codec)
9478 unsigned int present;
9481 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9482 if (present & 0x80000000)
9483 mute = HDA_AMP_MUTE;
9485 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9486 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9487 HDA_AMP_MUTE, mute);
9490 static void alc268_dell_unsol_event(struct hda_codec *codec,
9493 if ((res >> 26) != ALC880_HP_EVENT)
9495 alc268_dell_automute(codec);
9498 #define alc268_dell_init_hook alc268_dell_automute
9501 * generic initialization of ADC, input mixers and output mixers
9503 static struct hda_verb alc268_base_init_verbs[] = {
9504 /* Unmute DAC0-1 and set vol = 0 */
9505 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9506 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9507 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9508 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9509 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9510 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9513 * Set up output mixers (0x0c - 0x0e)
9515 /* set vol=0 to output mixers */
9516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9519 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9522 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9526 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9528 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9529 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9530 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9531 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9535 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9537 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9538 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9539 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9540 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9542 /* Unmute Selector 23h,24h and set the default input to mic-in */
9544 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9546 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9553 * generic initialization of ADC, input mixers and output mixers
9555 static struct hda_verb alc268_volume_init_verbs[] = {
9556 /* set output DAC */
9557 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9558 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9559 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9560 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9562 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9564 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9565 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9566 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9570 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9571 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9572 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9574 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9575 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9577 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9579 /* set PCBEEP vol = 0 */
9580 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9585 #define alc268_mux_enum_info alc_mux_enum_info
9586 #define alc268_mux_enum_get alc_mux_enum_get
9588 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9589 struct snd_ctl_elem_value *ucontrol)
9591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9592 struct alc_spec *spec = codec->spec;
9594 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9595 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9596 hda_nid_t nid = capture_mixers[adc_idx];
9598 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9600 &spec->cur_mux[adc_idx]);
9603 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9604 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9605 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9608 /* The multiple "Capture Source" controls confuse alsamixer
9609 * So call somewhat different..
9611 /* .name = "Capture Source", */
9612 .name = "Input Source",
9614 .info = alc268_mux_enum_info,
9615 .get = alc268_mux_enum_get,
9616 .put = alc268_mux_enum_put,
9621 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9622 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9623 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9624 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9625 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9627 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9628 /* The multiple "Capture Source" controls confuse alsamixer
9629 * So call somewhat different..
9631 /* .name = "Capture Source", */
9632 .name = "Input Source",
9634 .info = alc268_mux_enum_info,
9635 .get = alc268_mux_enum_get,
9636 .put = alc268_mux_enum_put,
9641 static struct hda_input_mux alc268_capture_source = {
9645 { "Front Mic", 0x1 },
9651 #ifdef CONFIG_SND_DEBUG
9652 static struct snd_kcontrol_new alc268_test_mixer[] = {
9653 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9654 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9655 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9658 /* Volume widgets */
9659 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9660 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9661 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9662 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9663 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9664 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9665 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9666 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9667 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9668 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9669 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9670 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9671 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9672 /* The below appears problematic on some hardwares */
9673 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
9674 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9675 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9676 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9677 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9679 /* Modes for retasking pin widgets */
9680 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9681 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9682 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9683 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9685 /* Controls for GPIO pins, assuming they are configured as outputs */
9686 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9687 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9688 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9689 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9691 /* Switches to allow the digital SPDIF output pin to be enabled.
9692 * The ALC268 does not have an SPDIF input.
9694 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9696 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9697 * this output to turn on an external amplifier.
9699 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9700 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9706 /* create input playback/capture controls for the given pin */
9707 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9708 const char *ctlname, int idx)
9713 sprintf(name, "%s Playback Volume", ctlname);
9715 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9716 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9720 } else if (nid == 0x15) {
9721 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9722 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9728 sprintf(name, "%s Playback Switch", ctlname);
9729 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9730 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9736 /* add playback controls from the parsed DAC table */
9737 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9738 const struct auto_pin_cfg *cfg)
9743 spec->multiout.num_dacs = 2; /* only use one dac */
9744 spec->multiout.dac_nids = spec->private_dac_nids;
9745 spec->multiout.dac_nids[0] = 2;
9746 spec->multiout.dac_nids[1] = 3;
9748 nid = cfg->line_out_pins[0];
9750 alc268_new_analog_output(spec, nid, "Front", 0);
9752 nid = cfg->speaker_pins[0];
9754 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9755 "Speaker Playback Volume",
9756 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9760 nid = cfg->hp_pins[0];
9762 alc268_new_analog_output(spec, nid, "Headphone", 0);
9764 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9766 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9767 "Mono Playback Switch",
9768 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9775 /* create playback/capture controls for input pins */
9776 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9777 const struct auto_pin_cfg *cfg)
9779 struct hda_input_mux *imux = &spec->private_imux;
9782 for (i = 0; i < AUTO_PIN_LAST; i++) {
9783 switch(cfg->input_pins[i]) {
9785 idx1 = 0; /* Mic 1 */
9788 idx1 = 1; /* Mic 2 */
9791 idx1 = 2; /* Line In */
9799 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9800 imux->items[imux->num_items].index = idx1;
9806 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9808 struct alc_spec *spec = codec->spec;
9809 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9810 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9811 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9812 unsigned int dac_vol1, dac_vol2;
9815 snd_hda_codec_write(codec, speaker_nid, 0,
9816 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9817 snd_hda_codec_write(codec, 0x0f, 0,
9818 AC_VERB_SET_AMP_GAIN_MUTE,
9820 snd_hda_codec_write(codec, 0x10, 0,
9821 AC_VERB_SET_AMP_GAIN_MUTE,
9824 snd_hda_codec_write(codec, 0x0f, 0,
9825 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9826 snd_hda_codec_write(codec, 0x10, 0,
9827 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9830 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9831 if (line_nid == 0x14)
9832 dac_vol2 = AMP_OUT_ZERO;
9833 else if (line_nid == 0x15)
9834 dac_vol1 = AMP_OUT_ZERO;
9836 dac_vol2 = AMP_OUT_ZERO;
9837 else if (hp_nid == 0x15)
9838 dac_vol1 = AMP_OUT_ZERO;
9839 if (line_nid != 0x16 || hp_nid != 0x16 ||
9840 spec->autocfg.line_out_pins[1] != 0x16 ||
9841 spec->autocfg.line_out_pins[2] != 0x16)
9842 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9844 snd_hda_codec_write(codec, 0x02, 0,
9845 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9846 snd_hda_codec_write(codec, 0x03, 0,
9847 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9850 /* pcm configuration: identiacal with ALC880 */
9851 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9852 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9853 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9854 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9857 * BIOS auto configuration
9859 static int alc268_parse_auto_config(struct hda_codec *codec)
9861 struct alc_spec *spec = codec->spec;
9863 static hda_nid_t alc268_ignore[] = { 0 };
9865 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9869 if (!spec->autocfg.line_outs)
9870 return 0; /* can't find valid BIOS pin config */
9872 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9875 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9879 spec->multiout.max_channels = 2;
9881 /* digital only support output */
9882 if (spec->autocfg.dig_out_pin)
9883 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9885 if (spec->kctl_alloc)
9886 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9888 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9889 spec->num_mux_defs = 1;
9890 spec->input_mux = &spec->private_imux;
9892 err = alc_auto_add_mic_boost(codec);
9899 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9900 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9901 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9903 /* init callback for auto-configuration model -- overriding the default init */
9904 static void alc268_auto_init(struct hda_codec *codec)
9906 alc268_auto_init_multi_out(codec);
9907 alc268_auto_init_hp_out(codec);
9908 alc268_auto_init_mono_speaker_out(codec);
9909 alc268_auto_init_analog_input(codec);
9913 * configuration and preset
9915 static const char *alc268_models[ALC268_MODEL_LAST] = {
9916 [ALC268_3ST] = "3stack",
9917 [ALC268_TOSHIBA] = "toshiba",
9918 [ALC268_ACER] = "acer",
9919 [ALC268_DELL] = "dell",
9920 #ifdef CONFIG_SND_DEBUG
9921 [ALC268_TEST] = "test",
9923 [ALC268_AUTO] = "auto",
9926 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9927 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9928 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9929 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
9930 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9931 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9932 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9933 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9934 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9938 static struct alc_config_preset alc268_presets[] = {
9940 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9941 .init_verbs = { alc268_base_init_verbs },
9942 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9943 .dac_nids = alc268_dac_nids,
9944 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9945 .adc_nids = alc268_adc_nids_alt,
9947 .dig_out_nid = ALC268_DIGOUT_NID,
9948 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9949 .channel_mode = alc268_modes,
9950 .input_mux = &alc268_capture_source,
9952 [ALC268_TOSHIBA] = {
9953 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9954 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9955 alc268_toshiba_verbs },
9956 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9957 .dac_nids = alc268_dac_nids,
9958 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9959 .adc_nids = alc268_adc_nids_alt,
9961 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9962 .channel_mode = alc268_modes,
9963 .input_mux = &alc268_capture_source,
9964 .unsol_event = alc268_toshiba_unsol_event,
9965 .init_hook = alc268_toshiba_automute,
9968 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9969 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9970 alc268_acer_verbs },
9971 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9972 .dac_nids = alc268_dac_nids,
9973 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9974 .adc_nids = alc268_adc_nids_alt,
9976 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9977 .channel_mode = alc268_modes,
9978 .input_mux = &alc268_capture_source,
9979 .unsol_event = alc268_acer_unsol_event,
9980 .init_hook = alc268_acer_init_hook,
9983 .mixers = { alc268_dell_mixer },
9984 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9985 alc268_dell_verbs },
9986 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9987 .dac_nids = alc268_dac_nids,
9989 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9990 .channel_mode = alc268_modes,
9991 .unsol_event = alc268_dell_unsol_event,
9992 .init_hook = alc268_dell_init_hook,
9993 .input_mux = &alc268_capture_source,
9995 #ifdef CONFIG_SND_DEBUG
9997 .mixers = { alc268_test_mixer, alc268_capture_mixer },
9998 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9999 alc268_volume_init_verbs },
10000 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10001 .dac_nids = alc268_dac_nids,
10002 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10003 .adc_nids = alc268_adc_nids_alt,
10005 .dig_out_nid = ALC268_DIGOUT_NID,
10006 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10007 .channel_mode = alc268_modes,
10008 .input_mux = &alc268_capture_source,
10013 static int patch_alc268(struct hda_codec *codec)
10015 struct alc_spec *spec;
10019 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10023 codec->spec = spec;
10025 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10029 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10030 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10031 "trying auto-probe from BIOS...\n");
10032 board_config = ALC268_AUTO;
10035 if (board_config == ALC268_AUTO) {
10036 /* automatic parse from the BIOS config */
10037 err = alc268_parse_auto_config(codec);
10043 "hda_codec: Cannot set up configuration "
10044 "from BIOS. Using base mode...\n");
10045 board_config = ALC268_3ST;
10049 if (board_config != ALC268_AUTO)
10050 setup_preset(spec, &alc268_presets[board_config]);
10052 spec->stream_name_analog = "ALC268 Analog";
10053 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10054 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10055 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10057 spec->stream_name_digital = "ALC268 Digital";
10058 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10060 if (!spec->adc_nids && spec->input_mux) {
10061 /* check whether NID 0x07 is valid */
10062 unsigned int wcap = get_wcaps(codec, 0x07);
10065 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10066 if (wcap != AC_WID_AUD_IN) {
10067 spec->adc_nids = alc268_adc_nids_alt;
10068 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10069 spec->mixers[spec->num_mixers] =
10070 alc268_capture_alt_mixer;
10071 spec->num_mixers++;
10073 spec->adc_nids = alc268_adc_nids;
10074 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10075 spec->mixers[spec->num_mixers] =
10076 alc268_capture_mixer;
10077 spec->num_mixers++;
10081 spec->vmaster_nid = 0x02;
10083 codec->patch_ops = alc_patch_ops;
10084 if (board_config == ALC268_AUTO)
10085 spec->init_hook = alc268_auto_init;
10091 * ALC269 channel source setting (2 channel)
10093 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10095 #define alc269_dac_nids alc260_dac_nids
10097 static hda_nid_t alc269_adc_nids[1] = {
10102 #define alc269_modes alc260_modes
10103 #define alc269_capture_source alc880_lg_lw_capture_source
10105 static struct snd_kcontrol_new alc269_base_mixer[] = {
10106 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10107 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10117 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10121 /* capture mixer elements */
10122 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10123 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10124 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10127 /* The multiple "Capture Source" controls confuse alsamixer
10128 * So call somewhat different..
10130 /* .name = "Capture Source", */
10131 .name = "Input Source",
10133 .info = alc_mux_enum_info,
10134 .get = alc_mux_enum_get,
10135 .put = alc_mux_enum_put,
10141 * generic initialization of ADC, input mixers and output mixers
10143 static struct hda_verb alc269_init_verbs[] = {
10145 * Unmute ADC0 and set the default input to mic-in
10147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10149 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10150 * analog-loopback mixer widget
10151 * Note: PASD motherboards uses the Line In 2 as the input for
10152 * front panel mic (mic 2)
10154 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10159 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10162 * Set up output mixers (0x0c - 0x0e)
10164 /* set vol=0 to output mixers */
10165 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10166 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10168 /* set up input amps for analog loopback */
10169 /* Amp Indices: DAC = 0, mixer = 1 */
10170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10172 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10173 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10177 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10179 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10185 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10187 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10193 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10196 /* FIXME: use matrix-type input source selection */
10197 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10198 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10205 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10206 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10210 /* add playback controls from the parsed DAC table */
10211 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10212 const struct auto_pin_cfg *cfg)
10217 spec->multiout.num_dacs = 1; /* only use one dac */
10218 spec->multiout.dac_nids = spec->private_dac_nids;
10219 spec->multiout.dac_nids[0] = 2;
10221 nid = cfg->line_out_pins[0];
10223 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10224 "Front Playback Volume",
10225 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10228 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10229 "Front Playback Switch",
10230 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10235 nid = cfg->speaker_pins[0];
10237 if (!cfg->line_out_pins[0]) {
10238 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10239 "Speaker Playback Volume",
10240 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10246 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10247 "Speaker Playback Switch",
10248 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10253 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10254 "Speaker Playback Switch",
10255 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10261 nid = cfg->hp_pins[0];
10263 /* spec->multiout.hp_nid = 2; */
10264 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10265 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10266 "Headphone Playback Volume",
10267 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10273 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10274 "Headphone Playback Switch",
10275 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10280 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10281 "Headphone Playback Switch",
10282 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10291 #define alc269_auto_create_analog_input_ctls \
10292 alc880_auto_create_analog_input_ctls
10294 #ifdef CONFIG_SND_HDA_POWER_SAVE
10295 #define alc269_loopbacks alc880_loopbacks
10298 /* pcm configuration: identiacal with ALC880 */
10299 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10300 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10301 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10302 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10305 * BIOS auto configuration
10307 static int alc269_parse_auto_config(struct hda_codec *codec)
10309 struct alc_spec *spec = codec->spec;
10311 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10313 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10318 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10321 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10325 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10327 if (spec->autocfg.dig_out_pin)
10328 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10330 if (spec->kctl_alloc)
10331 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10333 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10334 spec->num_mux_defs = 1;
10335 spec->input_mux = &spec->private_imux;
10337 err = alc_auto_add_mic_boost(codec);
10344 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10345 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10346 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10349 /* init callback for auto-configuration model -- overriding the default init */
10350 static void alc269_auto_init(struct hda_codec *codec)
10352 alc269_auto_init_multi_out(codec);
10353 alc269_auto_init_hp_out(codec);
10354 alc269_auto_init_analog_input(codec);
10358 * configuration and preset
10360 static const char *alc269_models[ALC269_MODEL_LAST] = {
10361 [ALC269_BASIC] = "basic",
10364 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10368 static struct alc_config_preset alc269_presets[] = {
10370 .mixers = { alc269_base_mixer },
10371 .init_verbs = { alc269_init_verbs },
10372 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10373 .dac_nids = alc269_dac_nids,
10375 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10376 .channel_mode = alc269_modes,
10377 .input_mux = &alc269_capture_source,
10381 static int patch_alc269(struct hda_codec *codec)
10383 struct alc_spec *spec;
10387 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10391 codec->spec = spec;
10393 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10397 if (board_config < 0) {
10398 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10399 "trying auto-probe from BIOS...\n");
10400 board_config = ALC269_AUTO;
10403 if (board_config == ALC269_AUTO) {
10404 /* automatic parse from the BIOS config */
10405 err = alc269_parse_auto_config(codec);
10411 "hda_codec: Cannot set up configuration "
10412 "from BIOS. Using base mode...\n");
10413 board_config = ALC269_BASIC;
10417 if (board_config != ALC269_AUTO)
10418 setup_preset(spec, &alc269_presets[board_config]);
10420 spec->stream_name_analog = "ALC269 Analog";
10421 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10422 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10424 spec->stream_name_digital = "ALC269 Digital";
10425 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10426 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10428 spec->adc_nids = alc269_adc_nids;
10429 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10430 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10431 spec->num_mixers++;
10433 codec->patch_ops = alc_patch_ops;
10434 if (board_config == ALC269_AUTO)
10435 spec->init_hook = alc269_auto_init;
10436 #ifdef CONFIG_SND_HDA_POWER_SAVE
10437 if (!spec->loopback.amplist)
10438 spec->loopback.amplist = alc269_loopbacks;
10445 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10449 * set the path ways for 2 channel output
10450 * need to set the codec line out and mic 1 pin widgets to inputs
10452 static struct hda_verb alc861_threestack_ch2_init[] = {
10453 /* set pin widget 1Ah (line in) for input */
10454 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10455 /* set pin widget 18h (mic1/2) for input, for mic also enable
10458 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10460 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10462 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10469 * need to set the codec line out and mic 1 pin widgets to outputs
10471 static struct hda_verb alc861_threestack_ch6_init[] = {
10472 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10473 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10474 /* set pin widget 18h (mic1) for output (CLFE)*/
10475 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10477 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10478 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10480 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10482 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10488 static struct hda_channel_mode alc861_threestack_modes[2] = {
10489 { 2, alc861_threestack_ch2_init },
10490 { 6, alc861_threestack_ch6_init },
10492 /* Set mic1 as input and unmute the mixer */
10493 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10494 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10495 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10498 /* Set mic1 as output and mute mixer */
10499 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10500 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10501 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10505 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10506 { 2, alc861_uniwill_m31_ch2_init },
10507 { 4, alc861_uniwill_m31_ch4_init },
10510 /* Set mic1 and line-in as input and unmute the mixer */
10511 static struct hda_verb alc861_asus_ch2_init[] = {
10512 /* set pin widget 1Ah (line in) for input */
10513 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10514 /* set pin widget 18h (mic1/2) for input, for mic also enable
10517 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10519 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10521 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10522 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10526 /* Set mic1 nad line-in as output and mute mixer */
10527 static struct hda_verb alc861_asus_ch6_init[] = {
10528 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10529 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10530 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10531 /* set pin widget 18h (mic1) for output (CLFE)*/
10532 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10533 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10534 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10535 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10537 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10539 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10540 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10545 static struct hda_channel_mode alc861_asus_modes[2] = {
10546 { 2, alc861_asus_ch2_init },
10547 { 6, alc861_asus_ch6_init },
10552 static struct snd_kcontrol_new alc861_base_mixer[] = {
10553 /* output mixer control */
10554 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10555 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10556 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10557 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10558 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10560 /*Input mixer control */
10561 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10562 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10563 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10564 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10565 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10566 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10568 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10572 /* Capture mixer control */
10573 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10574 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10576 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10577 .name = "Capture Source",
10579 .info = alc_mux_enum_info,
10580 .get = alc_mux_enum_get,
10581 .put = alc_mux_enum_put,
10586 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10587 /* output mixer control */
10588 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10589 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10590 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10591 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10592 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10594 /* Input mixer control */
10595 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10596 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10597 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10598 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10599 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10600 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10602 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10606 /* Capture mixer control */
10607 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10608 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10611 .name = "Capture Source",
10613 .info = alc_mux_enum_info,
10614 .get = alc_mux_enum_get,
10615 .put = alc_mux_enum_put,
10618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10619 .name = "Channel Mode",
10620 .info = alc_ch_mode_info,
10621 .get = alc_ch_mode_get,
10622 .put = alc_ch_mode_put,
10623 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10628 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10629 /* output mixer control */
10630 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10632 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10634 /*Capture mixer control */
10635 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10636 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10639 .name = "Capture Source",
10641 .info = alc_mux_enum_info,
10642 .get = alc_mux_enum_get,
10643 .put = alc_mux_enum_put,
10649 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10650 /* output mixer control */
10651 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10652 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10653 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10654 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10655 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10657 /* Input mixer control */
10658 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10659 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10660 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10661 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10662 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10663 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10665 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10666 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10669 /* Capture mixer control */
10670 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10671 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10673 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10674 .name = "Capture Source",
10676 .info = alc_mux_enum_info,
10677 .get = alc_mux_enum_get,
10678 .put = alc_mux_enum_put,
10681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10682 .name = "Channel Mode",
10683 .info = alc_ch_mode_info,
10684 .get = alc_ch_mode_get,
10685 .put = alc_ch_mode_put,
10686 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10691 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10692 /* output mixer control */
10693 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10694 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10695 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10696 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10697 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10699 /* Input mixer control */
10700 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10701 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10702 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10703 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10704 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10705 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10707 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10711 /* Capture mixer control */
10712 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10713 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10716 .name = "Capture Source",
10718 .info = alc_mux_enum_info,
10719 .get = alc_mux_enum_get,
10720 .put = alc_mux_enum_put,
10723 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10724 .name = "Channel Mode",
10725 .info = alc_ch_mode_info,
10726 .get = alc_ch_mode_get,
10727 .put = alc_ch_mode_put,
10728 .private_value = ARRAY_SIZE(alc861_asus_modes),
10733 /* additional mixer */
10734 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10735 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10736 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10737 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10738 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10743 * generic initialization of ADC, input mixers and output mixers
10745 static struct hda_verb alc861_base_init_verbs[] = {
10747 * Unmute ADC0 and set the default input to mic-in
10749 /* port-A for surround (rear panel) */
10750 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10751 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10752 /* port-B for mic-in (rear panel) with vref */
10753 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10754 /* port-C for line-in (rear panel) */
10755 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10756 /* port-D for Front */
10757 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10758 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10759 /* port-E for HP out (front panel) */
10760 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10761 /* route front PCM to HP */
10762 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10763 /* port-F for mic-in (front panel) with vref */
10764 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10765 /* port-G for CLFE (rear panel) */
10766 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10767 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10768 /* port-H for side (rear panel) */
10769 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10770 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10772 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10773 /* route front mic to ADC1*/
10774 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10775 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10777 /* Unmute DAC0~3 & spdif out*/
10778 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10779 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10780 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10781 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10784 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10785 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10786 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10787 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10788 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10790 /* Unmute Stereo Mixer 15 */
10791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10797 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10799 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10804 /* hp used DAC 3 (Front) */
10805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10806 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10811 static struct hda_verb alc861_threestack_init_verbs[] = {
10813 * Unmute ADC0 and set the default input to mic-in
10815 /* port-A for surround (rear panel) */
10816 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10817 /* port-B for mic-in (rear panel) with vref */
10818 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10819 /* port-C for line-in (rear panel) */
10820 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10821 /* port-D for Front */
10822 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10823 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10824 /* port-E for HP out (front panel) */
10825 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10826 /* route front PCM to HP */
10827 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10828 /* port-F for mic-in (front panel) with vref */
10829 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10830 /* port-G for CLFE (rear panel) */
10831 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10832 /* port-H for side (rear panel) */
10833 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10835 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10836 /* route front mic to ADC1*/
10837 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10838 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10839 /* Unmute DAC0~3 & spdif out*/
10840 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10841 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10842 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10843 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10846 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10847 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10848 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10849 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10850 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10852 /* Unmute Stereo Mixer 15 */
10853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10860 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10861 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10864 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10866 /* hp used DAC 3 (Front) */
10867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10872 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10874 * Unmute ADC0 and set the default input to mic-in
10876 /* port-A for surround (rear panel) */
10877 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10878 /* port-B for mic-in (rear panel) with vref */
10879 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10880 /* port-C for line-in (rear panel) */
10881 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10882 /* port-D for Front */
10883 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10884 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10885 /* port-E for HP out (front panel) */
10886 /* this has to be set to VREF80 */
10887 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10888 /* route front PCM to HP */
10889 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10890 /* port-F for mic-in (front panel) with vref */
10891 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10892 /* port-G for CLFE (rear panel) */
10893 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10894 /* port-H for side (rear panel) */
10895 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10897 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10898 /* route front mic to ADC1*/
10899 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10901 /* Unmute DAC0~3 & spdif out*/
10902 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10903 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10904 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10905 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10908 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10909 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10910 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10911 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10912 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10914 /* Unmute Stereo Mixer 15 */
10915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10922 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10923 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10924 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10925 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10926 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10928 /* hp used DAC 3 (Front) */
10929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10934 static struct hda_verb alc861_asus_init_verbs[] = {
10936 * Unmute ADC0 and set the default input to mic-in
10938 /* port-A for surround (rear panel)
10939 * according to codec#0 this is the HP jack
10941 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10942 /* route front PCM to HP */
10943 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10944 /* port-B for mic-in (rear panel) with vref */
10945 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10946 /* port-C for line-in (rear panel) */
10947 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10948 /* port-D for Front */
10949 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10950 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10951 /* port-E for HP out (front panel) */
10952 /* this has to be set to VREF80 */
10953 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10954 /* route front PCM to HP */
10955 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10956 /* port-F for mic-in (front panel) with vref */
10957 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10958 /* port-G for CLFE (rear panel) */
10959 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10960 /* port-H for side (rear panel) */
10961 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10963 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10964 /* route front mic to ADC1*/
10965 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10966 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10967 /* Unmute DAC0~3 & spdif out*/
10968 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10969 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10970 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10971 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10973 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10974 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10975 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10976 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10977 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10979 /* Unmute Stereo Mixer 15 */
10980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10981 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10982 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10985 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10986 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10988 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10989 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10990 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10991 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10992 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10993 /* hp used DAC 3 (Front) */
10994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10995 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10999 /* additional init verbs for ASUS laptops */
11000 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11001 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11002 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11007 * generic initialization of ADC, input mixers and output mixers
11009 static struct hda_verb alc861_auto_init_verbs[] = {
11011 * Unmute ADC0 and set the default input to mic-in
11013 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11016 /* Unmute DAC0~3 & spdif out*/
11017 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11018 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11019 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11020 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11023 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11024 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11025 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11026 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11027 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11029 /* Unmute Stereo Mixer 15 */
11030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11032 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11035 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11036 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11037 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11038 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11040 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11041 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11042 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11046 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11047 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11050 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11051 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11053 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11058 static struct hda_verb alc861_toshiba_init_verbs[] = {
11059 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11064 /* toggle speaker-output according to the hp-jack state */
11065 static void alc861_toshiba_automute(struct hda_codec *codec)
11067 unsigned int present;
11069 present = snd_hda_codec_read(codec, 0x0f, 0,
11070 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11071 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11072 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11073 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11074 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11077 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11080 if ((res >> 26) == ALC880_HP_EVENT)
11081 alc861_toshiba_automute(codec);
11084 /* pcm configuration: identiacal with ALC880 */
11085 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11086 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11087 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11088 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11091 #define ALC861_DIGOUT_NID 0x07
11093 static struct hda_channel_mode alc861_8ch_modes[1] = {
11097 static hda_nid_t alc861_dac_nids[4] = {
11098 /* front, surround, clfe, side */
11099 0x03, 0x06, 0x05, 0x04
11102 static hda_nid_t alc660_dac_nids[3] = {
11103 /* front, clfe, surround */
11107 static hda_nid_t alc861_adc_nids[1] = {
11112 static struct hda_input_mux alc861_capture_source = {
11116 { "Front Mic", 0x3 },
11123 /* fill in the dac_nids table from the parsed pin configuration */
11124 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11125 const struct auto_pin_cfg *cfg)
11130 spec->multiout.dac_nids = spec->private_dac_nids;
11131 for (i = 0; i < cfg->line_outs; i++) {
11132 nid = cfg->line_out_pins[i];
11134 if (i >= ARRAY_SIZE(alc861_dac_nids))
11136 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11139 spec->multiout.num_dacs = cfg->line_outs;
11143 /* add playback controls from the parsed DAC table */
11144 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11145 const struct auto_pin_cfg *cfg)
11148 static const char *chname[4] = {
11149 "Front", "Surround", NULL /*CLFE*/, "Side"
11154 for (i = 0; i < cfg->line_outs; i++) {
11155 nid = spec->multiout.dac_nids[i];
11160 err = add_control(spec, ALC_CTL_BIND_MUTE,
11161 "Center Playback Switch",
11162 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11166 err = add_control(spec, ALC_CTL_BIND_MUTE,
11167 "LFE Playback Switch",
11168 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11173 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11175 if (nid == alc861_dac_nids[idx])
11177 sprintf(name, "%s Playback Switch", chname[idx]);
11178 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11179 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11188 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11196 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11198 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11199 "Headphone Playback Switch",
11200 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11203 spec->multiout.hp_nid = nid;
11208 /* create playback/capture controls for input pins */
11209 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11210 const struct auto_pin_cfg *cfg)
11212 struct hda_input_mux *imux = &spec->private_imux;
11213 int i, err, idx, idx1;
11215 for (i = 0; i < AUTO_PIN_LAST; i++) {
11216 switch (cfg->input_pins[i]) {
11219 idx = 2; /* Line In */
11223 idx = 2; /* Line In */
11227 idx = 1; /* Mic In */
11231 idx = 1; /* Mic In */
11241 err = new_analog_input(spec, cfg->input_pins[i],
11242 auto_pin_cfg_labels[i], idx, 0x15);
11246 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11247 imux->items[imux->num_items].index = idx1;
11253 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11254 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11255 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11259 /* The multiple "Capture Source" controls confuse alsamixer
11260 * So call somewhat different..
11262 /* .name = "Capture Source", */
11263 .name = "Input Source",
11265 .info = alc_mux_enum_info,
11266 .get = alc_mux_enum_get,
11267 .put = alc_mux_enum_put,
11272 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11274 int pin_type, int dac_idx)
11276 /* set as output */
11278 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11280 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11285 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11287 struct alc_spec *spec = codec->spec;
11290 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11291 for (i = 0; i < spec->autocfg.line_outs; i++) {
11292 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11293 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11295 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11296 spec->multiout.dac_nids[i]);
11300 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11302 struct alc_spec *spec = codec->spec;
11305 pin = spec->autocfg.hp_pins[0];
11306 if (pin) /* connect to front */
11307 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11308 spec->multiout.dac_nids[0]);
11311 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11313 struct alc_spec *spec = codec->spec;
11316 for (i = 0; i < AUTO_PIN_LAST; i++) {
11317 hda_nid_t nid = spec->autocfg.input_pins[i];
11318 if (nid >= 0x0c && nid <= 0x11) {
11319 snd_hda_codec_write(codec, nid, 0,
11320 AC_VERB_SET_PIN_WIDGET_CONTROL,
11321 i <= AUTO_PIN_FRONT_MIC ?
11322 PIN_VREF80 : PIN_IN);
11327 /* parse the BIOS configuration and set up the alc_spec */
11328 /* return 1 if successful, 0 if the proper config is not found,
11329 * or a negative error code
11331 static int alc861_parse_auto_config(struct hda_codec *codec)
11333 struct alc_spec *spec = codec->spec;
11335 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11337 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11341 if (!spec->autocfg.line_outs)
11342 return 0; /* can't find valid BIOS pin config */
11344 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11347 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11350 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11353 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11357 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11359 if (spec->autocfg.dig_out_pin)
11360 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11362 if (spec->kctl_alloc)
11363 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11365 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11367 spec->num_mux_defs = 1;
11368 spec->input_mux = &spec->private_imux;
11370 spec->adc_nids = alc861_adc_nids;
11371 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11372 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11373 spec->num_mixers++;
11378 /* additional initialization for auto-configuration model */
11379 static void alc861_auto_init(struct hda_codec *codec)
11381 alc861_auto_init_multi_out(codec);
11382 alc861_auto_init_hp_out(codec);
11383 alc861_auto_init_analog_input(codec);
11386 #ifdef CONFIG_SND_HDA_POWER_SAVE
11387 static struct hda_amp_list alc861_loopbacks[] = {
11388 { 0x15, HDA_INPUT, 0 },
11389 { 0x15, HDA_INPUT, 1 },
11390 { 0x15, HDA_INPUT, 2 },
11391 { 0x15, HDA_INPUT, 3 },
11398 * configuration and preset
11400 static const char *alc861_models[ALC861_MODEL_LAST] = {
11401 [ALC861_3ST] = "3stack",
11402 [ALC660_3ST] = "3stack-660",
11403 [ALC861_3ST_DIG] = "3stack-dig",
11404 [ALC861_6ST_DIG] = "6stack-dig",
11405 [ALC861_UNIWILL_M31] = "uniwill-m31",
11406 [ALC861_TOSHIBA] = "toshiba",
11407 [ALC861_ASUS] = "asus",
11408 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11409 [ALC861_AUTO] = "auto",
11412 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11413 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11414 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11415 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11416 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11417 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11418 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11419 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11420 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11421 * Any other models that need this preset?
11423 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11424 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11425 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11426 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11427 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11428 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11429 /* FIXME: the below seems conflict */
11430 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11431 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11432 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11436 static struct alc_config_preset alc861_presets[] = {
11438 .mixers = { alc861_3ST_mixer },
11439 .init_verbs = { alc861_threestack_init_verbs },
11440 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11441 .dac_nids = alc861_dac_nids,
11442 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11443 .channel_mode = alc861_threestack_modes,
11445 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11446 .adc_nids = alc861_adc_nids,
11447 .input_mux = &alc861_capture_source,
11449 [ALC861_3ST_DIG] = {
11450 .mixers = { alc861_base_mixer },
11451 .init_verbs = { alc861_threestack_init_verbs },
11452 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11453 .dac_nids = alc861_dac_nids,
11454 .dig_out_nid = ALC861_DIGOUT_NID,
11455 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11456 .channel_mode = alc861_threestack_modes,
11458 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11459 .adc_nids = alc861_adc_nids,
11460 .input_mux = &alc861_capture_source,
11462 [ALC861_6ST_DIG] = {
11463 .mixers = { alc861_base_mixer },
11464 .init_verbs = { alc861_base_init_verbs },
11465 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11466 .dac_nids = alc861_dac_nids,
11467 .dig_out_nid = ALC861_DIGOUT_NID,
11468 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11469 .channel_mode = alc861_8ch_modes,
11470 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11471 .adc_nids = alc861_adc_nids,
11472 .input_mux = &alc861_capture_source,
11475 .mixers = { alc861_3ST_mixer },
11476 .init_verbs = { alc861_threestack_init_verbs },
11477 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11478 .dac_nids = alc660_dac_nids,
11479 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11480 .channel_mode = alc861_threestack_modes,
11482 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11483 .adc_nids = alc861_adc_nids,
11484 .input_mux = &alc861_capture_source,
11486 [ALC861_UNIWILL_M31] = {
11487 .mixers = { alc861_uniwill_m31_mixer },
11488 .init_verbs = { alc861_uniwill_m31_init_verbs },
11489 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11490 .dac_nids = alc861_dac_nids,
11491 .dig_out_nid = ALC861_DIGOUT_NID,
11492 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11493 .channel_mode = alc861_uniwill_m31_modes,
11495 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11496 .adc_nids = alc861_adc_nids,
11497 .input_mux = &alc861_capture_source,
11499 [ALC861_TOSHIBA] = {
11500 .mixers = { alc861_toshiba_mixer },
11501 .init_verbs = { alc861_base_init_verbs,
11502 alc861_toshiba_init_verbs },
11503 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11504 .dac_nids = alc861_dac_nids,
11505 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11506 .channel_mode = alc883_3ST_2ch_modes,
11507 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11508 .adc_nids = alc861_adc_nids,
11509 .input_mux = &alc861_capture_source,
11510 .unsol_event = alc861_toshiba_unsol_event,
11511 .init_hook = alc861_toshiba_automute,
11514 .mixers = { alc861_asus_mixer },
11515 .init_verbs = { alc861_asus_init_verbs },
11516 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11517 .dac_nids = alc861_dac_nids,
11518 .dig_out_nid = ALC861_DIGOUT_NID,
11519 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11520 .channel_mode = alc861_asus_modes,
11523 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11524 .adc_nids = alc861_adc_nids,
11525 .input_mux = &alc861_capture_source,
11527 [ALC861_ASUS_LAPTOP] = {
11528 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11529 .init_verbs = { alc861_asus_init_verbs,
11530 alc861_asus_laptop_init_verbs },
11531 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11532 .dac_nids = alc861_dac_nids,
11533 .dig_out_nid = ALC861_DIGOUT_NID,
11534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11535 .channel_mode = alc883_3ST_2ch_modes,
11537 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11538 .adc_nids = alc861_adc_nids,
11539 .input_mux = &alc861_capture_source,
11544 static int patch_alc861(struct hda_codec *codec)
11546 struct alc_spec *spec;
11550 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11554 codec->spec = spec;
11556 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11560 if (board_config < 0) {
11561 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11562 "trying auto-probe from BIOS...\n");
11563 board_config = ALC861_AUTO;
11566 if (board_config == ALC861_AUTO) {
11567 /* automatic parse from the BIOS config */
11568 err = alc861_parse_auto_config(codec);
11574 "hda_codec: Cannot set up configuration "
11575 "from BIOS. Using base mode...\n");
11576 board_config = ALC861_3ST_DIG;
11580 if (board_config != ALC861_AUTO)
11581 setup_preset(spec, &alc861_presets[board_config]);
11583 spec->stream_name_analog = "ALC861 Analog";
11584 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11585 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11587 spec->stream_name_digital = "ALC861 Digital";
11588 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11589 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11591 spec->vmaster_nid = 0x03;
11593 codec->patch_ops = alc_patch_ops;
11594 if (board_config == ALC861_AUTO)
11595 spec->init_hook = alc861_auto_init;
11596 #ifdef CONFIG_SND_HDA_POWER_SAVE
11597 if (!spec->loopback.amplist)
11598 spec->loopback.amplist = alc861_loopbacks;
11605 * ALC861-VD support
11609 * In addition, an independent DAC
11611 #define ALC861VD_DIGOUT_NID 0x06
11613 static hda_nid_t alc861vd_dac_nids[4] = {
11614 /* front, surr, clfe, side surr */
11615 0x02, 0x03, 0x04, 0x05
11618 /* dac_nids for ALC660vd are in a different order - according to
11619 * Realtek's driver.
11620 * This should probably tesult in a different mixer for 6stack models
11621 * of ALC660vd codecs, but for now there is only 3stack mixer
11622 * - and it is the same as in 861vd.
11623 * adc_nids in ALC660vd are (is) the same as in 861vd
11625 static hda_nid_t alc660vd_dac_nids[3] = {
11626 /* front, rear, clfe, rear_surr */
11630 static hda_nid_t alc861vd_adc_nids[1] = {
11636 /* FIXME: should be a matrix-type input source selection */
11637 static struct hda_input_mux alc861vd_capture_source = {
11641 { "Front Mic", 0x1 },
11647 static struct hda_input_mux alc861vd_dallas_capture_source = {
11650 { "Front Mic", 0x0 },
11651 { "ATAPI Mic", 0x1 },
11652 { "Line In", 0x5 },
11656 static struct hda_input_mux alc861vd_hp_capture_source = {
11659 { "Front Mic", 0x0 },
11660 { "ATAPI Mic", 0x1 },
11664 #define alc861vd_mux_enum_info alc_mux_enum_info
11665 #define alc861vd_mux_enum_get alc_mux_enum_get
11667 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11668 struct snd_ctl_elem_value *ucontrol)
11670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11671 struct alc_spec *spec = codec->spec;
11672 const struct hda_input_mux *imux = spec->input_mux;
11673 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11674 static hda_nid_t capture_mixers[1] = { 0x22 };
11675 hda_nid_t nid = capture_mixers[adc_idx];
11676 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11677 unsigned int i, idx;
11679 idx = ucontrol->value.enumerated.item[0];
11680 if (idx >= imux->num_items)
11681 idx = imux->num_items - 1;
11682 if (*cur_val == idx)
11684 for (i = 0; i < imux->num_items; i++) {
11685 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11686 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11687 imux->items[i].index,
11697 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11704 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11705 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11706 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11707 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11708 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11715 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11716 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11717 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11718 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11719 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11723 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11724 { 6, alc861vd_6stack_ch6_init },
11725 { 8, alc861vd_6stack_ch8_init },
11728 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11731 .name = "Channel Mode",
11732 .info = alc_ch_mode_info,
11733 .get = alc_ch_mode_get,
11734 .put = alc_ch_mode_put,
11739 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11740 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11741 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11744 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11745 /* The multiple "Capture Source" controls confuse alsamixer
11746 * So call somewhat different..
11748 /* .name = "Capture Source", */
11749 .name = "Input Source",
11751 .info = alc861vd_mux_enum_info,
11752 .get = alc861vd_mux_enum_get,
11753 .put = alc861vd_mux_enum_put,
11758 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11759 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11761 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11762 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11763 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11765 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11766 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11772 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11773 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11775 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11776 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11782 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11784 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11785 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11786 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11794 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11795 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11800 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11801 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11802 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11806 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11810 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11811 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11814 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11815 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11817 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11818 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11820 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11821 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11826 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11827 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11828 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11829 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11831 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11833 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11837 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11838 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11839 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11841 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11842 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11847 /* Pin assignment: Front=0x14, HP = 0x15,
11848 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11850 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11851 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11852 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11853 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11854 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11855 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11856 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11857 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11858 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11864 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11865 * Front Mic=0x18, ATAPI Mic = 0x19,
11867 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11868 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11869 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11870 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11871 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11872 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11873 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11874 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11875 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11881 * generic initialization of ADC, input mixers and output mixers
11883 static struct hda_verb alc861vd_volume_init_verbs[] = {
11885 * Unmute ADC0 and set the default input to mic-in
11887 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11888 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11890 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11891 * the analog-loopback mixer widget
11893 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11894 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11895 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11897 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11898 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11900 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11907 * Set up output mixers (0x02 - 0x05)
11909 /* set vol=0 to output mixers */
11910 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11911 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11912 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11913 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11915 /* set up input amps for analog loopback */
11916 /* Amp Indices: DAC = 0, mixer = 1 */
11917 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11919 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11920 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11921 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11922 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11923 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11924 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11930 * 3-stack pin configuration:
11931 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11933 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11935 * Set pin mode and muting
11937 /* set front pin widgets 0x14 for output */
11938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11939 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11940 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11942 /* Mic (rear) pin: input vref at 80% */
11943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11945 /* Front Mic pin: input vref at 80% */
11946 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11948 /* Line In pin: input */
11949 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11951 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11953 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11954 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11955 /* CD pin widget for input */
11956 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11962 * 6-stack pin configuration:
11964 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11966 * Set pin mode and muting
11968 /* set front pin widgets 0x14 for output */
11969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11971 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11973 /* Rear Pin: output 1 (0x0d) */
11974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11977 /* CLFE Pin: output 2 (0x0e) */
11978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11979 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11980 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11981 /* Side Pin: output 3 (0x0f) */
11982 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11983 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11984 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11986 /* Mic (rear) pin: input vref at 80% */
11987 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11988 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11989 /* Front Mic pin: input vref at 80% */
11990 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11991 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11992 /* Line In pin: input */
11993 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11995 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11996 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11997 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11998 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11999 /* CD pin widget for input */
12000 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12005 static struct hda_verb alc861vd_eapd_verbs[] = {
12006 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12010 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12011 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12012 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12014 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12015 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12019 /* toggle speaker-output according to the hp-jack state */
12020 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12022 unsigned int present;
12023 unsigned char bits;
12025 present = snd_hda_codec_read(codec, 0x1b, 0,
12026 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12027 bits = present ? HDA_AMP_MUTE : 0;
12028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12029 HDA_AMP_MUTE, bits);
12032 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12034 unsigned int present;
12035 unsigned char bits;
12037 present = snd_hda_codec_read(codec, 0x18, 0,
12038 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12039 bits = present ? HDA_AMP_MUTE : 0;
12040 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12041 HDA_AMP_MUTE, bits);
12044 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12046 alc861vd_lenovo_hp_automute(codec);
12047 alc861vd_lenovo_mic_automute(codec);
12050 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12053 switch (res >> 26) {
12054 case ALC880_HP_EVENT:
12055 alc861vd_lenovo_hp_automute(codec);
12057 case ALC880_MIC_EVENT:
12058 alc861vd_lenovo_mic_automute(codec);
12063 static struct hda_verb alc861vd_dallas_verbs[] = {
12064 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12065 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12066 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12067 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12072 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12073 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12079 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12083 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12084 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12085 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12089 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12090 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12091 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12092 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12093 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12094 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12101 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12102 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12103 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12108 /* toggle speaker-output according to the hp-jack state */
12109 static void alc861vd_dallas_automute(struct hda_codec *codec)
12111 unsigned int present;
12113 present = snd_hda_codec_read(codec, 0x15, 0,
12114 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12115 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12116 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12119 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12121 if ((res >> 26) == ALC880_HP_EVENT)
12122 alc861vd_dallas_automute(codec);
12125 #ifdef CONFIG_SND_HDA_POWER_SAVE
12126 #define alc861vd_loopbacks alc880_loopbacks
12129 /* pcm configuration: identiacal with ALC880 */
12130 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12131 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12132 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12133 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12136 * configuration and preset
12138 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12139 [ALC660VD_3ST] = "3stack-660",
12140 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12141 [ALC861VD_3ST] = "3stack",
12142 [ALC861VD_3ST_DIG] = "3stack-digout",
12143 [ALC861VD_6ST_DIG] = "6stack-digout",
12144 [ALC861VD_LENOVO] = "lenovo",
12145 [ALC861VD_DALLAS] = "dallas",
12146 [ALC861VD_HP] = "hp",
12147 [ALC861VD_AUTO] = "auto",
12150 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12151 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12152 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12153 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12154 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12155 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12156 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12157 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12158 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12159 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12160 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12161 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12162 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12163 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12164 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12168 static struct alc_config_preset alc861vd_presets[] = {
12170 .mixers = { alc861vd_3st_mixer },
12171 .init_verbs = { alc861vd_volume_init_verbs,
12172 alc861vd_3stack_init_verbs },
12173 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12174 .dac_nids = alc660vd_dac_nids,
12175 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12176 .adc_nids = alc861vd_adc_nids,
12177 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12178 .channel_mode = alc861vd_3stack_2ch_modes,
12179 .input_mux = &alc861vd_capture_source,
12181 [ALC660VD_3ST_DIG] = {
12182 .mixers = { alc861vd_3st_mixer },
12183 .init_verbs = { alc861vd_volume_init_verbs,
12184 alc861vd_3stack_init_verbs },
12185 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12186 .dac_nids = alc660vd_dac_nids,
12187 .dig_out_nid = ALC861VD_DIGOUT_NID,
12188 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12189 .adc_nids = alc861vd_adc_nids,
12190 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12191 .channel_mode = alc861vd_3stack_2ch_modes,
12192 .input_mux = &alc861vd_capture_source,
12195 .mixers = { alc861vd_3st_mixer },
12196 .init_verbs = { alc861vd_volume_init_verbs,
12197 alc861vd_3stack_init_verbs },
12198 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12199 .dac_nids = alc861vd_dac_nids,
12200 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12201 .channel_mode = alc861vd_3stack_2ch_modes,
12202 .input_mux = &alc861vd_capture_source,
12204 [ALC861VD_3ST_DIG] = {
12205 .mixers = { alc861vd_3st_mixer },
12206 .init_verbs = { alc861vd_volume_init_verbs,
12207 alc861vd_3stack_init_verbs },
12208 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12209 .dac_nids = alc861vd_dac_nids,
12210 .dig_out_nid = ALC861VD_DIGOUT_NID,
12211 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12212 .channel_mode = alc861vd_3stack_2ch_modes,
12213 .input_mux = &alc861vd_capture_source,
12215 [ALC861VD_6ST_DIG] = {
12216 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12217 .init_verbs = { alc861vd_volume_init_verbs,
12218 alc861vd_6stack_init_verbs },
12219 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12220 .dac_nids = alc861vd_dac_nids,
12221 .dig_out_nid = ALC861VD_DIGOUT_NID,
12222 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12223 .channel_mode = alc861vd_6stack_modes,
12224 .input_mux = &alc861vd_capture_source,
12226 [ALC861VD_LENOVO] = {
12227 .mixers = { alc861vd_lenovo_mixer },
12228 .init_verbs = { alc861vd_volume_init_verbs,
12229 alc861vd_3stack_init_verbs,
12230 alc861vd_eapd_verbs,
12231 alc861vd_lenovo_unsol_verbs },
12232 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12233 .dac_nids = alc660vd_dac_nids,
12234 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12235 .adc_nids = alc861vd_adc_nids,
12236 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12237 .channel_mode = alc861vd_3stack_2ch_modes,
12238 .input_mux = &alc861vd_capture_source,
12239 .unsol_event = alc861vd_lenovo_unsol_event,
12240 .init_hook = alc861vd_lenovo_automute,
12242 [ALC861VD_DALLAS] = {
12243 .mixers = { alc861vd_dallas_mixer },
12244 .init_verbs = { alc861vd_dallas_verbs },
12245 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12246 .dac_nids = alc861vd_dac_nids,
12247 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12248 .adc_nids = alc861vd_adc_nids,
12249 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12250 .channel_mode = alc861vd_3stack_2ch_modes,
12251 .input_mux = &alc861vd_dallas_capture_source,
12252 .unsol_event = alc861vd_dallas_unsol_event,
12253 .init_hook = alc861vd_dallas_automute,
12256 .mixers = { alc861vd_hp_mixer },
12257 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12258 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12259 .dac_nids = alc861vd_dac_nids,
12260 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12261 .dig_out_nid = ALC861VD_DIGOUT_NID,
12262 .adc_nids = alc861vd_adc_nids,
12263 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12264 .channel_mode = alc861vd_3stack_2ch_modes,
12265 .input_mux = &alc861vd_hp_capture_source,
12266 .unsol_event = alc861vd_dallas_unsol_event,
12267 .init_hook = alc861vd_dallas_automute,
12272 * BIOS auto configuration
12274 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12275 hda_nid_t nid, int pin_type, int dac_idx)
12277 /* set as output */
12278 snd_hda_codec_write(codec, nid, 0,
12279 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12280 snd_hda_codec_write(codec, nid, 0,
12281 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12284 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12286 struct alc_spec *spec = codec->spec;
12289 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12290 for (i = 0; i <= HDA_SIDE; i++) {
12291 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12292 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12294 alc861vd_auto_set_output_and_unmute(codec, nid,
12300 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12302 struct alc_spec *spec = codec->spec;
12305 pin = spec->autocfg.hp_pins[0];
12306 if (pin) /* connect to front and use dac 0 */
12307 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12310 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12311 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12313 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12315 struct alc_spec *spec = codec->spec;
12318 for (i = 0; i < AUTO_PIN_LAST; i++) {
12319 hda_nid_t nid = spec->autocfg.input_pins[i];
12320 if (alc861vd_is_input_pin(nid)) {
12321 snd_hda_codec_write(codec, nid, 0,
12322 AC_VERB_SET_PIN_WIDGET_CONTROL,
12323 i <= AUTO_PIN_FRONT_MIC ?
12324 PIN_VREF80 : PIN_IN);
12325 if (nid != ALC861VD_PIN_CD_NID)
12326 snd_hda_codec_write(codec, nid, 0,
12327 AC_VERB_SET_AMP_GAIN_MUTE,
12333 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12334 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12336 /* add playback controls from the parsed DAC table */
12337 /* Based on ALC880 version. But ALC861VD has separate,
12338 * different NIDs for mute/unmute switch and volume control */
12339 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12340 const struct auto_pin_cfg *cfg)
12343 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12344 hda_nid_t nid_v, nid_s;
12347 for (i = 0; i < cfg->line_outs; i++) {
12348 if (!spec->multiout.dac_nids[i])
12350 nid_v = alc861vd_idx_to_mixer_vol(
12352 spec->multiout.dac_nids[i]));
12353 nid_s = alc861vd_idx_to_mixer_switch(
12355 spec->multiout.dac_nids[i]));
12359 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12360 "Center Playback Volume",
12361 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12365 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12366 "LFE Playback Volume",
12367 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12371 err = add_control(spec, ALC_CTL_BIND_MUTE,
12372 "Center Playback Switch",
12373 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12377 err = add_control(spec, ALC_CTL_BIND_MUTE,
12378 "LFE Playback Switch",
12379 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12384 sprintf(name, "%s Playback Volume", chname[i]);
12385 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12386 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12390 sprintf(name, "%s Playback Switch", chname[i]);
12391 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12392 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12401 /* add playback controls for speaker and HP outputs */
12402 /* Based on ALC880 version. But ALC861VD has separate,
12403 * different NIDs for mute/unmute switch and volume control */
12404 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12405 hda_nid_t pin, const char *pfx)
12407 hda_nid_t nid_v, nid_s;
12414 if (alc880_is_fixed_pin(pin)) {
12415 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12416 /* specify the DAC as the extra output */
12417 if (!spec->multiout.hp_nid)
12418 spec->multiout.hp_nid = nid_v;
12420 spec->multiout.extra_out_nid[0] = nid_v;
12421 /* control HP volume/switch on the output mixer amp */
12422 nid_v = alc861vd_idx_to_mixer_vol(
12423 alc880_fixed_pin_idx(pin));
12424 nid_s = alc861vd_idx_to_mixer_switch(
12425 alc880_fixed_pin_idx(pin));
12427 sprintf(name, "%s Playback Volume", pfx);
12428 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12429 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12432 sprintf(name, "%s Playback Switch", pfx);
12433 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12434 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12437 } else if (alc880_is_multi_pin(pin)) {
12438 /* set manual connection */
12439 /* we have only a switch on HP-out PIN */
12440 sprintf(name, "%s Playback Switch", pfx);
12441 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12442 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12449 /* parse the BIOS configuration and set up the alc_spec
12450 * return 1 if successful, 0 if the proper config is not found,
12451 * or a negative error code
12452 * Based on ALC880 version - had to change it to override
12453 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12454 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12456 struct alc_spec *spec = codec->spec;
12458 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12460 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12464 if (!spec->autocfg.line_outs)
12465 return 0; /* can't find valid BIOS pin config */
12467 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12470 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12473 err = alc861vd_auto_create_extra_out(spec,
12474 spec->autocfg.speaker_pins[0],
12478 err = alc861vd_auto_create_extra_out(spec,
12479 spec->autocfg.hp_pins[0],
12483 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12487 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12489 if (spec->autocfg.dig_out_pin)
12490 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12492 if (spec->kctl_alloc)
12493 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12495 spec->init_verbs[spec->num_init_verbs++]
12496 = alc861vd_volume_init_verbs;
12498 spec->num_mux_defs = 1;
12499 spec->input_mux = &spec->private_imux;
12501 err = alc_auto_add_mic_boost(codec);
12508 /* additional initialization for auto-configuration model */
12509 static void alc861vd_auto_init(struct hda_codec *codec)
12511 alc861vd_auto_init_multi_out(codec);
12512 alc861vd_auto_init_hp_out(codec);
12513 alc861vd_auto_init_analog_input(codec);
12516 static int patch_alc861vd(struct hda_codec *codec)
12518 struct alc_spec *spec;
12519 int err, board_config;
12521 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12525 codec->spec = spec;
12527 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12531 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12532 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12533 "ALC861VD, trying auto-probe from BIOS...\n");
12534 board_config = ALC861VD_AUTO;
12537 if (board_config == ALC861VD_AUTO) {
12538 /* automatic parse from the BIOS config */
12539 err = alc861vd_parse_auto_config(codec);
12545 "hda_codec: Cannot set up configuration "
12546 "from BIOS. Using base mode...\n");
12547 board_config = ALC861VD_3ST;
12551 if (board_config != ALC861VD_AUTO)
12552 setup_preset(spec, &alc861vd_presets[board_config]);
12554 spec->stream_name_analog = "ALC861VD Analog";
12555 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12556 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12558 spec->stream_name_digital = "ALC861VD Digital";
12559 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12560 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12562 spec->adc_nids = alc861vd_adc_nids;
12563 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12565 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12566 spec->num_mixers++;
12568 spec->vmaster_nid = 0x02;
12570 codec->patch_ops = alc_patch_ops;
12572 if (board_config == ALC861VD_AUTO)
12573 spec->init_hook = alc861vd_auto_init;
12574 #ifdef CONFIG_SND_HDA_POWER_SAVE
12575 if (!spec->loopback.amplist)
12576 spec->loopback.amplist = alc861vd_loopbacks;
12585 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12586 * configuration. Each pin widget can choose any input DACs and a mixer.
12587 * Each ADC is connected from a mixer of all inputs. This makes possible
12588 * 6-channel independent captures.
12590 * In addition, an independent DAC for the multi-playback (not used in this
12593 #define ALC662_DIGOUT_NID 0x06
12594 #define ALC662_DIGIN_NID 0x0a
12596 static hda_nid_t alc662_dac_nids[4] = {
12597 /* front, rear, clfe, rear_surr */
12601 static hda_nid_t alc662_adc_nids[1] = {
12606 /* FIXME: should be a matrix-type input source selection */
12608 static struct hda_input_mux alc662_capture_source = {
12612 { "Front Mic", 0x1 },
12618 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12626 static struct hda_input_mux alc662_eeepc_capture_source = {
12634 #define alc662_mux_enum_info alc_mux_enum_info
12635 #define alc662_mux_enum_get alc_mux_enum_get
12637 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12638 struct snd_ctl_elem_value *ucontrol)
12640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12641 struct alc_spec *spec = codec->spec;
12642 const struct hda_input_mux *imux = spec->input_mux;
12643 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12644 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12645 hda_nid_t nid = capture_mixers[adc_idx];
12646 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12647 unsigned int i, idx;
12649 idx = ucontrol->value.enumerated.item[0];
12650 if (idx >= imux->num_items)
12651 idx = imux->num_items - 1;
12652 if (*cur_val == idx)
12654 for (i = 0; i < imux->num_items; i++) {
12655 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12656 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12657 imux->items[i].index,
12666 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12673 static struct hda_verb alc662_3ST_ch2_init[] = {
12674 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12675 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12676 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12677 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12684 static struct hda_verb alc662_3ST_ch6_init[] = {
12685 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12686 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12687 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12688 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12689 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12690 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12694 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12695 { 2, alc662_3ST_ch2_init },
12696 { 6, alc662_3ST_ch6_init },
12702 static struct hda_verb alc662_sixstack_ch6_init[] = {
12703 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12704 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12705 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12712 static struct hda_verb alc662_sixstack_ch8_init[] = {
12713 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12714 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12715 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12719 static struct hda_channel_mode alc662_5stack_modes[2] = {
12720 { 2, alc662_sixstack_ch6_init },
12721 { 6, alc662_sixstack_ch8_init },
12724 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12725 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12728 static struct snd_kcontrol_new alc662_base_mixer[] = {
12729 /* output mixer control */
12730 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12731 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12732 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12733 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12734 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12735 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12736 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12737 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12738 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12740 /*Input mixer control */
12741 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12742 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12743 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12744 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12745 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12746 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12748 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12752 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12753 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12754 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12755 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12758 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12759 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12764 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12765 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12769 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12770 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12771 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12772 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12773 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12774 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12775 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12776 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12777 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12785 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12786 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12787 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12788 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12792 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12793 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12794 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12795 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12796 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
12797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12798 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12799 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12800 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12801 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12805 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12806 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12808 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12809 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12811 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12812 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12813 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12815 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12816 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12817 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12821 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
12822 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12823 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12824 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12825 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12826 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12827 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12828 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12829 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12830 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12831 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
12832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12834 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12839 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12842 .name = "Channel Mode",
12843 .info = alc_ch_mode_info,
12844 .get = alc_ch_mode_get,
12845 .put = alc_ch_mode_put,
12850 static struct hda_verb alc662_init_verbs[] = {
12851 /* ADC: mute amp left and right */
12852 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12853 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12854 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12858 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12859 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12865 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12866 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12867 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12869 /* Front Pin: output 0 (0x0c) */
12870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12873 /* Rear Pin: output 1 (0x0d) */
12874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12875 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12877 /* CLFE Pin: output 2 (0x0e) */
12878 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12879 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12881 /* Mic (rear) pin: input vref at 80% */
12882 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12884 /* Front Mic pin: input vref at 80% */
12885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12887 /* Line In pin: input */
12888 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12889 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12890 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12891 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12892 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12893 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12894 /* CD pin widget for input */
12895 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12897 /* FIXME: use matrix-type input source selection */
12898 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12905 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12906 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12908 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12912 static struct hda_verb alc662_sue_init_verbs[] = {
12913 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12914 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12918 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12919 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12920 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12924 /* Set Unsolicited Event*/
12925 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
12926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12927 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12932 * generic initialization of ADC, input mixers and output mixers
12934 static struct hda_verb alc662_auto_init_verbs[] = {
12936 * Unmute ADC and set the default input to mic-in
12938 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12941 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12943 * Note: PASD motherboards uses the Line In 2 as the input for front
12944 * panel mic (mic 2)
12946 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12954 * Set up output mixers (0x0c - 0x0f)
12956 /* set vol=0 to output mixers */
12957 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12958 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12959 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12961 /* set up input amps for analog loopback */
12962 /* Amp Indices: DAC = 0, mixer = 1 */
12963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12965 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12966 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12967 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12971 /* FIXME: use matrix-type input source selection */
12972 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12974 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12979 /* capture mixer elements */
12980 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12981 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12982 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12985 /* The multiple "Capture Source" controls confuse alsamixer
12986 * So call somewhat different..
12988 /* .name = "Capture Source", */
12989 .name = "Input Source",
12991 .info = alc662_mux_enum_info,
12992 .get = alc662_mux_enum_get,
12993 .put = alc662_mux_enum_put,
12998 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13000 unsigned int present;
13001 unsigned char bits;
13003 present = snd_hda_codec_read(codec, 0x14, 0,
13004 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13005 bits = present ? HDA_AMP_MUTE : 0;
13006 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13007 HDA_AMP_MUTE, bits);
13010 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13012 unsigned int present;
13013 unsigned char bits;
13015 present = snd_hda_codec_read(codec, 0x1b, 0,
13016 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13017 bits = present ? HDA_AMP_MUTE : 0;
13018 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13019 HDA_AMP_MUTE, bits);
13020 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13021 HDA_AMP_MUTE, bits);
13024 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13027 if ((res >> 26) == ALC880_HP_EVENT)
13028 alc662_lenovo_101e_all_automute(codec);
13029 if ((res >> 26) == ALC880_FRONT_EVENT)
13030 alc662_lenovo_101e_ispeaker_automute(codec);
13033 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13035 unsigned int present;
13037 present = snd_hda_codec_read(codec, 0x18, 0,
13038 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13039 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13040 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13041 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13042 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13043 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13044 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13045 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13046 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13049 /* unsolicited event for HP jack sensing */
13050 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13053 if ((res >> 26) == ALC880_HP_EVENT)
13054 alc262_hippo1_automute( codec );
13056 if ((res >> 26) == ALC880_MIC_EVENT)
13057 alc662_eeepc_mic_automute(codec);
13060 static void alc662_eeepc_inithook(struct hda_codec *codec)
13062 alc262_hippo1_automute( codec );
13063 alc662_eeepc_mic_automute(codec);
13066 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13069 unsigned int present;
13071 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13072 present = snd_hda_codec_read(codec, 0x14, 0,
13073 AC_VERB_GET_PIN_SENSE, 0);
13074 present = (present & 0x80000000) != 0;
13076 /* mute internal speaker */
13077 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13078 HDA_AMP_MUTE, HDA_AMP_MUTE);
13080 /* unmute internal speaker if necessary */
13081 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13082 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13083 HDA_AMP_MUTE, mute);
13087 /* unsolicited event for HP jack sensing */
13088 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13091 if ((res >> 26) == ALC880_HP_EVENT)
13092 alc662_eeepc_ep20_automute(codec);
13095 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13097 alc662_eeepc_ep20_automute(codec);
13100 #ifdef CONFIG_SND_HDA_POWER_SAVE
13101 #define alc662_loopbacks alc880_loopbacks
13105 /* pcm configuration: identiacal with ALC880 */
13106 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13107 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13108 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13109 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13112 * configuration and preset
13114 static const char *alc662_models[ALC662_MODEL_LAST] = {
13115 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13116 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13117 [ALC662_3ST_6ch] = "3stack-6ch",
13118 [ALC662_5ST_DIG] = "6stack-dig",
13119 [ALC662_LENOVO_101E] = "lenovo-101e",
13120 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13121 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13122 [ALC662_AUTO] = "auto",
13125 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13126 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13127 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13128 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13132 static struct alc_config_preset alc662_presets[] = {
13133 [ALC662_3ST_2ch_DIG] = {
13134 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13135 .init_verbs = { alc662_init_verbs },
13136 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13137 .dac_nids = alc662_dac_nids,
13138 .dig_out_nid = ALC662_DIGOUT_NID,
13139 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13140 .adc_nids = alc662_adc_nids,
13141 .dig_in_nid = ALC662_DIGIN_NID,
13142 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13143 .channel_mode = alc662_3ST_2ch_modes,
13144 .input_mux = &alc662_capture_source,
13146 [ALC662_3ST_6ch_DIG] = {
13147 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13148 alc662_capture_mixer },
13149 .init_verbs = { alc662_init_verbs },
13150 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13151 .dac_nids = alc662_dac_nids,
13152 .dig_out_nid = ALC662_DIGOUT_NID,
13153 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13154 .adc_nids = alc662_adc_nids,
13155 .dig_in_nid = ALC662_DIGIN_NID,
13156 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13157 .channel_mode = alc662_3ST_6ch_modes,
13159 .input_mux = &alc662_capture_source,
13161 [ALC662_3ST_6ch] = {
13162 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13163 alc662_capture_mixer },
13164 .init_verbs = { alc662_init_verbs },
13165 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13166 .dac_nids = alc662_dac_nids,
13167 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13168 .adc_nids = alc662_adc_nids,
13169 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13170 .channel_mode = alc662_3ST_6ch_modes,
13172 .input_mux = &alc662_capture_source,
13174 [ALC662_5ST_DIG] = {
13175 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13176 alc662_capture_mixer },
13177 .init_verbs = { alc662_init_verbs },
13178 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13179 .dac_nids = alc662_dac_nids,
13180 .dig_out_nid = ALC662_DIGOUT_NID,
13181 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13182 .adc_nids = alc662_adc_nids,
13183 .dig_in_nid = ALC662_DIGIN_NID,
13184 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13185 .channel_mode = alc662_5stack_modes,
13186 .input_mux = &alc662_capture_source,
13188 [ALC662_LENOVO_101E] = {
13189 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13190 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13191 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13192 .dac_nids = alc662_dac_nids,
13193 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13194 .adc_nids = alc662_adc_nids,
13195 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13196 .channel_mode = alc662_3ST_2ch_modes,
13197 .input_mux = &alc662_lenovo_101e_capture_source,
13198 .unsol_event = alc662_lenovo_101e_unsol_event,
13199 .init_hook = alc662_lenovo_101e_all_automute,
13201 [ALC662_ASUS_EEEPC_P701] = {
13202 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13203 .init_verbs = { alc662_init_verbs,
13204 alc662_eeepc_sue_init_verbs },
13205 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13206 .dac_nids = alc662_dac_nids,
13207 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
13208 .adc_nids = alc662_adc_nids,
13209 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13210 .channel_mode = alc662_3ST_2ch_modes,
13211 .input_mux = &alc662_eeepc_capture_source,
13212 .unsol_event = alc662_eeepc_unsol_event,
13213 .init_hook = alc662_eeepc_inithook,
13215 [ALC662_ASUS_EEEPC_EP20] = {
13216 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13217 alc662_chmode_mixer },
13218 .init_verbs = { alc662_init_verbs,
13219 alc662_eeepc_ep20_sue_init_verbs },
13220 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13221 .dac_nids = alc662_dac_nids,
13222 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13223 .adc_nids = alc662_adc_nids,
13224 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13225 .channel_mode = alc662_3ST_6ch_modes,
13226 .input_mux = &alc662_lenovo_101e_capture_source,
13227 .unsol_event = alc662_eeepc_ep20_unsol_event,
13228 .init_hook = alc662_eeepc_ep20_inithook,
13235 * BIOS auto configuration
13238 /* add playback controls from the parsed DAC table */
13239 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13240 const struct auto_pin_cfg *cfg)
13243 static const char *chname[4] = {
13244 "Front", "Surround", NULL /*CLFE*/, "Side"
13249 for (i = 0; i < cfg->line_outs; i++) {
13250 if (!spec->multiout.dac_nids[i])
13252 nid = alc880_idx_to_dac(i);
13255 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13256 "Center Playback Volume",
13257 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13261 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13262 "LFE Playback Volume",
13263 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13267 err = add_control(spec, ALC_CTL_BIND_MUTE,
13268 "Center Playback Switch",
13269 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13273 err = add_control(spec, ALC_CTL_BIND_MUTE,
13274 "LFE Playback Switch",
13275 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13280 sprintf(name, "%s Playback Volume", chname[i]);
13281 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13282 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13286 sprintf(name, "%s Playback Switch", chname[i]);
13287 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13288 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13297 /* add playback controls for speaker and HP outputs */
13298 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13308 if (alc880_is_fixed_pin(pin)) {
13309 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13310 /* printk("DAC nid=%x\n",nid); */
13311 /* specify the DAC as the extra output */
13312 if (!spec->multiout.hp_nid)
13313 spec->multiout.hp_nid = nid;
13315 spec->multiout.extra_out_nid[0] = nid;
13316 /* control HP volume/switch on the output mixer amp */
13317 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13318 sprintf(name, "%s Playback Volume", pfx);
13319 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13320 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13323 sprintf(name, "%s Playback Switch", pfx);
13324 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13325 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13328 } else if (alc880_is_multi_pin(pin)) {
13329 /* set manual connection */
13330 /* we have only a switch on HP-out PIN */
13331 sprintf(name, "%s Playback Switch", pfx);
13332 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13333 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13340 /* create playback/capture controls for input pins */
13341 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13342 const struct auto_pin_cfg *cfg)
13344 struct hda_input_mux *imux = &spec->private_imux;
13347 for (i = 0; i < AUTO_PIN_LAST; i++) {
13348 if (alc880_is_input_pin(cfg->input_pins[i])) {
13349 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13350 err = new_analog_input(spec, cfg->input_pins[i],
13351 auto_pin_cfg_labels[i],
13355 imux->items[imux->num_items].label =
13356 auto_pin_cfg_labels[i];
13357 imux->items[imux->num_items].index =
13358 alc880_input_pin_idx(cfg->input_pins[i]);
13365 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13366 hda_nid_t nid, int pin_type,
13369 /* set as output */
13370 snd_hda_codec_write(codec, nid, 0,
13371 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13372 snd_hda_codec_write(codec, nid, 0,
13373 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13374 /* need the manual connection? */
13375 if (alc880_is_multi_pin(nid)) {
13376 struct alc_spec *spec = codec->spec;
13377 int idx = alc880_multi_pin_idx(nid);
13378 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13379 AC_VERB_SET_CONNECT_SEL,
13380 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13384 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13386 struct alc_spec *spec = codec->spec;
13389 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13390 for (i = 0; i <= HDA_SIDE; i++) {
13391 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13392 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13394 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13399 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13401 struct alc_spec *spec = codec->spec;
13404 pin = spec->autocfg.hp_pins[0];
13405 if (pin) /* connect to front */
13407 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13410 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13411 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13413 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13415 struct alc_spec *spec = codec->spec;
13418 for (i = 0; i < AUTO_PIN_LAST; i++) {
13419 hda_nid_t nid = spec->autocfg.input_pins[i];
13420 if (alc662_is_input_pin(nid)) {
13421 snd_hda_codec_write(codec, nid, 0,
13422 AC_VERB_SET_PIN_WIDGET_CONTROL,
13423 (i <= AUTO_PIN_FRONT_MIC ?
13424 PIN_VREF80 : PIN_IN));
13425 if (nid != ALC662_PIN_CD_NID)
13426 snd_hda_codec_write(codec, nid, 0,
13427 AC_VERB_SET_AMP_GAIN_MUTE,
13433 static int alc662_parse_auto_config(struct hda_codec *codec)
13435 struct alc_spec *spec = codec->spec;
13437 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13439 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13443 if (!spec->autocfg.line_outs)
13444 return 0; /* can't find valid BIOS pin config */
13446 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13449 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13452 err = alc662_auto_create_extra_out(spec,
13453 spec->autocfg.speaker_pins[0],
13457 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13461 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13465 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13467 if (spec->autocfg.dig_out_pin)
13468 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13470 if (spec->kctl_alloc)
13471 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13473 spec->num_mux_defs = 1;
13474 spec->input_mux = &spec->private_imux;
13476 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13477 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13478 spec->num_mixers++;
13482 /* additional initialization for auto-configuration model */
13483 static void alc662_auto_init(struct hda_codec *codec)
13485 alc662_auto_init_multi_out(codec);
13486 alc662_auto_init_hp_out(codec);
13487 alc662_auto_init_analog_input(codec);
13490 static int patch_alc662(struct hda_codec *codec)
13492 struct alc_spec *spec;
13493 int err, board_config;
13495 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13499 codec->spec = spec;
13501 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13504 if (board_config < 0) {
13505 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13506 "trying auto-probe from BIOS...\n");
13507 board_config = ALC662_AUTO;
13510 if (board_config == ALC662_AUTO) {
13511 /* automatic parse from the BIOS config */
13512 err = alc662_parse_auto_config(codec);
13518 "hda_codec: Cannot set up configuration "
13519 "from BIOS. Using base mode...\n");
13520 board_config = ALC662_3ST_2ch_DIG;
13524 if (board_config != ALC662_AUTO)
13525 setup_preset(spec, &alc662_presets[board_config]);
13527 spec->stream_name_analog = "ALC662 Analog";
13528 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13529 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13531 spec->stream_name_digital = "ALC662 Digital";
13532 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13533 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13535 if (!spec->adc_nids && spec->input_mux) {
13536 spec->adc_nids = alc662_adc_nids;
13537 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13540 spec->vmaster_nid = 0x02;
13542 codec->patch_ops = alc_patch_ops;
13543 if (board_config == ALC662_AUTO)
13544 spec->init_hook = alc662_auto_init;
13545 #ifdef CONFIG_SND_HDA_POWER_SAVE
13546 if (!spec->loopback.amplist)
13547 spec->loopback.amplist = alc662_loopbacks;
13556 struct hda_codec_preset snd_hda_preset_realtek[] = {
13557 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13558 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13559 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13560 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13561 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13562 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13563 .patch = patch_alc861 },
13564 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13565 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13566 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13567 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13568 .patch = patch_alc883 },
13569 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13570 .patch = patch_alc662 },
13571 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13572 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13573 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13574 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13575 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13576 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13577 {} /* terminator */