2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
79 #ifdef CONFIG_SND_DEBUG
83 ALC260_MODEL_LAST /* last tag */
93 ALC262_HP_BPC_D7000_WL,
94 ALC262_HP_BPC_D7000_WF,
102 ALC262_MODEL_LAST /* last tag */
112 #ifdef CONFIG_SND_DEBUG
116 ALC268_MODEL_LAST /* last tag */
123 ALC269_MODEL_LAST /* last tag */
140 /* ALC861-VD models */
161 ALC662_ASUS_EEEPC_P701,
162 ALC662_ASUS_EEEPC_EP20,
190 ALC883_TARGA_2ch_DIG,
196 ALC883_LENOVO_101E_2ch,
197 ALC883_LENOVO_NB0763,
198 ALC888_LENOVO_MS7195_DIG,
209 #define GPIO_MASK 0x03
212 /* codec parameterization */
213 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
214 unsigned int num_mixers;
216 const struct hda_verb *init_verbs[5]; /* initialization verbs
220 unsigned int num_init_verbs;
222 char *stream_name_analog; /* analog PCM stream */
223 struct hda_pcm_stream *stream_analog_playback;
224 struct hda_pcm_stream *stream_analog_capture;
225 struct hda_pcm_stream *stream_analog_alt_playback;
226 struct hda_pcm_stream *stream_analog_alt_capture;
228 char *stream_name_digital; /* digital PCM stream */
229 struct hda_pcm_stream *stream_digital_playback;
230 struct hda_pcm_stream *stream_digital_capture;
233 struct hda_multi_out multiout; /* playback set-up
234 * max_channels, dacs must be set
235 * dig_out_nid and hp_nid are optional
237 hda_nid_t alt_dac_nid;
240 unsigned int num_adc_nids;
242 hda_nid_t *capsrc_nids;
243 hda_nid_t dig_in_nid; /* digital-in NID; optional */
246 unsigned int num_mux_defs;
247 const struct hda_input_mux *input_mux;
248 unsigned int cur_mux[3];
251 const struct hda_channel_mode *channel_mode;
252 int num_channel_mode;
255 /* PCM information */
256 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
258 /* dynamic controls, init_verbs and input_mux */
259 struct auto_pin_cfg autocfg;
260 unsigned int num_kctl_alloc, num_kctl_used;
261 struct snd_kcontrol_new *kctl_alloc;
262 struct hda_input_mux private_imux;
263 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
266 void (*init_hook)(struct hda_codec *codec);
267 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
269 /* for pin sensing */
270 unsigned int sense_updated: 1;
271 unsigned int jack_present: 1;
272 unsigned int master_sw: 1;
274 /* for virtual master */
275 hda_nid_t vmaster_nid;
276 #ifdef CONFIG_SND_HDA_POWER_SAVE
277 struct hda_loopback_check loopback;
282 * configuration template - to be copied to the spec instance
284 struct alc_config_preset {
285 struct snd_kcontrol_new *mixers[5]; /* should be identical size
288 const struct hda_verb *init_verbs[5];
289 unsigned int num_dacs;
291 hda_nid_t dig_out_nid; /* optional */
292 hda_nid_t hp_nid; /* optional */
293 unsigned int num_adc_nids;
295 hda_nid_t *capsrc_nids;
296 hda_nid_t dig_in_nid;
297 unsigned int num_channel_mode;
298 const struct hda_channel_mode *channel_mode;
300 unsigned int num_mux_defs;
301 const struct hda_input_mux *input_mux;
302 void (*unsol_event)(struct hda_codec *, unsigned int);
303 void (*init_hook)(struct hda_codec *);
304 #ifdef CONFIG_SND_HDA_POWER_SAVE
305 struct hda_amp_list *loopbacks;
313 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
314 struct snd_ctl_elem_info *uinfo)
316 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
317 struct alc_spec *spec = codec->spec;
318 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
319 if (mux_idx >= spec->num_mux_defs)
321 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
324 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
325 struct snd_ctl_elem_value *ucontrol)
327 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
328 struct alc_spec *spec = codec->spec;
329 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
331 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
335 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
336 struct snd_ctl_elem_value *ucontrol)
338 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
339 struct alc_spec *spec = codec->spec;
340 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
341 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
342 hda_nid_t nid = spec->capsrc_nids ?
343 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
344 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
345 nid, &spec->cur_mux[adc_idx]);
350 * channel mode setting
352 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
353 struct snd_ctl_elem_info *uinfo)
355 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
356 struct alc_spec *spec = codec->spec;
357 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
358 spec->num_channel_mode);
361 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
362 struct snd_ctl_elem_value *ucontrol)
364 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
365 struct alc_spec *spec = codec->spec;
366 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
367 spec->num_channel_mode,
368 spec->multiout.max_channels);
371 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
372 struct snd_ctl_elem_value *ucontrol)
374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
375 struct alc_spec *spec = codec->spec;
376 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
377 spec->num_channel_mode,
378 &spec->multiout.max_channels);
379 if (err >= 0 && spec->need_dac_fix)
380 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
385 * Control the mode of pin widget settings via the mixer. "pc" is used
386 * instead of "%" to avoid consequences of accidently treating the % as
387 * being part of a format specifier. Maximum allowed length of a value is
388 * 63 characters plus NULL terminator.
390 * Note: some retasking pin complexes seem to ignore requests for input
391 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
392 * are requested. Therefore order this list so that this behaviour will not
393 * cause problems when mixer clients move through the enum sequentially.
394 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
397 static char *alc_pin_mode_names[] = {
398 "Mic 50pc bias", "Mic 80pc bias",
399 "Line in", "Line out", "Headphone out",
401 static unsigned char alc_pin_mode_values[] = {
402 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
404 /* The control can present all 5 options, or it can limit the options based
405 * in the pin being assumed to be exclusively an input or an output pin. In
406 * addition, "input" pins may or may not process the mic bias option
407 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
408 * accept requests for bias as of chip versions up to March 2006) and/or
409 * wiring in the computer.
411 #define ALC_PIN_DIR_IN 0x00
412 #define ALC_PIN_DIR_OUT 0x01
413 #define ALC_PIN_DIR_INOUT 0x02
414 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
415 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
417 /* Info about the pin modes supported by the different pin direction modes.
418 * For each direction the minimum and maximum values are given.
420 static signed char alc_pin_mode_dir_info[5][2] = {
421 { 0, 2 }, /* ALC_PIN_DIR_IN */
422 { 3, 4 }, /* ALC_PIN_DIR_OUT */
423 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
424 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
425 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
427 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
428 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
429 #define alc_pin_mode_n_items(_dir) \
430 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
432 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_info *uinfo)
435 unsigned int item_num = uinfo->value.enumerated.item;
436 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
438 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
440 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
442 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
443 item_num = alc_pin_mode_min(dir);
444 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
448 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_value *ucontrol)
452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
453 hda_nid_t nid = kcontrol->private_value & 0xffff;
454 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
455 long *valp = ucontrol->value.integer.value;
456 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
457 AC_VERB_GET_PIN_WIDGET_CONTROL,
460 /* Find enumerated value for current pinctl setting */
461 i = alc_pin_mode_min(dir);
462 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
464 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
468 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_value *ucontrol)
472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
473 hda_nid_t nid = kcontrol->private_value & 0xffff;
474 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
475 long val = *ucontrol->value.integer.value;
476 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
477 AC_VERB_GET_PIN_WIDGET_CONTROL,
480 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
481 val = alc_pin_mode_min(dir);
483 change = pinctl != alc_pin_mode_values[val];
485 /* Set pin mode to that requested */
486 snd_hda_codec_write_cache(codec, nid, 0,
487 AC_VERB_SET_PIN_WIDGET_CONTROL,
488 alc_pin_mode_values[val]);
490 /* Also enable the retasking pin's input/output as required
491 * for the requested pin mode. Enum values of 2 or less are
494 * Dynamically switching the input/output buffers probably
495 * reduces noise slightly (particularly on input) so we'll
496 * do it. However, having both input and output buffers
497 * enabled simultaneously doesn't seem to be problematic if
498 * this turns out to be necessary in the future.
501 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
502 HDA_AMP_MUTE, HDA_AMP_MUTE);
503 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
506 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
507 HDA_AMP_MUTE, HDA_AMP_MUTE);
508 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
515 #define ALC_PIN_MODE(xname, nid, dir) \
516 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
517 .info = alc_pin_mode_info, \
518 .get = alc_pin_mode_get, \
519 .put = alc_pin_mode_put, \
520 .private_value = nid | (dir<<16) }
522 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
523 * together using a mask with more than one bit set. This control is
524 * currently used only by the ALC260 test model. At this stage they are not
525 * needed for any "production" models.
527 #ifdef CONFIG_SND_DEBUG
528 #define alc_gpio_data_info snd_ctl_boolean_mono_info
530 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
531 struct snd_ctl_elem_value *ucontrol)
533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
534 hda_nid_t nid = kcontrol->private_value & 0xffff;
535 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
536 long *valp = ucontrol->value.integer.value;
537 unsigned int val = snd_hda_codec_read(codec, nid, 0,
538 AC_VERB_GET_GPIO_DATA, 0x00);
540 *valp = (val & mask) != 0;
543 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_value *ucontrol)
547 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
548 hda_nid_t nid = kcontrol->private_value & 0xffff;
549 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
550 long val = *ucontrol->value.integer.value;
551 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
552 AC_VERB_GET_GPIO_DATA,
555 /* Set/unset the masked GPIO bit(s) as needed */
556 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
561 snd_hda_codec_write_cache(codec, nid, 0,
562 AC_VERB_SET_GPIO_DATA, gpio_data);
566 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
567 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
568 .info = alc_gpio_data_info, \
569 .get = alc_gpio_data_get, \
570 .put = alc_gpio_data_put, \
571 .private_value = nid | (mask<<16) }
572 #endif /* CONFIG_SND_DEBUG */
574 /* A switch control to allow the enabling of the digital IO pins on the
575 * ALC260. This is incredibly simplistic; the intention of this control is
576 * to provide something in the test model allowing digital outputs to be
577 * identified if present. If models are found which can utilise these
578 * outputs a more complete mixer control can be devised for those models if
581 #ifdef CONFIG_SND_DEBUG
582 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
584 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
585 struct snd_ctl_elem_value *ucontrol)
587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
588 hda_nid_t nid = kcontrol->private_value & 0xffff;
589 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
590 long *valp = ucontrol->value.integer.value;
591 unsigned int val = snd_hda_codec_read(codec, nid, 0,
592 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
594 *valp = (val & mask) != 0;
597 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
598 struct snd_ctl_elem_value *ucontrol)
601 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
602 hda_nid_t nid = kcontrol->private_value & 0xffff;
603 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
604 long val = *ucontrol->value.integer.value;
605 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
606 AC_VERB_GET_DIGI_CONVERT_1,
609 /* Set/unset the masked control bit(s) as needed */
610 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
615 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
620 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
621 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
622 .info = alc_spdif_ctrl_info, \
623 .get = alc_spdif_ctrl_get, \
624 .put = alc_spdif_ctrl_put, \
625 .private_value = nid | (mask<<16) }
626 #endif /* CONFIG_SND_DEBUG */
628 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
629 * Again, this is only used in the ALC26x test models to help identify when
630 * the EAPD line must be asserted for features to work.
632 #ifdef CONFIG_SND_DEBUG
633 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
635 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
636 struct snd_ctl_elem_value *ucontrol)
638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
639 hda_nid_t nid = kcontrol->private_value & 0xffff;
640 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
641 long *valp = ucontrol->value.integer.value;
642 unsigned int val = snd_hda_codec_read(codec, nid, 0,
643 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
645 *valp = (val & mask) != 0;
649 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
650 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long val = *ucontrol->value.integer.value;
657 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_EAPD_BTLENABLE,
661 /* Set/unset the masked control bit(s) as needed */
662 change = (!val ? 0 : mask) != (ctrl_data & mask);
667 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
673 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
674 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
675 .info = alc_eapd_ctrl_info, \
676 .get = alc_eapd_ctrl_get, \
677 .put = alc_eapd_ctrl_put, \
678 .private_value = nid | (mask<<16) }
679 #endif /* CONFIG_SND_DEBUG */
682 * set up from the preset table
684 static void setup_preset(struct alc_spec *spec,
685 const struct alc_config_preset *preset)
689 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
690 spec->mixers[spec->num_mixers++] = preset->mixers[i];
691 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
693 spec->init_verbs[spec->num_init_verbs++] =
694 preset->init_verbs[i];
696 spec->channel_mode = preset->channel_mode;
697 spec->num_channel_mode = preset->num_channel_mode;
698 spec->need_dac_fix = preset->need_dac_fix;
700 spec->multiout.max_channels = spec->channel_mode[0].channels;
702 spec->multiout.num_dacs = preset->num_dacs;
703 spec->multiout.dac_nids = preset->dac_nids;
704 spec->multiout.dig_out_nid = preset->dig_out_nid;
705 spec->multiout.hp_nid = preset->hp_nid;
707 spec->num_mux_defs = preset->num_mux_defs;
708 if (!spec->num_mux_defs)
709 spec->num_mux_defs = 1;
710 spec->input_mux = preset->input_mux;
712 spec->num_adc_nids = preset->num_adc_nids;
713 spec->adc_nids = preset->adc_nids;
714 spec->capsrc_nids = preset->capsrc_nids;
715 spec->dig_in_nid = preset->dig_in_nid;
717 spec->unsol_event = preset->unsol_event;
718 spec->init_hook = preset->init_hook;
719 #ifdef CONFIG_SND_HDA_POWER_SAVE
720 spec->loopback.amplist = preset->loopbacks;
724 /* Enable GPIO mask and set output */
725 static struct hda_verb alc_gpio1_init_verbs[] = {
726 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
727 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
728 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
732 static struct hda_verb alc_gpio2_init_verbs[] = {
733 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
734 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
735 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
739 static struct hda_verb alc_gpio3_init_verbs[] = {
740 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
741 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
742 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
746 static void alc_sku_automute(struct hda_codec *codec)
748 struct alc_spec *spec = codec->spec;
749 unsigned int present;
750 unsigned int hp_nid = spec->autocfg.hp_pins[0];
751 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
753 /* need to execute and sync at first */
754 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
755 present = snd_hda_codec_read(codec, hp_nid, 0,
756 AC_VERB_GET_PIN_SENSE, 0);
757 spec->jack_present = (present & 0x80000000) != 0;
758 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
759 spec->jack_present ? 0 : PIN_OUT);
762 /* unsolicited event for HP jack sensing */
763 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
765 if (codec->vendor_id == 0x10ec0880)
769 if (res != ALC880_HP_EVENT)
772 alc_sku_automute(codec);
775 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
776 * 31 ~ 16 : Manufacture ID
778 * 7 ~ 0 : Assembly ID
779 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
781 static void alc_subsystem_id(struct hda_codec *codec,
782 unsigned int porta, unsigned int porte,
785 unsigned int ass, tmp, i;
787 struct alc_spec *spec = codec->spec;
789 ass = codec->subsystem_id & 0xffff;
790 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
794 * 31~30 : port conetcivity
797 * 19~16 : Check sum (15:1)
802 if (codec->vendor_id == 0x10ec0260)
804 ass = snd_hda_codec_read(codec, nid, 0,
805 AC_VERB_GET_CONFIG_DEFAULT, 0);
806 if (!(ass & 1) && !(ass & 0x100000))
808 if ((ass >> 30) != 1) /* no physical connection */
813 for (i = 1; i < 16; i++) {
817 if (((ass >> 16) & 0xf) != tmp)
823 * 2 : 0 --> Desktop, 1 --> Laptop
824 * 3~5 : External Amplifier control
827 tmp = (ass & 0x38) >> 3; /* external Amp control */
830 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
833 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
836 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
838 case 5: /* set EAPD output high */
839 switch (codec->vendor_id) {
841 snd_hda_codec_write(codec, 0x0f, 0,
842 AC_VERB_SET_EAPD_BTLENABLE, 2);
843 snd_hda_codec_write(codec, 0x10, 0,
844 AC_VERB_SET_EAPD_BTLENABLE, 2);
852 snd_hda_codec_write(codec, 0x14, 0,
853 AC_VERB_SET_EAPD_BTLENABLE, 2);
854 snd_hda_codec_write(codec, 0x15, 0,
855 AC_VERB_SET_EAPD_BTLENABLE, 2);
858 switch (codec->vendor_id) {
860 snd_hda_codec_write(codec, 0x1a, 0,
861 AC_VERB_SET_COEF_INDEX, 7);
862 tmp = snd_hda_codec_read(codec, 0x1a, 0,
863 AC_VERB_GET_PROC_COEF, 0);
864 snd_hda_codec_write(codec, 0x1a, 0,
865 AC_VERB_SET_COEF_INDEX, 7);
866 snd_hda_codec_write(codec, 0x1a, 0,
867 AC_VERB_SET_PROC_COEF,
876 snd_hda_codec_write(codec, 0x20, 0,
877 AC_VERB_SET_COEF_INDEX, 7);
878 tmp = snd_hda_codec_read(codec, 0x20, 0,
879 AC_VERB_GET_PROC_COEF, 0);
880 snd_hda_codec_write(codec, 0x20, 0,
881 AC_VERB_SET_COEF_INDEX, 7);
882 snd_hda_codec_write(codec, 0x20, 0,
883 AC_VERB_SET_PROC_COEF,
888 snd_hda_codec_write(codec, 0x20, 0,
889 AC_VERB_SET_COEF_INDEX, 7);
890 tmp = snd_hda_codec_read(codec, 0x20, 0,
891 AC_VERB_GET_PROC_COEF, 0);
892 snd_hda_codec_write(codec, 0x20, 0,
893 AC_VERB_SET_COEF_INDEX, 7);
894 snd_hda_codec_write(codec, 0x20, 0,
895 AC_VERB_SET_PROC_COEF,
903 /* is laptop or Desktop and enable the function "Mute internal speaker
904 * when the external headphone out jack is plugged"
909 * 10~8 : Jack location
910 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
912 * 15 : 1 --> enable the function "Mute internal speaker
913 * when the external headphone out jack is plugged"
915 if (!spec->autocfg.speaker_pins[0]) {
916 if (spec->autocfg.line_out_pins[0])
917 spec->autocfg.speaker_pins[0] =
918 spec->autocfg.line_out_pins[0];
923 if (!spec->autocfg.hp_pins[0]) {
924 tmp = (ass >> 11) & 0x3; /* HP to chassis */
926 spec->autocfg.hp_pins[0] = porta;
928 spec->autocfg.hp_pins[0] = porte;
930 spec->autocfg.hp_pins[0] = portd;
935 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
936 AC_VERB_SET_UNSOLICITED_ENABLE,
937 AC_USRSP_EN | ALC880_HP_EVENT);
938 spec->unsol_event = alc_sku_unsol_event;
939 spec->init_hook = alc_sku_automute;
943 * Fix-up pin default configurations
951 static void alc_fix_pincfg(struct hda_codec *codec,
952 const struct snd_pci_quirk *quirk,
953 const struct alc_pincfg **pinfix)
955 const struct alc_pincfg *cfg;
957 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
961 cfg = pinfix[quirk->value];
962 for (; cfg->nid; cfg++) {
965 for (i = 0; i < 4; i++) {
966 snd_hda_codec_write(codec, cfg->nid, 0,
967 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
975 * ALC880 3-stack model
977 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
978 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
979 * F-Mic = 0x1b, HP = 0x19
982 static hda_nid_t alc880_dac_nids[4] = {
983 /* front, rear, clfe, rear_surr */
984 0x02, 0x05, 0x04, 0x03
987 static hda_nid_t alc880_adc_nids[3] = {
992 /* The datasheet says the node 0x07 is connected from inputs,
993 * but it shows zero connection in the real implementation on some devices.
994 * Note: this is a 915GAV bug, fixed on 915GLV
996 static hda_nid_t alc880_adc_nids_alt[2] = {
1001 #define ALC880_DIGOUT_NID 0x06
1002 #define ALC880_DIGIN_NID 0x0a
1004 static struct hda_input_mux alc880_capture_source = {
1008 { "Front Mic", 0x3 },
1014 /* channel source setting (2/6 channel selection for 3-stack) */
1016 static struct hda_verb alc880_threestack_ch2_init[] = {
1017 /* set line-in to input, mute it */
1018 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1019 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1020 /* set mic-in to input vref 80%, mute it */
1021 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1022 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1027 static struct hda_verb alc880_threestack_ch6_init[] = {
1028 /* set line-in to output, unmute it */
1029 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1030 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1031 /* set mic-in to output, unmute it */
1032 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1033 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1037 static struct hda_channel_mode alc880_threestack_modes[2] = {
1038 { 2, alc880_threestack_ch2_init },
1039 { 6, alc880_threestack_ch6_init },
1042 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1045 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1046 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1050 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1051 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1052 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1053 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1054 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1057 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1058 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1059 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1060 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1063 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1064 .name = "Channel Mode",
1065 .info = alc_ch_mode_info,
1066 .get = alc_ch_mode_get,
1067 .put = alc_ch_mode_put,
1072 /* capture mixer elements */
1073 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1074 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1075 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1076 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1077 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1078 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1079 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1082 /* The multiple "Capture Source" controls confuse alsamixer
1083 * So call somewhat different..
1085 /* .name = "Capture Source", */
1086 .name = "Input Source",
1088 .info = alc_mux_enum_info,
1089 .get = alc_mux_enum_get,
1090 .put = alc_mux_enum_put,
1095 /* capture mixer elements (in case NID 0x07 not available) */
1096 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1097 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1098 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1099 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1100 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1102 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1103 /* The multiple "Capture Source" controls confuse alsamixer
1104 * So call somewhat different..
1106 /* .name = "Capture Source", */
1107 .name = "Input Source",
1109 .info = alc_mux_enum_info,
1110 .get = alc_mux_enum_get,
1111 .put = alc_mux_enum_put,
1119 * ALC880 5-stack model
1121 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1123 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1124 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1127 /* additional mixers to alc880_three_stack_mixer */
1128 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1129 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1130 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1134 /* channel source setting (6/8 channel selection for 5-stack) */
1136 static struct hda_verb alc880_fivestack_ch6_init[] = {
1137 /* set line-in to input, mute it */
1138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1144 static struct hda_verb alc880_fivestack_ch8_init[] = {
1145 /* set line-in to output, unmute it */
1146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1151 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1152 { 6, alc880_fivestack_ch6_init },
1153 { 8, alc880_fivestack_ch8_init },
1158 * ALC880 6-stack model
1160 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1161 * Side = 0x05 (0x0f)
1162 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1163 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1166 static hda_nid_t alc880_6st_dac_nids[4] = {
1167 /* front, rear, clfe, rear_surr */
1168 0x02, 0x03, 0x04, 0x05
1171 static struct hda_input_mux alc880_6stack_capture_source = {
1175 { "Front Mic", 0x1 },
1181 /* fixed 8-channels */
1182 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1186 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1195 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1205 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1206 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1209 .name = "Channel Mode",
1210 .info = alc_ch_mode_info,
1211 .get = alc_ch_mode_get,
1212 .put = alc_ch_mode_put,
1221 * W810 has rear IO for:
1224 * Center/LFE (DAC 04)
1227 * The system also has a pair of internal speakers, and a headphone jack.
1228 * These are both connected to Line2 on the codec, hence to DAC 02.
1230 * There is a variable resistor to control the speaker or headphone
1231 * volume. This is a hardware-only device without a software API.
1233 * Plugging headphones in will disable the internal speakers. This is
1234 * implemented in hardware, not via the driver using jack sense. In
1235 * a similar fashion, plugging into the rear socket marked "front" will
1236 * disable both the speakers and headphones.
1238 * For input, there's a microphone jack, and an "audio in" jack.
1239 * These may not do anything useful with this driver yet, because I
1240 * haven't setup any initialization verbs for these yet...
1243 static hda_nid_t alc880_w810_dac_nids[3] = {
1244 /* front, rear/surround, clfe */
1248 /* fixed 6 channels */
1249 static struct hda_channel_mode alc880_w810_modes[1] = {
1253 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1254 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1258 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1259 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1262 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1271 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1272 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1276 static hda_nid_t alc880_z71v_dac_nids[1] = {
1279 #define ALC880_Z71V_HP_DAC 0x03
1281 /* fixed 2 channels */
1282 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1286 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1289 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1290 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1291 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1292 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1300 * ALC880 F1734 model
1302 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1303 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1306 static hda_nid_t alc880_f1734_dac_nids[1] = {
1309 #define ALC880_F1734_HP_DAC 0x02
1311 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1312 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1313 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1314 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1315 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1317 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1323 static struct hda_input_mux alc880_f1734_capture_source = {
1335 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1336 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1337 * Mic = 0x18, Line = 0x1a
1340 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1341 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1343 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1346 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1347 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1348 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1349 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1350 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1351 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1360 .name = "Channel Mode",
1361 .info = alc_ch_mode_info,
1362 .get = alc_ch_mode_get,
1363 .put = alc_ch_mode_put,
1369 * ALC880 ASUS W1V model
1371 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1372 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1373 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1376 /* additional mixers to alc880_asus_mixer */
1377 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1378 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1379 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1383 /* additional mixers to alc880_asus_mixer */
1384 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1385 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1386 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1391 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1392 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1393 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1394 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1395 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1396 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1399 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1400 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1403 /* The multiple "Capture Source" controls confuse alsamixer
1404 * So call somewhat different..
1406 /* .name = "Capture Source", */
1407 .name = "Input Source",
1409 .info = alc_mux_enum_info,
1410 .get = alc_mux_enum_get,
1411 .put = alc_mux_enum_put,
1417 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1418 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1419 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1420 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1421 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1422 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1423 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1424 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1425 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1426 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1427 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1428 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1429 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1431 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1434 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1435 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1438 .name = "Channel Mode",
1439 .info = alc_ch_mode_info,
1440 .get = alc_ch_mode_get,
1441 .put = alc_ch_mode_put,
1446 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1448 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1450 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1451 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1452 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1453 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1454 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1455 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1456 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1460 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1461 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1462 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1463 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1464 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1471 * virtual master controls
1475 * slave controls for virtual master
1477 static const char *alc_slave_vols[] = {
1478 "Front Playback Volume",
1479 "Surround Playback Volume",
1480 "Center Playback Volume",
1481 "LFE Playback Volume",
1482 "Side Playback Volume",
1483 "Headphone Playback Volume",
1484 "Speaker Playback Volume",
1485 "Mono Playback Volume",
1486 "Line-Out Playback Volume",
1490 static const char *alc_slave_sws[] = {
1491 "Front Playback Switch",
1492 "Surround Playback Switch",
1493 "Center Playback Switch",
1494 "LFE Playback Switch",
1495 "Side Playback Switch",
1496 "Headphone Playback Switch",
1497 "Speaker Playback Switch",
1498 "Mono Playback Switch",
1499 "IEC958 Playback Switch",
1504 * build control elements
1506 static int alc_build_controls(struct hda_codec *codec)
1508 struct alc_spec *spec = codec->spec;
1512 for (i = 0; i < spec->num_mixers; i++) {
1513 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1518 if (spec->multiout.dig_out_nid) {
1519 err = snd_hda_create_spdif_out_ctls(codec,
1520 spec->multiout.dig_out_nid);
1523 err = snd_hda_create_spdif_share_sw(codec,
1527 spec->multiout.share_spdif = 1;
1529 if (spec->dig_in_nid) {
1530 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1535 /* if we have no master control, let's create it */
1536 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1537 unsigned int vmaster_tlv[4];
1538 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1539 HDA_OUTPUT, vmaster_tlv);
1540 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1541 vmaster_tlv, alc_slave_vols);
1545 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1546 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1547 NULL, alc_slave_sws);
1557 * initialize the codec volumes, etc
1561 * generic initialization of ADC, input mixers and output mixers
1563 static struct hda_verb alc880_volume_init_verbs[] = {
1565 * Unmute ADC0-2 and set the default input to mic-in
1567 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1569 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1571 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1572 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1574 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1576 * Note: PASD motherboards uses the Line In 2 as the input for front
1579 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1589 * Set up output mixers (0x0c - 0x0f)
1591 /* set vol=0 to output mixers */
1592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1593 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1595 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1596 /* set up input amps for analog loopback */
1597 /* Amp Indices: DAC = 0, mixer = 1 */
1598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1599 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1600 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1601 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1602 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1603 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1604 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1605 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1611 * 3-stack pin configuration:
1612 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1614 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1616 * preset connection lists of input pins
1617 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1619 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1620 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1621 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1624 * Set pin mode and muting
1626 /* set front pin widgets 0x14 for output */
1627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1629 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1631 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1632 /* Mic2 (as headphone out) for HP output */
1633 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1634 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635 /* Line In pin widget for input */
1636 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1638 /* Line2 (as front mic) pin widget for input and vref at 80% */
1639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1640 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1641 /* CD pin widget for input */
1642 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1648 * 5-stack pin configuration:
1649 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1650 * line-in/side = 0x1a, f-mic = 0x1b
1652 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1654 * preset connection lists of input pins
1655 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1657 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1658 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1661 * Set pin mode and muting
1663 /* set pin widgets 0x14-0x17 for output */
1664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1666 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1667 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1668 /* unmute pins for output (no gain on this amp) */
1669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1674 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1675 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1677 /* Mic2 (as headphone out) for HP output */
1678 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1679 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1680 /* Line In pin widget for input */
1681 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1682 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1683 /* Line2 (as front mic) pin widget for input and vref at 80% */
1684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1686 /* CD pin widget for input */
1687 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1693 * W810 pin configuration:
1694 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1696 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1697 /* hphone/speaker input selector: front DAC */
1698 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1700 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1701 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1704 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1714 * Z71V pin configuration:
1715 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1717 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1718 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1719 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1723 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1726 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1732 * 6-stack pin configuration:
1733 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1734 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1736 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1737 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1739 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1741 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1742 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1743 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1744 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1746 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1748 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1749 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1750 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1751 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1755 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1756 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1762 * Uniwill pin configuration:
1763 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1766 static struct hda_verb alc880_uniwill_init_verbs[] = {
1767 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1773 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1775 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1776 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1784 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1786 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1787 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1790 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1791 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1792 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1794 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1795 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1802 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1804 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1805 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1822 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1823 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1824 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1827 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1828 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1833 static struct hda_verb alc880_beep_init_verbs[] = {
1834 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1838 /* toggle speaker-output according to the hp-jack state */
1839 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1841 unsigned int present;
1844 present = snd_hda_codec_read(codec, 0x14, 0,
1845 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1846 bits = present ? HDA_AMP_MUTE : 0;
1847 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1848 HDA_AMP_MUTE, bits);
1849 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1850 HDA_AMP_MUTE, bits);
1853 /* auto-toggle front mic */
1854 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1856 unsigned int present;
1859 present = snd_hda_codec_read(codec, 0x18, 0,
1860 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1861 bits = present ? HDA_AMP_MUTE : 0;
1862 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1865 static void alc880_uniwill_automute(struct hda_codec *codec)
1867 alc880_uniwill_hp_automute(codec);
1868 alc880_uniwill_mic_automute(codec);
1871 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1874 /* Looks like the unsol event is incompatible with the standard
1875 * definition. 4bit tag is placed at 28 bit!
1877 switch (res >> 28) {
1878 case ALC880_HP_EVENT:
1879 alc880_uniwill_hp_automute(codec);
1881 case ALC880_MIC_EVENT:
1882 alc880_uniwill_mic_automute(codec);
1887 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1889 unsigned int present;
1892 present = snd_hda_codec_read(codec, 0x14, 0,
1893 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1894 bits = present ? HDA_AMP_MUTE : 0;
1895 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1898 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1900 unsigned int present;
1902 present = snd_hda_codec_read(codec, 0x21, 0,
1903 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1904 present &= HDA_AMP_VOLMASK;
1905 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1906 HDA_AMP_VOLMASK, present);
1907 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1908 HDA_AMP_VOLMASK, present);
1911 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1914 /* Looks like the unsol event is incompatible with the standard
1915 * definition. 4bit tag is placed at 28 bit!
1917 if ((res >> 28) == ALC880_HP_EVENT)
1918 alc880_uniwill_p53_hp_automute(codec);
1919 if ((res >> 28) == ALC880_DCVOL_EVENT)
1920 alc880_uniwill_p53_dcvol_automute(codec);
1924 * F1734 pin configuration:
1925 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1927 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1928 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1929 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1930 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1931 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1938 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1940 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1941 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1942 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1944 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1945 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1946 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1948 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1949 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1955 * ASUS pin configuration:
1956 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1958 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1959 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1960 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1961 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1962 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1968 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1969 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1970 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1971 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1973 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1975 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1976 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1981 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1986 /* Enable GPIO mask and set output */
1987 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1988 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1990 /* Clevo m520g init */
1991 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1992 /* headphone output */
1993 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1999 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2001 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2002 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2003 /* Mic1 (rear panel) */
2004 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2005 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2006 /* Mic2 (front panel) */
2007 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2008 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2012 /* change to EAPD mode */
2013 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2014 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2019 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2020 /* change to EAPD mode */
2021 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2022 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2024 /* Headphone output */
2025 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2027 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2028 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2030 /* Line In pin widget for input */
2031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2032 /* CD pin widget for input */
2033 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2034 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2035 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2037 /* change to EAPD mode */
2038 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2039 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2045 * LG m1 express dual
2048 * Rear Line-In/Out (blue): 0x14
2049 * Build-in Mic-In: 0x15
2051 * HP-Out (green): 0x1b
2052 * Mic-In/Out (red): 0x19
2056 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2057 static hda_nid_t alc880_lg_dac_nids[3] = {
2061 /* seems analog CD is not working */
2062 static struct hda_input_mux alc880_lg_capture_source = {
2067 { "Internal Mic", 0x6 },
2071 /* 2,4,6 channel modes */
2072 static struct hda_verb alc880_lg_ch2_init[] = {
2073 /* set line-in and mic-in to input */
2074 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2075 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2079 static struct hda_verb alc880_lg_ch4_init[] = {
2080 /* set line-in to out and mic-in to input */
2081 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2082 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2086 static struct hda_verb alc880_lg_ch6_init[] = {
2087 /* set line-in and mic-in to output */
2088 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2089 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2093 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2094 { 2, alc880_lg_ch2_init },
2095 { 4, alc880_lg_ch4_init },
2096 { 6, alc880_lg_ch6_init },
2099 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2105 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2106 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2107 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2113 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2116 .name = "Channel Mode",
2117 .info = alc_ch_mode_info,
2118 .get = alc_ch_mode_get,
2119 .put = alc_ch_mode_put,
2124 static struct hda_verb alc880_lg_init_verbs[] = {
2125 /* set capture source to mic-in */
2126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2127 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2129 /* mute all amp mixer inputs */
2130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2133 /* line-in to input */
2134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2135 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2140 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2141 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2142 /* mic-in to input */
2143 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2147 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2148 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2149 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2151 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2155 /* toggle speaker-output according to the hp-jack state */
2156 static void alc880_lg_automute(struct hda_codec *codec)
2158 unsigned int present;
2161 present = snd_hda_codec_read(codec, 0x1b, 0,
2162 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2163 bits = present ? HDA_AMP_MUTE : 0;
2164 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2165 HDA_AMP_MUTE, bits);
2168 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2170 /* Looks like the unsol event is incompatible with the standard
2171 * definition. 4bit tag is placed at 28 bit!
2173 if ((res >> 28) == 0x01)
2174 alc880_lg_automute(codec);
2183 * Built-in Mic-In: 0x19
2189 static struct hda_input_mux alc880_lg_lw_capture_source = {
2193 { "Internal Mic", 0x1 },
2198 #define alc880_lg_lw_modes alc880_threestack_modes
2200 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2203 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2204 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2205 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2206 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2207 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2208 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2210 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2214 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2217 .name = "Channel Mode",
2218 .info = alc_ch_mode_info,
2219 .get = alc_ch_mode_get,
2220 .put = alc_ch_mode_put,
2225 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2226 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2227 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2228 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2230 /* set capture source to mic-in */
2231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2232 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2233 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2237 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2239 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2240 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2241 /* mic-in to input */
2242 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2243 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2245 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2246 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2248 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2252 /* toggle speaker-output according to the hp-jack state */
2253 static void alc880_lg_lw_automute(struct hda_codec *codec)
2255 unsigned int present;
2258 present = snd_hda_codec_read(codec, 0x1b, 0,
2259 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2260 bits = present ? HDA_AMP_MUTE : 0;
2261 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2262 HDA_AMP_MUTE, bits);
2265 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2267 /* Looks like the unsol event is incompatible with the standard
2268 * definition. 4bit tag is placed at 28 bit!
2270 if ((res >> 28) == 0x01)
2271 alc880_lg_lw_automute(codec);
2274 #ifdef CONFIG_SND_HDA_POWER_SAVE
2275 static struct hda_amp_list alc880_loopbacks[] = {
2276 { 0x0b, HDA_INPUT, 0 },
2277 { 0x0b, HDA_INPUT, 1 },
2278 { 0x0b, HDA_INPUT, 2 },
2279 { 0x0b, HDA_INPUT, 3 },
2280 { 0x0b, HDA_INPUT, 4 },
2284 static struct hda_amp_list alc880_lg_loopbacks[] = {
2285 { 0x0b, HDA_INPUT, 1 },
2286 { 0x0b, HDA_INPUT, 6 },
2287 { 0x0b, HDA_INPUT, 7 },
2296 static int alc_init(struct hda_codec *codec)
2298 struct alc_spec *spec = codec->spec;
2301 for (i = 0; i < spec->num_init_verbs; i++)
2302 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2304 if (spec->init_hook)
2305 spec->init_hook(codec);
2310 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2312 struct alc_spec *spec = codec->spec;
2314 if (spec->unsol_event)
2315 spec->unsol_event(codec, res);
2318 #ifdef CONFIG_SND_HDA_POWER_SAVE
2319 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2321 struct alc_spec *spec = codec->spec;
2322 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2327 * Analog playback callbacks
2329 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2330 struct hda_codec *codec,
2331 struct snd_pcm_substream *substream)
2333 struct alc_spec *spec = codec->spec;
2334 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2338 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2339 struct hda_codec *codec,
2340 unsigned int stream_tag,
2341 unsigned int format,
2342 struct snd_pcm_substream *substream)
2344 struct alc_spec *spec = codec->spec;
2345 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2346 stream_tag, format, substream);
2349 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2350 struct hda_codec *codec,
2351 struct snd_pcm_substream *substream)
2353 struct alc_spec *spec = codec->spec;
2354 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2360 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2361 struct hda_codec *codec,
2362 struct snd_pcm_substream *substream)
2364 struct alc_spec *spec = codec->spec;
2365 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2368 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2369 struct hda_codec *codec,
2370 unsigned int stream_tag,
2371 unsigned int format,
2372 struct snd_pcm_substream *substream)
2374 struct alc_spec *spec = codec->spec;
2375 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2376 stream_tag, format, substream);
2379 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2380 struct hda_codec *codec,
2381 struct snd_pcm_substream *substream)
2383 struct alc_spec *spec = codec->spec;
2384 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2390 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2391 struct hda_codec *codec,
2392 unsigned int stream_tag,
2393 unsigned int format,
2394 struct snd_pcm_substream *substream)
2396 struct alc_spec *spec = codec->spec;
2398 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2399 stream_tag, 0, format);
2403 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2404 struct hda_codec *codec,
2405 struct snd_pcm_substream *substream)
2407 struct alc_spec *spec = codec->spec;
2409 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2417 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2421 /* NID is set in alc_build_pcms */
2423 .open = alc880_playback_pcm_open,
2424 .prepare = alc880_playback_pcm_prepare,
2425 .cleanup = alc880_playback_pcm_cleanup
2429 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2433 /* NID is set in alc_build_pcms */
2436 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2440 /* NID is set in alc_build_pcms */
2443 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2444 .substreams = 2, /* can be overridden */
2447 /* NID is set in alc_build_pcms */
2449 .prepare = alc880_alt_capture_pcm_prepare,
2450 .cleanup = alc880_alt_capture_pcm_cleanup
2454 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2458 /* NID is set in alc_build_pcms */
2460 .open = alc880_dig_playback_pcm_open,
2461 .close = alc880_dig_playback_pcm_close,
2462 .prepare = alc880_dig_playback_pcm_prepare
2466 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2470 /* NID is set in alc_build_pcms */
2473 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2474 static struct hda_pcm_stream alc_pcm_null_stream = {
2480 static int alc_build_pcms(struct hda_codec *codec)
2482 struct alc_spec *spec = codec->spec;
2483 struct hda_pcm *info = spec->pcm_rec;
2486 codec->num_pcms = 1;
2487 codec->pcm_info = info;
2489 info->name = spec->stream_name_analog;
2490 if (spec->stream_analog_playback) {
2491 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2492 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2493 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2495 if (spec->stream_analog_capture) {
2496 snd_assert(spec->adc_nids, return -EINVAL);
2497 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2498 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2501 if (spec->channel_mode) {
2502 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2503 for (i = 0; i < spec->num_channel_mode; i++) {
2504 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2505 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2510 /* SPDIF for stream index #1 */
2511 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2512 codec->num_pcms = 2;
2513 info = spec->pcm_rec + 1;
2514 info->name = spec->stream_name_digital;
2515 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2516 if (spec->multiout.dig_out_nid &&
2517 spec->stream_digital_playback) {
2518 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2519 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2521 if (spec->dig_in_nid &&
2522 spec->stream_digital_capture) {
2523 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2524 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2528 /* If the use of more than one ADC is requested for the current
2529 * model, configure a second analog capture-only PCM.
2531 /* Additional Analaog capture for index #2 */
2532 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2533 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2534 codec->num_pcms = 3;
2535 info = spec->pcm_rec + 2;
2536 info->name = spec->stream_name_analog;
2537 if (spec->alt_dac_nid) {
2538 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2539 *spec->stream_analog_alt_playback;
2540 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2543 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2544 alc_pcm_null_stream;
2545 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2547 if (spec->num_adc_nids > 1) {
2548 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2549 *spec->stream_analog_alt_capture;
2550 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2552 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2553 spec->num_adc_nids - 1;
2555 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2556 alc_pcm_null_stream;
2557 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2564 static void alc_free(struct hda_codec *codec)
2566 struct alc_spec *spec = codec->spec;
2572 if (spec->kctl_alloc) {
2573 for (i = 0; i < spec->num_kctl_used; i++)
2574 kfree(spec->kctl_alloc[i].name);
2575 kfree(spec->kctl_alloc);
2582 static struct hda_codec_ops alc_patch_ops = {
2583 .build_controls = alc_build_controls,
2584 .build_pcms = alc_build_pcms,
2587 .unsol_event = alc_unsol_event,
2588 #ifdef CONFIG_SND_HDA_POWER_SAVE
2589 .check_power_status = alc_check_power_status,
2595 * Test configuration for debugging
2597 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2600 #ifdef CONFIG_SND_DEBUG
2601 static hda_nid_t alc880_test_dac_nids[4] = {
2602 0x02, 0x03, 0x04, 0x05
2605 static struct hda_input_mux alc880_test_capture_source = {
2614 { "Surround", 0x6 },
2618 static struct hda_channel_mode alc880_test_modes[4] = {
2625 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2626 struct snd_ctl_elem_info *uinfo)
2628 static char *texts[] = {
2629 "N/A", "Line Out", "HP Out",
2630 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2632 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2634 uinfo->value.enumerated.items = 8;
2635 if (uinfo->value.enumerated.item >= 8)
2636 uinfo->value.enumerated.item = 7;
2637 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2641 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2642 struct snd_ctl_elem_value *ucontrol)
2644 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2645 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2646 unsigned int pin_ctl, item = 0;
2648 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2649 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2650 if (pin_ctl & AC_PINCTL_OUT_EN) {
2651 if (pin_ctl & AC_PINCTL_HP_EN)
2655 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2656 switch (pin_ctl & AC_PINCTL_VREFEN) {
2657 case AC_PINCTL_VREF_HIZ: item = 3; break;
2658 case AC_PINCTL_VREF_50: item = 4; break;
2659 case AC_PINCTL_VREF_GRD: item = 5; break;
2660 case AC_PINCTL_VREF_80: item = 6; break;
2661 case AC_PINCTL_VREF_100: item = 7; break;
2664 ucontrol->value.enumerated.item[0] = item;
2668 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2669 struct snd_ctl_elem_value *ucontrol)
2671 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2672 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2673 static unsigned int ctls[] = {
2674 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2675 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2676 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2677 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2678 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2679 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2681 unsigned int old_ctl, new_ctl;
2683 old_ctl = snd_hda_codec_read(codec, nid, 0,
2684 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2685 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2686 if (old_ctl != new_ctl) {
2688 snd_hda_codec_write_cache(codec, nid, 0,
2689 AC_VERB_SET_PIN_WIDGET_CONTROL,
2691 val = ucontrol->value.enumerated.item[0] >= 3 ?
2693 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2700 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2701 struct snd_ctl_elem_info *uinfo)
2703 static char *texts[] = {
2704 "Front", "Surround", "CLFE", "Side"
2706 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2708 uinfo->value.enumerated.items = 4;
2709 if (uinfo->value.enumerated.item >= 4)
2710 uinfo->value.enumerated.item = 3;
2711 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2715 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2716 struct snd_ctl_elem_value *ucontrol)
2718 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2719 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2722 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2723 ucontrol->value.enumerated.item[0] = sel & 3;
2727 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2728 struct snd_ctl_elem_value *ucontrol)
2730 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2731 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2734 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2735 if (ucontrol->value.enumerated.item[0] != sel) {
2736 sel = ucontrol->value.enumerated.item[0] & 3;
2737 snd_hda_codec_write_cache(codec, nid, 0,
2738 AC_VERB_SET_CONNECT_SEL, sel);
2744 #define PIN_CTL_TEST(xname,nid) { \
2745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2747 .info = alc_test_pin_ctl_info, \
2748 .get = alc_test_pin_ctl_get, \
2749 .put = alc_test_pin_ctl_put, \
2750 .private_value = nid \
2753 #define PIN_SRC_TEST(xname,nid) { \
2754 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2756 .info = alc_test_pin_src_info, \
2757 .get = alc_test_pin_src_get, \
2758 .put = alc_test_pin_src_put, \
2759 .private_value = nid \
2762 static struct snd_kcontrol_new alc880_test_mixer[] = {
2763 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2764 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2765 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2766 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2768 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2769 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2770 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2771 PIN_CTL_TEST("Front Pin Mode", 0x14),
2772 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2773 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2774 PIN_CTL_TEST("Side Pin Mode", 0x17),
2775 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2776 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2777 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2778 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2779 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2780 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2781 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2782 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2783 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2784 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2785 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2786 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2787 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2788 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2789 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2790 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2791 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2792 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2795 .name = "Channel Mode",
2796 .info = alc_ch_mode_info,
2797 .get = alc_ch_mode_get,
2798 .put = alc_ch_mode_put,
2803 static struct hda_verb alc880_test_init_verbs[] = {
2804 /* Unmute inputs of 0x0c - 0x0f */
2805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2810 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2812 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2813 /* Vol output for 0x0c-0x0f */
2814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2818 /* Set output pins 0x14-0x17 */
2819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2821 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2822 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2823 /* Unmute output pins 0x14-0x17 */
2824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2825 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2826 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2827 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2828 /* Set input pins 0x18-0x1c */
2829 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2831 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2834 /* Mute input pins 0x18-0x1b */
2835 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2836 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2837 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2838 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2840 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2841 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2842 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2843 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2844 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2845 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2846 /* Analog input/passthru */
2847 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2859 static const char *alc880_models[ALC880_MODEL_LAST] = {
2860 [ALC880_3ST] = "3stack",
2861 [ALC880_TCL_S700] = "tcl",
2862 [ALC880_3ST_DIG] = "3stack-digout",
2863 [ALC880_CLEVO] = "clevo",
2864 [ALC880_5ST] = "5stack",
2865 [ALC880_5ST_DIG] = "5stack-digout",
2866 [ALC880_W810] = "w810",
2867 [ALC880_Z71V] = "z71v",
2868 [ALC880_6ST] = "6stack",
2869 [ALC880_6ST_DIG] = "6stack-digout",
2870 [ALC880_ASUS] = "asus",
2871 [ALC880_ASUS_W1V] = "asus-w1v",
2872 [ALC880_ASUS_DIG] = "asus-dig",
2873 [ALC880_ASUS_DIG2] = "asus-dig2",
2874 [ALC880_UNIWILL_DIG] = "uniwill",
2875 [ALC880_UNIWILL_P53] = "uniwill-p53",
2876 [ALC880_FUJITSU] = "fujitsu",
2877 [ALC880_F1734] = "F1734",
2879 [ALC880_LG_LW] = "lg-lw",
2880 #ifdef CONFIG_SND_DEBUG
2881 [ALC880_TEST] = "test",
2883 [ALC880_AUTO] = "auto",
2886 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2887 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2888 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2889 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2890 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2891 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2892 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2893 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2894 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2895 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2896 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2897 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2898 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2899 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2900 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2901 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2902 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2903 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2904 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2905 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2906 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2907 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2908 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2909 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2910 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2911 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2912 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2913 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2914 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2915 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2916 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2917 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2918 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2919 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2920 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2921 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2922 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2923 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2924 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2925 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2926 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2927 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2928 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2929 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2930 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2931 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2932 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2933 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2934 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2935 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2936 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2937 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2938 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2939 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2940 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2941 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2942 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2943 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2944 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2945 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2946 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2947 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2948 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2949 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2950 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2951 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2952 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2953 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2954 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2955 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2960 * ALC880 codec presets
2962 static struct alc_config_preset alc880_presets[] = {
2964 .mixers = { alc880_three_stack_mixer },
2965 .init_verbs = { alc880_volume_init_verbs,
2966 alc880_pin_3stack_init_verbs },
2967 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2968 .dac_nids = alc880_dac_nids,
2969 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2970 .channel_mode = alc880_threestack_modes,
2972 .input_mux = &alc880_capture_source,
2974 [ALC880_3ST_DIG] = {
2975 .mixers = { alc880_three_stack_mixer },
2976 .init_verbs = { alc880_volume_init_verbs,
2977 alc880_pin_3stack_init_verbs },
2978 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2979 .dac_nids = alc880_dac_nids,
2980 .dig_out_nid = ALC880_DIGOUT_NID,
2981 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2982 .channel_mode = alc880_threestack_modes,
2984 .input_mux = &alc880_capture_source,
2986 [ALC880_TCL_S700] = {
2987 .mixers = { alc880_tcl_s700_mixer },
2988 .init_verbs = { alc880_volume_init_verbs,
2989 alc880_pin_tcl_S700_init_verbs,
2990 alc880_gpio2_init_verbs },
2991 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2992 .dac_nids = alc880_dac_nids,
2994 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2995 .channel_mode = alc880_2_jack_modes,
2996 .input_mux = &alc880_capture_source,
2999 .mixers = { alc880_three_stack_mixer,
3000 alc880_five_stack_mixer},
3001 .init_verbs = { alc880_volume_init_verbs,
3002 alc880_pin_5stack_init_verbs },
3003 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3004 .dac_nids = alc880_dac_nids,
3005 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3006 .channel_mode = alc880_fivestack_modes,
3007 .input_mux = &alc880_capture_source,
3009 [ALC880_5ST_DIG] = {
3010 .mixers = { alc880_three_stack_mixer,
3011 alc880_five_stack_mixer },
3012 .init_verbs = { alc880_volume_init_verbs,
3013 alc880_pin_5stack_init_verbs },
3014 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3015 .dac_nids = alc880_dac_nids,
3016 .dig_out_nid = ALC880_DIGOUT_NID,
3017 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3018 .channel_mode = alc880_fivestack_modes,
3019 .input_mux = &alc880_capture_source,
3022 .mixers = { alc880_six_stack_mixer },
3023 .init_verbs = { alc880_volume_init_verbs,
3024 alc880_pin_6stack_init_verbs },
3025 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3026 .dac_nids = alc880_6st_dac_nids,
3027 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3028 .channel_mode = alc880_sixstack_modes,
3029 .input_mux = &alc880_6stack_capture_source,
3031 [ALC880_6ST_DIG] = {
3032 .mixers = { alc880_six_stack_mixer },
3033 .init_verbs = { alc880_volume_init_verbs,
3034 alc880_pin_6stack_init_verbs },
3035 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3036 .dac_nids = alc880_6st_dac_nids,
3037 .dig_out_nid = ALC880_DIGOUT_NID,
3038 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3039 .channel_mode = alc880_sixstack_modes,
3040 .input_mux = &alc880_6stack_capture_source,
3043 .mixers = { alc880_w810_base_mixer },
3044 .init_verbs = { alc880_volume_init_verbs,
3045 alc880_pin_w810_init_verbs,
3046 alc880_gpio2_init_verbs },
3047 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3048 .dac_nids = alc880_w810_dac_nids,
3049 .dig_out_nid = ALC880_DIGOUT_NID,
3050 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3051 .channel_mode = alc880_w810_modes,
3052 .input_mux = &alc880_capture_source,
3055 .mixers = { alc880_z71v_mixer },
3056 .init_verbs = { alc880_volume_init_verbs,
3057 alc880_pin_z71v_init_verbs },
3058 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3059 .dac_nids = alc880_z71v_dac_nids,
3060 .dig_out_nid = ALC880_DIGOUT_NID,
3062 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3063 .channel_mode = alc880_2_jack_modes,
3064 .input_mux = &alc880_capture_source,
3067 .mixers = { alc880_f1734_mixer },
3068 .init_verbs = { alc880_volume_init_verbs,
3069 alc880_pin_f1734_init_verbs },
3070 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3071 .dac_nids = alc880_f1734_dac_nids,
3073 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3074 .channel_mode = alc880_2_jack_modes,
3075 .input_mux = &alc880_f1734_capture_source,
3076 .unsol_event = alc880_uniwill_p53_unsol_event,
3077 .init_hook = alc880_uniwill_p53_hp_automute,
3080 .mixers = { alc880_asus_mixer },
3081 .init_verbs = { alc880_volume_init_verbs,
3082 alc880_pin_asus_init_verbs,
3083 alc880_gpio1_init_verbs },
3084 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3085 .dac_nids = alc880_asus_dac_nids,
3086 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3087 .channel_mode = alc880_asus_modes,
3089 .input_mux = &alc880_capture_source,
3091 [ALC880_ASUS_DIG] = {
3092 .mixers = { alc880_asus_mixer },
3093 .init_verbs = { alc880_volume_init_verbs,
3094 alc880_pin_asus_init_verbs,
3095 alc880_gpio1_init_verbs },
3096 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3097 .dac_nids = alc880_asus_dac_nids,
3098 .dig_out_nid = ALC880_DIGOUT_NID,
3099 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3100 .channel_mode = alc880_asus_modes,
3102 .input_mux = &alc880_capture_source,
3104 [ALC880_ASUS_DIG2] = {
3105 .mixers = { alc880_asus_mixer },
3106 .init_verbs = { alc880_volume_init_verbs,
3107 alc880_pin_asus_init_verbs,
3108 alc880_gpio2_init_verbs }, /* use GPIO2 */
3109 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3110 .dac_nids = alc880_asus_dac_nids,
3111 .dig_out_nid = ALC880_DIGOUT_NID,
3112 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3113 .channel_mode = alc880_asus_modes,
3115 .input_mux = &alc880_capture_source,
3117 [ALC880_ASUS_W1V] = {
3118 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3119 .init_verbs = { alc880_volume_init_verbs,
3120 alc880_pin_asus_init_verbs,
3121 alc880_gpio1_init_verbs },
3122 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3123 .dac_nids = alc880_asus_dac_nids,
3124 .dig_out_nid = ALC880_DIGOUT_NID,
3125 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3126 .channel_mode = alc880_asus_modes,
3128 .input_mux = &alc880_capture_source,
3130 [ALC880_UNIWILL_DIG] = {
3131 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3132 .init_verbs = { alc880_volume_init_verbs,
3133 alc880_pin_asus_init_verbs },
3134 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3135 .dac_nids = alc880_asus_dac_nids,
3136 .dig_out_nid = ALC880_DIGOUT_NID,
3137 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3138 .channel_mode = alc880_asus_modes,
3140 .input_mux = &alc880_capture_source,
3142 [ALC880_UNIWILL] = {
3143 .mixers = { alc880_uniwill_mixer },
3144 .init_verbs = { alc880_volume_init_verbs,
3145 alc880_uniwill_init_verbs },
3146 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3147 .dac_nids = alc880_asus_dac_nids,
3148 .dig_out_nid = ALC880_DIGOUT_NID,
3149 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3150 .channel_mode = alc880_threestack_modes,
3152 .input_mux = &alc880_capture_source,
3153 .unsol_event = alc880_uniwill_unsol_event,
3154 .init_hook = alc880_uniwill_automute,
3156 [ALC880_UNIWILL_P53] = {
3157 .mixers = { alc880_uniwill_p53_mixer },
3158 .init_verbs = { alc880_volume_init_verbs,
3159 alc880_uniwill_p53_init_verbs },
3160 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3161 .dac_nids = alc880_asus_dac_nids,
3162 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3163 .channel_mode = alc880_threestack_modes,
3164 .input_mux = &alc880_capture_source,
3165 .unsol_event = alc880_uniwill_p53_unsol_event,
3166 .init_hook = alc880_uniwill_p53_hp_automute,
3168 [ALC880_FUJITSU] = {
3169 .mixers = { alc880_fujitsu_mixer,
3170 alc880_pcbeep_mixer, },
3171 .init_verbs = { alc880_volume_init_verbs,
3172 alc880_uniwill_p53_init_verbs,
3173 alc880_beep_init_verbs },
3174 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3175 .dac_nids = alc880_dac_nids,
3176 .dig_out_nid = ALC880_DIGOUT_NID,
3177 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3178 .channel_mode = alc880_2_jack_modes,
3179 .input_mux = &alc880_capture_source,
3180 .unsol_event = alc880_uniwill_p53_unsol_event,
3181 .init_hook = alc880_uniwill_p53_hp_automute,
3184 .mixers = { alc880_three_stack_mixer },
3185 .init_verbs = { alc880_volume_init_verbs,
3186 alc880_pin_clevo_init_verbs },
3187 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3188 .dac_nids = alc880_dac_nids,
3190 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3191 .channel_mode = alc880_threestack_modes,
3193 .input_mux = &alc880_capture_source,
3196 .mixers = { alc880_lg_mixer },
3197 .init_verbs = { alc880_volume_init_verbs,
3198 alc880_lg_init_verbs },
3199 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3200 .dac_nids = alc880_lg_dac_nids,
3201 .dig_out_nid = ALC880_DIGOUT_NID,
3202 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3203 .channel_mode = alc880_lg_ch_modes,
3205 .input_mux = &alc880_lg_capture_source,
3206 .unsol_event = alc880_lg_unsol_event,
3207 .init_hook = alc880_lg_automute,
3208 #ifdef CONFIG_SND_HDA_POWER_SAVE
3209 .loopbacks = alc880_lg_loopbacks,
3213 .mixers = { alc880_lg_lw_mixer },
3214 .init_verbs = { alc880_volume_init_verbs,
3215 alc880_lg_lw_init_verbs },
3216 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3217 .dac_nids = alc880_dac_nids,
3218 .dig_out_nid = ALC880_DIGOUT_NID,
3219 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3220 .channel_mode = alc880_lg_lw_modes,
3221 .input_mux = &alc880_lg_lw_capture_source,
3222 .unsol_event = alc880_lg_lw_unsol_event,
3223 .init_hook = alc880_lg_lw_automute,
3225 #ifdef CONFIG_SND_DEBUG
3227 .mixers = { alc880_test_mixer },
3228 .init_verbs = { alc880_test_init_verbs },
3229 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3230 .dac_nids = alc880_test_dac_nids,
3231 .dig_out_nid = ALC880_DIGOUT_NID,
3232 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3233 .channel_mode = alc880_test_modes,
3234 .input_mux = &alc880_test_capture_source,
3240 * Automatic parse of I/O pins from the BIOS configuration
3243 #define NUM_CONTROL_ALLOC 32
3244 #define NUM_VERB_ALLOC 32
3248 ALC_CTL_WIDGET_MUTE,
3251 static struct snd_kcontrol_new alc880_control_templates[] = {
3252 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3253 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3254 HDA_BIND_MUTE(NULL, 0, 0, 0),
3257 /* add dynamic controls */
3258 static int add_control(struct alc_spec *spec, int type, const char *name,
3261 struct snd_kcontrol_new *knew;
3263 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3264 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3266 /* array + terminator */
3267 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3270 if (spec->kctl_alloc) {
3271 memcpy(knew, spec->kctl_alloc,
3272 sizeof(*knew) * spec->num_kctl_alloc);
3273 kfree(spec->kctl_alloc);
3275 spec->kctl_alloc = knew;
3276 spec->num_kctl_alloc = num;
3279 knew = &spec->kctl_alloc[spec->num_kctl_used];
3280 *knew = alc880_control_templates[type];
3281 knew->name = kstrdup(name, GFP_KERNEL);
3284 knew->private_value = val;
3285 spec->num_kctl_used++;
3289 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3290 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3291 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3292 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3293 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3294 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3295 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3296 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3297 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3298 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3299 #define ALC880_PIN_CD_NID 0x1c
3301 /* fill in the dac_nids table from the parsed pin configuration */
3302 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3303 const struct auto_pin_cfg *cfg)
3309 memset(assigned, 0, sizeof(assigned));
3310 spec->multiout.dac_nids = spec->private_dac_nids;
3312 /* check the pins hardwired to audio widget */
3313 for (i = 0; i < cfg->line_outs; i++) {
3314 nid = cfg->line_out_pins[i];
3315 if (alc880_is_fixed_pin(nid)) {
3316 int idx = alc880_fixed_pin_idx(nid);
3317 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3321 /* left pins can be connect to any audio widget */
3322 for (i = 0; i < cfg->line_outs; i++) {
3323 nid = cfg->line_out_pins[i];
3324 if (alc880_is_fixed_pin(nid))
3326 /* search for an empty channel */
3327 for (j = 0; j < cfg->line_outs; j++) {
3329 spec->multiout.dac_nids[i] =
3330 alc880_idx_to_dac(j);
3336 spec->multiout.num_dacs = cfg->line_outs;
3340 /* add playback controls from the parsed DAC table */
3341 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3342 const struct auto_pin_cfg *cfg)
3345 static const char *chname[4] = {
3346 "Front", "Surround", NULL /*CLFE*/, "Side"
3351 for (i = 0; i < cfg->line_outs; i++) {
3352 if (!spec->multiout.dac_nids[i])
3354 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3357 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3358 "Center Playback Volume",
3359 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3363 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3364 "LFE Playback Volume",
3365 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3369 err = add_control(spec, ALC_CTL_BIND_MUTE,
3370 "Center Playback Switch",
3371 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3375 err = add_control(spec, ALC_CTL_BIND_MUTE,
3376 "LFE Playback Switch",
3377 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3382 sprintf(name, "%s Playback Volume", chname[i]);
3383 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3384 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3388 sprintf(name, "%s Playback Switch", chname[i]);
3389 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3390 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3399 /* add playback controls for speaker and HP outputs */
3400 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3410 if (alc880_is_fixed_pin(pin)) {
3411 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3412 /* specify the DAC as the extra output */
3413 if (!spec->multiout.hp_nid)
3414 spec->multiout.hp_nid = nid;
3416 spec->multiout.extra_out_nid[0] = nid;
3417 /* control HP volume/switch on the output mixer amp */
3418 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3419 sprintf(name, "%s Playback Volume", pfx);
3420 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3421 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3424 sprintf(name, "%s Playback Switch", pfx);
3425 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3426 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3429 } else if (alc880_is_multi_pin(pin)) {
3430 /* set manual connection */
3431 /* we have only a switch on HP-out PIN */
3432 sprintf(name, "%s Playback Switch", pfx);
3433 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3434 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3441 /* create input playback/capture controls for the given pin */
3442 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3443 const char *ctlname,
3444 int idx, hda_nid_t mix_nid)
3449 sprintf(name, "%s Playback Volume", ctlname);
3450 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3451 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3454 sprintf(name, "%s Playback Switch", ctlname);
3455 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3456 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3462 /* create playback/capture controls for input pins */
3463 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3464 const struct auto_pin_cfg *cfg)
3466 struct hda_input_mux *imux = &spec->private_imux;
3469 for (i = 0; i < AUTO_PIN_LAST; i++) {
3470 if (alc880_is_input_pin(cfg->input_pins[i])) {
3471 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3472 err = new_analog_input(spec, cfg->input_pins[i],
3473 auto_pin_cfg_labels[i],
3477 imux->items[imux->num_items].label =
3478 auto_pin_cfg_labels[i];
3479 imux->items[imux->num_items].index =
3480 alc880_input_pin_idx(cfg->input_pins[i]);
3487 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3488 unsigned int pin_type)
3490 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3493 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3497 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3498 hda_nid_t nid, int pin_type,
3501 alc_set_pin_output(codec, nid, pin_type);
3502 /* need the manual connection? */
3503 if (alc880_is_multi_pin(nid)) {
3504 struct alc_spec *spec = codec->spec;
3505 int idx = alc880_multi_pin_idx(nid);
3506 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3507 AC_VERB_SET_CONNECT_SEL,
3508 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3512 static int get_pin_type(int line_out_type)
3514 if (line_out_type == AUTO_PIN_HP_OUT)
3520 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3522 struct alc_spec *spec = codec->spec;
3525 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3526 for (i = 0; i < spec->autocfg.line_outs; i++) {
3527 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3528 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3529 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3533 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3535 struct alc_spec *spec = codec->spec;
3538 pin = spec->autocfg.speaker_pins[0];
3539 if (pin) /* connect to front */
3540 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3541 pin = spec->autocfg.hp_pins[0];
3542 if (pin) /* connect to front */
3543 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3546 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3548 struct alc_spec *spec = codec->spec;
3551 for (i = 0; i < AUTO_PIN_LAST; i++) {
3552 hda_nid_t nid = spec->autocfg.input_pins[i];
3553 if (alc880_is_input_pin(nid)) {
3554 snd_hda_codec_write(codec, nid, 0,
3555 AC_VERB_SET_PIN_WIDGET_CONTROL,
3556 i <= AUTO_PIN_FRONT_MIC ?
3557 PIN_VREF80 : PIN_IN);
3558 if (nid != ALC880_PIN_CD_NID)
3559 snd_hda_codec_write(codec, nid, 0,
3560 AC_VERB_SET_AMP_GAIN_MUTE,
3566 /* parse the BIOS configuration and set up the alc_spec */
3567 /* return 1 if successful, 0 if the proper config is not found,
3568 * or a negative error code
3570 static int alc880_parse_auto_config(struct hda_codec *codec)
3572 struct alc_spec *spec = codec->spec;
3574 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3576 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3580 if (!spec->autocfg.line_outs)
3581 return 0; /* can't find valid BIOS pin config */
3583 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3586 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3589 err = alc880_auto_create_extra_out(spec,
3590 spec->autocfg.speaker_pins[0],
3594 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3598 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3602 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3604 if (spec->autocfg.dig_out_pin)
3605 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3606 if (spec->autocfg.dig_in_pin)
3607 spec->dig_in_nid = ALC880_DIGIN_NID;
3609 if (spec->kctl_alloc)
3610 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3612 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3614 spec->num_mux_defs = 1;
3615 spec->input_mux = &spec->private_imux;
3620 /* additional initialization for auto-configuration model */
3621 static void alc880_auto_init(struct hda_codec *codec)
3623 struct alc_spec *spec = codec->spec;
3624 alc880_auto_init_multi_out(codec);
3625 alc880_auto_init_extra_out(codec);
3626 alc880_auto_init_analog_input(codec);
3627 if (spec->unsol_event)
3628 alc_sku_automute(codec);
3632 * OK, here we have finally the patch for ALC880
3635 static int patch_alc880(struct hda_codec *codec)
3637 struct alc_spec *spec;
3641 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3647 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3650 if (board_config < 0) {
3651 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3652 "trying auto-probe from BIOS...\n");
3653 board_config = ALC880_AUTO;
3656 if (board_config == ALC880_AUTO) {
3657 /* automatic parse from the BIOS config */
3658 err = alc880_parse_auto_config(codec);
3664 "hda_codec: Cannot set up configuration "
3665 "from BIOS. Using 3-stack mode...\n");
3666 board_config = ALC880_3ST;
3670 if (board_config != ALC880_AUTO)
3671 setup_preset(spec, &alc880_presets[board_config]);
3673 spec->stream_name_analog = "ALC880 Analog";
3674 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3675 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3676 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3678 spec->stream_name_digital = "ALC880 Digital";
3679 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3680 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3682 if (!spec->adc_nids && spec->input_mux) {
3683 /* check whether NID 0x07 is valid */
3684 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3686 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3687 if (wcap != AC_WID_AUD_IN) {
3688 spec->adc_nids = alc880_adc_nids_alt;
3689 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3690 spec->mixers[spec->num_mixers] =
3691 alc880_capture_alt_mixer;
3694 spec->adc_nids = alc880_adc_nids;
3695 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3696 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3701 spec->vmaster_nid = 0x0c;
3703 codec->patch_ops = alc_patch_ops;
3704 if (board_config == ALC880_AUTO)
3705 spec->init_hook = alc880_auto_init;
3706 #ifdef CONFIG_SND_HDA_POWER_SAVE
3707 if (!spec->loopback.amplist)
3708 spec->loopback.amplist = alc880_loopbacks;
3719 static hda_nid_t alc260_dac_nids[1] = {
3724 static hda_nid_t alc260_adc_nids[1] = {
3729 static hda_nid_t alc260_adc_nids_alt[1] = {
3734 static hda_nid_t alc260_hp_adc_nids[2] = {
3739 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3740 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3742 static hda_nid_t alc260_dual_adc_nids[2] = {
3747 #define ALC260_DIGOUT_NID 0x03
3748 #define ALC260_DIGIN_NID 0x06
3750 static struct hda_input_mux alc260_capture_source = {
3754 { "Front Mic", 0x1 },
3760 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3761 * headphone jack and the internal CD lines since these are the only pins at
3762 * which audio can appear. For flexibility, also allow the option of
3763 * recording the mixer output on the second ADC (ADC0 doesn't have a
3764 * connection to the mixer output).
3766 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3770 { "Mic/Line", 0x0 },
3772 { "Headphone", 0x2 },
3778 { "Mic/Line", 0x0 },
3780 { "Headphone", 0x2 },
3787 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3788 * the Fujitsu S702x, but jacks are marked differently.
3790 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3797 { "Headphone", 0x5 },
3806 { "Headphone", 0x6 },
3812 * This is just place-holder, so there's something for alc_build_pcms to look
3813 * at when it calculates the maximum number of channels. ALC260 has no mixer
3814 * element which allows changing the channel mode, so the verb list is
3817 static struct hda_channel_mode alc260_modes[1] = {
3822 /* Mixer combinations
3824 * basic: base_output + input + pc_beep + capture
3825 * HP: base_output + input + capture_alt
3826 * HP_3013: hp_3013 + input + capture
3827 * fujitsu: fujitsu + capture
3828 * acer: acer + capture
3831 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3832 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3833 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3834 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3835 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3836 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3837 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3841 static struct snd_kcontrol_new alc260_input_mixer[] = {
3842 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3843 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3844 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3845 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3847 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3848 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3849 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3853 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3854 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3855 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3859 /* update HP, line and mono out pins according to the master switch */
3860 static void alc260_hp_master_update(struct hda_codec *codec,
3861 hda_nid_t hp, hda_nid_t line,
3864 struct alc_spec *spec = codec->spec;
3865 unsigned int val = spec->master_sw ? PIN_HP : 0;
3866 /* change HP and line-out pins */
3867 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3869 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3871 /* mono (speaker) depending on the HP jack sense */
3872 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3873 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3877 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3878 struct snd_ctl_elem_value *ucontrol)
3880 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3881 struct alc_spec *spec = codec->spec;
3882 *ucontrol->value.integer.value = spec->master_sw;
3886 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3887 struct snd_ctl_elem_value *ucontrol)
3889 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3890 struct alc_spec *spec = codec->spec;
3891 int val = !!*ucontrol->value.integer.value;
3892 hda_nid_t hp, line, mono;
3894 if (val == spec->master_sw)
3896 spec->master_sw = val;
3897 hp = (kcontrol->private_value >> 16) & 0xff;
3898 line = (kcontrol->private_value >> 8) & 0xff;
3899 mono = kcontrol->private_value & 0xff;
3900 alc260_hp_master_update(codec, hp, line, mono);
3904 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
3906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3907 .name = "Master Playback Switch",
3908 .info = snd_ctl_boolean_mono_info,
3909 .get = alc260_hp_master_sw_get,
3910 .put = alc260_hp_master_sw_put,
3911 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
3913 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3914 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3915 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3916 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3917 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
3919 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3923 static struct hda_verb alc260_hp_unsol_verbs[] = {
3924 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3928 static void alc260_hp_automute(struct hda_codec *codec)
3930 struct alc_spec *spec = codec->spec;
3931 unsigned int present;
3933 present = snd_hda_codec_read(codec, 0x10, 0,
3934 AC_VERB_GET_PIN_SENSE, 0);
3935 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3936 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
3939 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3941 if ((res >> 26) == ALC880_HP_EVENT)
3942 alc260_hp_automute(codec);
3945 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3947 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3948 .name = "Master Playback Switch",
3949 .info = snd_ctl_boolean_mono_info,
3950 .get = alc260_hp_master_sw_get,
3951 .put = alc260_hp_master_sw_put,
3952 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
3954 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3955 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3956 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3957 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3960 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3961 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3965 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
3966 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3970 static void alc260_hp_3013_automute(struct hda_codec *codec)
3972 struct alc_spec *spec = codec->spec;
3973 unsigned int present;
3975 present = snd_hda_codec_read(codec, 0x15, 0,
3976 AC_VERB_GET_PIN_SENSE, 0);
3977 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3978 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
3981 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
3984 if ((res >> 26) == ALC880_HP_EVENT)
3985 alc260_hp_3013_automute(codec);
3988 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3989 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3991 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3992 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3993 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3994 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3995 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3996 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3997 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3998 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3999 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4000 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4001 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4002 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4003 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4007 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4008 * versions of the ALC260 don't act on requests to enable mic bias from NID
4009 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4010 * datasheet doesn't mention this restriction. At this stage it's not clear
4011 * whether this behaviour is intentional or is a hardware bug in chip
4012 * revisions available in early 2006. Therefore for now allow the
4013 * "Headphone Jack Mode" control to span all choices, but if it turns out
4014 * that the lack of mic bias for this NID is intentional we could change the
4015 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4017 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4018 * don't appear to make the mic bias available from the "line" jack, even
4019 * though the NID used for this jack (0x14) can supply it. The theory is
4020 * that perhaps Acer have included blocking capacitors between the ALC260
4021 * and the output jack. If this turns out to be the case for all such
4022 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4023 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4025 * The C20x Tablet series have a mono internal speaker which is controlled
4026 * via the chip's Mono sum widget and pin complex, so include the necessary
4027 * controls for such models. On models without a "mono speaker" the control
4028 * won't do anything.
4030 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4031 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4032 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4033 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4034 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4036 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4038 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4039 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4041 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4042 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4043 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4044 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4045 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4046 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4047 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4051 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4052 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4054 static struct snd_kcontrol_new alc260_will_mixer[] = {
4055 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4056 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4058 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4059 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4060 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4061 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4062 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4063 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4064 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4065 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4066 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4070 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4071 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4073 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4074 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4075 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4077 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4078 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4079 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4080 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4081 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4082 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4083 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4087 /* capture mixer elements */
4088 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4089 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4090 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4091 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4092 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4094 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4095 /* The multiple "Capture Source" controls confuse alsamixer
4096 * So call somewhat different..
4098 /* .name = "Capture Source", */
4099 .name = "Input Source",
4101 .info = alc_mux_enum_info,
4102 .get = alc_mux_enum_get,
4103 .put = alc_mux_enum_put,
4108 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4109 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4110 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4113 /* The multiple "Capture Source" controls confuse alsamixer
4114 * So call somewhat different..
4116 /* .name = "Capture Source", */
4117 .name = "Input Source",
4119 .info = alc_mux_enum_info,
4120 .get = alc_mux_enum_get,
4121 .put = alc_mux_enum_put,
4127 * initialization verbs
4129 static struct hda_verb alc260_init_verbs[] = {
4130 /* Line In pin widget for input */
4131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4132 /* CD pin widget for input */
4133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4134 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4135 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4136 /* Mic2 (front panel) pin widget for input and vref at 80% */
4137 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4138 /* LINE-2 is used for line-out in rear */
4139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4140 /* select line-out */
4141 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4143 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4145 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4147 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4148 /* mute capture amp left and right */
4149 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4150 /* set connection select to line in (default select for this ADC) */
4151 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4152 /* mute capture amp left and right */
4153 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4154 /* set connection select to line in (default select for this ADC) */
4155 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4156 /* set vol=0 Line-Out mixer amp left and right */
4157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4158 /* unmute pin widget amp left and right (no gain on this amp) */
4159 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4160 /* set vol=0 HP mixer amp left and right */
4161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4162 /* unmute pin widget amp left and right (no gain on this amp) */
4163 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4164 /* set vol=0 Mono mixer amp left and right */
4165 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4166 /* unmute pin widget amp left and right (no gain on this amp) */
4167 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4168 /* unmute LINE-2 out pin */
4169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4170 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4173 /* mute analog inputs */
4174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4179 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4180 /* mute Front out path */
4181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4183 /* mute Headphone out path */
4184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4185 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4186 /* mute Mono out path */
4187 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4188 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4192 #if 0 /* should be identical with alc260_init_verbs? */
4193 static struct hda_verb alc260_hp_init_verbs[] = {
4194 /* Headphone and output */
4195 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4197 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4198 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4199 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4200 /* Mic2 (front panel) pin widget for input and vref at 80% */
4201 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4202 /* Line In pin widget for input */
4203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4204 /* Line-2 pin widget for output */
4205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4206 /* CD pin widget for input */
4207 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4208 /* unmute amp left and right */
4209 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4210 /* set connection select to line in (default select for this ADC) */
4211 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4212 /* unmute Line-Out mixer amp left and right (volume = 0) */
4213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4214 /* mute pin widget amp left and right (no gain on this amp) */
4215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4216 /* unmute HP mixer amp left and right (volume = 0) */
4217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4218 /* mute pin widget amp left and right (no gain on this amp) */
4219 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4220 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4223 /* mute analog inputs */
4224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4226 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4229 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4230 /* Unmute Front out path */
4231 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4232 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4233 /* Unmute Headphone out path */
4234 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4235 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4236 /* Unmute Mono out path */
4237 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4238 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4243 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4244 /* Line out and output */
4245 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4247 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4248 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4249 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4250 /* Mic2 (front panel) pin widget for input and vref at 80% */
4251 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4252 /* Line In pin widget for input */
4253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4254 /* Headphone pin widget for output */
4255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4256 /* CD pin widget for input */
4257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4258 /* unmute amp left and right */
4259 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4260 /* set connection select to line in (default select for this ADC) */
4261 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4262 /* unmute Line-Out mixer amp left and right (volume = 0) */
4263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4264 /* mute pin widget amp left and right (no gain on this amp) */
4265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4266 /* unmute HP mixer amp left and right (volume = 0) */
4267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4268 /* mute pin widget amp left and right (no gain on this amp) */
4269 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4270 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4273 /* mute analog inputs */
4274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4279 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4280 /* Unmute Front out path */
4281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4283 /* Unmute Headphone out path */
4284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4285 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4286 /* Unmute Mono out path */
4287 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4288 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4292 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4293 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4294 * audio = 0x16, internal speaker = 0x10.
4296 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4297 /* Disable all GPIOs */
4298 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4299 /* Internal speaker is connected to headphone pin */
4300 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4301 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4303 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4304 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4305 /* Ensure all other unused pins are disabled and muted. */
4306 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4307 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4308 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4309 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4310 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4311 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4315 /* Disable digital (SPDIF) pins */
4316 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4317 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4319 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4320 * when acting as an output.
4322 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4324 /* Start with output sum widgets muted and their output gains at min */
4325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4326 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4328 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4329 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4331 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4332 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4333 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4335 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4336 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4337 /* Unmute Line1 pin widget output buffer since it starts as an output.
4338 * If the pin mode is changed by the user the pin mode control will
4339 * take care of enabling the pin's input/output buffers as needed.
4340 * Therefore there's no need to enable the input buffer at this
4343 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4344 /* Unmute input buffer of pin widget used for Line-in (no equiv
4347 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4349 /* Mute capture amp left and right */
4350 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4351 /* Set ADC connection select to match default mixer setting - line
4354 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4356 /* Do the same for the second ADC: mute capture input amp and
4357 * set ADC connection to line in (on mic1 pin)
4359 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4360 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4362 /* Mute all inputs to mixer widget (even unconnected ones) */
4363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4375 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4376 * similar laptops (adapted from Fujitsu init verbs).
4378 static struct hda_verb alc260_acer_init_verbs[] = {
4379 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4380 * the headphone jack. Turn this on and rely on the standard mute
4381 * methods whenever the user wants to turn these outputs off.
4383 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4384 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4385 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4386 /* Internal speaker/Headphone jack is connected to Line-out pin */
4387 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4388 /* Internal microphone/Mic jack is connected to Mic1 pin */
4389 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4390 /* Line In jack is connected to Line1 pin */
4391 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4392 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4393 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4394 /* Ensure all other unused pins are disabled and muted. */
4395 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4396 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4397 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4398 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4399 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4401 /* Disable digital (SPDIF) pins */
4402 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4403 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4405 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4406 * bus when acting as outputs.
4408 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4409 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4411 /* Start with output sum widgets muted and their output gains at min */
4412 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4413 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4415 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4416 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4418 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4419 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4422 /* Unmute Line-out pin widget amp left and right
4423 * (no equiv mixer ctrl)
4425 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4426 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4427 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4428 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4429 * inputs. If the pin mode is changed by the user the pin mode control
4430 * will take care of enabling the pin's input/output buffers as needed.
4431 * Therefore there's no need to enable the input buffer at this
4434 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4437 /* Mute capture amp left and right */
4438 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4439 /* Set ADC connection select to match default mixer setting - mic
4442 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4444 /* Do similar with the second ADC: mute capture input amp and
4445 * set ADC connection to mic to match ALSA's default state.
4447 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4448 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4450 /* Mute all inputs to mixer widget (even unconnected ones) */
4451 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4452 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4453 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4463 static struct hda_verb alc260_will_verbs[] = {
4464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4465 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4466 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4467 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4468 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4469 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4473 static struct hda_verb alc260_replacer_672v_verbs[] = {
4474 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4475 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4476 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4478 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4479 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4480 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4482 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4486 /* toggle speaker-output according to the hp-jack state */
4487 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4489 unsigned int present;
4491 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4492 present = snd_hda_codec_read(codec, 0x0f, 0,
4493 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4495 snd_hda_codec_write_cache(codec, 0x01, 0,
4496 AC_VERB_SET_GPIO_DATA, 1);
4497 snd_hda_codec_write_cache(codec, 0x0f, 0,
4498 AC_VERB_SET_PIN_WIDGET_CONTROL,
4501 snd_hda_codec_write_cache(codec, 0x01, 0,
4502 AC_VERB_SET_GPIO_DATA, 0);
4503 snd_hda_codec_write_cache(codec, 0x0f, 0,
4504 AC_VERB_SET_PIN_WIDGET_CONTROL,
4509 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4512 if ((res >> 26) == ALC880_HP_EVENT)
4513 alc260_replacer_672v_automute(codec);
4516 /* Test configuration for debugging, modelled after the ALC880 test
4519 #ifdef CONFIG_SND_DEBUG
4520 static hda_nid_t alc260_test_dac_nids[1] = {
4523 static hda_nid_t alc260_test_adc_nids[2] = {
4526 /* For testing the ALC260, each input MUX needs its own definition since
4527 * the signal assignments are different. This assumes that the first ADC
4530 static struct hda_input_mux alc260_test_capture_sources[2] = {
4534 { "MIC1 pin", 0x0 },
4535 { "MIC2 pin", 0x1 },
4536 { "LINE1 pin", 0x2 },
4537 { "LINE2 pin", 0x3 },
4539 { "LINE-OUT pin", 0x5 },
4540 { "HP-OUT pin", 0x6 },
4546 { "MIC1 pin", 0x0 },
4547 { "MIC2 pin", 0x1 },
4548 { "LINE1 pin", 0x2 },
4549 { "LINE2 pin", 0x3 },
4552 { "LINE-OUT pin", 0x6 },
4553 { "HP-OUT pin", 0x7 },
4557 static struct snd_kcontrol_new alc260_test_mixer[] = {
4558 /* Output driver widgets */
4559 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4560 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4561 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4562 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4563 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4564 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4566 /* Modes for retasking pin widgets
4567 * Note: the ALC260 doesn't seem to act on requests to enable mic
4568 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4569 * mention this restriction. At this stage it's not clear whether
4570 * this behaviour is intentional or is a hardware bug in chip
4571 * revisions available at least up until early 2006. Therefore for
4572 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4573 * choices, but if it turns out that the lack of mic bias for these
4574 * NIDs is intentional we could change their modes from
4575 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4577 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4578 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4579 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4580 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4581 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4582 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4584 /* Loopback mixer controls */
4585 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4586 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4587 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4588 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4589 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4590 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4591 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4592 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4593 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4594 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4595 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4596 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4597 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4598 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4599 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4600 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4602 /* Controls for GPIO pins, assuming they are configured as outputs */
4603 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4604 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4605 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4606 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4608 /* Switches to allow the digital IO pins to be enabled. The datasheet
4609 * is ambigious as to which NID is which; testing on laptops which
4610 * make this output available should provide clarification.
4612 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4613 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4615 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4616 * this output to turn on an external amplifier.
4618 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4619 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4623 static struct hda_verb alc260_test_init_verbs[] = {
4624 /* Enable all GPIOs as outputs with an initial value of 0 */
4625 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4626 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4627 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4629 /* Enable retasking pins as output, initially without power amp */
4630 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4631 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4634 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4635 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4637 /* Disable digital (SPDIF) pins initially, but users can enable
4638 * them via a mixer switch. In the case of SPDIF-out, this initverb
4639 * payload also sets the generation to 0, output to be in "consumer"
4640 * PCM format, copyright asserted, no pre-emphasis and no validity
4643 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4644 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4646 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4647 * OUT1 sum bus when acting as an output.
4649 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4650 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4651 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4652 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4654 /* Start with output sum widgets muted and their output gains at min */
4655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4661 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4662 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4663 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4665 /* Unmute retasking pin widget output buffers since the default
4666 * state appears to be output. As the pin mode is changed by the
4667 * user the pin mode control will take care of enabling the pin's
4668 * input/output buffers as needed.
4670 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4671 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4674 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4675 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4676 /* Also unmute the mono-out pin widget */
4677 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4679 /* Mute capture amp left and right */
4680 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4681 /* Set ADC connection select to match default mixer setting (mic1
4684 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4686 /* Do the same for the second ADC: mute capture input amp and
4687 * set ADC connection to mic1 pin
4689 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4690 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4692 /* Mute all inputs to mixer widget (even unconnected ones) */
4693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4706 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4707 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4709 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4710 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4713 * for BIOS auto-configuration
4716 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4720 unsigned long vol_val, sw_val;
4724 if (nid >= 0x0f && nid < 0x11) {
4725 nid_vol = nid - 0x7;
4726 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4727 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4728 } else if (nid == 0x11) {
4729 nid_vol = nid - 0x7;
4730 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4731 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4732 } else if (nid >= 0x12 && nid <= 0x15) {
4734 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4735 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4739 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4740 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4743 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4744 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4750 /* add playback controls from the parsed DAC table */
4751 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4752 const struct auto_pin_cfg *cfg)
4757 spec->multiout.num_dacs = 1;
4758 spec->multiout.dac_nids = spec->private_dac_nids;
4759 spec->multiout.dac_nids[0] = 0x02;
4761 nid = cfg->line_out_pins[0];
4763 err = alc260_add_playback_controls(spec, nid, "Front");
4768 nid = cfg->speaker_pins[0];
4770 err = alc260_add_playback_controls(spec, nid, "Speaker");
4775 nid = cfg->hp_pins[0];
4777 err = alc260_add_playback_controls(spec, nid, "Headphone");
4784 /* create playback/capture controls for input pins */
4785 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4786 const struct auto_pin_cfg *cfg)
4788 struct hda_input_mux *imux = &spec->private_imux;
4791 for (i = 0; i < AUTO_PIN_LAST; i++) {
4792 if (cfg->input_pins[i] >= 0x12) {
4793 idx = cfg->input_pins[i] - 0x12;
4794 err = new_analog_input(spec, cfg->input_pins[i],
4795 auto_pin_cfg_labels[i], idx,
4799 imux->items[imux->num_items].label =
4800 auto_pin_cfg_labels[i];
4801 imux->items[imux->num_items].index = idx;
4804 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4805 idx = cfg->input_pins[i] - 0x09;
4806 err = new_analog_input(spec, cfg->input_pins[i],
4807 auto_pin_cfg_labels[i], idx,
4811 imux->items[imux->num_items].label =
4812 auto_pin_cfg_labels[i];
4813 imux->items[imux->num_items].index = idx;
4820 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4821 hda_nid_t nid, int pin_type,
4824 alc_set_pin_output(codec, nid, pin_type);
4825 /* need the manual connection? */
4827 int idx = nid - 0x12;
4828 snd_hda_codec_write(codec, idx + 0x0b, 0,
4829 AC_VERB_SET_CONNECT_SEL, sel_idx);
4833 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4835 struct alc_spec *spec = codec->spec;
4838 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4839 nid = spec->autocfg.line_out_pins[0];
4841 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4842 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4845 nid = spec->autocfg.speaker_pins[0];
4847 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4849 nid = spec->autocfg.hp_pins[0];
4851 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4854 #define ALC260_PIN_CD_NID 0x16
4855 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4857 struct alc_spec *spec = codec->spec;
4860 for (i = 0; i < AUTO_PIN_LAST; i++) {
4861 hda_nid_t nid = spec->autocfg.input_pins[i];
4863 snd_hda_codec_write(codec, nid, 0,
4864 AC_VERB_SET_PIN_WIDGET_CONTROL,
4865 i <= AUTO_PIN_FRONT_MIC ?
4866 PIN_VREF80 : PIN_IN);
4867 if (nid != ALC260_PIN_CD_NID)
4868 snd_hda_codec_write(codec, nid, 0,
4869 AC_VERB_SET_AMP_GAIN_MUTE,
4876 * generic initialization of ADC, input mixers and output mixers
4878 static struct hda_verb alc260_volume_init_verbs[] = {
4880 * Unmute ADC0-1 and set the default input to mic-in
4882 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4883 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4884 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4885 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4887 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4889 * Note: PASD motherboards uses the Line In 2 as the input for
4890 * front panel mic (mic 2)
4892 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4893 /* mute analog inputs */
4894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4901 * Set up output mixers (0x08 - 0x0a)
4903 /* set vol=0 to output mixers */
4904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4906 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4907 /* set up input amps for analog loopback */
4908 /* Amp Indices: DAC = 0, mixer = 1 */
4909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4913 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4914 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4919 static int alc260_parse_auto_config(struct hda_codec *codec)
4921 struct alc_spec *spec = codec->spec;
4924 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4926 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4930 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4933 if (!spec->kctl_alloc)
4934 return 0; /* can't find valid BIOS pin config */
4935 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4939 spec->multiout.max_channels = 2;
4941 if (spec->autocfg.dig_out_pin)
4942 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4943 if (spec->kctl_alloc)
4944 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4946 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4948 spec->num_mux_defs = 1;
4949 spec->input_mux = &spec->private_imux;
4951 /* check whether NID 0x04 is valid */
4952 wcap = get_wcaps(codec, 0x04);
4953 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4954 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
4955 spec->adc_nids = alc260_adc_nids_alt;
4956 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4957 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4959 spec->adc_nids = alc260_adc_nids;
4960 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4961 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4968 /* additional initialization for auto-configuration model */
4969 static void alc260_auto_init(struct hda_codec *codec)
4971 struct alc_spec *spec = codec->spec;
4972 alc260_auto_init_multi_out(codec);
4973 alc260_auto_init_analog_input(codec);
4974 if (spec->unsol_event)
4975 alc_sku_automute(codec);
4978 #ifdef CONFIG_SND_HDA_POWER_SAVE
4979 static struct hda_amp_list alc260_loopbacks[] = {
4980 { 0x07, HDA_INPUT, 0 },
4981 { 0x07, HDA_INPUT, 1 },
4982 { 0x07, HDA_INPUT, 2 },
4983 { 0x07, HDA_INPUT, 3 },
4984 { 0x07, HDA_INPUT, 4 },
4990 * ALC260 configurations
4992 static const char *alc260_models[ALC260_MODEL_LAST] = {
4993 [ALC260_BASIC] = "basic",
4995 [ALC260_HP_3013] = "hp-3013",
4996 [ALC260_FUJITSU_S702X] = "fujitsu",
4997 [ALC260_ACER] = "acer",
4998 [ALC260_WILL] = "will",
4999 [ALC260_REPLACER_672V] = "replacer",
5000 #ifdef CONFIG_SND_DEBUG
5001 [ALC260_TEST] = "test",
5003 [ALC260_AUTO] = "auto",
5006 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5007 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5008 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5009 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5010 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5011 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5012 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5013 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5014 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5015 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5016 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5017 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5018 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5019 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5020 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5021 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5022 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5023 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5024 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5028 static struct alc_config_preset alc260_presets[] = {
5030 .mixers = { alc260_base_output_mixer,
5032 alc260_pc_beep_mixer,
5033 alc260_capture_mixer },
5034 .init_verbs = { alc260_init_verbs },
5035 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5036 .dac_nids = alc260_dac_nids,
5037 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5038 .adc_nids = alc260_adc_nids,
5039 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5040 .channel_mode = alc260_modes,
5041 .input_mux = &alc260_capture_source,
5044 .mixers = { alc260_hp_output_mixer,
5046 alc260_capture_alt_mixer },
5047 .init_verbs = { alc260_init_verbs,
5048 alc260_hp_unsol_verbs },
5049 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5050 .dac_nids = alc260_dac_nids,
5051 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5052 .adc_nids = alc260_hp_adc_nids,
5053 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5054 .channel_mode = alc260_modes,
5055 .input_mux = &alc260_capture_source,
5056 .unsol_event = alc260_hp_unsol_event,
5057 .init_hook = alc260_hp_automute,
5059 [ALC260_HP_3013] = {
5060 .mixers = { alc260_hp_3013_mixer,
5062 alc260_capture_alt_mixer },
5063 .init_verbs = { alc260_hp_3013_init_verbs,
5064 alc260_hp_3013_unsol_verbs },
5065 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5066 .dac_nids = alc260_dac_nids,
5067 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5068 .adc_nids = alc260_hp_adc_nids,
5069 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5070 .channel_mode = alc260_modes,
5071 .input_mux = &alc260_capture_source,
5072 .unsol_event = alc260_hp_3013_unsol_event,
5073 .init_hook = alc260_hp_3013_automute,
5075 [ALC260_FUJITSU_S702X] = {
5076 .mixers = { alc260_fujitsu_mixer,
5077 alc260_capture_mixer },
5078 .init_verbs = { alc260_fujitsu_init_verbs },
5079 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5080 .dac_nids = alc260_dac_nids,
5081 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5082 .adc_nids = alc260_dual_adc_nids,
5083 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5084 .channel_mode = alc260_modes,
5085 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5086 .input_mux = alc260_fujitsu_capture_sources,
5089 .mixers = { alc260_acer_mixer,
5090 alc260_capture_mixer },
5091 .init_verbs = { alc260_acer_init_verbs },
5092 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5093 .dac_nids = alc260_dac_nids,
5094 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5095 .adc_nids = alc260_dual_adc_nids,
5096 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5097 .channel_mode = alc260_modes,
5098 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5099 .input_mux = alc260_acer_capture_sources,
5102 .mixers = { alc260_will_mixer,
5103 alc260_capture_mixer },
5104 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5105 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5106 .dac_nids = alc260_dac_nids,
5107 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5108 .adc_nids = alc260_adc_nids,
5109 .dig_out_nid = ALC260_DIGOUT_NID,
5110 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5111 .channel_mode = alc260_modes,
5112 .input_mux = &alc260_capture_source,
5114 [ALC260_REPLACER_672V] = {
5115 .mixers = { alc260_replacer_672v_mixer,
5116 alc260_capture_mixer },
5117 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5118 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5119 .dac_nids = alc260_dac_nids,
5120 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5121 .adc_nids = alc260_adc_nids,
5122 .dig_out_nid = ALC260_DIGOUT_NID,
5123 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5124 .channel_mode = alc260_modes,
5125 .input_mux = &alc260_capture_source,
5126 .unsol_event = alc260_replacer_672v_unsol_event,
5127 .init_hook = alc260_replacer_672v_automute,
5129 #ifdef CONFIG_SND_DEBUG
5131 .mixers = { alc260_test_mixer,
5132 alc260_capture_mixer },
5133 .init_verbs = { alc260_test_init_verbs },
5134 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5135 .dac_nids = alc260_test_dac_nids,
5136 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5137 .adc_nids = alc260_test_adc_nids,
5138 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5139 .channel_mode = alc260_modes,
5140 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5141 .input_mux = alc260_test_capture_sources,
5146 static int patch_alc260(struct hda_codec *codec)
5148 struct alc_spec *spec;
5149 int err, board_config;
5151 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5157 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5160 if (board_config < 0) {
5161 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5162 "trying auto-probe from BIOS...\n");
5163 board_config = ALC260_AUTO;
5166 if (board_config == ALC260_AUTO) {
5167 /* automatic parse from the BIOS config */
5168 err = alc260_parse_auto_config(codec);
5174 "hda_codec: Cannot set up configuration "
5175 "from BIOS. Using base mode...\n");
5176 board_config = ALC260_BASIC;
5180 if (board_config != ALC260_AUTO)
5181 setup_preset(spec, &alc260_presets[board_config]);
5183 spec->stream_name_analog = "ALC260 Analog";
5184 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5185 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5187 spec->stream_name_digital = "ALC260 Digital";
5188 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5189 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5191 spec->vmaster_nid = 0x08;
5193 codec->patch_ops = alc_patch_ops;
5194 if (board_config == ALC260_AUTO)
5195 spec->init_hook = alc260_auto_init;
5196 #ifdef CONFIG_SND_HDA_POWER_SAVE
5197 if (!spec->loopback.amplist)
5198 spec->loopback.amplist = alc260_loopbacks;
5208 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5209 * configuration. Each pin widget can choose any input DACs and a mixer.
5210 * Each ADC is connected from a mixer of all inputs. This makes possible
5211 * 6-channel independent captures.
5213 * In addition, an independent DAC for the multi-playback (not used in this
5216 #define ALC882_DIGOUT_NID 0x06
5217 #define ALC882_DIGIN_NID 0x0a
5219 static struct hda_channel_mode alc882_ch_modes[1] = {
5223 static hda_nid_t alc882_dac_nids[4] = {
5224 /* front, rear, clfe, rear_surr */
5225 0x02, 0x03, 0x04, 0x05
5228 /* identical with ALC880 */
5229 #define alc882_adc_nids alc880_adc_nids
5230 #define alc882_adc_nids_alt alc880_adc_nids_alt
5232 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5233 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5236 /* FIXME: should be a matrix-type input source selection */
5238 static struct hda_input_mux alc882_capture_source = {
5242 { "Front Mic", 0x1 },
5247 #define alc882_mux_enum_info alc_mux_enum_info
5248 #define alc882_mux_enum_get alc_mux_enum_get
5250 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5251 struct snd_ctl_elem_value *ucontrol)
5253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5254 struct alc_spec *spec = codec->spec;
5255 const struct hda_input_mux *imux = spec->input_mux;
5256 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5257 hda_nid_t nid = spec->capsrc_nids ?
5258 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5259 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5260 unsigned int i, idx;
5262 idx = ucontrol->value.enumerated.item[0];
5263 if (idx >= imux->num_items)
5264 idx = imux->num_items - 1;
5265 if (*cur_val == idx)
5267 for (i = 0; i < imux->num_items; i++) {
5268 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5269 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5270 imux->items[i].index,
5280 static struct hda_verb alc882_3ST_ch2_init[] = {
5281 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5282 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5283 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5284 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5291 static struct hda_verb alc882_3ST_ch6_init[] = {
5292 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5293 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5294 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5295 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5296 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5297 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5301 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5302 { 2, alc882_3ST_ch2_init },
5303 { 6, alc882_3ST_ch6_init },
5309 static struct hda_verb alc882_sixstack_ch6_init[] = {
5310 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5311 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5312 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5313 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5320 static struct hda_verb alc882_sixstack_ch8_init[] = {
5321 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5322 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5323 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5324 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5328 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5329 { 6, alc882_sixstack_ch6_init },
5330 { 8, alc882_sixstack_ch8_init },
5334 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5340 static struct hda_verb alc885_mbp_ch2_init[] = {
5341 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5342 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5343 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5350 static struct hda_verb alc885_mbp_ch6_init[] = {
5351 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5352 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5353 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5354 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5355 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5359 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5360 { 2, alc885_mbp_ch2_init },
5361 { 6, alc885_mbp_ch6_init },
5365 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5366 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5368 static struct snd_kcontrol_new alc882_base_mixer[] = {
5369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5371 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5372 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5373 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5374 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5375 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5376 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5377 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5378 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5385 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5387 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5388 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5389 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5390 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5391 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5395 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5396 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5397 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5398 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5399 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5400 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5401 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5403 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5404 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5405 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5408 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5409 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5410 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5411 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5412 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5414 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5416 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5417 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5418 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5419 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5423 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5424 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5425 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5427 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5428 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5436 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5440 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5441 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5443 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5444 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5445 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5446 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5447 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5448 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5449 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5452 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5453 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5456 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5460 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5461 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5462 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5463 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5464 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5465 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5466 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5467 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5469 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5470 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5471 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5472 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5476 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5478 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5479 .name = "Channel Mode",
5480 .info = alc_ch_mode_info,
5481 .get = alc_ch_mode_get,
5482 .put = alc_ch_mode_put,
5487 static struct hda_verb alc882_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)},
5497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5498 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5499 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5501 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5503 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5505 /* Front Pin: output 0 (0x0c) */
5506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5508 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5509 /* Rear Pin: output 1 (0x0d) */
5510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5512 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5513 /* CLFE Pin: output 2 (0x0e) */
5514 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5515 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5516 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5517 /* Side Pin: output 3 (0x0f) */
5518 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5519 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5520 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5521 /* Mic (rear) pin: input vref at 80% */
5522 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5524 /* Front Mic pin: input vref at 80% */
5525 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5526 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5527 /* Line In pin: input */
5528 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5529 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5530 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5531 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5532 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5533 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5534 /* CD pin widget for input */
5535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5537 /* FIXME: use matrix-type input source selection */
5538 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5539 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5554 /* ADC1: mute amp left and right */
5555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5556 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5557 /* ADC2: mute amp left and right */
5558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5559 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5560 /* ADC3: mute amp left and right */
5561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5567 static struct hda_verb alc882_eapd_verbs[] = {
5568 /* change to EAPD mode */
5569 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5570 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5575 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5579 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5580 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5581 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5582 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5586 static struct hda_verb alc882_macpro_init_verbs[] = {
5587 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5591 /* Front Pin: output 0 (0x0c) */
5592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5593 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5594 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5595 /* Front Mic pin: input vref at 80% */
5596 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5597 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5598 /* Speaker: output */
5599 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5600 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5601 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5602 /* Headphone output (output 0 - 0x0c) */
5603 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5604 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5605 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5607 /* FIXME: use matrix-type input source selection */
5608 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5609 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5624 /* ADC1: mute amp left and right */
5625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5626 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5627 /* ADC2: mute amp left and right */
5628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* ADC3: mute amp left and right */
5631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5637 /* Macbook Pro rev3 */
5638 static struct hda_verb alc885_mbp3_init_verbs[] = {
5639 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5647 /* Front Pin: output 0 (0x0c) */
5648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5650 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5651 /* HP Pin: output 0 (0x0d) */
5652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5655 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5656 /* Mic (rear) pin: input vref at 80% */
5657 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5658 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5659 /* Front Mic pin: input vref at 80% */
5660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5662 /* Line In pin: use output 1 when in LineOut mode */
5663 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5665 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5667 /* FIXME: use matrix-type input source selection */
5668 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5669 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5684 /* ADC1: mute amp left and right */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5686 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5687 /* ADC2: mute amp left and right */
5688 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5689 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5690 /* ADC3: mute amp left and right */
5691 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5692 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5697 /* iMac 24 mixer. */
5698 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5699 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5700 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5704 /* iMac 24 init verbs. */
5705 static struct hda_verb alc885_imac24_init_verbs[] = {
5706 /* Internal speakers: output 0 (0x0c) */
5707 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5708 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5709 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5710 /* Internal speakers: output 0 (0x0c) */
5711 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5712 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5713 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5714 /* Headphone: output 0 (0x0c) */
5715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5717 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5718 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5719 /* Front Mic: input vref at 80% */
5720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5725 /* Toggle speaker-output according to the hp-jack state */
5726 static void alc885_imac24_automute(struct hda_codec *codec)
5728 unsigned int present;
5730 present = snd_hda_codec_read(codec, 0x14, 0,
5731 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5732 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5733 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5734 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5735 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5738 /* Processes unsolicited events. */
5739 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5742 /* Headphone insertion or removal. */
5743 if ((res >> 26) == ALC880_HP_EVENT)
5744 alc885_imac24_automute(codec);
5747 static void alc885_mbp3_automute(struct hda_codec *codec)
5749 unsigned int present;
5751 present = snd_hda_codec_read(codec, 0x15, 0,
5752 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5753 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5754 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5755 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5756 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5759 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5762 /* Headphone insertion or removal. */
5763 if ((res >> 26) == ALC880_HP_EVENT)
5764 alc885_mbp3_automute(codec);
5768 static struct hda_verb alc882_targa_verbs[] = {
5769 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5770 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5773 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5775 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5776 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5777 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5779 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5780 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5781 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5782 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5786 /* toggle speaker-output according to the hp-jack state */
5787 static void alc882_targa_automute(struct hda_codec *codec)
5789 unsigned int present;
5791 present = snd_hda_codec_read(codec, 0x14, 0,
5792 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5793 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5794 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5795 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5799 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5801 /* Looks like the unsol event is incompatible with the standard
5802 * definition. 4bit tag is placed at 26 bit!
5804 if (((res >> 26) == ALC880_HP_EVENT)) {
5805 alc882_targa_automute(codec);
5809 static struct hda_verb alc882_asus_a7j_verbs[] = {
5810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5817 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5818 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5819 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5821 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5822 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5823 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5827 static struct hda_verb alc882_asus_a7m_verbs[] = {
5828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5835 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5836 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5837 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5839 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5840 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5841 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5845 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5847 unsigned int gpiostate, gpiomask, gpiodir;
5849 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5850 AC_VERB_GET_GPIO_DATA, 0);
5853 gpiostate |= (1 << pin);
5855 gpiostate &= ~(1 << pin);
5857 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5858 AC_VERB_GET_GPIO_MASK, 0);
5859 gpiomask |= (1 << pin);
5861 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5862 AC_VERB_GET_GPIO_DIRECTION, 0);
5863 gpiodir |= (1 << pin);
5866 snd_hda_codec_write(codec, codec->afg, 0,
5867 AC_VERB_SET_GPIO_MASK, gpiomask);
5868 snd_hda_codec_write(codec, codec->afg, 0,
5869 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5873 snd_hda_codec_write(codec, codec->afg, 0,
5874 AC_VERB_SET_GPIO_DATA, gpiostate);
5877 /* set up GPIO at initialization */
5878 static void alc885_macpro_init_hook(struct hda_codec *codec)
5880 alc882_gpio_mute(codec, 0, 0);
5881 alc882_gpio_mute(codec, 1, 0);
5884 /* set up GPIO and update auto-muting at initialization */
5885 static void alc885_imac24_init_hook(struct hda_codec *codec)
5887 alc885_macpro_init_hook(codec);
5888 alc885_imac24_automute(codec);
5892 * generic initialization of ADC, input mixers and output mixers
5894 static struct hda_verb alc882_auto_init_verbs[] = {
5896 * Unmute ADC0-2 and set the default input to mic-in
5898 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5900 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5902 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5905 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5907 * Note: PASD motherboards uses the Line In 2 as the input for
5908 * front panel mic (mic 2)
5910 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5911 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5912 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5913 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5914 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5918 * Set up output mixers (0x0c - 0x0f)
5920 /* set vol=0 to output mixers */
5921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5922 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5923 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5924 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5925 /* set up input amps for analog loopback */
5926 /* Amp Indices: DAC = 0, mixer = 1 */
5927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5930 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5932 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5934 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5935 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5936 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5938 /* FIXME: use matrix-type input source selection */
5939 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5940 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5941 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5942 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5943 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5959 /* capture mixer elements */
5960 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5961 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5962 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5963 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5964 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5967 /* The multiple "Capture Source" controls confuse alsamixer
5968 * So call somewhat different..
5970 /* .name = "Capture Source", */
5971 .name = "Input Source",
5973 .info = alc882_mux_enum_info,
5974 .get = alc882_mux_enum_get,
5975 .put = alc882_mux_enum_put,
5980 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5981 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5982 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5983 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5984 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5985 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5986 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5988 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5989 /* The multiple "Capture Source" controls confuse alsamixer
5990 * So call somewhat different..
5992 /* .name = "Capture Source", */
5993 .name = "Input Source",
5995 .info = alc882_mux_enum_info,
5996 .get = alc882_mux_enum_get,
5997 .put = alc882_mux_enum_put,
6002 #ifdef CONFIG_SND_HDA_POWER_SAVE
6003 #define alc882_loopbacks alc880_loopbacks
6006 /* pcm configuration: identiacal with ALC880 */
6007 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6008 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6009 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6010 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6013 * configuration and preset
6015 static const char *alc882_models[ALC882_MODEL_LAST] = {
6016 [ALC882_3ST_DIG] = "3stack-dig",
6017 [ALC882_6ST_DIG] = "6stack-dig",
6018 [ALC882_ARIMA] = "arima",
6019 [ALC882_W2JC] = "w2jc",
6020 [ALC882_TARGA] = "targa",
6021 [ALC882_ASUS_A7J] = "asus-a7j",
6022 [ALC882_ASUS_A7M] = "asus-a7m",
6023 [ALC885_MACPRO] = "macpro",
6024 [ALC885_MBP3] = "mbp3",
6025 [ALC885_IMAC24] = "imac24",
6026 [ALC882_AUTO] = "auto",
6029 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6030 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6031 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6032 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6033 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6034 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6035 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6036 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6037 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6038 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6039 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6040 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6041 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6045 static struct alc_config_preset alc882_presets[] = {
6046 [ALC882_3ST_DIG] = {
6047 .mixers = { alc882_base_mixer },
6048 .init_verbs = { alc882_init_verbs },
6049 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6050 .dac_nids = alc882_dac_nids,
6051 .dig_out_nid = ALC882_DIGOUT_NID,
6052 .dig_in_nid = ALC882_DIGIN_NID,
6053 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6054 .channel_mode = alc882_ch_modes,
6056 .input_mux = &alc882_capture_source,
6058 [ALC882_6ST_DIG] = {
6059 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6060 .init_verbs = { alc882_init_verbs },
6061 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6062 .dac_nids = alc882_dac_nids,
6063 .dig_out_nid = ALC882_DIGOUT_NID,
6064 .dig_in_nid = ALC882_DIGIN_NID,
6065 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6066 .channel_mode = alc882_sixstack_modes,
6067 .input_mux = &alc882_capture_source,
6070 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6071 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6072 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6073 .dac_nids = alc882_dac_nids,
6074 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6075 .channel_mode = alc882_sixstack_modes,
6076 .input_mux = &alc882_capture_source,
6079 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6080 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6081 alc880_gpio1_init_verbs },
6082 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6083 .dac_nids = alc882_dac_nids,
6084 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6085 .channel_mode = alc880_threestack_modes,
6087 .input_mux = &alc882_capture_source,
6088 .dig_out_nid = ALC882_DIGOUT_NID,
6091 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6092 .init_verbs = { alc885_mbp3_init_verbs,
6093 alc880_gpio1_init_verbs },
6094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6095 .dac_nids = alc882_dac_nids,
6096 .channel_mode = alc885_mbp_6ch_modes,
6097 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6098 .input_mux = &alc882_capture_source,
6099 .dig_out_nid = ALC882_DIGOUT_NID,
6100 .dig_in_nid = ALC882_DIGIN_NID,
6101 .unsol_event = alc885_mbp3_unsol_event,
6102 .init_hook = alc885_mbp3_automute,
6105 .mixers = { alc882_macpro_mixer },
6106 .init_verbs = { alc882_macpro_init_verbs },
6107 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6108 .dac_nids = alc882_dac_nids,
6109 .dig_out_nid = ALC882_DIGOUT_NID,
6110 .dig_in_nid = ALC882_DIGIN_NID,
6111 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6112 .channel_mode = alc882_ch_modes,
6113 .input_mux = &alc882_capture_source,
6114 .init_hook = alc885_macpro_init_hook,
6117 .mixers = { alc885_imac24_mixer },
6118 .init_verbs = { alc885_imac24_init_verbs },
6119 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6120 .dac_nids = alc882_dac_nids,
6121 .dig_out_nid = ALC882_DIGOUT_NID,
6122 .dig_in_nid = ALC882_DIGIN_NID,
6123 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6124 .channel_mode = alc882_ch_modes,
6125 .input_mux = &alc882_capture_source,
6126 .unsol_event = alc885_imac24_unsol_event,
6127 .init_hook = alc885_imac24_init_hook,
6130 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6131 alc882_capture_mixer },
6132 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6133 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6134 .dac_nids = alc882_dac_nids,
6135 .dig_out_nid = ALC882_DIGOUT_NID,
6136 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6137 .adc_nids = alc882_adc_nids,
6138 .capsrc_nids = alc882_capsrc_nids,
6139 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6140 .channel_mode = alc882_3ST_6ch_modes,
6142 .input_mux = &alc882_capture_source,
6143 .unsol_event = alc882_targa_unsol_event,
6144 .init_hook = alc882_targa_automute,
6146 [ALC882_ASUS_A7J] = {
6147 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6148 alc882_capture_mixer },
6149 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6150 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6151 .dac_nids = alc882_dac_nids,
6152 .dig_out_nid = ALC882_DIGOUT_NID,
6153 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6154 .adc_nids = alc882_adc_nids,
6155 .capsrc_nids = alc882_capsrc_nids,
6156 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6157 .channel_mode = alc882_3ST_6ch_modes,
6159 .input_mux = &alc882_capture_source,
6161 [ALC882_ASUS_A7M] = {
6162 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6163 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6164 alc880_gpio1_init_verbs,
6165 alc882_asus_a7m_verbs },
6166 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6167 .dac_nids = alc882_dac_nids,
6168 .dig_out_nid = ALC882_DIGOUT_NID,
6169 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6170 .channel_mode = alc880_threestack_modes,
6172 .input_mux = &alc882_capture_source,
6181 PINFIX_ABIT_AW9D_MAX
6184 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6185 { 0x15, 0x01080104 }, /* side */
6186 { 0x16, 0x01011012 }, /* rear */
6187 { 0x17, 0x01016011 }, /* clfe */
6191 static const struct alc_pincfg *alc882_pin_fixes[] = {
6192 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6195 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6196 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6201 * BIOS auto configuration
6203 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6204 hda_nid_t nid, int pin_type,
6208 struct alc_spec *spec = codec->spec;
6211 alc_set_pin_output(codec, nid, pin_type);
6212 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6215 idx = spec->multiout.dac_nids[dac_idx] - 2;
6216 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6220 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6222 struct alc_spec *spec = codec->spec;
6225 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6226 for (i = 0; i <= HDA_SIDE; i++) {
6227 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6228 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6230 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6235 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6237 struct alc_spec *spec = codec->spec;
6240 pin = spec->autocfg.hp_pins[0];
6241 if (pin) /* connect to front */
6243 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6244 pin = spec->autocfg.speaker_pins[0];
6246 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6249 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6250 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6252 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6254 struct alc_spec *spec = codec->spec;
6257 for (i = 0; i < AUTO_PIN_LAST; i++) {
6258 hda_nid_t nid = spec->autocfg.input_pins[i];
6259 if (alc882_is_input_pin(nid)) {
6260 snd_hda_codec_write(codec, nid, 0,
6261 AC_VERB_SET_PIN_WIDGET_CONTROL,
6262 i <= AUTO_PIN_FRONT_MIC ?
6263 PIN_VREF80 : PIN_IN);
6264 if (nid != ALC882_PIN_CD_NID)
6265 snd_hda_codec_write(codec, nid, 0,
6266 AC_VERB_SET_AMP_GAIN_MUTE,
6272 /* add mic boosts if needed */
6273 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6275 struct alc_spec *spec = codec->spec;
6279 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6280 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6281 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6283 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6287 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6288 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6289 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6291 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6298 /* almost identical with ALC880 parser... */
6299 static int alc882_parse_auto_config(struct hda_codec *codec)
6301 struct alc_spec *spec = codec->spec;
6302 int err = alc880_parse_auto_config(codec);
6307 return 0; /* no config found */
6309 err = alc_auto_add_mic_boost(codec);
6313 /* hack - override the init verbs */
6314 spec->init_verbs[0] = alc882_auto_init_verbs;
6316 return 1; /* config found */
6319 /* additional initialization for auto-configuration model */
6320 static void alc882_auto_init(struct hda_codec *codec)
6322 struct alc_spec *spec = codec->spec;
6323 alc882_auto_init_multi_out(codec);
6324 alc882_auto_init_hp_out(codec);
6325 alc882_auto_init_analog_input(codec);
6326 if (spec->unsol_event)
6327 alc_sku_automute(codec);
6330 static int patch_alc882(struct hda_codec *codec)
6332 struct alc_spec *spec;
6333 int err, board_config;
6335 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6341 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6345 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6346 /* Pick up systems that don't supply PCI SSID */
6347 switch (codec->subsystem_id) {
6348 case 0x106b0c00: /* Mac Pro */
6349 board_config = ALC885_MACPRO;
6351 case 0x106b1000: /* iMac 24 */
6352 board_config = ALC885_IMAC24;
6354 case 0x106b00a1: /* Macbook */
6355 case 0x106b2c00: /* Macbook Pro rev3 */
6356 board_config = ALC885_MBP3;
6359 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6360 "trying auto-probe from BIOS...\n");
6361 board_config = ALC882_AUTO;
6365 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6367 if (board_config == ALC882_AUTO) {
6368 /* automatic parse from the BIOS config */
6369 err = alc882_parse_auto_config(codec);
6375 "hda_codec: Cannot set up configuration "
6376 "from BIOS. Using base mode...\n");
6377 board_config = ALC882_3ST_DIG;
6381 if (board_config != ALC882_AUTO)
6382 setup_preset(spec, &alc882_presets[board_config]);
6384 spec->stream_name_analog = "ALC882 Analog";
6385 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6386 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6387 /* FIXME: setup DAC5 */
6388 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6389 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6391 spec->stream_name_digital = "ALC882 Digital";
6392 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6393 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6395 if (!spec->adc_nids && spec->input_mux) {
6396 /* check whether NID 0x07 is valid */
6397 unsigned int wcap = get_wcaps(codec, 0x07);
6399 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6400 if (wcap != AC_WID_AUD_IN) {
6401 spec->adc_nids = alc882_adc_nids_alt;
6402 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6403 spec->capsrc_nids = alc882_capsrc_nids_alt;
6404 spec->mixers[spec->num_mixers] =
6405 alc882_capture_alt_mixer;
6408 spec->adc_nids = alc882_adc_nids;
6409 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6410 spec->capsrc_nids = alc882_capsrc_nids;
6411 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6416 spec->vmaster_nid = 0x0c;
6418 codec->patch_ops = alc_patch_ops;
6419 if (board_config == ALC882_AUTO)
6420 spec->init_hook = alc882_auto_init;
6421 #ifdef CONFIG_SND_HDA_POWER_SAVE
6422 if (!spec->loopback.amplist)
6423 spec->loopback.amplist = alc882_loopbacks;
6432 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6433 * configuration. Each pin widget can choose any input DACs and a mixer.
6434 * Each ADC is connected from a mixer of all inputs. This makes possible
6435 * 6-channel independent captures.
6437 * In addition, an independent DAC for the multi-playback (not used in this
6440 #define ALC883_DIGOUT_NID 0x06
6441 #define ALC883_DIGIN_NID 0x0a
6443 static hda_nid_t alc883_dac_nids[4] = {
6444 /* front, rear, clfe, rear_surr */
6445 0x02, 0x04, 0x03, 0x05
6448 static hda_nid_t alc883_adc_nids[2] = {
6453 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6456 /* FIXME: should be a matrix-type input source selection */
6458 static struct hda_input_mux alc883_capture_source = {
6462 { "Front Mic", 0x1 },
6468 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6476 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6486 #define alc883_mux_enum_info alc_mux_enum_info
6487 #define alc883_mux_enum_get alc_mux_enum_get
6488 /* ALC883 has the ALC882-type input selection */
6489 #define alc883_mux_enum_put alc882_mux_enum_put
6494 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6501 static struct hda_verb alc883_3ST_ch2_init[] = {
6502 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6503 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6504 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6505 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6512 static struct hda_verb alc883_3ST_ch4_init[] = {
6513 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6514 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6515 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6516 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6517 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6524 static struct hda_verb alc883_3ST_ch6_init[] = {
6525 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6526 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6527 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6528 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6529 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6530 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6534 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6535 { 2, alc883_3ST_ch2_init },
6536 { 4, alc883_3ST_ch4_init },
6537 { 6, alc883_3ST_ch6_init },
6543 static struct hda_verb alc883_sixstack_ch6_init[] = {
6544 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6545 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6546 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6547 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6554 static struct hda_verb alc883_sixstack_ch8_init[] = {
6555 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6556 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6557 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6558 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6562 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6563 { 6, alc883_sixstack_ch6_init },
6564 { 8, alc883_sixstack_ch8_init },
6567 static struct hda_verb alc883_medion_eapd_verbs[] = {
6568 /* eanable EAPD on medion laptop */
6569 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6570 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6574 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6575 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6578 static struct snd_kcontrol_new alc883_base_mixer[] = {
6579 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6580 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6581 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6582 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6583 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6584 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6585 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6586 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6587 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6588 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6590 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6591 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6592 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6593 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6595 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6598 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6600 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6601 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6602 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6603 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6604 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6605 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6608 /* .name = "Capture Source", */
6609 .name = "Input Source",
6611 .info = alc883_mux_enum_info,
6612 .get = alc883_mux_enum_get,
6613 .put = alc883_mux_enum_put,
6618 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6621 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6622 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6623 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6624 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6627 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6630 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6632 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6633 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6634 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6635 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6638 /* .name = "Capture Source", */
6639 .name = "Input Source",
6641 .info = alc883_mux_enum_info,
6642 .get = alc883_mux_enum_get,
6643 .put = alc883_mux_enum_put,
6648 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6652 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6653 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6654 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6655 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6660 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6661 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6662 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6663 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6664 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6665 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6666 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6667 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6670 /* .name = "Capture Source", */
6671 .name = "Input Source",
6673 .info = alc883_mux_enum_info,
6674 .get = alc883_mux_enum_get,
6675 .put = alc883_mux_enum_put,
6680 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6681 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6682 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6684 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6690 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6691 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6695 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6698 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6700 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6701 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6702 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6703 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6704 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6705 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6707 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6708 /* .name = "Capture Source", */
6709 .name = "Input Source",
6711 .info = alc883_mux_enum_info,
6712 .get = alc883_mux_enum_get,
6713 .put = alc883_mux_enum_put,
6718 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6719 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6720 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6721 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6722 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6723 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6724 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6725 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6726 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6728 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6729 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6733 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6734 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6735 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6736 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6737 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6738 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6739 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6740 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6741 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6744 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6745 /* .name = "Capture Source", */
6746 .name = "Input Source",
6748 .info = alc883_mux_enum_info,
6749 .get = alc883_mux_enum_get,
6750 .put = alc883_mux_enum_put,
6755 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6756 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6757 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6758 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6760 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6763 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6764 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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("Capture Volume", 0x08, 0x0, HDA_INPUT),
6773 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6774 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6775 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6778 /* .name = "Capture Source", */
6779 .name = "Input Source",
6781 .info = alc883_mux_enum_info,
6782 .get = alc883_mux_enum_get,
6783 .put = alc883_mux_enum_put,
6788 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6789 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6791 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6795 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6797 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6798 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6799 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6800 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6802 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6803 /* .name = "Capture Source", */
6804 .name = "Input Source",
6806 .info = alc883_mux_enum_info,
6807 .get = alc883_mux_enum_get,
6808 .put = alc883_mux_enum_put,
6813 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6814 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6815 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6816 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6817 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6820 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6822 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6823 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6826 /* .name = "Capture Source", */
6827 .name = "Input Source",
6829 .info = alc883_mux_enum_info,
6830 .get = alc883_mux_enum_get,
6831 .put = alc883_mux_enum_put,
6836 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6837 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6838 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6839 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6840 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6841 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6844 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6845 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6846 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6847 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6848 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6849 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6851 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6852 /* .name = "Capture Source", */
6853 .name = "Input Source",
6855 .info = alc883_mux_enum_info,
6856 .get = alc883_mux_enum_get,
6857 .put = alc883_mux_enum_put,
6862 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6865 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6868 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6869 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6872 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6873 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6874 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6875 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6878 /* .name = "Capture Source", */
6879 .name = "Input Source",
6881 .info = alc883_mux_enum_info,
6882 .get = alc883_mux_enum_get,
6883 .put = alc883_mux_enum_put,
6888 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6889 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6890 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6891 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6892 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6893 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6894 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6895 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6896 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6897 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6898 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6900 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6901 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6902 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6903 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6905 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6907 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6908 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6910 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6911 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6912 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6913 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6914 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6915 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6918 /* .name = "Capture Source", */
6919 .name = "Input Source",
6921 .info = alc883_mux_enum_info,
6922 .get = alc883_mux_enum_get,
6923 .put = alc883_mux_enum_put,
6928 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6929 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6930 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6931 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6932 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6933 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6934 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6935 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6936 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6938 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6939 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6941 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6945 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6946 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6947 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6948 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6949 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6951 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6952 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6953 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6955 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6956 /* .name = "Capture Source", */
6957 .name = "Input Source",
6959 .info = alc883_mux_enum_info,
6960 .get = alc883_mux_enum_get,
6961 .put = alc883_mux_enum_put,
6966 static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {
6967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6970 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6971 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6972 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6973 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6974 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6975 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6976 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6979 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6983 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6986 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6988 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6989 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6990 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6991 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6992 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6993 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6996 /* .name = "Capture Source", */
6997 .name = "Input Source",
6999 .info = alc883_mux_enum_info,
7000 .get = alc883_mux_enum_get,
7001 .put = alc883_mux_enum_put,
7006 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7010 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7011 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7012 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7013 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7014 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7015 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7016 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7017 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7018 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7021 /* .name = "Capture Source", */
7022 .name = "Input Source",
7024 .info = alc883_mux_enum_info,
7025 .get = alc883_mux_enum_get,
7026 .put = alc883_mux_enum_put,
7031 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7034 .name = "Channel Mode",
7035 .info = alc_ch_mode_info,
7036 .get = alc_ch_mode_get,
7037 .put = alc_ch_mode_put,
7042 static struct hda_verb alc883_init_verbs[] = {
7043 /* ADC1: mute amp left and right */
7044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7045 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7046 /* ADC2: mute amp left and right */
7047 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7048 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7049 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7062 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7066 /* mute analog input loopbacks */
7067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7073 /* Front Pin: output 0 (0x0c) */
7074 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7075 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7076 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7077 /* Rear Pin: output 1 (0x0d) */
7078 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7079 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7080 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7081 /* CLFE Pin: output 2 (0x0e) */
7082 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7083 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7084 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7085 /* Side Pin: output 3 (0x0f) */
7086 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7087 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7088 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7089 /* Mic (rear) pin: input vref at 80% */
7090 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7091 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7092 /* Front Mic pin: input vref at 80% */
7093 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7094 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7095 /* Line In pin: input */
7096 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7097 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7098 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7100 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7102 /* CD pin widget for input */
7103 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7105 /* FIXME: use matrix-type input source selection */
7106 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7108 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7120 /* toggle speaker-output according to the hp-jack state */
7121 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7123 unsigned int present;
7125 present = snd_hda_codec_read(codec, 0x15, 0,
7126 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7127 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7128 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7129 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7130 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7133 /* auto-toggle front mic */
7135 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7137 unsigned int present;
7140 present = snd_hda_codec_read(codec, 0x18, 0,
7141 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7142 bits = present ? HDA_AMP_MUTE : 0;
7143 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7147 static void alc883_mitac_automute(struct hda_codec *codec)
7149 alc883_mitac_hp_automute(codec);
7150 /* alc883_mitac_mic_automute(codec); */
7153 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7156 switch (res >> 26) {
7157 case ALC880_HP_EVENT:
7158 alc883_mitac_hp_automute(codec);
7160 case ALC880_MIC_EVENT:
7161 /* alc883_mitac_mic_automute(codec); */
7166 static struct hda_verb alc883_mitac_verbs[] = {
7168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7171 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7172 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7174 /* enable unsolicited event */
7175 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7176 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7181 static struct hda_verb alc883_tagra_verbs[] = {
7182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7188 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7189 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7190 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7192 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7193 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7194 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7195 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7200 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7202 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7203 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7207 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7210 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7211 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7215 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7218 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7219 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7224 static struct hda_verb alc883_haier_w66_verbs[] = {
7225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7230 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7232 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7237 static struct hda_verb alc888_6st_hp_verbs[] = {
7238 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7239 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7240 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7241 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7245 static struct hda_verb alc888_3st_hp_verbs[] = {
7246 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7247 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7248 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7252 static struct hda_verb alc888_6st_dell_verbs[] = {
7253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */
7255 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */
7256 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7257 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7261 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7262 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7263 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7264 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7265 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7269 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7270 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7271 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7272 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7273 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7277 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7278 { 2, alc888_3st_hp_2ch_init },
7279 { 6, alc888_3st_hp_6ch_init },
7282 /* toggle front-jack and RCA according to the hp-jack state */
7283 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7285 unsigned int present;
7287 present = snd_hda_codec_read(codec, 0x1b, 0,
7288 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7289 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7290 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7291 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7292 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7295 /* toggle RCA according to the front-jack state */
7296 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7298 unsigned int present;
7300 present = snd_hda_codec_read(codec, 0x14, 0,
7301 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7303 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7306 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7309 if ((res >> 26) == ALC880_HP_EVENT)
7310 alc888_lenovo_ms7195_front_automute(codec);
7311 if ((res >> 26) == ALC880_FRONT_EVENT)
7312 alc888_lenovo_ms7195_rca_automute(codec);
7315 static struct hda_verb alc883_medion_md2_verbs[] = {
7316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7319 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7321 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7325 /* toggle speaker-output according to the hp-jack state */
7326 static void alc883_medion_md2_automute(struct hda_codec *codec)
7328 unsigned int present;
7330 present = snd_hda_codec_read(codec, 0x14, 0,
7331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7332 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7333 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7336 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7339 if ((res >> 26) == ALC880_HP_EVENT)
7340 alc883_medion_md2_automute(codec);
7343 /* toggle speaker-output according to the hp-jack state */
7344 static void alc883_tagra_automute(struct hda_codec *codec)
7346 unsigned int present;
7349 present = snd_hda_codec_read(codec, 0x14, 0,
7350 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7351 bits = present ? HDA_AMP_MUTE : 0;
7352 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7353 HDA_AMP_MUTE, bits);
7354 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7358 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7360 if ((res >> 26) == ALC880_HP_EVENT)
7361 alc883_tagra_automute(codec);
7364 static void alc883_haier_w66_automute(struct hda_codec *codec)
7366 unsigned int present;
7369 present = snd_hda_codec_read(codec, 0x1b, 0,
7370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7371 bits = present ? 0x80 : 0;
7372 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7376 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7379 if ((res >> 26) == ALC880_HP_EVENT)
7380 alc883_haier_w66_automute(codec);
7383 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7385 unsigned int present;
7388 present = snd_hda_codec_read(codec, 0x14, 0,
7389 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7390 bits = present ? HDA_AMP_MUTE : 0;
7391 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7392 HDA_AMP_MUTE, bits);
7395 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7397 unsigned int present;
7400 present = snd_hda_codec_read(codec, 0x1b, 0,
7401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7402 bits = present ? HDA_AMP_MUTE : 0;
7403 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7404 HDA_AMP_MUTE, bits);
7405 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7406 HDA_AMP_MUTE, bits);
7409 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7412 if ((res >> 26) == ALC880_HP_EVENT)
7413 alc883_lenovo_101e_all_automute(codec);
7414 if ((res >> 26) == ALC880_FRONT_EVENT)
7415 alc883_lenovo_101e_ispeaker_automute(codec);
7418 /* toggle speaker-output according to the hp-jack state */
7419 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7421 unsigned int present;
7423 present = snd_hda_codec_read(codec, 0x14, 0,
7424 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7425 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7426 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7427 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7428 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7431 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7434 if ((res >> 26) == ALC880_HP_EVENT)
7435 alc883_acer_aspire_automute(codec);
7438 static struct hda_verb alc883_acer_eapd_verbs[] = {
7439 /* HP Pin: output 0 (0x0c) */
7440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7442 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7443 /* Front Pin: output 0 (0x0c) */
7444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7446 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7447 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7448 /* eanable EAPD on medion laptop */
7449 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7450 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7451 /* enable unsolicited event */
7452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7456 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7458 unsigned int present;
7460 present = snd_hda_codec_read(codec, 0x1b, 0,
7461 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7462 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7463 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7464 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7465 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7466 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7467 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7468 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7469 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7472 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7475 switch (res >> 26) {
7476 case ALC880_HP_EVENT:
7477 printk("hp_event\n");
7478 alc888_6st_dell_front_automute(codec);
7484 * generic initialization of ADC, input mixers and output mixers
7486 static struct hda_verb alc883_auto_init_verbs[] = {
7488 * Unmute ADC0-2 and set the default input to mic-in
7490 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7492 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7495 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7497 * Note: PASD motherboards uses the Line In 2 as the input for
7498 * front panel mic (mic 2)
7500 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7508 * Set up output mixers (0x0c - 0x0f)
7510 /* set vol=0 to output mixers */
7511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7515 /* set up input amps for analog loopback */
7516 /* Amp Indices: DAC = 0, mixer = 1 */
7517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7525 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7528 /* FIXME: use matrix-type input source selection */
7529 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7532 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7534 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7535 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7540 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7541 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7546 /* capture mixer elements */
7547 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7548 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7549 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7550 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7551 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7554 /* The multiple "Capture Source" controls confuse alsamixer
7555 * So call somewhat different..
7557 /* .name = "Capture Source", */
7558 .name = "Input Source",
7560 .info = alc882_mux_enum_info,
7561 .get = alc882_mux_enum_get,
7562 .put = alc882_mux_enum_put,
7567 #ifdef CONFIG_SND_HDA_POWER_SAVE
7568 #define alc883_loopbacks alc880_loopbacks
7571 /* pcm configuration: identiacal with ALC880 */
7572 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7573 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7574 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7575 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7576 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7579 * configuration and preset
7581 static const char *alc883_models[ALC883_MODEL_LAST] = {
7582 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7583 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7584 [ALC883_3ST_6ch] = "3stack-6ch",
7585 [ALC883_6ST_DIG] = "6stack-dig",
7586 [ALC883_TARGA_DIG] = "targa-dig",
7587 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7588 [ALC883_ACER] = "acer",
7589 [ALC883_ACER_ASPIRE] = "acer-aspire",
7590 [ALC883_MEDION] = "medion",
7591 [ALC883_MEDION_MD2] = "medion-md2",
7592 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7593 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7594 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7595 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7596 [ALC883_HAIER_W66] = "haier-w66",
7597 [ALC888_6ST_HP] = "6stack-hp",
7598 [ALC888_3ST_HP] = "3stack-hp",
7599 [ALC888_6ST_DELL] = "6stack-dell",
7600 [ALC883_MITAC] = "mitac",
7601 [ALC883_AUTO] = "auto",
7604 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7605 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7606 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7607 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7608 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7609 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7610 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7611 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7612 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7613 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7614 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7615 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7616 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7617 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7618 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7619 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7620 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7621 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7622 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7623 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7624 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7625 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7626 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7627 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7628 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7629 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7630 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7631 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7632 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7633 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7634 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7635 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7636 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7637 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7638 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7639 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7640 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7641 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7642 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7643 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7644 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7645 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7646 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7647 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7648 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7649 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7650 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7651 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7655 static struct alc_config_preset alc883_presets[] = {
7656 [ALC883_3ST_2ch_DIG] = {
7657 .mixers = { alc883_3ST_2ch_mixer },
7658 .init_verbs = { alc883_init_verbs },
7659 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7660 .dac_nids = alc883_dac_nids,
7661 .dig_out_nid = ALC883_DIGOUT_NID,
7662 .dig_in_nid = ALC883_DIGIN_NID,
7663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7664 .channel_mode = alc883_3ST_2ch_modes,
7665 .input_mux = &alc883_capture_source,
7667 [ALC883_3ST_6ch_DIG] = {
7668 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7669 .init_verbs = { alc883_init_verbs },
7670 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7671 .dac_nids = alc883_dac_nids,
7672 .dig_out_nid = ALC883_DIGOUT_NID,
7673 .dig_in_nid = ALC883_DIGIN_NID,
7674 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7675 .channel_mode = alc883_3ST_6ch_modes,
7677 .input_mux = &alc883_capture_source,
7679 [ALC883_3ST_6ch] = {
7680 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7681 .init_verbs = { alc883_init_verbs },
7682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7683 .dac_nids = alc883_dac_nids,
7684 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7685 .channel_mode = alc883_3ST_6ch_modes,
7687 .input_mux = &alc883_capture_source,
7689 [ALC883_6ST_DIG] = {
7690 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7691 .init_verbs = { alc883_init_verbs },
7692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7693 .dac_nids = alc883_dac_nids,
7694 .dig_out_nid = ALC883_DIGOUT_NID,
7695 .dig_in_nid = ALC883_DIGIN_NID,
7696 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7697 .channel_mode = alc883_sixstack_modes,
7698 .input_mux = &alc883_capture_source,
7700 [ALC883_TARGA_DIG] = {
7701 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7702 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7703 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7704 .dac_nids = alc883_dac_nids,
7705 .dig_out_nid = ALC883_DIGOUT_NID,
7706 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7707 .channel_mode = alc883_3ST_6ch_modes,
7709 .input_mux = &alc883_capture_source,
7710 .unsol_event = alc883_tagra_unsol_event,
7711 .init_hook = alc883_tagra_automute,
7713 [ALC883_TARGA_2ch_DIG] = {
7714 .mixers = { alc883_tagra_2ch_mixer},
7715 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7716 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7717 .dac_nids = alc883_dac_nids,
7718 .dig_out_nid = ALC883_DIGOUT_NID,
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_tagra_unsol_event,
7723 .init_hook = alc883_tagra_automute,
7726 .mixers = { alc883_base_mixer },
7727 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7728 * and the headphone jack. Turn this on and rely on the
7729 * standard mute methods whenever the user wants to turn
7730 * these outputs off.
7732 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7733 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7734 .dac_nids = alc883_dac_nids,
7735 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7736 .channel_mode = alc883_3ST_2ch_modes,
7737 .input_mux = &alc883_capture_source,
7739 [ALC883_ACER_ASPIRE] = {
7740 .mixers = { alc883_acer_aspire_mixer },
7741 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7743 .dac_nids = alc883_dac_nids,
7744 .dig_out_nid = ALC883_DIGOUT_NID,
7745 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7746 .channel_mode = alc883_3ST_2ch_modes,
7747 .input_mux = &alc883_capture_source,
7748 .unsol_event = alc883_acer_aspire_unsol_event,
7749 .init_hook = alc883_acer_aspire_automute,
7752 .mixers = { alc883_fivestack_mixer,
7753 alc883_chmode_mixer },
7754 .init_verbs = { alc883_init_verbs,
7755 alc883_medion_eapd_verbs },
7756 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7757 .dac_nids = alc883_dac_nids,
7758 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7759 .channel_mode = alc883_sixstack_modes,
7760 .input_mux = &alc883_capture_source,
7762 [ALC883_MEDION_MD2] = {
7763 .mixers = { alc883_medion_md2_mixer},
7764 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7765 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7766 .dac_nids = alc883_dac_nids,
7767 .dig_out_nid = ALC883_DIGOUT_NID,
7768 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7769 .channel_mode = alc883_3ST_2ch_modes,
7770 .input_mux = &alc883_capture_source,
7771 .unsol_event = alc883_medion_md2_unsol_event,
7772 .init_hook = alc883_medion_md2_automute,
7774 [ALC883_LAPTOP_EAPD] = {
7775 .mixers = { alc883_base_mixer },
7776 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7777 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7778 .dac_nids = alc883_dac_nids,
7779 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7780 .channel_mode = alc883_3ST_2ch_modes,
7781 .input_mux = &alc883_capture_source,
7783 [ALC883_LENOVO_101E_2ch] = {
7784 .mixers = { alc883_lenovo_101e_2ch_mixer},
7785 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7786 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7787 .dac_nids = alc883_dac_nids,
7788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7789 .channel_mode = alc883_3ST_2ch_modes,
7790 .input_mux = &alc883_lenovo_101e_capture_source,
7791 .unsol_event = alc883_lenovo_101e_unsol_event,
7792 .init_hook = alc883_lenovo_101e_all_automute,
7794 [ALC883_LENOVO_NB0763] = {
7795 .mixers = { alc883_lenovo_nb0763_mixer },
7796 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7797 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7798 .dac_nids = alc883_dac_nids,
7799 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7800 .channel_mode = alc883_3ST_2ch_modes,
7802 .input_mux = &alc883_lenovo_nb0763_capture_source,
7803 .unsol_event = alc883_medion_md2_unsol_event,
7804 .init_hook = alc883_medion_md2_automute,
7806 [ALC888_LENOVO_MS7195_DIG] = {
7807 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7808 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7810 .dac_nids = alc883_dac_nids,
7811 .dig_out_nid = ALC883_DIGOUT_NID,
7812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7813 .channel_mode = alc883_3ST_6ch_modes,
7815 .input_mux = &alc883_capture_source,
7816 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7817 .init_hook = alc888_lenovo_ms7195_front_automute,
7819 [ALC883_HAIER_W66] = {
7820 .mixers = { alc883_tagra_2ch_mixer},
7821 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7822 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7823 .dac_nids = alc883_dac_nids,
7824 .dig_out_nid = ALC883_DIGOUT_NID,
7825 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7826 .channel_mode = alc883_3ST_2ch_modes,
7827 .input_mux = &alc883_capture_source,
7828 .unsol_event = alc883_haier_w66_unsol_event,
7829 .init_hook = alc883_haier_w66_automute,
7832 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7833 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7834 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7835 .dac_nids = alc883_dac_nids,
7836 .dig_out_nid = ALC883_DIGOUT_NID,
7837 .dig_in_nid = ALC883_DIGIN_NID,
7838 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7839 .channel_mode = alc883_sixstack_modes,
7840 .input_mux = &alc883_capture_source,
7843 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7844 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7845 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7846 .dac_nids = alc883_dac_nids,
7847 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7848 .channel_mode = alc888_3st_hp_modes,
7850 .input_mux = &alc883_capture_source,
7852 [ALC888_6ST_DELL] = {
7853 .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer },
7854 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7855 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7856 .dac_nids = alc883_dac_nids,
7857 .dig_out_nid = ALC883_DIGOUT_NID,
7858 .dig_in_nid = ALC883_DIGIN_NID,
7859 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7860 .channel_mode = alc883_sixstack_modes,
7861 .input_mux = &alc883_capture_source,
7862 .unsol_event = alc888_6st_dell_unsol_event,
7863 .init_hook = alc888_6st_dell_front_automute,
7866 .mixers = { alc883_mitac_mixer },
7867 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7868 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7869 .dac_nids = alc883_dac_nids,
7870 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7871 .channel_mode = alc883_3ST_2ch_modes,
7872 .input_mux = &alc883_capture_source,
7873 .unsol_event = alc883_mitac_unsol_event,
7874 .init_hook = alc883_mitac_automute,
7880 * BIOS auto configuration
7882 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7883 hda_nid_t nid, int pin_type,
7887 struct alc_spec *spec = codec->spec;
7890 alc_set_pin_output(codec, nid, pin_type);
7891 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7894 idx = spec->multiout.dac_nids[dac_idx] - 2;
7895 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7899 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7901 struct alc_spec *spec = codec->spec;
7904 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7905 for (i = 0; i <= HDA_SIDE; i++) {
7906 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7907 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7909 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7914 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7916 struct alc_spec *spec = codec->spec;
7919 pin = spec->autocfg.hp_pins[0];
7920 if (pin) /* connect to front */
7922 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7923 pin = spec->autocfg.speaker_pins[0];
7925 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7928 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7929 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7931 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7933 struct alc_spec *spec = codec->spec;
7936 for (i = 0; i < AUTO_PIN_LAST; i++) {
7937 hda_nid_t nid = spec->autocfg.input_pins[i];
7938 if (alc883_is_input_pin(nid)) {
7939 snd_hda_codec_write(codec, nid, 0,
7940 AC_VERB_SET_PIN_WIDGET_CONTROL,
7941 (i <= AUTO_PIN_FRONT_MIC ?
7942 PIN_VREF80 : PIN_IN));
7943 if (nid != ALC883_PIN_CD_NID)
7944 snd_hda_codec_write(codec, nid, 0,
7945 AC_VERB_SET_AMP_GAIN_MUTE,
7951 /* almost identical with ALC880 parser... */
7952 static int alc883_parse_auto_config(struct hda_codec *codec)
7954 struct alc_spec *spec = codec->spec;
7955 int err = alc880_parse_auto_config(codec);
7960 return 0; /* no config found */
7962 err = alc_auto_add_mic_boost(codec);
7966 /* hack - override the init verbs */
7967 spec->init_verbs[0] = alc883_auto_init_verbs;
7968 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7971 return 1; /* config found */
7974 /* additional initialization for auto-configuration model */
7975 static void alc883_auto_init(struct hda_codec *codec)
7977 struct alc_spec *spec = codec->spec;
7978 alc883_auto_init_multi_out(codec);
7979 alc883_auto_init_hp_out(codec);
7980 alc883_auto_init_analog_input(codec);
7981 if (spec->unsol_event)
7982 alc_sku_automute(codec);
7985 static int patch_alc883(struct hda_codec *codec)
7987 struct alc_spec *spec;
7988 int err, board_config;
7990 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7996 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7999 if (board_config < 0) {
8000 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8001 "trying auto-probe from BIOS...\n");
8002 board_config = ALC883_AUTO;
8005 if (board_config == ALC883_AUTO) {
8006 /* automatic parse from the BIOS config */
8007 err = alc883_parse_auto_config(codec);
8013 "hda_codec: Cannot set up configuration "
8014 "from BIOS. Using base mode...\n");
8015 board_config = ALC883_3ST_2ch_DIG;
8019 if (board_config != ALC883_AUTO)
8020 setup_preset(spec, &alc883_presets[board_config]);
8022 spec->stream_name_analog = "ALC883 Analog";
8023 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8024 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8025 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8027 spec->stream_name_digital = "ALC883 Digital";
8028 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8029 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8031 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8032 spec->adc_nids = alc883_adc_nids;
8033 spec->capsrc_nids = alc883_capsrc_nids;
8035 spec->vmaster_nid = 0x0c;
8037 codec->patch_ops = alc_patch_ops;
8038 if (board_config == ALC883_AUTO)
8039 spec->init_hook = alc883_auto_init;
8040 #ifdef CONFIG_SND_HDA_POWER_SAVE
8041 if (!spec->loopback.amplist)
8042 spec->loopback.amplist = alc883_loopbacks;
8052 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8053 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8055 #define alc262_dac_nids alc260_dac_nids
8056 #define alc262_adc_nids alc882_adc_nids
8057 #define alc262_adc_nids_alt alc882_adc_nids_alt
8058 #define alc262_capsrc_nids alc882_capsrc_nids
8059 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8061 #define alc262_modes alc260_modes
8062 #define alc262_capture_source alc882_capture_source
8064 static struct snd_kcontrol_new alc262_base_mixer[] = {
8065 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8066 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8067 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8068 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8070 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8077 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8078 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8079 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8081 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8082 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8086 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8088 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8089 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8090 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8092 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8096 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8097 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8099 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8100 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8101 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8106 /* update HP, line and mono-out pins according to the master switch */
8107 static void alc262_hp_master_update(struct hda_codec *codec)
8109 struct alc_spec *spec = codec->spec;
8110 int val = spec->master_sw;
8113 snd_hda_codec_write_cache(codec, 0x1b, 0,
8114 AC_VERB_SET_PIN_WIDGET_CONTROL,
8116 snd_hda_codec_write_cache(codec, 0x15, 0,
8117 AC_VERB_SET_PIN_WIDGET_CONTROL,
8119 /* mono (speaker) depending on the HP jack sense */
8120 val = val && !spec->jack_present;
8121 snd_hda_codec_write_cache(codec, 0x16, 0,
8122 AC_VERB_SET_PIN_WIDGET_CONTROL,
8126 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8128 struct alc_spec *spec = codec->spec;
8129 unsigned int presence;
8130 presence = snd_hda_codec_read(codec, 0x1b, 0,
8131 AC_VERB_GET_PIN_SENSE, 0);
8132 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8133 alc262_hp_master_update(codec);
8136 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8138 if ((res >> 26) != ALC880_HP_EVENT)
8140 alc262_hp_bpc_automute(codec);
8143 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8145 struct alc_spec *spec = codec->spec;
8146 unsigned int presence;
8147 presence = snd_hda_codec_read(codec, 0x15, 0,
8148 AC_VERB_GET_PIN_SENSE, 0);
8149 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8150 alc262_hp_master_update(codec);
8153 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8156 if ((res >> 26) != ALC880_HP_EVENT)
8158 alc262_hp_wildwest_automute(codec);
8161 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8162 struct snd_ctl_elem_value *ucontrol)
8164 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8165 struct alc_spec *spec = codec->spec;
8166 *ucontrol->value.integer.value = spec->master_sw;
8170 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8171 struct snd_ctl_elem_value *ucontrol)
8173 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8174 struct alc_spec *spec = codec->spec;
8175 int val = !!*ucontrol->value.integer.value;
8177 if (val == spec->master_sw)
8179 spec->master_sw = val;
8180 alc262_hp_master_update(codec);
8184 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8187 .name = "Master Playback Switch",
8188 .info = snd_ctl_boolean_mono_info,
8189 .get = alc262_hp_master_sw_get,
8190 .put = alc262_hp_master_sw_put,
8192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8193 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8195 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8197 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8201 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8202 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8203 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8204 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8205 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8206 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8209 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8210 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8211 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8212 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8216 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8219 .name = "Master Playback Switch",
8220 .info = snd_ctl_boolean_mono_info,
8221 .get = alc262_hp_master_sw_get,
8222 .put = alc262_hp_master_sw_put,
8224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8225 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8228 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8230 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8236 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8239 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8240 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8244 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8245 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8246 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8247 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8251 /* mute/unmute internal speaker according to the hp jack and mute state */
8252 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8254 struct alc_spec *spec = codec->spec;
8256 if (force || !spec->sense_updated) {
8257 unsigned int present;
8258 present = snd_hda_codec_read(codec, 0x15, 0,
8259 AC_VERB_GET_PIN_SENSE, 0);
8260 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8261 spec->sense_updated = 1;
8263 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8264 spec->jack_present ? HDA_AMP_MUTE : 0);
8267 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8270 if ((res >> 26) != ALC880_HP_EVENT)
8272 alc262_hp_t5735_automute(codec, 1);
8275 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8277 alc262_hp_t5735_automute(codec, 1);
8280 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8281 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8282 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8284 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8291 static struct hda_verb alc262_hp_t5735_verbs[] = {
8292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8295 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8299 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8300 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8302 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8303 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8309 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8310 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8313 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8314 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8315 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8316 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8323 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8330 /* bind hp and internal speaker mute (with plug check) */
8331 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8332 struct snd_ctl_elem_value *ucontrol)
8334 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8335 long *valp = ucontrol->value.integer.value;
8338 /* change hp mute */
8339 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8341 valp[0] ? 0 : HDA_AMP_MUTE);
8342 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8344 valp[1] ? 0 : HDA_AMP_MUTE);
8346 /* change speaker according to HP jack state */
8347 struct alc_spec *spec = codec->spec;
8349 if (spec->jack_present)
8350 mute = HDA_AMP_MUTE;
8352 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8354 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8355 HDA_AMP_MUTE, mute);
8360 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8361 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8364 .name = "Master Playback Switch",
8365 .info = snd_hda_mixer_amp_switch_info,
8366 .get = snd_hda_mixer_amp_switch_get,
8367 .put = alc262_sony_master_sw_put,
8368 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8372 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8373 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8377 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8378 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8379 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8383 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8384 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8388 #define alc262_capture_mixer alc882_capture_mixer
8389 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8392 * generic initialization of ADC, input mixers and output mixers
8394 static struct hda_verb alc262_init_verbs[] = {
8396 * Unmute ADC0-2 and set the default input to mic-in
8398 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8400 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8402 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8403 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8405 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8407 * Note: PASD motherboards uses the Line In 2 as the input for
8408 * front panel mic (mic 2)
8410 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8411 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8418 * Set up output mixers (0x0c - 0x0e)
8420 /* set vol=0 to output mixers */
8421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8424 /* set up input amps for analog loopback */
8425 /* Amp Indices: DAC = 0, mixer = 1 */
8426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8431 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8434 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8435 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8436 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8438 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8442 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8446 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8449 /* FIXME: use matrix-type input source selection */
8450 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8451 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8470 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8471 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8472 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8476 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8478 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8481 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8482 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8486 static struct hda_verb alc262_sony_unsol_verbs[] = {
8487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8489 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8491 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8495 /* mute/unmute internal speaker according to the hp jack and mute state */
8496 static void alc262_hippo_automute(struct hda_codec *codec)
8498 struct alc_spec *spec = codec->spec;
8500 unsigned int present;
8502 /* need to execute and sync at first */
8503 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8504 present = snd_hda_codec_read(codec, 0x15, 0,
8505 AC_VERB_GET_PIN_SENSE, 0);
8506 spec->jack_present = (present & 0x80000000) != 0;
8507 if (spec->jack_present) {
8508 /* mute internal speaker */
8509 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8510 HDA_AMP_MUTE, HDA_AMP_MUTE);
8512 /* unmute internal speaker if necessary */
8513 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8514 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8515 HDA_AMP_MUTE, mute);
8519 /* unsolicited event for HP jack sensing */
8520 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8523 if ((res >> 26) != ALC880_HP_EVENT)
8525 alc262_hippo_automute(codec);
8528 static void alc262_hippo1_automute(struct hda_codec *codec)
8531 unsigned int present;
8533 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8534 present = snd_hda_codec_read(codec, 0x1b, 0,
8535 AC_VERB_GET_PIN_SENSE, 0);
8536 present = (present & 0x80000000) != 0;
8538 /* mute internal speaker */
8539 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8540 HDA_AMP_MUTE, HDA_AMP_MUTE);
8542 /* unmute internal speaker if necessary */
8543 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8544 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8545 HDA_AMP_MUTE, mute);
8549 /* unsolicited event for HP jack sensing */
8550 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8553 if ((res >> 26) != ALC880_HP_EVENT)
8555 alc262_hippo1_automute(codec);
8560 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8563 #define ALC_HP_EVENT 0x37
8565 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8566 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8571 static struct hda_input_mux alc262_fujitsu_capture_source = {
8580 static struct hda_input_mux alc262_HP_capture_source = {
8584 { "Front Mic", 0x1 },
8591 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8595 { "Front Mic", 0x2 },
8601 /* mute/unmute internal speaker according to the hp jack and mute state */
8602 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8604 struct alc_spec *spec = codec->spec;
8607 if (force || !spec->sense_updated) {
8608 unsigned int present;
8609 /* need to execute and sync at first */
8610 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8611 present = snd_hda_codec_read(codec, 0x14, 0,
8612 AC_VERB_GET_PIN_SENSE, 0);
8613 spec->jack_present = (present & 0x80000000) != 0;
8614 spec->sense_updated = 1;
8616 if (spec->jack_present) {
8617 /* mute internal speaker */
8618 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8619 HDA_AMP_MUTE, HDA_AMP_MUTE);
8621 /* unmute internal speaker if necessary */
8622 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8623 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8624 HDA_AMP_MUTE, mute);
8628 /* unsolicited event for HP jack sensing */
8629 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8632 if ((res >> 26) != ALC_HP_EVENT)
8634 alc262_fujitsu_automute(codec, 1);
8637 /* bind volumes of both NID 0x0c and 0x0d */
8638 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8639 .ops = &snd_hda_bind_vol,
8641 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8642 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8647 /* bind hp and internal speaker mute (with plug check) */
8648 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8649 struct snd_ctl_elem_value *ucontrol)
8651 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8652 long *valp = ucontrol->value.integer.value;
8655 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8657 valp[0] ? 0 : HDA_AMP_MUTE);
8658 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8660 valp[1] ? 0 : HDA_AMP_MUTE);
8662 alc262_fujitsu_automute(codec, 0);
8666 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8667 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8670 .name = "Master Playback Switch",
8671 .info = snd_hda_mixer_amp_switch_info,
8672 .get = snd_hda_mixer_amp_switch_get,
8673 .put = alc262_fujitsu_master_sw_put,
8674 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8676 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8677 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8681 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8682 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8683 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8687 /* additional init verbs for Benq laptops */
8688 static struct hda_verb alc262_EAPD_verbs[] = {
8689 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8690 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8694 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8695 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8698 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8699 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8703 /* Samsung Q1 Ultra Vista model setup */
8704 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8705 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8706 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8710 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8714 static struct hda_verb alc262_ultra_verbs[] = {
8715 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8718 /* Mic is on Node 0x19 */
8719 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8720 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8722 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8724 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8729 static struct hda_input_mux alc262_ultra_capture_source = {
8736 /* mute/unmute internal speaker according to the hp jack and mute state */
8737 static void alc262_ultra_automute(struct hda_codec *codec)
8739 struct alc_spec *spec = codec->spec;
8741 unsigned int present;
8743 /* need to execute and sync at first */
8744 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8745 present = snd_hda_codec_read(codec, 0x15, 0,
8746 AC_VERB_GET_PIN_SENSE, 0);
8747 spec->jack_present = (present & 0x80000000) != 0;
8748 if (spec->jack_present) {
8749 /* mute internal speaker */
8750 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8751 HDA_AMP_MUTE, HDA_AMP_MUTE);
8753 /* unmute internal speaker if necessary */
8754 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8755 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8756 HDA_AMP_MUTE, mute);
8760 /* unsolicited event for HP jack sensing */
8761 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8764 if ((res >> 26) != ALC880_HP_EVENT)
8766 alc262_ultra_automute(codec);
8769 /* add playback controls from the parsed DAC table */
8770 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8771 const struct auto_pin_cfg *cfg)
8776 spec->multiout.num_dacs = 1; /* only use one dac */
8777 spec->multiout.dac_nids = spec->private_dac_nids;
8778 spec->multiout.dac_nids[0] = 2;
8780 nid = cfg->line_out_pins[0];
8782 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8783 "Front Playback Volume",
8784 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8787 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8788 "Front Playback Switch",
8789 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8794 nid = cfg->speaker_pins[0];
8797 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8798 "Speaker Playback Volume",
8799 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8803 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8804 "Speaker Playback Switch",
8805 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8810 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8811 "Speaker Playback Switch",
8812 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8818 nid = cfg->hp_pins[0];
8820 /* spec->multiout.hp_nid = 2; */
8822 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8823 "Headphone Playback Volume",
8824 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8828 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8829 "Headphone Playback Switch",
8830 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8835 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8836 "Headphone Playback Switch",
8837 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8846 /* identical with ALC880 */
8847 #define alc262_auto_create_analog_input_ctls \
8848 alc880_auto_create_analog_input_ctls
8851 * generic initialization of ADC, input mixers and output mixers
8853 static struct hda_verb alc262_volume_init_verbs[] = {
8855 * Unmute ADC0-2 and set the default input to mic-in
8857 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8859 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8860 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8861 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8864 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8866 * Note: PASD motherboards uses the Line In 2 as the input for
8867 * front panel mic (mic 2)
8869 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8872 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8873 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8877 * Set up output mixers (0x0c - 0x0f)
8879 /* set vol=0 to output mixers */
8880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8881 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8882 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8884 /* set up input amps for analog loopback */
8885 /* Amp Indices: DAC = 0, mixer = 1 */
8886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8893 /* FIXME: use matrix-type input source selection */
8894 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8895 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8898 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8904 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8909 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8914 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8916 * Unmute ADC0-2 and set the default input to mic-in
8918 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8920 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8922 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8925 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8927 * Note: PASD motherboards uses the Line In 2 as the input for
8928 * front panel mic (mic 2)
8930 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8940 * Set up output mixers (0x0c - 0x0e)
8942 /* set vol=0 to output mixers */
8943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8944 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8947 /* set up input amps for analog loopback */
8948 /* Amp Indices: DAC = 0, mixer = 1 */
8949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8956 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8960 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8963 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8964 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8967 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8968 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8969 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8970 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8972 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8976 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8977 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8980 /* FIXME: use matrix-type input source selection */
8981 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8982 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8988 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9003 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9005 * Unmute ADC0-2 and set the default input to mic-in
9007 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9009 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9011 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9012 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9014 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9016 * Note: PASD motherboards uses the Line In 2 as the input for front
9019 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9029 * Set up output mixers (0x0c - 0x0e)
9031 /* set vol=0 to output mixers */
9032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9036 /* set up input amps for analog loopback */
9037 /* Amp Indices: DAC = 0, mixer = 1 */
9038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9043 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9052 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9054 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9057 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9060 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9063 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9064 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9065 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9067 /* FIXME: use matrix-type input source selection */
9068 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9069 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9072 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9075 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9079 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9080 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9081 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9083 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9091 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9099 #ifdef CONFIG_SND_HDA_POWER_SAVE
9100 #define alc262_loopbacks alc880_loopbacks
9103 /* pcm configuration: identiacal with ALC880 */
9104 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9105 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9106 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9107 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9110 * BIOS auto configuration
9112 static int alc262_parse_auto_config(struct hda_codec *codec)
9114 struct alc_spec *spec = codec->spec;
9116 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9118 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9122 if (!spec->autocfg.line_outs)
9123 return 0; /* can't find valid BIOS pin config */
9124 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9127 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9131 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9133 if (spec->autocfg.dig_out_pin)
9134 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9135 if (spec->autocfg.dig_in_pin)
9136 spec->dig_in_nid = ALC262_DIGIN_NID;
9138 if (spec->kctl_alloc)
9139 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9141 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9142 spec->num_mux_defs = 1;
9143 spec->input_mux = &spec->private_imux;
9145 err = alc_auto_add_mic_boost(codec);
9152 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9153 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9154 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9157 /* init callback for auto-configuration model -- overriding the default init */
9158 static void alc262_auto_init(struct hda_codec *codec)
9160 struct alc_spec *spec = codec->spec;
9161 alc262_auto_init_multi_out(codec);
9162 alc262_auto_init_hp_out(codec);
9163 alc262_auto_init_analog_input(codec);
9164 if (spec->unsol_event)
9165 alc_sku_automute(codec);
9169 * configuration and preset
9171 static const char *alc262_models[ALC262_MODEL_LAST] = {
9172 [ALC262_BASIC] = "basic",
9173 [ALC262_HIPPO] = "hippo",
9174 [ALC262_HIPPO_1] = "hippo_1",
9175 [ALC262_FUJITSU] = "fujitsu",
9176 [ALC262_HP_BPC] = "hp-bpc",
9177 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9178 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9179 [ALC262_HP_RP5700] = "hp-rp5700",
9180 [ALC262_BENQ_ED8] = "benq",
9181 [ALC262_BENQ_T31] = "benq-t31",
9182 [ALC262_SONY_ASSAMD] = "sony-assamd",
9183 [ALC262_ULTRA] = "ultra",
9184 [ALC262_AUTO] = "auto",
9187 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9188 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9189 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9190 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9191 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9192 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9193 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9194 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9195 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9196 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9197 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9198 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9199 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9200 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9201 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9202 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9203 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9204 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9205 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9206 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9207 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9208 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9209 ALC262_HP_TC_T5735),
9210 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9211 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9212 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9213 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9214 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9215 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9216 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9217 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9218 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9219 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9220 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9221 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9225 static struct alc_config_preset alc262_presets[] = {
9227 .mixers = { alc262_base_mixer },
9228 .init_verbs = { alc262_init_verbs },
9229 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9230 .dac_nids = alc262_dac_nids,
9232 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9233 .channel_mode = alc262_modes,
9234 .input_mux = &alc262_capture_source,
9237 .mixers = { alc262_base_mixer },
9238 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9239 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9240 .dac_nids = alc262_dac_nids,
9242 .dig_out_nid = ALC262_DIGOUT_NID,
9243 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9244 .channel_mode = alc262_modes,
9245 .input_mux = &alc262_capture_source,
9246 .unsol_event = alc262_hippo_unsol_event,
9247 .init_hook = alc262_hippo_automute,
9249 [ALC262_HIPPO_1] = {
9250 .mixers = { alc262_hippo1_mixer },
9251 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9252 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9253 .dac_nids = alc262_dac_nids,
9255 .dig_out_nid = ALC262_DIGOUT_NID,
9256 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9257 .channel_mode = alc262_modes,
9258 .input_mux = &alc262_capture_source,
9259 .unsol_event = alc262_hippo1_unsol_event,
9260 .init_hook = alc262_hippo1_automute,
9262 [ALC262_FUJITSU] = {
9263 .mixers = { alc262_fujitsu_mixer },
9264 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9265 alc262_fujitsu_unsol_verbs },
9266 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9267 .dac_nids = alc262_dac_nids,
9269 .dig_out_nid = ALC262_DIGOUT_NID,
9270 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9271 .channel_mode = alc262_modes,
9272 .input_mux = &alc262_fujitsu_capture_source,
9273 .unsol_event = alc262_fujitsu_unsol_event,
9276 .mixers = { alc262_HP_BPC_mixer },
9277 .init_verbs = { alc262_HP_BPC_init_verbs },
9278 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9279 .dac_nids = alc262_dac_nids,
9281 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9282 .channel_mode = alc262_modes,
9283 .input_mux = &alc262_HP_capture_source,
9284 .unsol_event = alc262_hp_bpc_unsol_event,
9285 .init_hook = alc262_hp_bpc_automute,
9287 [ALC262_HP_BPC_D7000_WF] = {
9288 .mixers = { alc262_HP_BPC_WildWest_mixer },
9289 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9290 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9291 .dac_nids = alc262_dac_nids,
9293 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9294 .channel_mode = alc262_modes,
9295 .input_mux = &alc262_HP_D7000_capture_source,
9296 .unsol_event = alc262_hp_wildwest_unsol_event,
9297 .init_hook = alc262_hp_wildwest_automute,
9299 [ALC262_HP_BPC_D7000_WL] = {
9300 .mixers = { alc262_HP_BPC_WildWest_mixer,
9301 alc262_HP_BPC_WildWest_option_mixer },
9302 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9303 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9304 .dac_nids = alc262_dac_nids,
9306 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9307 .channel_mode = alc262_modes,
9308 .input_mux = &alc262_HP_D7000_capture_source,
9309 .unsol_event = alc262_hp_wildwest_unsol_event,
9310 .init_hook = alc262_hp_wildwest_automute,
9312 [ALC262_HP_TC_T5735] = {
9313 .mixers = { alc262_hp_t5735_mixer },
9314 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9315 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9316 .dac_nids = alc262_dac_nids,
9318 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9319 .channel_mode = alc262_modes,
9320 .input_mux = &alc262_capture_source,
9321 .unsol_event = alc262_hp_t5735_unsol_event,
9322 .init_hook = alc262_hp_t5735_init_hook,
9324 [ALC262_HP_RP5700] = {
9325 .mixers = { alc262_hp_rp5700_mixer },
9326 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9327 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9328 .dac_nids = alc262_dac_nids,
9329 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9330 .channel_mode = alc262_modes,
9331 .input_mux = &alc262_hp_rp5700_capture_source,
9333 [ALC262_BENQ_ED8] = {
9334 .mixers = { alc262_base_mixer },
9335 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9336 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9337 .dac_nids = alc262_dac_nids,
9339 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9340 .channel_mode = alc262_modes,
9341 .input_mux = &alc262_capture_source,
9343 [ALC262_SONY_ASSAMD] = {
9344 .mixers = { alc262_sony_mixer },
9345 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9346 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9347 .dac_nids = alc262_dac_nids,
9349 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9350 .channel_mode = alc262_modes,
9351 .input_mux = &alc262_capture_source,
9352 .unsol_event = alc262_hippo_unsol_event,
9353 .init_hook = alc262_hippo_automute,
9355 [ALC262_BENQ_T31] = {
9356 .mixers = { alc262_benq_t31_mixer },
9357 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9358 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9359 .dac_nids = alc262_dac_nids,
9361 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9362 .channel_mode = alc262_modes,
9363 .input_mux = &alc262_capture_source,
9364 .unsol_event = alc262_hippo_unsol_event,
9365 .init_hook = alc262_hippo_automute,
9368 .mixers = { alc262_ultra_mixer },
9369 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
9370 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9371 .dac_nids = alc262_dac_nids,
9373 .dig_out_nid = ALC262_DIGOUT_NID,
9374 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9375 .channel_mode = alc262_modes,
9376 .input_mux = &alc262_ultra_capture_source,
9377 .unsol_event = alc262_ultra_unsol_event,
9378 .init_hook = alc262_ultra_automute,
9382 static int patch_alc262(struct hda_codec *codec)
9384 struct alc_spec *spec;
9388 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9394 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9399 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9400 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9401 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9402 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9406 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9410 if (board_config < 0) {
9411 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9412 "trying auto-probe from BIOS...\n");
9413 board_config = ALC262_AUTO;
9416 if (board_config == ALC262_AUTO) {
9417 /* automatic parse from the BIOS config */
9418 err = alc262_parse_auto_config(codec);
9424 "hda_codec: Cannot set up configuration "
9425 "from BIOS. Using base mode...\n");
9426 board_config = ALC262_BASIC;
9430 if (board_config != ALC262_AUTO)
9431 setup_preset(spec, &alc262_presets[board_config]);
9433 spec->stream_name_analog = "ALC262 Analog";
9434 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9435 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9437 spec->stream_name_digital = "ALC262 Digital";
9438 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9439 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9441 if (!spec->adc_nids && spec->input_mux) {
9442 /* check whether NID 0x07 is valid */
9443 unsigned int wcap = get_wcaps(codec, 0x07);
9446 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9447 if (wcap != AC_WID_AUD_IN) {
9448 spec->adc_nids = alc262_adc_nids_alt;
9449 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9450 spec->capsrc_nids = alc262_capsrc_nids_alt;
9451 spec->mixers[spec->num_mixers] =
9452 alc262_capture_alt_mixer;
9455 spec->adc_nids = alc262_adc_nids;
9456 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9457 spec->capsrc_nids = alc262_capsrc_nids;
9458 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9463 spec->vmaster_nid = 0x0c;
9465 codec->patch_ops = alc_patch_ops;
9466 if (board_config == ALC262_AUTO)
9467 spec->init_hook = alc262_auto_init;
9468 #ifdef CONFIG_SND_HDA_POWER_SAVE
9469 if (!spec->loopback.amplist)
9470 spec->loopback.amplist = alc262_loopbacks;
9477 * ALC268 channel source setting (2 channel)
9479 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9480 #define alc268_modes alc260_modes
9482 static hda_nid_t alc268_dac_nids[2] = {
9487 static hda_nid_t alc268_adc_nids[2] = {
9492 static hda_nid_t alc268_adc_nids_alt[1] = {
9497 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9499 static struct snd_kcontrol_new alc268_base_mixer[] = {
9500 /* output mixer control */
9501 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9502 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9503 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9505 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9506 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9507 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9511 /* bind Beep switches of both NID 0x0f and 0x10 */
9512 static struct hda_bind_ctls alc268_bind_beep_sw = {
9513 .ops = &snd_hda_bind_sw,
9515 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9516 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9521 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9522 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9523 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9527 static struct hda_verb alc268_eapd_verbs[] = {
9528 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9529 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9533 /* Toshiba specific */
9534 #define alc268_toshiba_automute alc262_hippo_automute
9536 static struct hda_verb alc268_toshiba_verbs[] = {
9537 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9542 /* bind volumes of both NID 0x02 and 0x03 */
9543 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9544 .ops = &snd_hda_bind_vol,
9546 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9547 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9552 /* mute/unmute internal speaker according to the hp jack and mute state */
9553 static void alc268_acer_automute(struct hda_codec *codec, int force)
9555 struct alc_spec *spec = codec->spec;
9558 if (force || !spec->sense_updated) {
9559 unsigned int present;
9560 present = snd_hda_codec_read(codec, 0x14, 0,
9561 AC_VERB_GET_PIN_SENSE, 0);
9562 spec->jack_present = (present & 0x80000000) != 0;
9563 spec->sense_updated = 1;
9565 if (spec->jack_present)
9566 mute = HDA_AMP_MUTE; /* mute internal speaker */
9567 else /* unmute internal speaker if necessary */
9568 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9570 HDA_AMP_MUTE, mute);
9574 /* bind hp and internal speaker mute (with plug check) */
9575 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9576 struct snd_ctl_elem_value *ucontrol)
9578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9579 long *valp = ucontrol->value.integer.value;
9582 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9584 valp[0] ? 0 : HDA_AMP_MUTE);
9585 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9587 valp[1] ? 0 : HDA_AMP_MUTE);
9589 alc268_acer_automute(codec, 0);
9593 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9594 /* output mixer control */
9595 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9597 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9598 .name = "Master Playback Switch",
9599 .info = snd_hda_mixer_amp_switch_info,
9600 .get = snd_hda_mixer_amp_switch_get,
9601 .put = alc268_acer_master_sw_put,
9602 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9605 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9606 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9610 static struct hda_verb alc268_acer_verbs[] = {
9611 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9614 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9618 /* unsolicited event for HP jack sensing */
9619 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9622 if ((res >> 26) != ALC880_HP_EVENT)
9624 alc268_toshiba_automute(codec);
9627 static void alc268_acer_unsol_event(struct hda_codec *codec,
9630 if ((res >> 26) != ALC880_HP_EVENT)
9632 alc268_acer_automute(codec, 1);
9635 static void alc268_acer_init_hook(struct hda_codec *codec)
9637 alc268_acer_automute(codec, 1);
9640 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9641 /* output mixer control */
9642 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9643 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9644 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9646 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9647 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9651 static struct hda_verb alc268_dell_verbs[] = {
9652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9653 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9654 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9658 /* mute/unmute internal speaker according to the hp jack and mute state */
9659 static void alc268_dell_automute(struct hda_codec *codec)
9661 unsigned int present;
9664 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9665 if (present & 0x80000000)
9666 mute = HDA_AMP_MUTE;
9668 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9669 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9670 HDA_AMP_MUTE, mute);
9673 static void alc268_dell_unsol_event(struct hda_codec *codec,
9676 if ((res >> 26) != ALC880_HP_EVENT)
9678 alc268_dell_automute(codec);
9681 #define alc268_dell_init_hook alc268_dell_automute
9684 * generic initialization of ADC, input mixers and output mixers
9686 static struct hda_verb alc268_base_init_verbs[] = {
9687 /* Unmute DAC0-1 and set vol = 0 */
9688 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9689 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9690 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9691 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9692 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9693 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9696 * Set up output mixers (0x0c - 0x0e)
9698 /* set vol=0 to output mixers */
9699 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9702 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9704 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9705 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9709 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9710 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9711 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9712 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9714 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9717 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9718 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9719 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9720 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9721 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9722 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9724 /* set PCBEEP vol = 0, mute connections */
9725 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9727 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9729 /* Unmute Selector 23h,24h and set the default input to mic-in */
9731 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9733 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9734 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9740 * generic initialization of ADC, input mixers and output mixers
9742 static struct hda_verb alc268_volume_init_verbs[] = {
9743 /* set output DAC */
9744 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9745 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9746 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9747 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9749 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9750 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9752 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9753 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9759 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9761 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9762 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9764 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9766 /* set PCBEEP vol = 0, mute connections */
9767 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9769 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9774 #define alc268_mux_enum_info alc_mux_enum_info
9775 #define alc268_mux_enum_get alc_mux_enum_get
9776 #define alc268_mux_enum_put alc_mux_enum_put
9778 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9779 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9780 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9783 /* The multiple "Capture Source" controls confuse alsamixer
9784 * So call somewhat different..
9786 /* .name = "Capture Source", */
9787 .name = "Input Source",
9789 .info = alc268_mux_enum_info,
9790 .get = alc268_mux_enum_get,
9791 .put = alc268_mux_enum_put,
9796 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9797 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9798 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9799 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9800 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9802 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9803 /* The multiple "Capture Source" controls confuse alsamixer
9804 * So call somewhat different..
9806 /* .name = "Capture Source", */
9807 .name = "Input Source",
9809 .info = alc268_mux_enum_info,
9810 .get = alc268_mux_enum_get,
9811 .put = alc268_mux_enum_put,
9816 static struct hda_input_mux alc268_capture_source = {
9820 { "Front Mic", 0x1 },
9826 #ifdef CONFIG_SND_DEBUG
9827 static struct snd_kcontrol_new alc268_test_mixer[] = {
9828 /* Volume widgets */
9829 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9830 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9831 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9832 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9833 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9834 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9835 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9836 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9837 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9838 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9839 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9840 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9841 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9842 /* The below appears problematic on some hardwares */
9843 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
9844 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9845 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9846 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9847 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9849 /* Modes for retasking pin widgets */
9850 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9851 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9852 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9853 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9855 /* Controls for GPIO pins, assuming they are configured as outputs */
9856 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9857 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9858 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9859 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9861 /* Switches to allow the digital SPDIF output pin to be enabled.
9862 * The ALC268 does not have an SPDIF input.
9864 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9866 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9867 * this output to turn on an external amplifier.
9869 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9870 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9876 /* create input playback/capture controls for the given pin */
9877 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9878 const char *ctlname, int idx)
9883 sprintf(name, "%s Playback Volume", ctlname);
9885 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9886 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9890 } else if (nid == 0x15) {
9891 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9892 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9898 sprintf(name, "%s Playback Switch", ctlname);
9899 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9900 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9906 /* add playback controls from the parsed DAC table */
9907 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9908 const struct auto_pin_cfg *cfg)
9913 spec->multiout.num_dacs = 2; /* only use one dac */
9914 spec->multiout.dac_nids = spec->private_dac_nids;
9915 spec->multiout.dac_nids[0] = 2;
9916 spec->multiout.dac_nids[1] = 3;
9918 nid = cfg->line_out_pins[0];
9920 alc268_new_analog_output(spec, nid, "Front", 0);
9922 nid = cfg->speaker_pins[0];
9924 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9925 "Speaker Playback Volume",
9926 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9930 nid = cfg->hp_pins[0];
9932 alc268_new_analog_output(spec, nid, "Headphone", 0);
9934 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9936 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9937 "Mono Playback Switch",
9938 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9945 /* create playback/capture controls for input pins */
9946 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9947 const struct auto_pin_cfg *cfg)
9949 struct hda_input_mux *imux = &spec->private_imux;
9952 for (i = 0; i < AUTO_PIN_LAST; i++) {
9953 switch(cfg->input_pins[i]) {
9955 idx1 = 0; /* Mic 1 */
9958 idx1 = 1; /* Mic 2 */
9961 idx1 = 2; /* Line In */
9969 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9970 imux->items[imux->num_items].index = idx1;
9976 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9978 struct alc_spec *spec = codec->spec;
9979 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9980 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9981 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9982 unsigned int dac_vol1, dac_vol2;
9985 snd_hda_codec_write(codec, speaker_nid, 0,
9986 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9987 snd_hda_codec_write(codec, 0x0f, 0,
9988 AC_VERB_SET_AMP_GAIN_MUTE,
9990 snd_hda_codec_write(codec, 0x10, 0,
9991 AC_VERB_SET_AMP_GAIN_MUTE,
9994 snd_hda_codec_write(codec, 0x0f, 0,
9995 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9996 snd_hda_codec_write(codec, 0x10, 0,
9997 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10000 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10001 if (line_nid == 0x14)
10002 dac_vol2 = AMP_OUT_ZERO;
10003 else if (line_nid == 0x15)
10004 dac_vol1 = AMP_OUT_ZERO;
10005 if (hp_nid == 0x14)
10006 dac_vol2 = AMP_OUT_ZERO;
10007 else if (hp_nid == 0x15)
10008 dac_vol1 = AMP_OUT_ZERO;
10009 if (line_nid != 0x16 || hp_nid != 0x16 ||
10010 spec->autocfg.line_out_pins[1] != 0x16 ||
10011 spec->autocfg.line_out_pins[2] != 0x16)
10012 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10014 snd_hda_codec_write(codec, 0x02, 0,
10015 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10016 snd_hda_codec_write(codec, 0x03, 0,
10017 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10020 /* pcm configuration: identiacal with ALC880 */
10021 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10022 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10023 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10024 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10027 * BIOS auto configuration
10029 static int alc268_parse_auto_config(struct hda_codec *codec)
10031 struct alc_spec *spec = codec->spec;
10033 static hda_nid_t alc268_ignore[] = { 0 };
10035 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10039 if (!spec->autocfg.line_outs)
10040 return 0; /* can't find valid BIOS pin config */
10042 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10045 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10049 spec->multiout.max_channels = 2;
10051 /* digital only support output */
10052 if (spec->autocfg.dig_out_pin)
10053 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10055 if (spec->kctl_alloc)
10056 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10058 if (spec->autocfg.speaker_pins[0] != 0x1d)
10059 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10061 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10062 spec->num_mux_defs = 1;
10063 spec->input_mux = &spec->private_imux;
10065 err = alc_auto_add_mic_boost(codec);
10072 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10073 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10074 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10076 /* init callback for auto-configuration model -- overriding the default init */
10077 static void alc268_auto_init(struct hda_codec *codec)
10079 struct alc_spec *spec = codec->spec;
10080 alc268_auto_init_multi_out(codec);
10081 alc268_auto_init_hp_out(codec);
10082 alc268_auto_init_mono_speaker_out(codec);
10083 alc268_auto_init_analog_input(codec);
10084 if (spec->unsol_event)
10085 alc_sku_automute(codec);
10089 * configuration and preset
10091 static const char *alc268_models[ALC268_MODEL_LAST] = {
10092 [ALC268_3ST] = "3stack",
10093 [ALC268_TOSHIBA] = "toshiba",
10094 [ALC268_ACER] = "acer",
10095 [ALC268_DELL] = "dell",
10096 [ALC268_ZEPTO] = "zepto",
10097 #ifdef CONFIG_SND_DEBUG
10098 [ALC268_TEST] = "test",
10100 [ALC268_AUTO] = "auto",
10103 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10104 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10105 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10106 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10107 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10108 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10109 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10110 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10111 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10112 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10113 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10114 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10118 static struct alc_config_preset alc268_presets[] = {
10120 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10121 alc268_beep_mixer },
10122 .init_verbs = { alc268_base_init_verbs },
10123 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10124 .dac_nids = alc268_dac_nids,
10125 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10126 .adc_nids = alc268_adc_nids_alt,
10127 .capsrc_nids = alc268_capsrc_nids,
10129 .dig_out_nid = ALC268_DIGOUT_NID,
10130 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10131 .channel_mode = alc268_modes,
10132 .input_mux = &alc268_capture_source,
10134 [ALC268_TOSHIBA] = {
10135 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10136 alc268_beep_mixer },
10137 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10138 alc268_toshiba_verbs },
10139 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10140 .dac_nids = alc268_dac_nids,
10141 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10142 .adc_nids = alc268_adc_nids_alt,
10143 .capsrc_nids = alc268_capsrc_nids,
10145 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10146 .channel_mode = alc268_modes,
10147 .input_mux = &alc268_capture_source,
10148 .unsol_event = alc268_toshiba_unsol_event,
10149 .init_hook = alc268_toshiba_automute,
10152 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10153 alc268_beep_mixer },
10154 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10155 alc268_acer_verbs },
10156 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10157 .dac_nids = alc268_dac_nids,
10158 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10159 .adc_nids = alc268_adc_nids_alt,
10160 .capsrc_nids = alc268_capsrc_nids,
10162 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10163 .channel_mode = alc268_modes,
10164 .input_mux = &alc268_capture_source,
10165 .unsol_event = alc268_acer_unsol_event,
10166 .init_hook = alc268_acer_init_hook,
10169 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10170 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10171 alc268_dell_verbs },
10172 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10173 .dac_nids = alc268_dac_nids,
10175 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10176 .channel_mode = alc268_modes,
10177 .unsol_event = alc268_dell_unsol_event,
10178 .init_hook = alc268_dell_init_hook,
10179 .input_mux = &alc268_capture_source,
10182 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10183 alc268_beep_mixer },
10184 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10185 alc268_toshiba_verbs },
10186 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10187 .dac_nids = alc268_dac_nids,
10188 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10189 .adc_nids = alc268_adc_nids_alt,
10190 .capsrc_nids = alc268_capsrc_nids,
10192 .dig_out_nid = ALC268_DIGOUT_NID,
10193 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10194 .channel_mode = alc268_modes,
10195 .input_mux = &alc268_capture_source,
10196 .unsol_event = alc268_toshiba_unsol_event,
10197 .init_hook = alc268_toshiba_automute
10199 #ifdef CONFIG_SND_DEBUG
10201 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10202 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10203 alc268_volume_init_verbs },
10204 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10205 .dac_nids = alc268_dac_nids,
10206 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10207 .adc_nids = alc268_adc_nids_alt,
10208 .capsrc_nids = alc268_capsrc_nids,
10210 .dig_out_nid = ALC268_DIGOUT_NID,
10211 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10212 .channel_mode = alc268_modes,
10213 .input_mux = &alc268_capture_source,
10218 static int patch_alc268(struct hda_codec *codec)
10220 struct alc_spec *spec;
10224 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10228 codec->spec = spec;
10230 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10234 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10235 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10236 "trying auto-probe from BIOS...\n");
10237 board_config = ALC268_AUTO;
10240 if (board_config == ALC268_AUTO) {
10241 /* automatic parse from the BIOS config */
10242 err = alc268_parse_auto_config(codec);
10248 "hda_codec: Cannot set up configuration "
10249 "from BIOS. Using base mode...\n");
10250 board_config = ALC268_3ST;
10254 if (board_config != ALC268_AUTO)
10255 setup_preset(spec, &alc268_presets[board_config]);
10257 spec->stream_name_analog = "ALC268 Analog";
10258 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10259 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10260 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10262 spec->stream_name_digital = "ALC268 Digital";
10263 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10265 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10266 /* override the amp caps for beep generator */
10267 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10268 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10269 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10270 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10271 (0 << AC_AMPCAP_MUTE_SHIFT));
10273 if (!spec->adc_nids && spec->input_mux) {
10274 /* check whether NID 0x07 is valid */
10275 unsigned int wcap = get_wcaps(codec, 0x07);
10279 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10280 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10281 spec->adc_nids = alc268_adc_nids_alt;
10282 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10283 spec->mixers[spec->num_mixers] =
10284 alc268_capture_alt_mixer;
10285 spec->num_mixers++;
10287 spec->adc_nids = alc268_adc_nids;
10288 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10289 spec->mixers[spec->num_mixers] =
10290 alc268_capture_mixer;
10291 spec->num_mixers++;
10293 spec->capsrc_nids = alc268_capsrc_nids;
10294 /* set default input source */
10295 for (i = 0; i < spec->num_adc_nids; i++)
10296 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10297 0, AC_VERB_SET_CONNECT_SEL,
10298 spec->input_mux->items[0].index);
10301 spec->vmaster_nid = 0x02;
10303 codec->patch_ops = alc_patch_ops;
10304 if (board_config == ALC268_AUTO)
10305 spec->init_hook = alc268_auto_init;
10311 * ALC269 channel source setting (2 channel)
10313 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10315 #define alc269_dac_nids alc260_dac_nids
10317 static hda_nid_t alc269_adc_nids[1] = {
10322 #define alc269_modes alc260_modes
10323 #define alc269_capture_source alc880_lg_lw_capture_source
10325 static struct snd_kcontrol_new alc269_base_mixer[] = {
10326 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10327 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10328 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10329 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10332 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10333 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10334 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10335 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10337 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10341 /* capture mixer elements */
10342 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10343 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10344 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10347 /* The multiple "Capture Source" controls confuse alsamixer
10348 * So call somewhat different..
10350 /* .name = "Capture Source", */
10351 .name = "Input Source",
10353 .info = alc_mux_enum_info,
10354 .get = alc_mux_enum_get,
10355 .put = alc_mux_enum_put,
10361 * generic initialization of ADC, input mixers and output mixers
10363 static struct hda_verb alc269_init_verbs[] = {
10365 * Unmute ADC0 and set the default input to mic-in
10367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10369 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10370 * analog-loopback mixer widget
10371 * Note: PASD motherboards uses the Line In 2 as the input for
10372 * front panel mic (mic 2)
10374 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10382 * Set up output mixers (0x0c - 0x0e)
10384 /* set vol=0 to output mixers */
10385 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10386 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10388 /* set up input amps for analog loopback */
10389 /* Amp Indices: DAC = 0, mixer = 1 */
10390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10398 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10399 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10401 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10402 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10405 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10406 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10407 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10411 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10413 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10416 /* FIXME: use matrix-type input source selection */
10417 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10418 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10422 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10425 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10426 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10430 /* add playback controls from the parsed DAC table */
10431 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10432 const struct auto_pin_cfg *cfg)
10437 spec->multiout.num_dacs = 1; /* only use one dac */
10438 spec->multiout.dac_nids = spec->private_dac_nids;
10439 spec->multiout.dac_nids[0] = 2;
10441 nid = cfg->line_out_pins[0];
10443 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10444 "Front Playback Volume",
10445 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10448 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10449 "Front Playback Switch",
10450 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10455 nid = cfg->speaker_pins[0];
10457 if (!cfg->line_out_pins[0]) {
10458 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10459 "Speaker Playback Volume",
10460 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10466 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10467 "Speaker Playback Switch",
10468 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10473 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10474 "Speaker Playback Switch",
10475 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10481 nid = cfg->hp_pins[0];
10483 /* spec->multiout.hp_nid = 2; */
10484 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10485 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10486 "Headphone Playback Volume",
10487 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10493 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10494 "Headphone Playback Switch",
10495 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10500 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10501 "Headphone Playback Switch",
10502 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10511 #define alc269_auto_create_analog_input_ctls \
10512 alc880_auto_create_analog_input_ctls
10514 #ifdef CONFIG_SND_HDA_POWER_SAVE
10515 #define alc269_loopbacks alc880_loopbacks
10518 /* pcm configuration: identiacal with ALC880 */
10519 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10520 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10521 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10522 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10525 * BIOS auto configuration
10527 static int alc269_parse_auto_config(struct hda_codec *codec)
10529 struct alc_spec *spec = codec->spec;
10531 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10533 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10538 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10541 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10545 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10547 if (spec->autocfg.dig_out_pin)
10548 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10550 if (spec->kctl_alloc)
10551 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10553 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10554 spec->num_mux_defs = 1;
10555 spec->input_mux = &spec->private_imux;
10557 err = alc_auto_add_mic_boost(codec);
10564 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10565 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10566 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10569 /* init callback for auto-configuration model -- overriding the default init */
10570 static void alc269_auto_init(struct hda_codec *codec)
10572 struct alc_spec *spec = codec->spec;
10573 alc269_auto_init_multi_out(codec);
10574 alc269_auto_init_hp_out(codec);
10575 alc269_auto_init_analog_input(codec);
10576 if (spec->unsol_event)
10577 alc_sku_automute(codec);
10581 * configuration and preset
10583 static const char *alc269_models[ALC269_MODEL_LAST] = {
10584 [ALC269_BASIC] = "basic",
10587 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10591 static struct alc_config_preset alc269_presets[] = {
10593 .mixers = { alc269_base_mixer },
10594 .init_verbs = { alc269_init_verbs },
10595 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10596 .dac_nids = alc269_dac_nids,
10598 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10599 .channel_mode = alc269_modes,
10600 .input_mux = &alc269_capture_source,
10604 static int patch_alc269(struct hda_codec *codec)
10606 struct alc_spec *spec;
10610 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10614 codec->spec = spec;
10616 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10620 if (board_config < 0) {
10621 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10622 "trying auto-probe from BIOS...\n");
10623 board_config = ALC269_AUTO;
10626 if (board_config == ALC269_AUTO) {
10627 /* automatic parse from the BIOS config */
10628 err = alc269_parse_auto_config(codec);
10634 "hda_codec: Cannot set up configuration "
10635 "from BIOS. Using base mode...\n");
10636 board_config = ALC269_BASIC;
10640 if (board_config != ALC269_AUTO)
10641 setup_preset(spec, &alc269_presets[board_config]);
10643 spec->stream_name_analog = "ALC269 Analog";
10644 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10645 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10647 spec->stream_name_digital = "ALC269 Digital";
10648 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10649 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10651 spec->adc_nids = alc269_adc_nids;
10652 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10653 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10654 spec->num_mixers++;
10656 codec->patch_ops = alc_patch_ops;
10657 if (board_config == ALC269_AUTO)
10658 spec->init_hook = alc269_auto_init;
10659 #ifdef CONFIG_SND_HDA_POWER_SAVE
10660 if (!spec->loopback.amplist)
10661 spec->loopback.amplist = alc269_loopbacks;
10668 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10672 * set the path ways for 2 channel output
10673 * need to set the codec line out and mic 1 pin widgets to inputs
10675 static struct hda_verb alc861_threestack_ch2_init[] = {
10676 /* set pin widget 1Ah (line in) for input */
10677 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10678 /* set pin widget 18h (mic1/2) for input, for mic also enable
10681 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10683 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10685 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10686 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10692 * need to set the codec line out and mic 1 pin widgets to outputs
10694 static struct hda_verb alc861_threestack_ch6_init[] = {
10695 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10696 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10697 /* set pin widget 18h (mic1) for output (CLFE)*/
10698 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10700 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10701 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10703 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10705 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10706 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10711 static struct hda_channel_mode alc861_threestack_modes[2] = {
10712 { 2, alc861_threestack_ch2_init },
10713 { 6, alc861_threestack_ch6_init },
10715 /* Set mic1 as input and unmute the mixer */
10716 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10717 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10718 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10721 /* Set mic1 as output and mute mixer */
10722 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10723 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10724 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10728 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10729 { 2, alc861_uniwill_m31_ch2_init },
10730 { 4, alc861_uniwill_m31_ch4_init },
10733 /* Set mic1 and line-in as input and unmute the mixer */
10734 static struct hda_verb alc861_asus_ch2_init[] = {
10735 /* set pin widget 1Ah (line in) for input */
10736 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10737 /* set pin widget 18h (mic1/2) for input, for mic also enable
10740 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10742 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10744 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10745 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10749 /* Set mic1 nad line-in as output and mute mixer */
10750 static struct hda_verb alc861_asus_ch6_init[] = {
10751 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10752 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10753 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10754 /* set pin widget 18h (mic1) for output (CLFE)*/
10755 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10756 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10757 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10758 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10760 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10762 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10763 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10768 static struct hda_channel_mode alc861_asus_modes[2] = {
10769 { 2, alc861_asus_ch2_init },
10770 { 6, alc861_asus_ch6_init },
10775 static struct snd_kcontrol_new alc861_base_mixer[] = {
10776 /* output mixer control */
10777 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10778 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10779 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10780 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10781 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10783 /*Input mixer control */
10784 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10785 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10786 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10787 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10788 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10789 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10791 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10792 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10795 /* Capture mixer control */
10796 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10797 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10799 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10800 .name = "Capture Source",
10802 .info = alc_mux_enum_info,
10803 .get = alc_mux_enum_get,
10804 .put = alc_mux_enum_put,
10809 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10810 /* output mixer control */
10811 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10812 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10813 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10814 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10815 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10817 /* Input mixer control */
10818 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10819 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10820 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10821 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10822 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10823 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10825 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10829 /* Capture mixer control */
10830 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10831 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10834 .name = "Capture Source",
10836 .info = alc_mux_enum_info,
10837 .get = alc_mux_enum_get,
10838 .put = alc_mux_enum_put,
10841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10842 .name = "Channel Mode",
10843 .info = alc_ch_mode_info,
10844 .get = alc_ch_mode_get,
10845 .put = alc_ch_mode_put,
10846 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10851 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10852 /* output mixer control */
10853 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10855 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10857 /*Capture mixer control */
10858 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10859 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10861 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10862 .name = "Capture Source",
10864 .info = alc_mux_enum_info,
10865 .get = alc_mux_enum_get,
10866 .put = alc_mux_enum_put,
10872 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10873 /* output mixer control */
10874 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10875 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10876 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10877 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10878 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10880 /* Input mixer control */
10881 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10882 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10883 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10884 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10885 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10886 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10888 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10889 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10892 /* Capture mixer control */
10893 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10894 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10896 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10897 .name = "Capture Source",
10899 .info = alc_mux_enum_info,
10900 .get = alc_mux_enum_get,
10901 .put = alc_mux_enum_put,
10904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10905 .name = "Channel Mode",
10906 .info = alc_ch_mode_info,
10907 .get = alc_ch_mode_get,
10908 .put = alc_ch_mode_put,
10909 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10914 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10915 /* output mixer control */
10916 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10917 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10918 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10919 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10920 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10922 /* Input mixer control */
10923 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10924 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10925 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10926 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10927 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10928 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10930 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10934 /* Capture mixer control */
10935 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10936 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10939 .name = "Capture Source",
10941 .info = alc_mux_enum_info,
10942 .get = alc_mux_enum_get,
10943 .put = alc_mux_enum_put,
10946 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10947 .name = "Channel Mode",
10948 .info = alc_ch_mode_info,
10949 .get = alc_ch_mode_get,
10950 .put = alc_ch_mode_put,
10951 .private_value = ARRAY_SIZE(alc861_asus_modes),
10956 /* additional mixer */
10957 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10958 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10959 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10960 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10961 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10966 * generic initialization of ADC, input mixers and output mixers
10968 static struct hda_verb alc861_base_init_verbs[] = {
10970 * Unmute ADC0 and set the default input to mic-in
10972 /* port-A for surround (rear panel) */
10973 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10974 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10975 /* port-B for mic-in (rear panel) with vref */
10976 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10977 /* port-C for line-in (rear panel) */
10978 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10979 /* port-D for Front */
10980 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10981 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10982 /* port-E for HP out (front panel) */
10983 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10984 /* route front PCM to HP */
10985 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10986 /* port-F for mic-in (front panel) with vref */
10987 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10988 /* port-G for CLFE (rear panel) */
10989 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10990 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10991 /* port-H for side (rear panel) */
10992 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10993 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10995 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10996 /* route front mic to ADC1*/
10997 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10998 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11000 /* Unmute DAC0~3 & spdif out*/
11001 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11002 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11003 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11004 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11007 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11008 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11009 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11010 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11011 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11013 /* Unmute Stereo Mixer 15 */
11014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11019 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11020 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11021 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11022 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11023 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11024 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11026 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11027 /* hp used DAC 3 (Front) */
11028 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11034 static struct hda_verb alc861_threestack_init_verbs[] = {
11036 * Unmute ADC0 and set the default input to mic-in
11038 /* port-A for surround (rear panel) */
11039 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11040 /* port-B for mic-in (rear panel) with vref */
11041 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11042 /* port-C for line-in (rear panel) */
11043 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11044 /* port-D for Front */
11045 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11046 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11047 /* port-E for HP out (front panel) */
11048 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11049 /* route front PCM to HP */
11050 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11051 /* port-F for mic-in (front panel) with vref */
11052 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11053 /* port-G for CLFE (rear panel) */
11054 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11055 /* port-H for side (rear panel) */
11056 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11058 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11059 /* route front mic to ADC1*/
11060 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11062 /* Unmute DAC0~3 & spdif out*/
11063 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11064 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11065 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11066 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11067 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11069 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11070 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11071 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11072 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11073 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11075 /* Unmute Stereo Mixer 15 */
11076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11079 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11081 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11082 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11083 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11084 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11086 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11087 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11088 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11089 /* hp used DAC 3 (Front) */
11090 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11091 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11095 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11097 * Unmute ADC0 and set the default input to mic-in
11099 /* port-A for surround (rear panel) */
11100 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11101 /* port-B for mic-in (rear panel) with vref */
11102 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11103 /* port-C for line-in (rear panel) */
11104 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11105 /* port-D for Front */
11106 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11107 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11108 /* port-E for HP out (front panel) */
11109 /* this has to be set to VREF80 */
11110 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11111 /* route front PCM to HP */
11112 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11113 /* port-F for mic-in (front panel) with vref */
11114 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11115 /* port-G for CLFE (rear panel) */
11116 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11117 /* port-H for side (rear panel) */
11118 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11120 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11121 /* route front mic to ADC1*/
11122 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11124 /* Unmute DAC0~3 & spdif out*/
11125 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11126 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11127 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11128 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11131 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11132 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11133 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11134 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11135 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11137 /* Unmute Stereo Mixer 15 */
11138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11143 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11145 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11147 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11151 /* hp used DAC 3 (Front) */
11152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11157 static struct hda_verb alc861_asus_init_verbs[] = {
11159 * Unmute ADC0 and set the default input to mic-in
11161 /* port-A for surround (rear panel)
11162 * according to codec#0 this is the HP jack
11164 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11165 /* route front PCM to HP */
11166 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11167 /* port-B for mic-in (rear panel) with vref */
11168 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11169 /* port-C for line-in (rear panel) */
11170 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11171 /* port-D for Front */
11172 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11173 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11174 /* port-E for HP out (front panel) */
11175 /* this has to be set to VREF80 */
11176 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11177 /* route front PCM to HP */
11178 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11179 /* port-F for mic-in (front panel) with vref */
11180 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11181 /* port-G for CLFE (rear panel) */
11182 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11183 /* port-H for side (rear panel) */
11184 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11186 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11187 /* route front mic to ADC1*/
11188 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11190 /* Unmute DAC0~3 & spdif out*/
11191 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11192 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11193 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11194 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11196 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11197 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11198 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11199 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11200 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11202 /* Unmute Stereo Mixer 15 */
11203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11204 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11205 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11206 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11208 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11209 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11210 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11211 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11212 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11213 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11214 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11215 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11216 /* hp used DAC 3 (Front) */
11217 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11218 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11222 /* additional init verbs for ASUS laptops */
11223 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11224 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11225 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11230 * generic initialization of ADC, input mixers and output mixers
11232 static struct hda_verb alc861_auto_init_verbs[] = {
11234 * Unmute ADC0 and set the default input to mic-in
11236 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11239 /* Unmute DAC0~3 & spdif out*/
11240 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11241 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11242 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11243 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11246 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11247 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11248 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11249 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11250 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11252 /* Unmute Stereo Mixer 15 */
11253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11258 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11259 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11262 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11265 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11276 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11281 static struct hda_verb alc861_toshiba_init_verbs[] = {
11282 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11287 /* toggle speaker-output according to the hp-jack state */
11288 static void alc861_toshiba_automute(struct hda_codec *codec)
11290 unsigned int present;
11292 present = snd_hda_codec_read(codec, 0x0f, 0,
11293 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11294 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11295 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11296 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11297 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11300 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11303 if ((res >> 26) == ALC880_HP_EVENT)
11304 alc861_toshiba_automute(codec);
11307 /* pcm configuration: identiacal with ALC880 */
11308 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11309 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11310 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11311 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11314 #define ALC861_DIGOUT_NID 0x07
11316 static struct hda_channel_mode alc861_8ch_modes[1] = {
11320 static hda_nid_t alc861_dac_nids[4] = {
11321 /* front, surround, clfe, side */
11322 0x03, 0x06, 0x05, 0x04
11325 static hda_nid_t alc660_dac_nids[3] = {
11326 /* front, clfe, surround */
11330 static hda_nid_t alc861_adc_nids[1] = {
11335 static struct hda_input_mux alc861_capture_source = {
11339 { "Front Mic", 0x3 },
11346 /* fill in the dac_nids table from the parsed pin configuration */
11347 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11348 const struct auto_pin_cfg *cfg)
11353 spec->multiout.dac_nids = spec->private_dac_nids;
11354 for (i = 0; i < cfg->line_outs; i++) {
11355 nid = cfg->line_out_pins[i];
11357 if (i >= ARRAY_SIZE(alc861_dac_nids))
11359 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11362 spec->multiout.num_dacs = cfg->line_outs;
11366 /* add playback controls from the parsed DAC table */
11367 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11368 const struct auto_pin_cfg *cfg)
11371 static const char *chname[4] = {
11372 "Front", "Surround", NULL /*CLFE*/, "Side"
11377 for (i = 0; i < cfg->line_outs; i++) {
11378 nid = spec->multiout.dac_nids[i];
11383 err = add_control(spec, ALC_CTL_BIND_MUTE,
11384 "Center Playback Switch",
11385 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11389 err = add_control(spec, ALC_CTL_BIND_MUTE,
11390 "LFE Playback Switch",
11391 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11396 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11398 if (nid == alc861_dac_nids[idx])
11400 sprintf(name, "%s Playback Switch", chname[idx]);
11401 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11402 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11411 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11419 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11421 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11422 "Headphone Playback Switch",
11423 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11426 spec->multiout.hp_nid = nid;
11431 /* create playback/capture controls for input pins */
11432 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11433 const struct auto_pin_cfg *cfg)
11435 struct hda_input_mux *imux = &spec->private_imux;
11436 int i, err, idx, idx1;
11438 for (i = 0; i < AUTO_PIN_LAST; i++) {
11439 switch (cfg->input_pins[i]) {
11442 idx = 2; /* Line In */
11446 idx = 2; /* Line In */
11450 idx = 1; /* Mic In */
11454 idx = 1; /* Mic In */
11464 err = new_analog_input(spec, cfg->input_pins[i],
11465 auto_pin_cfg_labels[i], idx, 0x15);
11469 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11470 imux->items[imux->num_items].index = idx1;
11476 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11477 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11478 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11482 /* The multiple "Capture Source" controls confuse alsamixer
11483 * So call somewhat different..
11485 /* .name = "Capture Source", */
11486 .name = "Input Source",
11488 .info = alc_mux_enum_info,
11489 .get = alc_mux_enum_get,
11490 .put = alc_mux_enum_put,
11495 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11497 int pin_type, int dac_idx)
11499 alc_set_pin_output(codec, nid, pin_type);
11502 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11504 struct alc_spec *spec = codec->spec;
11507 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11508 for (i = 0; i < spec->autocfg.line_outs; i++) {
11509 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11510 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11512 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11513 spec->multiout.dac_nids[i]);
11517 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11519 struct alc_spec *spec = codec->spec;
11522 pin = spec->autocfg.hp_pins[0];
11523 if (pin) /* connect to front */
11524 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11525 spec->multiout.dac_nids[0]);
11526 pin = spec->autocfg.speaker_pins[0];
11528 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11531 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11533 struct alc_spec *spec = codec->spec;
11536 for (i = 0; i < AUTO_PIN_LAST; i++) {
11537 hda_nid_t nid = spec->autocfg.input_pins[i];
11538 if (nid >= 0x0c && nid <= 0x11) {
11539 snd_hda_codec_write(codec, nid, 0,
11540 AC_VERB_SET_PIN_WIDGET_CONTROL,
11541 i <= AUTO_PIN_FRONT_MIC ?
11542 PIN_VREF80 : PIN_IN);
11547 /* parse the BIOS configuration and set up the alc_spec */
11548 /* return 1 if successful, 0 if the proper config is not found,
11549 * or a negative error code
11551 static int alc861_parse_auto_config(struct hda_codec *codec)
11553 struct alc_spec *spec = codec->spec;
11555 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11557 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11561 if (!spec->autocfg.line_outs)
11562 return 0; /* can't find valid BIOS pin config */
11564 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11567 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11570 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11573 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11577 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11579 if (spec->autocfg.dig_out_pin)
11580 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11582 if (spec->kctl_alloc)
11583 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11585 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11587 spec->num_mux_defs = 1;
11588 spec->input_mux = &spec->private_imux;
11590 spec->adc_nids = alc861_adc_nids;
11591 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11592 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11593 spec->num_mixers++;
11598 /* additional initialization for auto-configuration model */
11599 static void alc861_auto_init(struct hda_codec *codec)
11601 struct alc_spec *spec = codec->spec;
11602 alc861_auto_init_multi_out(codec);
11603 alc861_auto_init_hp_out(codec);
11604 alc861_auto_init_analog_input(codec);
11605 if (spec->unsol_event)
11606 alc_sku_automute(codec);
11609 #ifdef CONFIG_SND_HDA_POWER_SAVE
11610 static struct hda_amp_list alc861_loopbacks[] = {
11611 { 0x15, HDA_INPUT, 0 },
11612 { 0x15, HDA_INPUT, 1 },
11613 { 0x15, HDA_INPUT, 2 },
11614 { 0x15, HDA_INPUT, 3 },
11621 * configuration and preset
11623 static const char *alc861_models[ALC861_MODEL_LAST] = {
11624 [ALC861_3ST] = "3stack",
11625 [ALC660_3ST] = "3stack-660",
11626 [ALC861_3ST_DIG] = "3stack-dig",
11627 [ALC861_6ST_DIG] = "6stack-dig",
11628 [ALC861_UNIWILL_M31] = "uniwill-m31",
11629 [ALC861_TOSHIBA] = "toshiba",
11630 [ALC861_ASUS] = "asus",
11631 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11632 [ALC861_AUTO] = "auto",
11635 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11636 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11637 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11638 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11639 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11640 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11641 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11642 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11643 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11644 * Any other models that need this preset?
11646 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11647 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11648 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11649 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11650 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11651 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11652 /* FIXME: the below seems conflict */
11653 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11654 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11655 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11659 static struct alc_config_preset alc861_presets[] = {
11661 .mixers = { alc861_3ST_mixer },
11662 .init_verbs = { alc861_threestack_init_verbs },
11663 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11664 .dac_nids = alc861_dac_nids,
11665 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11666 .channel_mode = alc861_threestack_modes,
11668 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11669 .adc_nids = alc861_adc_nids,
11670 .input_mux = &alc861_capture_source,
11672 [ALC861_3ST_DIG] = {
11673 .mixers = { alc861_base_mixer },
11674 .init_verbs = { alc861_threestack_init_verbs },
11675 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11676 .dac_nids = alc861_dac_nids,
11677 .dig_out_nid = ALC861_DIGOUT_NID,
11678 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11679 .channel_mode = alc861_threestack_modes,
11681 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11682 .adc_nids = alc861_adc_nids,
11683 .input_mux = &alc861_capture_source,
11685 [ALC861_6ST_DIG] = {
11686 .mixers = { alc861_base_mixer },
11687 .init_verbs = { alc861_base_init_verbs },
11688 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11689 .dac_nids = alc861_dac_nids,
11690 .dig_out_nid = ALC861_DIGOUT_NID,
11691 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11692 .channel_mode = alc861_8ch_modes,
11693 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11694 .adc_nids = alc861_adc_nids,
11695 .input_mux = &alc861_capture_source,
11698 .mixers = { alc861_3ST_mixer },
11699 .init_verbs = { alc861_threestack_init_verbs },
11700 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11701 .dac_nids = alc660_dac_nids,
11702 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11703 .channel_mode = alc861_threestack_modes,
11705 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11706 .adc_nids = alc861_adc_nids,
11707 .input_mux = &alc861_capture_source,
11709 [ALC861_UNIWILL_M31] = {
11710 .mixers = { alc861_uniwill_m31_mixer },
11711 .init_verbs = { alc861_uniwill_m31_init_verbs },
11712 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11713 .dac_nids = alc861_dac_nids,
11714 .dig_out_nid = ALC861_DIGOUT_NID,
11715 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11716 .channel_mode = alc861_uniwill_m31_modes,
11718 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11719 .adc_nids = alc861_adc_nids,
11720 .input_mux = &alc861_capture_source,
11722 [ALC861_TOSHIBA] = {
11723 .mixers = { alc861_toshiba_mixer },
11724 .init_verbs = { alc861_base_init_verbs,
11725 alc861_toshiba_init_verbs },
11726 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11727 .dac_nids = alc861_dac_nids,
11728 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11729 .channel_mode = alc883_3ST_2ch_modes,
11730 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11731 .adc_nids = alc861_adc_nids,
11732 .input_mux = &alc861_capture_source,
11733 .unsol_event = alc861_toshiba_unsol_event,
11734 .init_hook = alc861_toshiba_automute,
11737 .mixers = { alc861_asus_mixer },
11738 .init_verbs = { alc861_asus_init_verbs },
11739 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11740 .dac_nids = alc861_dac_nids,
11741 .dig_out_nid = ALC861_DIGOUT_NID,
11742 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11743 .channel_mode = alc861_asus_modes,
11746 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11747 .adc_nids = alc861_adc_nids,
11748 .input_mux = &alc861_capture_source,
11750 [ALC861_ASUS_LAPTOP] = {
11751 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11752 .init_verbs = { alc861_asus_init_verbs,
11753 alc861_asus_laptop_init_verbs },
11754 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11755 .dac_nids = alc861_dac_nids,
11756 .dig_out_nid = ALC861_DIGOUT_NID,
11757 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11758 .channel_mode = alc883_3ST_2ch_modes,
11760 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11761 .adc_nids = alc861_adc_nids,
11762 .input_mux = &alc861_capture_source,
11767 static int patch_alc861(struct hda_codec *codec)
11769 struct alc_spec *spec;
11773 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11777 codec->spec = spec;
11779 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11783 if (board_config < 0) {
11784 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11785 "trying auto-probe from BIOS...\n");
11786 board_config = ALC861_AUTO;
11789 if (board_config == ALC861_AUTO) {
11790 /* automatic parse from the BIOS config */
11791 err = alc861_parse_auto_config(codec);
11797 "hda_codec: Cannot set up configuration "
11798 "from BIOS. Using base mode...\n");
11799 board_config = ALC861_3ST_DIG;
11803 if (board_config != ALC861_AUTO)
11804 setup_preset(spec, &alc861_presets[board_config]);
11806 spec->stream_name_analog = "ALC861 Analog";
11807 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11808 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11810 spec->stream_name_digital = "ALC861 Digital";
11811 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11812 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11814 spec->vmaster_nid = 0x03;
11816 codec->patch_ops = alc_patch_ops;
11817 if (board_config == ALC861_AUTO)
11818 spec->init_hook = alc861_auto_init;
11819 #ifdef CONFIG_SND_HDA_POWER_SAVE
11820 if (!spec->loopback.amplist)
11821 spec->loopback.amplist = alc861_loopbacks;
11828 * ALC861-VD support
11832 * In addition, an independent DAC
11834 #define ALC861VD_DIGOUT_NID 0x06
11836 static hda_nid_t alc861vd_dac_nids[4] = {
11837 /* front, surr, clfe, side surr */
11838 0x02, 0x03, 0x04, 0x05
11841 /* dac_nids for ALC660vd are in a different order - according to
11842 * Realtek's driver.
11843 * This should probably tesult in a different mixer for 6stack models
11844 * of ALC660vd codecs, but for now there is only 3stack mixer
11845 * - and it is the same as in 861vd.
11846 * adc_nids in ALC660vd are (is) the same as in 861vd
11848 static hda_nid_t alc660vd_dac_nids[3] = {
11849 /* front, rear, clfe, rear_surr */
11853 static hda_nid_t alc861vd_adc_nids[1] = {
11858 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
11861 /* FIXME: should be a matrix-type input source selection */
11862 static struct hda_input_mux alc861vd_capture_source = {
11866 { "Front Mic", 0x1 },
11872 static struct hda_input_mux alc861vd_dallas_capture_source = {
11875 { "Front Mic", 0x0 },
11876 { "ATAPI Mic", 0x1 },
11877 { "Line In", 0x5 },
11881 static struct hda_input_mux alc861vd_hp_capture_source = {
11884 { "Front Mic", 0x0 },
11885 { "ATAPI Mic", 0x1 },
11889 #define alc861vd_mux_enum_info alc_mux_enum_info
11890 #define alc861vd_mux_enum_get alc_mux_enum_get
11891 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
11892 #define alc861vd_mux_enum_put alc882_mux_enum_put
11897 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11904 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11905 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11906 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11907 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11908 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11915 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11916 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11917 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11918 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11919 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11923 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11924 { 6, alc861vd_6stack_ch6_init },
11925 { 8, alc861vd_6stack_ch8_init },
11928 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11931 .name = "Channel Mode",
11932 .info = alc_ch_mode_info,
11933 .get = alc_ch_mode_get,
11934 .put = alc_ch_mode_put,
11939 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11940 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11941 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11945 /* The multiple "Capture Source" controls confuse alsamixer
11946 * So call somewhat different..
11948 /* .name = "Capture Source", */
11949 .name = "Input Source",
11951 .info = alc861vd_mux_enum_info,
11952 .get = alc861vd_mux_enum_get,
11953 .put = alc861vd_mux_enum_put,
11958 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11959 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11961 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11962 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11965 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11966 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11968 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11970 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11972 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11975 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11976 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11980 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11984 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11994 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11995 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12000 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12001 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12002 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12004 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12006 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12010 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12012 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12017 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12018 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12020 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12021 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12026 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12027 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12028 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12029 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12031 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12037 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12038 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12039 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12047 /* Pin assignment: Front=0x14, HP = 0x15,
12048 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
12050 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12051 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12053 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12054 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12058 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12059 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
12060 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
12064 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12065 * Front Mic=0x18, ATAPI Mic = 0x19,
12067 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12068 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12069 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12070 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12071 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12072 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12073 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12074 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12075 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12081 * generic initialization of ADC, input mixers and output mixers
12083 static struct hda_verb alc861vd_volume_init_verbs[] = {
12085 * Unmute ADC0 and set the default input to mic-in
12087 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12088 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12091 * the analog-loopback mixer widget
12093 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12100 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12107 * Set up output mixers (0x02 - 0x05)
12109 /* set vol=0 to output mixers */
12110 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12111 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12112 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12115 /* set up input amps for analog loopback */
12116 /* Amp Indices: DAC = 0, mixer = 1 */
12117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12124 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12130 * 3-stack pin configuration:
12131 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12133 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12135 * Set pin mode and muting
12137 /* set front pin widgets 0x14 for output */
12138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12140 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12142 /* Mic (rear) pin: input vref at 80% */
12143 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12145 /* Front Mic pin: input vref at 80% */
12146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12148 /* Line In pin: input */
12149 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12151 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12152 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12153 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12154 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12155 /* CD pin widget for input */
12156 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12162 * 6-stack pin configuration:
12164 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12166 * Set pin mode and muting
12168 /* set front pin widgets 0x14 for output */
12169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12173 /* Rear Pin: output 1 (0x0d) */
12174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12176 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12177 /* CLFE Pin: output 2 (0x0e) */
12178 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12179 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12180 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12181 /* Side Pin: output 3 (0x0f) */
12182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12184 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12186 /* Mic (rear) pin: input vref at 80% */
12187 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12188 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12189 /* Front Mic pin: input vref at 80% */
12190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12191 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12192 /* Line In pin: input */
12193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12194 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12195 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12196 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12197 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12199 /* CD pin widget for input */
12200 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12205 static struct hda_verb alc861vd_eapd_verbs[] = {
12206 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12210 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12211 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12214 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12219 /* toggle speaker-output according to the hp-jack state */
12220 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12222 unsigned int present;
12223 unsigned char bits;
12225 present = snd_hda_codec_read(codec, 0x1b, 0,
12226 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12227 bits = present ? HDA_AMP_MUTE : 0;
12228 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12229 HDA_AMP_MUTE, bits);
12232 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12234 unsigned int present;
12235 unsigned char bits;
12237 present = snd_hda_codec_read(codec, 0x18, 0,
12238 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12239 bits = present ? HDA_AMP_MUTE : 0;
12240 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12241 HDA_AMP_MUTE, bits);
12244 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12246 alc861vd_lenovo_hp_automute(codec);
12247 alc861vd_lenovo_mic_automute(codec);
12250 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12253 switch (res >> 26) {
12254 case ALC880_HP_EVENT:
12255 alc861vd_lenovo_hp_automute(codec);
12257 case ALC880_MIC_EVENT:
12258 alc861vd_lenovo_mic_automute(codec);
12263 static struct hda_verb alc861vd_dallas_verbs[] = {
12264 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12265 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12266 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12275 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12276 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12282 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12283 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12284 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12285 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12288 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12289 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12291 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12292 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12293 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12294 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12302 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12308 /* toggle speaker-output according to the hp-jack state */
12309 static void alc861vd_dallas_automute(struct hda_codec *codec)
12311 unsigned int present;
12313 present = snd_hda_codec_read(codec, 0x15, 0,
12314 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12315 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12316 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12319 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12321 if ((res >> 26) == ALC880_HP_EVENT)
12322 alc861vd_dallas_automute(codec);
12325 #ifdef CONFIG_SND_HDA_POWER_SAVE
12326 #define alc861vd_loopbacks alc880_loopbacks
12329 /* pcm configuration: identiacal with ALC880 */
12330 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12331 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12332 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12333 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12336 * configuration and preset
12338 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12339 [ALC660VD_3ST] = "3stack-660",
12340 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12341 [ALC861VD_3ST] = "3stack",
12342 [ALC861VD_3ST_DIG] = "3stack-digout",
12343 [ALC861VD_6ST_DIG] = "6stack-digout",
12344 [ALC861VD_LENOVO] = "lenovo",
12345 [ALC861VD_DALLAS] = "dallas",
12346 [ALC861VD_HP] = "hp",
12347 [ALC861VD_AUTO] = "auto",
12350 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12351 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12352 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12353 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12354 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12355 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12356 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12357 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12358 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12359 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12360 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12361 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12362 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12363 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12364 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12368 static struct alc_config_preset alc861vd_presets[] = {
12370 .mixers = { alc861vd_3st_mixer },
12371 .init_verbs = { alc861vd_volume_init_verbs,
12372 alc861vd_3stack_init_verbs },
12373 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12374 .dac_nids = alc660vd_dac_nids,
12375 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12376 .channel_mode = alc861vd_3stack_2ch_modes,
12377 .input_mux = &alc861vd_capture_source,
12379 [ALC660VD_3ST_DIG] = {
12380 .mixers = { alc861vd_3st_mixer },
12381 .init_verbs = { alc861vd_volume_init_verbs,
12382 alc861vd_3stack_init_verbs },
12383 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12384 .dac_nids = alc660vd_dac_nids,
12385 .dig_out_nid = ALC861VD_DIGOUT_NID,
12386 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12387 .channel_mode = alc861vd_3stack_2ch_modes,
12388 .input_mux = &alc861vd_capture_source,
12391 .mixers = { alc861vd_3st_mixer },
12392 .init_verbs = { alc861vd_volume_init_verbs,
12393 alc861vd_3stack_init_verbs },
12394 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12395 .dac_nids = alc861vd_dac_nids,
12396 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12397 .channel_mode = alc861vd_3stack_2ch_modes,
12398 .input_mux = &alc861vd_capture_source,
12400 [ALC861VD_3ST_DIG] = {
12401 .mixers = { alc861vd_3st_mixer },
12402 .init_verbs = { alc861vd_volume_init_verbs,
12403 alc861vd_3stack_init_verbs },
12404 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12405 .dac_nids = alc861vd_dac_nids,
12406 .dig_out_nid = ALC861VD_DIGOUT_NID,
12407 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12408 .channel_mode = alc861vd_3stack_2ch_modes,
12409 .input_mux = &alc861vd_capture_source,
12411 [ALC861VD_6ST_DIG] = {
12412 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12413 .init_verbs = { alc861vd_volume_init_verbs,
12414 alc861vd_6stack_init_verbs },
12415 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12416 .dac_nids = alc861vd_dac_nids,
12417 .dig_out_nid = ALC861VD_DIGOUT_NID,
12418 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12419 .channel_mode = alc861vd_6stack_modes,
12420 .input_mux = &alc861vd_capture_source,
12422 [ALC861VD_LENOVO] = {
12423 .mixers = { alc861vd_lenovo_mixer },
12424 .init_verbs = { alc861vd_volume_init_verbs,
12425 alc861vd_3stack_init_verbs,
12426 alc861vd_eapd_verbs,
12427 alc861vd_lenovo_unsol_verbs },
12428 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12429 .dac_nids = alc660vd_dac_nids,
12430 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12431 .channel_mode = alc861vd_3stack_2ch_modes,
12432 .input_mux = &alc861vd_capture_source,
12433 .unsol_event = alc861vd_lenovo_unsol_event,
12434 .init_hook = alc861vd_lenovo_automute,
12436 [ALC861VD_DALLAS] = {
12437 .mixers = { alc861vd_dallas_mixer },
12438 .init_verbs = { alc861vd_dallas_verbs },
12439 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12440 .dac_nids = alc861vd_dac_nids,
12441 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12442 .channel_mode = alc861vd_3stack_2ch_modes,
12443 .input_mux = &alc861vd_dallas_capture_source,
12444 .unsol_event = alc861vd_dallas_unsol_event,
12445 .init_hook = alc861vd_dallas_automute,
12448 .mixers = { alc861vd_hp_mixer },
12449 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12450 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12451 .dac_nids = alc861vd_dac_nids,
12452 .dig_out_nid = ALC861VD_DIGOUT_NID,
12453 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12454 .channel_mode = alc861vd_3stack_2ch_modes,
12455 .input_mux = &alc861vd_hp_capture_source,
12456 .unsol_event = alc861vd_dallas_unsol_event,
12457 .init_hook = alc861vd_dallas_automute,
12462 * BIOS auto configuration
12464 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12465 hda_nid_t nid, int pin_type, int dac_idx)
12467 alc_set_pin_output(codec, nid, pin_type);
12470 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12472 struct alc_spec *spec = codec->spec;
12475 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12476 for (i = 0; i <= HDA_SIDE; i++) {
12477 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12478 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12480 alc861vd_auto_set_output_and_unmute(codec, nid,
12486 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12488 struct alc_spec *spec = codec->spec;
12491 pin = spec->autocfg.hp_pins[0];
12492 if (pin) /* connect to front and use dac 0 */
12493 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12494 pin = spec->autocfg.speaker_pins[0];
12496 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12499 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12500 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12502 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12504 struct alc_spec *spec = codec->spec;
12507 for (i = 0; i < AUTO_PIN_LAST; i++) {
12508 hda_nid_t nid = spec->autocfg.input_pins[i];
12509 if (alc861vd_is_input_pin(nid)) {
12510 snd_hda_codec_write(codec, nid, 0,
12511 AC_VERB_SET_PIN_WIDGET_CONTROL,
12512 i <= AUTO_PIN_FRONT_MIC ?
12513 PIN_VREF80 : PIN_IN);
12514 if (nid != ALC861VD_PIN_CD_NID)
12515 snd_hda_codec_write(codec, nid, 0,
12516 AC_VERB_SET_AMP_GAIN_MUTE,
12522 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12523 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12525 /* add playback controls from the parsed DAC table */
12526 /* Based on ALC880 version. But ALC861VD has separate,
12527 * different NIDs for mute/unmute switch and volume control */
12528 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12529 const struct auto_pin_cfg *cfg)
12532 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12533 hda_nid_t nid_v, nid_s;
12536 for (i = 0; i < cfg->line_outs; i++) {
12537 if (!spec->multiout.dac_nids[i])
12539 nid_v = alc861vd_idx_to_mixer_vol(
12541 spec->multiout.dac_nids[i]));
12542 nid_s = alc861vd_idx_to_mixer_switch(
12544 spec->multiout.dac_nids[i]));
12548 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12549 "Center Playback Volume",
12550 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12554 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12555 "LFE Playback Volume",
12556 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12560 err = add_control(spec, ALC_CTL_BIND_MUTE,
12561 "Center Playback Switch",
12562 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12566 err = add_control(spec, ALC_CTL_BIND_MUTE,
12567 "LFE Playback Switch",
12568 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12573 sprintf(name, "%s Playback Volume", chname[i]);
12574 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12575 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12579 sprintf(name, "%s Playback Switch", chname[i]);
12580 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12581 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12590 /* add playback controls for speaker and HP outputs */
12591 /* Based on ALC880 version. But ALC861VD has separate,
12592 * different NIDs for mute/unmute switch and volume control */
12593 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12594 hda_nid_t pin, const char *pfx)
12596 hda_nid_t nid_v, nid_s;
12603 if (alc880_is_fixed_pin(pin)) {
12604 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12605 /* specify the DAC as the extra output */
12606 if (!spec->multiout.hp_nid)
12607 spec->multiout.hp_nid = nid_v;
12609 spec->multiout.extra_out_nid[0] = nid_v;
12610 /* control HP volume/switch on the output mixer amp */
12611 nid_v = alc861vd_idx_to_mixer_vol(
12612 alc880_fixed_pin_idx(pin));
12613 nid_s = alc861vd_idx_to_mixer_switch(
12614 alc880_fixed_pin_idx(pin));
12616 sprintf(name, "%s Playback Volume", pfx);
12617 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12618 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12621 sprintf(name, "%s Playback Switch", pfx);
12622 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12623 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12626 } else if (alc880_is_multi_pin(pin)) {
12627 /* set manual connection */
12628 /* we have only a switch on HP-out PIN */
12629 sprintf(name, "%s Playback Switch", pfx);
12630 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12631 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12638 /* parse the BIOS configuration and set up the alc_spec
12639 * return 1 if successful, 0 if the proper config is not found,
12640 * or a negative error code
12641 * Based on ALC880 version - had to change it to override
12642 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12643 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12645 struct alc_spec *spec = codec->spec;
12647 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12649 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12653 if (!spec->autocfg.line_outs)
12654 return 0; /* can't find valid BIOS pin config */
12656 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12659 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12662 err = alc861vd_auto_create_extra_out(spec,
12663 spec->autocfg.speaker_pins[0],
12667 err = alc861vd_auto_create_extra_out(spec,
12668 spec->autocfg.hp_pins[0],
12672 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12676 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12678 if (spec->autocfg.dig_out_pin)
12679 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12681 if (spec->kctl_alloc)
12682 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12684 spec->init_verbs[spec->num_init_verbs++]
12685 = alc861vd_volume_init_verbs;
12687 spec->num_mux_defs = 1;
12688 spec->input_mux = &spec->private_imux;
12690 err = alc_auto_add_mic_boost(codec);
12697 /* additional initialization for auto-configuration model */
12698 static void alc861vd_auto_init(struct hda_codec *codec)
12700 struct alc_spec *spec = codec->spec;
12701 alc861vd_auto_init_multi_out(codec);
12702 alc861vd_auto_init_hp_out(codec);
12703 alc861vd_auto_init_analog_input(codec);
12704 if (spec->unsol_event)
12705 alc_sku_automute(codec);
12708 static int patch_alc861vd(struct hda_codec *codec)
12710 struct alc_spec *spec;
12711 int err, board_config;
12713 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12717 codec->spec = spec;
12719 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12723 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12724 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12725 "ALC861VD, trying auto-probe from BIOS...\n");
12726 board_config = ALC861VD_AUTO;
12729 if (board_config == ALC861VD_AUTO) {
12730 /* automatic parse from the BIOS config */
12731 err = alc861vd_parse_auto_config(codec);
12737 "hda_codec: Cannot set up configuration "
12738 "from BIOS. Using base mode...\n");
12739 board_config = ALC861VD_3ST;
12743 if (board_config != ALC861VD_AUTO)
12744 setup_preset(spec, &alc861vd_presets[board_config]);
12746 spec->stream_name_analog = "ALC861VD Analog";
12747 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12748 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12750 spec->stream_name_digital = "ALC861VD Digital";
12751 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12752 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12754 spec->adc_nids = alc861vd_adc_nids;
12755 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12756 spec->capsrc_nids = alc861vd_capsrc_nids;
12758 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12759 spec->num_mixers++;
12761 spec->vmaster_nid = 0x02;
12763 codec->patch_ops = alc_patch_ops;
12765 if (board_config == ALC861VD_AUTO)
12766 spec->init_hook = alc861vd_auto_init;
12767 #ifdef CONFIG_SND_HDA_POWER_SAVE
12768 if (!spec->loopback.amplist)
12769 spec->loopback.amplist = alc861vd_loopbacks;
12778 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12779 * configuration. Each pin widget can choose any input DACs and a mixer.
12780 * Each ADC is connected from a mixer of all inputs. This makes possible
12781 * 6-channel independent captures.
12783 * In addition, an independent DAC for the multi-playback (not used in this
12786 #define ALC662_DIGOUT_NID 0x06
12787 #define ALC662_DIGIN_NID 0x0a
12789 static hda_nid_t alc662_dac_nids[4] = {
12790 /* front, rear, clfe, rear_surr */
12794 static hda_nid_t alc662_adc_nids[1] = {
12799 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
12802 /* FIXME: should be a matrix-type input source selection */
12803 static struct hda_input_mux alc662_capture_source = {
12807 { "Front Mic", 0x1 },
12813 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12821 static struct hda_input_mux alc662_eeepc_capture_source = {
12829 #define alc662_mux_enum_info alc_mux_enum_info
12830 #define alc662_mux_enum_get alc_mux_enum_get
12831 #define alc662_mux_enum_put alc882_mux_enum_put
12836 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12843 static struct hda_verb alc662_3ST_ch2_init[] = {
12844 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12845 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12846 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12847 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12854 static struct hda_verb alc662_3ST_ch6_init[] = {
12855 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12856 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12857 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12858 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12859 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12860 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12864 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12865 { 2, alc662_3ST_ch2_init },
12866 { 6, alc662_3ST_ch6_init },
12872 static struct hda_verb alc662_sixstack_ch6_init[] = {
12873 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12874 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12875 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12882 static struct hda_verb alc662_sixstack_ch8_init[] = {
12883 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12884 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12885 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12889 static struct hda_channel_mode alc662_5stack_modes[2] = {
12890 { 2, alc662_sixstack_ch6_init },
12891 { 6, alc662_sixstack_ch8_init },
12894 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12895 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12898 static struct snd_kcontrol_new alc662_base_mixer[] = {
12899 /* output mixer control */
12900 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12901 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12903 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12905 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12906 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12907 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12910 /*Input mixer control */
12911 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12912 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12913 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12914 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12915 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12916 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12922 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12923 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12924 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12931 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12934 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12935 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12939 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12940 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12941 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12942 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12943 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12944 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12945 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12946 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12947 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12948 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12950 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12951 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12952 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12955 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12957 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12958 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12962 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12963 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12964 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12965 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12966 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
12967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12968 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12969 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12975 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12976 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12978 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12979 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12981 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12982 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12983 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12985 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12986 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12987 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12991 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
12992 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12993 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12994 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12995 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12996 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12997 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12998 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12999 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13000 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13001 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13002 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13003 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13005 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13009 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13012 .name = "Channel Mode",
13013 .info = alc_ch_mode_info,
13014 .get = alc_ch_mode_get,
13015 .put = alc_ch_mode_put,
13020 static struct hda_verb alc662_init_verbs[] = {
13021 /* ADC: mute amp left and right */
13022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13023 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13024 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13034 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13035 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13036 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13037 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13039 /* Front Pin: output 0 (0x0c) */
13040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13043 /* Rear Pin: output 1 (0x0d) */
13044 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13047 /* CLFE Pin: output 2 (0x0e) */
13048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13049 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13051 /* Mic (rear) pin: input vref at 80% */
13052 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13054 /* Front Mic pin: input vref at 80% */
13055 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13057 /* Line In pin: input */
13058 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13060 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13063 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13064 /* CD pin widget for input */
13065 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13067 /* FIXME: use matrix-type input source selection */
13068 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13078 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13082 static struct hda_verb alc662_sue_init_verbs[] = {
13083 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13084 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13088 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13089 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13090 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13094 /* Set Unsolicited Event*/
13095 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13097 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13102 * generic initialization of ADC, input mixers and output mixers
13104 static struct hda_verb alc662_auto_init_verbs[] = {
13106 * Unmute ADC and set the default input to mic-in
13108 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13109 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13111 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13113 * Note: PASD motherboards uses the Line In 2 as the input for front
13114 * panel mic (mic 2)
13116 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13119 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13124 * Set up output mixers (0x0c - 0x0f)
13126 /* set vol=0 to output mixers */
13127 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13128 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13129 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13131 /* set up input amps for analog loopback */
13132 /* Amp Indices: DAC = 0, mixer = 1 */
13133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13135 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13138 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13141 /* FIXME: use matrix-type input source selection */
13142 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13145 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13149 /* capture mixer elements */
13150 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13151 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13152 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13155 /* The multiple "Capture Source" controls confuse alsamixer
13156 * So call somewhat different..
13158 /* .name = "Capture Source", */
13159 .name = "Input Source",
13161 .info = alc662_mux_enum_info,
13162 .get = alc662_mux_enum_get,
13163 .put = alc662_mux_enum_put,
13168 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13170 unsigned int present;
13171 unsigned char bits;
13173 present = snd_hda_codec_read(codec, 0x14, 0,
13174 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13175 bits = present ? HDA_AMP_MUTE : 0;
13176 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13177 HDA_AMP_MUTE, bits);
13180 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13182 unsigned int present;
13183 unsigned char bits;
13185 present = snd_hda_codec_read(codec, 0x1b, 0,
13186 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13187 bits = present ? HDA_AMP_MUTE : 0;
13188 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13189 HDA_AMP_MUTE, bits);
13190 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13191 HDA_AMP_MUTE, bits);
13194 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13197 if ((res >> 26) == ALC880_HP_EVENT)
13198 alc662_lenovo_101e_all_automute(codec);
13199 if ((res >> 26) == ALC880_FRONT_EVENT)
13200 alc662_lenovo_101e_ispeaker_automute(codec);
13203 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13205 unsigned int present;
13207 present = snd_hda_codec_read(codec, 0x18, 0,
13208 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13209 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13210 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13211 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13212 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13213 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13214 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13215 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13216 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13219 /* unsolicited event for HP jack sensing */
13220 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13223 if ((res >> 26) == ALC880_HP_EVENT)
13224 alc262_hippo1_automute( codec );
13226 if ((res >> 26) == ALC880_MIC_EVENT)
13227 alc662_eeepc_mic_automute(codec);
13230 static void alc662_eeepc_inithook(struct hda_codec *codec)
13232 alc262_hippo1_automute( codec );
13233 alc662_eeepc_mic_automute(codec);
13236 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13239 unsigned int present;
13241 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13242 present = snd_hda_codec_read(codec, 0x14, 0,
13243 AC_VERB_GET_PIN_SENSE, 0);
13244 present = (present & 0x80000000) != 0;
13246 /* mute internal speaker */
13247 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13248 HDA_AMP_MUTE, HDA_AMP_MUTE);
13250 /* unmute internal speaker if necessary */
13251 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13252 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13253 HDA_AMP_MUTE, mute);
13257 /* unsolicited event for HP jack sensing */
13258 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13261 if ((res >> 26) == ALC880_HP_EVENT)
13262 alc662_eeepc_ep20_automute(codec);
13265 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13267 alc662_eeepc_ep20_automute(codec);
13270 #ifdef CONFIG_SND_HDA_POWER_SAVE
13271 #define alc662_loopbacks alc880_loopbacks
13275 /* pcm configuration: identiacal with ALC880 */
13276 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13277 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13278 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13279 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13282 * configuration and preset
13284 static const char *alc662_models[ALC662_MODEL_LAST] = {
13285 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13286 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13287 [ALC662_3ST_6ch] = "3stack-6ch",
13288 [ALC662_5ST_DIG] = "6stack-dig",
13289 [ALC662_LENOVO_101E] = "lenovo-101e",
13290 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13291 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13292 [ALC662_AUTO] = "auto",
13295 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13296 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13297 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13298 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13302 static struct alc_config_preset alc662_presets[] = {
13303 [ALC662_3ST_2ch_DIG] = {
13304 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13305 .init_verbs = { alc662_init_verbs },
13306 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13307 .dac_nids = alc662_dac_nids,
13308 .dig_out_nid = ALC662_DIGOUT_NID,
13309 .dig_in_nid = ALC662_DIGIN_NID,
13310 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13311 .channel_mode = alc662_3ST_2ch_modes,
13312 .input_mux = &alc662_capture_source,
13314 [ALC662_3ST_6ch_DIG] = {
13315 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13316 alc662_capture_mixer },
13317 .init_verbs = { alc662_init_verbs },
13318 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13319 .dac_nids = alc662_dac_nids,
13320 .dig_out_nid = ALC662_DIGOUT_NID,
13321 .dig_in_nid = ALC662_DIGIN_NID,
13322 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13323 .channel_mode = alc662_3ST_6ch_modes,
13325 .input_mux = &alc662_capture_source,
13327 [ALC662_3ST_6ch] = {
13328 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13329 alc662_capture_mixer },
13330 .init_verbs = { alc662_init_verbs },
13331 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13332 .dac_nids = alc662_dac_nids,
13333 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13334 .channel_mode = alc662_3ST_6ch_modes,
13336 .input_mux = &alc662_capture_source,
13338 [ALC662_5ST_DIG] = {
13339 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13340 alc662_capture_mixer },
13341 .init_verbs = { alc662_init_verbs },
13342 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13343 .dac_nids = alc662_dac_nids,
13344 .dig_out_nid = ALC662_DIGOUT_NID,
13345 .dig_in_nid = ALC662_DIGIN_NID,
13346 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13347 .channel_mode = alc662_5stack_modes,
13348 .input_mux = &alc662_capture_source,
13350 [ALC662_LENOVO_101E] = {
13351 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13352 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13353 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13354 .dac_nids = alc662_dac_nids,
13355 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13356 .channel_mode = alc662_3ST_2ch_modes,
13357 .input_mux = &alc662_lenovo_101e_capture_source,
13358 .unsol_event = alc662_lenovo_101e_unsol_event,
13359 .init_hook = alc662_lenovo_101e_all_automute,
13361 [ALC662_ASUS_EEEPC_P701] = {
13362 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13363 .init_verbs = { alc662_init_verbs,
13364 alc662_eeepc_sue_init_verbs },
13365 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13366 .dac_nids = alc662_dac_nids,
13367 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13368 .channel_mode = alc662_3ST_2ch_modes,
13369 .input_mux = &alc662_eeepc_capture_source,
13370 .unsol_event = alc662_eeepc_unsol_event,
13371 .init_hook = alc662_eeepc_inithook,
13373 [ALC662_ASUS_EEEPC_EP20] = {
13374 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13375 alc662_chmode_mixer },
13376 .init_verbs = { alc662_init_verbs,
13377 alc662_eeepc_ep20_sue_init_verbs },
13378 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13379 .dac_nids = alc662_dac_nids,
13380 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13381 .channel_mode = alc662_3ST_6ch_modes,
13382 .input_mux = &alc662_lenovo_101e_capture_source,
13383 .unsol_event = alc662_eeepc_ep20_unsol_event,
13384 .init_hook = alc662_eeepc_ep20_inithook,
13391 * BIOS auto configuration
13394 /* add playback controls from the parsed DAC table */
13395 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13396 const struct auto_pin_cfg *cfg)
13399 static const char *chname[4] = {
13400 "Front", "Surround", NULL /*CLFE*/, "Side"
13405 for (i = 0; i < cfg->line_outs; i++) {
13406 if (!spec->multiout.dac_nids[i])
13408 nid = alc880_idx_to_dac(i);
13411 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13412 "Center Playback Volume",
13413 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13417 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13418 "LFE Playback Volume",
13419 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13423 err = add_control(spec, ALC_CTL_BIND_MUTE,
13424 "Center Playback Switch",
13425 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13429 err = add_control(spec, ALC_CTL_BIND_MUTE,
13430 "LFE Playback Switch",
13431 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13436 sprintf(name, "%s Playback Volume", chname[i]);
13437 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13438 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13442 sprintf(name, "%s Playback Switch", chname[i]);
13443 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13444 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13453 /* add playback controls for speaker and HP outputs */
13454 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13464 if (alc880_is_fixed_pin(pin)) {
13465 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13466 /* printk("DAC nid=%x\n",nid); */
13467 /* specify the DAC as the extra output */
13468 if (!spec->multiout.hp_nid)
13469 spec->multiout.hp_nid = nid;
13471 spec->multiout.extra_out_nid[0] = nid;
13472 /* control HP volume/switch on the output mixer amp */
13473 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13474 sprintf(name, "%s Playback Volume", pfx);
13475 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13476 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13479 sprintf(name, "%s Playback Switch", pfx);
13480 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13481 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13484 } else if (alc880_is_multi_pin(pin)) {
13485 /* set manual connection */
13486 /* we have only a switch on HP-out PIN */
13487 sprintf(name, "%s Playback Switch", pfx);
13488 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13489 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13496 /* create playback/capture controls for input pins */
13497 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13498 const struct auto_pin_cfg *cfg)
13500 struct hda_input_mux *imux = &spec->private_imux;
13503 for (i = 0; i < AUTO_PIN_LAST; i++) {
13504 if (alc880_is_input_pin(cfg->input_pins[i])) {
13505 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13506 err = new_analog_input(spec, cfg->input_pins[i],
13507 auto_pin_cfg_labels[i],
13511 imux->items[imux->num_items].label =
13512 auto_pin_cfg_labels[i];
13513 imux->items[imux->num_items].index =
13514 alc880_input_pin_idx(cfg->input_pins[i]);
13521 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13522 hda_nid_t nid, int pin_type,
13525 alc_set_pin_output(codec, nid, pin_type);
13526 /* need the manual connection? */
13527 if (alc880_is_multi_pin(nid)) {
13528 struct alc_spec *spec = codec->spec;
13529 int idx = alc880_multi_pin_idx(nid);
13530 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13531 AC_VERB_SET_CONNECT_SEL,
13532 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13536 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13538 struct alc_spec *spec = codec->spec;
13541 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13542 for (i = 0; i <= HDA_SIDE; i++) {
13543 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13544 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13546 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13551 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13553 struct alc_spec *spec = codec->spec;
13556 pin = spec->autocfg.hp_pins[0];
13557 if (pin) /* connect to front */
13559 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13560 pin = spec->autocfg.speaker_pins[0];
13562 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13565 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13566 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13568 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13570 struct alc_spec *spec = codec->spec;
13573 for (i = 0; i < AUTO_PIN_LAST; i++) {
13574 hda_nid_t nid = spec->autocfg.input_pins[i];
13575 if (alc662_is_input_pin(nid)) {
13576 snd_hda_codec_write(codec, nid, 0,
13577 AC_VERB_SET_PIN_WIDGET_CONTROL,
13578 (i <= AUTO_PIN_FRONT_MIC ?
13579 PIN_VREF80 : PIN_IN));
13580 if (nid != ALC662_PIN_CD_NID)
13581 snd_hda_codec_write(codec, nid, 0,
13582 AC_VERB_SET_AMP_GAIN_MUTE,
13588 static int alc662_parse_auto_config(struct hda_codec *codec)
13590 struct alc_spec *spec = codec->spec;
13592 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13594 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13598 if (!spec->autocfg.line_outs)
13599 return 0; /* can't find valid BIOS pin config */
13601 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13604 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13607 err = alc662_auto_create_extra_out(spec,
13608 spec->autocfg.speaker_pins[0],
13612 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13616 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13620 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13622 if (spec->autocfg.dig_out_pin)
13623 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13625 if (spec->kctl_alloc)
13626 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13628 spec->num_mux_defs = 1;
13629 spec->input_mux = &spec->private_imux;
13631 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13632 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13633 spec->num_mixers++;
13637 /* additional initialization for auto-configuration model */
13638 static void alc662_auto_init(struct hda_codec *codec)
13640 struct alc_spec *spec = codec->spec;
13641 alc662_auto_init_multi_out(codec);
13642 alc662_auto_init_hp_out(codec);
13643 alc662_auto_init_analog_input(codec);
13644 if (spec->unsol_event)
13645 alc_sku_automute(codec);
13648 static int patch_alc662(struct hda_codec *codec)
13650 struct alc_spec *spec;
13651 int err, board_config;
13653 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13657 codec->spec = spec;
13659 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13662 if (board_config < 0) {
13663 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13664 "trying auto-probe from BIOS...\n");
13665 board_config = ALC662_AUTO;
13668 if (board_config == ALC662_AUTO) {
13669 /* automatic parse from the BIOS config */
13670 err = alc662_parse_auto_config(codec);
13676 "hda_codec: Cannot set up configuration "
13677 "from BIOS. Using base mode...\n");
13678 board_config = ALC662_3ST_2ch_DIG;
13682 if (board_config != ALC662_AUTO)
13683 setup_preset(spec, &alc662_presets[board_config]);
13685 spec->stream_name_analog = "ALC662 Analog";
13686 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13687 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13689 spec->stream_name_digital = "ALC662 Digital";
13690 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13691 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13693 spec->adc_nids = alc662_adc_nids;
13694 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13695 spec->capsrc_nids = alc662_capsrc_nids;
13697 spec->vmaster_nid = 0x02;
13699 codec->patch_ops = alc_patch_ops;
13700 if (board_config == ALC662_AUTO)
13701 spec->init_hook = alc662_auto_init;
13702 #ifdef CONFIG_SND_HDA_POWER_SAVE
13703 if (!spec->loopback.amplist)
13704 spec->loopback.amplist = alc662_loopbacks;
13713 struct hda_codec_preset snd_hda_preset_realtek[] = {
13714 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13715 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13716 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13717 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13718 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13719 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13720 .patch = patch_alc861 },
13721 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13722 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13723 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13724 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13725 .patch = patch_alc883 },
13726 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13727 .patch = patch_alc662 },
13728 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13729 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13730 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13731 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13732 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13733 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13734 {} /* terminator */