2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
34 #define ALC880_FRONT_EVENT 0x01
35 #define ALC880_DCVOL_EVENT 0x02
36 #define ALC880_HP_EVENT 0x04
37 #define ALC880_MIC_EVENT 0x08
39 /* ALC880 board config type */
62 #ifdef CONFIG_SND_DEBUG
66 ALC880_MODEL_LAST /* last tag */
78 #ifdef CONFIG_SND_DEBUG
82 ALC260_MODEL_LAST /* last tag */
92 ALC262_HP_BPC_D7000_WL,
93 ALC262_HP_BPC_D7000_WF,
101 ALC262_MODEL_LAST /* last tag */
110 #ifdef CONFIG_SND_DEBUG
114 ALC268_MODEL_LAST /* last tag */
121 ALC269_MODEL_LAST /* last tag */
138 /* ALC861-VD models */
159 ALC662_ASUS_EEEPC_P701,
160 ALC662_ASUS_EEEPC_EP20,
188 ALC883_TARGA_2ch_DIG,
194 ALC883_LENOVO_101E_2ch,
195 ALC883_LENOVO_NB0763,
196 ALC888_LENOVO_MS7195_DIG,
207 #define GPIO_MASK 0x03
210 /* codec parameterization */
211 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
212 unsigned int num_mixers;
214 const struct hda_verb *init_verbs[5]; /* initialization verbs
218 unsigned int num_init_verbs;
220 char *stream_name_analog; /* analog PCM stream */
221 struct hda_pcm_stream *stream_analog_playback;
222 struct hda_pcm_stream *stream_analog_capture;
223 struct hda_pcm_stream *stream_analog_alt_playback;
224 struct hda_pcm_stream *stream_analog_alt_capture;
226 char *stream_name_digital; /* digital PCM stream */
227 struct hda_pcm_stream *stream_digital_playback;
228 struct hda_pcm_stream *stream_digital_capture;
231 struct hda_multi_out multiout; /* playback set-up
232 * max_channels, dacs must be set
233 * dig_out_nid and hp_nid are optional
235 hda_nid_t alt_dac_nid;
238 unsigned int num_adc_nids;
240 hda_nid_t dig_in_nid; /* digital-in NID; optional */
243 unsigned int num_mux_defs;
244 const struct hda_input_mux *input_mux;
245 unsigned int cur_mux[3];
248 const struct hda_channel_mode *channel_mode;
249 int num_channel_mode;
252 /* PCM information */
253 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
255 /* dynamic controls, init_verbs and input_mux */
256 struct auto_pin_cfg autocfg;
257 unsigned int num_kctl_alloc, num_kctl_used;
258 struct snd_kcontrol_new *kctl_alloc;
259 struct hda_input_mux private_imux;
260 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
263 void (*init_hook)(struct hda_codec *codec);
264 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
266 /* for pin sensing */
267 unsigned int sense_updated: 1;
268 unsigned int jack_present: 1;
269 unsigned int master_sw: 1;
271 /* for virtual master */
272 hda_nid_t vmaster_nid;
274 #ifdef CONFIG_SND_HDA_POWER_SAVE
275 struct hda_loopback_check loopback;
280 * configuration template - to be copied to the spec instance
282 struct alc_config_preset {
283 struct snd_kcontrol_new *mixers[5]; /* should be identical size
286 const struct hda_verb *init_verbs[5];
287 unsigned int num_dacs;
289 hda_nid_t dig_out_nid; /* optional */
290 hda_nid_t hp_nid; /* optional */
291 unsigned int num_adc_nids;
293 hda_nid_t dig_in_nid;
294 unsigned int num_channel_mode;
295 const struct hda_channel_mode *channel_mode;
297 unsigned int num_mux_defs;
298 const struct hda_input_mux *input_mux;
299 void (*unsol_event)(struct hda_codec *, unsigned int);
300 void (*init_hook)(struct hda_codec *);
301 #ifdef CONFIG_SND_HDA_POWER_SAVE
302 struct hda_amp_list *loopbacks;
310 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
311 struct snd_ctl_elem_info *uinfo)
313 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
314 struct alc_spec *spec = codec->spec;
315 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
316 if (mux_idx >= spec->num_mux_defs)
318 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
321 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
322 struct snd_ctl_elem_value *ucontrol)
324 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
325 struct alc_spec *spec = codec->spec;
326 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
328 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
332 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
333 struct snd_ctl_elem_value *ucontrol)
335 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
336 struct alc_spec *spec = codec->spec;
337 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
338 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
339 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
340 spec->adc_nids[adc_idx],
341 &spec->cur_mux[adc_idx]);
346 * channel mode setting
348 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
349 struct snd_ctl_elem_info *uinfo)
351 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
352 struct alc_spec *spec = codec->spec;
353 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
354 spec->num_channel_mode);
357 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
358 struct snd_ctl_elem_value *ucontrol)
360 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
361 struct alc_spec *spec = codec->spec;
362 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
363 spec->num_channel_mode,
364 spec->multiout.max_channels);
367 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
368 struct snd_ctl_elem_value *ucontrol)
370 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
371 struct alc_spec *spec = codec->spec;
372 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
373 spec->num_channel_mode,
374 &spec->multiout.max_channels);
375 if (err >= 0 && spec->need_dac_fix)
376 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
381 * Control the mode of pin widget settings via the mixer. "pc" is used
382 * instead of "%" to avoid consequences of accidently treating the % as
383 * being part of a format specifier. Maximum allowed length of a value is
384 * 63 characters plus NULL terminator.
386 * Note: some retasking pin complexes seem to ignore requests for input
387 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
388 * are requested. Therefore order this list so that this behaviour will not
389 * cause problems when mixer clients move through the enum sequentially.
390 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
393 static char *alc_pin_mode_names[] = {
394 "Mic 50pc bias", "Mic 80pc bias",
395 "Line in", "Line out", "Headphone out",
397 static unsigned char alc_pin_mode_values[] = {
398 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
400 /* The control can present all 5 options, or it can limit the options based
401 * in the pin being assumed to be exclusively an input or an output pin. In
402 * addition, "input" pins may or may not process the mic bias option
403 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
404 * accept requests for bias as of chip versions up to March 2006) and/or
405 * wiring in the computer.
407 #define ALC_PIN_DIR_IN 0x00
408 #define ALC_PIN_DIR_OUT 0x01
409 #define ALC_PIN_DIR_INOUT 0x02
410 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
411 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
413 /* Info about the pin modes supported by the different pin direction modes.
414 * For each direction the minimum and maximum values are given.
416 static signed char alc_pin_mode_dir_info[5][2] = {
417 { 0, 2 }, /* ALC_PIN_DIR_IN */
418 { 3, 4 }, /* ALC_PIN_DIR_OUT */
419 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
420 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
421 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
423 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
424 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
425 #define alc_pin_mode_n_items(_dir) \
426 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
428 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
429 struct snd_ctl_elem_info *uinfo)
431 unsigned int item_num = uinfo->value.enumerated.item;
432 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
434 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
436 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
438 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
439 item_num = alc_pin_mode_min(dir);
440 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
444 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
445 struct snd_ctl_elem_value *ucontrol)
448 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
449 hda_nid_t nid = kcontrol->private_value & 0xffff;
450 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
451 long *valp = ucontrol->value.integer.value;
452 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
453 AC_VERB_GET_PIN_WIDGET_CONTROL,
456 /* Find enumerated value for current pinctl setting */
457 i = alc_pin_mode_min(dir);
458 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
460 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
464 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
469 hda_nid_t nid = kcontrol->private_value & 0xffff;
470 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
471 long val = *ucontrol->value.integer.value;
472 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
473 AC_VERB_GET_PIN_WIDGET_CONTROL,
476 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
477 val = alc_pin_mode_min(dir);
479 change = pinctl != alc_pin_mode_values[val];
481 /* Set pin mode to that requested */
482 snd_hda_codec_write_cache(codec, nid, 0,
483 AC_VERB_SET_PIN_WIDGET_CONTROL,
484 alc_pin_mode_values[val]);
486 /* Also enable the retasking pin's input/output as required
487 * for the requested pin mode. Enum values of 2 or less are
490 * Dynamically switching the input/output buffers probably
491 * reduces noise slightly (particularly on input) so we'll
492 * do it. However, having both input and output buffers
493 * enabled simultaneously doesn't seem to be problematic if
494 * this turns out to be necessary in the future.
497 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
498 HDA_AMP_MUTE, HDA_AMP_MUTE);
499 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
502 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
503 HDA_AMP_MUTE, HDA_AMP_MUTE);
504 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
511 #define ALC_PIN_MODE(xname, nid, dir) \
512 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
513 .info = alc_pin_mode_info, \
514 .get = alc_pin_mode_get, \
515 .put = alc_pin_mode_put, \
516 .private_value = nid | (dir<<16) }
518 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
519 * together using a mask with more than one bit set. This control is
520 * currently used only by the ALC260 test model. At this stage they are not
521 * needed for any "production" models.
523 #ifdef CONFIG_SND_DEBUG
524 #define alc_gpio_data_info snd_ctl_boolean_mono_info
526 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
527 struct snd_ctl_elem_value *ucontrol)
529 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
530 hda_nid_t nid = kcontrol->private_value & 0xffff;
531 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
532 long *valp = ucontrol->value.integer.value;
533 unsigned int val = snd_hda_codec_read(codec, nid, 0,
534 AC_VERB_GET_GPIO_DATA, 0x00);
536 *valp = (val & mask) != 0;
539 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
540 struct snd_ctl_elem_value *ucontrol)
543 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
544 hda_nid_t nid = kcontrol->private_value & 0xffff;
545 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
546 long val = *ucontrol->value.integer.value;
547 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
548 AC_VERB_GET_GPIO_DATA,
551 /* Set/unset the masked GPIO bit(s) as needed */
552 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
557 snd_hda_codec_write_cache(codec, nid, 0,
558 AC_VERB_SET_GPIO_DATA, gpio_data);
562 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
563 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
564 .info = alc_gpio_data_info, \
565 .get = alc_gpio_data_get, \
566 .put = alc_gpio_data_put, \
567 .private_value = nid | (mask<<16) }
568 #endif /* CONFIG_SND_DEBUG */
570 /* A switch control to allow the enabling of the digital IO pins on the
571 * ALC260. This is incredibly simplistic; the intention of this control is
572 * to provide something in the test model allowing digital outputs to be
573 * identified if present. If models are found which can utilise these
574 * outputs a more complete mixer control can be devised for those models if
577 #ifdef CONFIG_SND_DEBUG
578 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
580 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
581 struct snd_ctl_elem_value *ucontrol)
583 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
584 hda_nid_t nid = kcontrol->private_value & 0xffff;
585 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
586 long *valp = ucontrol->value.integer.value;
587 unsigned int val = snd_hda_codec_read(codec, nid, 0,
588 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
590 *valp = (val & mask) != 0;
593 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
594 struct snd_ctl_elem_value *ucontrol)
597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
598 hda_nid_t nid = kcontrol->private_value & 0xffff;
599 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
600 long val = *ucontrol->value.integer.value;
601 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
602 AC_VERB_GET_DIGI_CONVERT_1,
605 /* Set/unset the masked control bit(s) as needed */
606 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
611 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
616 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
617 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
618 .info = alc_spdif_ctrl_info, \
619 .get = alc_spdif_ctrl_get, \
620 .put = alc_spdif_ctrl_put, \
621 .private_value = nid | (mask<<16) }
622 #endif /* CONFIG_SND_DEBUG */
624 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
625 * Again, this is only used in the ALC26x test models to help identify when
626 * the EAPD line must be asserted for features to work.
628 #ifdef CONFIG_SND_DEBUG
629 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
631 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
632 struct snd_ctl_elem_value *ucontrol)
634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
635 hda_nid_t nid = kcontrol->private_value & 0xffff;
636 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
637 long *valp = ucontrol->value.integer.value;
638 unsigned int val = snd_hda_codec_read(codec, nid, 0,
639 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
641 *valp = (val & mask) != 0;
645 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
646 struct snd_ctl_elem_value *ucontrol)
649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
650 hda_nid_t nid = kcontrol->private_value & 0xffff;
651 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
652 long val = *ucontrol->value.integer.value;
653 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
654 AC_VERB_GET_EAPD_BTLENABLE,
657 /* Set/unset the masked control bit(s) as needed */
658 change = (!val ? 0 : mask) != (ctrl_data & mask);
663 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
669 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
670 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
671 .info = alc_eapd_ctrl_info, \
672 .get = alc_eapd_ctrl_get, \
673 .put = alc_eapd_ctrl_put, \
674 .private_value = nid | (mask<<16) }
675 #endif /* CONFIG_SND_DEBUG */
678 * set up from the preset table
680 static void setup_preset(struct alc_spec *spec,
681 const struct alc_config_preset *preset)
685 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
686 spec->mixers[spec->num_mixers++] = preset->mixers[i];
687 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
689 spec->init_verbs[spec->num_init_verbs++] =
690 preset->init_verbs[i];
692 spec->channel_mode = preset->channel_mode;
693 spec->num_channel_mode = preset->num_channel_mode;
694 spec->need_dac_fix = preset->need_dac_fix;
696 spec->multiout.max_channels = spec->channel_mode[0].channels;
698 spec->multiout.num_dacs = preset->num_dacs;
699 spec->multiout.dac_nids = preset->dac_nids;
700 spec->multiout.dig_out_nid = preset->dig_out_nid;
701 spec->multiout.hp_nid = preset->hp_nid;
703 spec->num_mux_defs = preset->num_mux_defs;
704 if (!spec->num_mux_defs)
705 spec->num_mux_defs = 1;
706 spec->input_mux = preset->input_mux;
708 spec->num_adc_nids = preset->num_adc_nids;
709 spec->adc_nids = preset->adc_nids;
710 spec->dig_in_nid = preset->dig_in_nid;
712 spec->unsol_event = preset->unsol_event;
713 spec->init_hook = preset->init_hook;
714 #ifdef CONFIG_SND_HDA_POWER_SAVE
715 spec->loopback.amplist = preset->loopbacks;
719 /* Enable GPIO mask and set output */
720 static struct hda_verb alc_gpio1_init_verbs[] = {
721 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
722 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
723 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
727 static struct hda_verb alc_gpio2_init_verbs[] = {
728 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
729 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
730 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
734 static struct hda_verb alc_gpio3_init_verbs[] = {
735 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
736 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
737 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
741 static void alc_sku_automute(struct hda_codec *codec)
743 struct alc_spec *spec = codec->spec;
745 unsigned int present;
746 unsigned int hp_nid = spec->autocfg.hp_pins[0];
747 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
749 /* need to execute and sync at first */
750 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
751 present = snd_hda_codec_read(codec, hp_nid, 0,
752 AC_VERB_GET_PIN_SENSE, 0);
753 spec->jack_present = (present & 0x80000000) != 0;
754 if (spec->jack_present) {
755 /* mute internal speaker */
756 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
757 HDA_AMP_MUTE, HDA_AMP_MUTE);
759 /* unmute internal speaker if necessary */
760 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
761 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
766 /* unsolicited event for HP jack sensing */
767 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
769 if (codec->vendor_id == 0x10ec0880)
773 if (res != ALC880_HP_EVENT)
776 alc_sku_automute(codec);
779 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
780 * 31 ~ 16 : Manufacture ID
782 * 7 ~ 0 : Assembly ID
783 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
785 static void alc_subsystem_id(struct hda_codec *codec,
786 unsigned int porta, unsigned int porte,
789 unsigned int ass, tmp, i;
791 struct alc_spec *spec = codec->spec;
793 ass = codec->subsystem_id & 0xffff;
794 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
798 * 31~30 : port conetcivity
801 * 19~16 : Check sum (15:1)
806 if (codec->vendor_id == 0x10ec0260)
808 ass = snd_hda_codec_read(codec, nid, 0,
809 AC_VERB_GET_CONFIG_DEFAULT, 0);
810 if (!(ass & 1) && !(ass & 0x100000))
812 if ((ass >> 30) != 1) /* no physical connection */
817 for (i = 1; i < 16; i++) {
821 if (((ass >> 16) & 0xf) != tmp)
827 * 2 : 0 --> Desktop, 1 --> Laptop
828 * 3~5 : External Amplifier control
831 tmp = (ass & 0x38) >> 3; /* external Amp control */
834 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
837 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
840 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
842 case 5: /* set EAPD output high */
843 switch (codec->vendor_id) {
845 snd_hda_codec_write(codec, 0x0f, 0,
846 AC_VERB_SET_EAPD_BTLENABLE, 2);
847 snd_hda_codec_write(codec, 0x10, 0,
848 AC_VERB_SET_EAPD_BTLENABLE, 2);
856 snd_hda_codec_write(codec, 0x14, 0,
857 AC_VERB_SET_EAPD_BTLENABLE, 2);
858 snd_hda_codec_write(codec, 0x15, 0,
859 AC_VERB_SET_EAPD_BTLENABLE, 2);
862 switch (codec->vendor_id) {
864 snd_hda_codec_write(codec, 0x1a, 0,
865 AC_VERB_SET_COEF_INDEX, 7);
866 tmp = snd_hda_codec_read(codec, 0x1a, 0,
867 AC_VERB_GET_PROC_COEF, 0);
868 snd_hda_codec_write(codec, 0x1a, 0,
869 AC_VERB_SET_COEF_INDEX, 7);
870 snd_hda_codec_write(codec, 0x1a, 0,
871 AC_VERB_SET_PROC_COEF,
880 snd_hda_codec_write(codec, 0x20, 0,
881 AC_VERB_SET_COEF_INDEX, 7);
882 tmp = snd_hda_codec_read(codec, 0x20, 0,
883 AC_VERB_GET_PROC_COEF, 0);
884 snd_hda_codec_write(codec, 0x20, 0,
885 AC_VERB_SET_COEF_INDEX, 7);
886 snd_hda_codec_write(codec, 0x20, 0,
887 AC_VERB_SET_PROC_COEF,
892 snd_hda_codec_write(codec, 0x20, 0,
893 AC_VERB_SET_COEF_INDEX, 7);
894 tmp = snd_hda_codec_read(codec, 0x20, 0,
895 AC_VERB_GET_PROC_COEF, 0);
896 snd_hda_codec_write(codec, 0x20, 0,
897 AC_VERB_SET_COEF_INDEX, 7);
898 snd_hda_codec_write(codec, 0x20, 0,
899 AC_VERB_SET_PROC_COEF,
907 /* is laptop or Desktop and enable the function "Mute internal speaker
908 * when the external headphone out jack is plugged"
913 * 10~8 : Jack location
914 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
916 * 15 : 1 --> enable the function "Mute internal speaker
917 * when the external headphone out jack is plugged"
919 if (!spec->autocfg.speaker_pins[0]) {
920 if (spec->autocfg.line_out_pins[0])
921 spec->autocfg.speaker_pins[0] =
922 spec->autocfg.line_out_pins[0];
927 if (!spec->autocfg.hp_pins[0]) {
928 tmp = (ass >> 11) & 0x3; /* HP to chassis */
930 spec->autocfg.hp_pins[0] = porta;
932 spec->autocfg.hp_pins[0] = porte;
934 spec->autocfg.hp_pins[0] = portd;
939 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
940 AC_VERB_SET_UNSOLICITED_ENABLE,
941 AC_USRSP_EN | ALC880_HP_EVENT);
942 spec->unsol_event = alc_sku_unsol_event;
943 spec->init_hook = alc_sku_automute;
947 * Fix-up pin default configurations
955 static void alc_fix_pincfg(struct hda_codec *codec,
956 const struct snd_pci_quirk *quirk,
957 const struct alc_pincfg **pinfix)
959 const struct alc_pincfg *cfg;
961 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
965 cfg = pinfix[quirk->value];
966 for (; cfg->nid; cfg++) {
969 for (i = 0; i < 4; i++) {
970 snd_hda_codec_write(codec, cfg->nid, 0,
971 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
979 * ALC880 3-stack model
981 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
982 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
983 * F-Mic = 0x1b, HP = 0x19
986 static hda_nid_t alc880_dac_nids[4] = {
987 /* front, rear, clfe, rear_surr */
988 0x02, 0x05, 0x04, 0x03
991 static hda_nid_t alc880_adc_nids[3] = {
996 /* The datasheet says the node 0x07 is connected from inputs,
997 * but it shows zero connection in the real implementation on some devices.
998 * Note: this is a 915GAV bug, fixed on 915GLV
1000 static hda_nid_t alc880_adc_nids_alt[2] = {
1005 #define ALC880_DIGOUT_NID 0x06
1006 #define ALC880_DIGIN_NID 0x0a
1008 static struct hda_input_mux alc880_capture_source = {
1012 { "Front Mic", 0x3 },
1018 /* channel source setting (2/6 channel selection for 3-stack) */
1020 static struct hda_verb alc880_threestack_ch2_init[] = {
1021 /* set line-in to input, mute it */
1022 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1023 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1024 /* set mic-in to input vref 80%, mute it */
1025 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1026 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1031 static struct hda_verb alc880_threestack_ch6_init[] = {
1032 /* set line-in to output, unmute it */
1033 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1034 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1035 /* set mic-in to output, unmute it */
1036 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1037 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1041 static struct hda_channel_mode alc880_threestack_modes[2] = {
1042 { 2, alc880_threestack_ch2_init },
1043 { 6, alc880_threestack_ch6_init },
1046 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1048 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1049 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1050 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1051 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1052 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1053 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1054 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1061 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1062 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1063 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1064 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1068 .name = "Channel Mode",
1069 .info = alc_ch_mode_info,
1070 .get = alc_ch_mode_get,
1071 .put = alc_ch_mode_put,
1076 /* capture mixer elements */
1077 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1078 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1079 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1080 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1081 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1082 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1083 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1086 /* The multiple "Capture Source" controls confuse alsamixer
1087 * So call somewhat different..
1089 /* .name = "Capture Source", */
1090 .name = "Input Source",
1092 .info = alc_mux_enum_info,
1093 .get = alc_mux_enum_get,
1094 .put = alc_mux_enum_put,
1099 /* capture mixer elements (in case NID 0x07 not available) */
1100 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1101 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1102 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1103 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1104 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1107 /* The multiple "Capture Source" controls confuse alsamixer
1108 * So call somewhat different..
1110 /* .name = "Capture Source", */
1111 .name = "Input Source",
1113 .info = alc_mux_enum_info,
1114 .get = alc_mux_enum_get,
1115 .put = alc_mux_enum_put,
1123 * ALC880 5-stack model
1125 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1127 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1128 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1131 /* additional mixers to alc880_three_stack_mixer */
1132 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1133 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1134 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1138 /* channel source setting (6/8 channel selection for 5-stack) */
1140 static struct hda_verb alc880_fivestack_ch6_init[] = {
1141 /* set line-in to input, mute it */
1142 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1143 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1148 static struct hda_verb alc880_fivestack_ch8_init[] = {
1149 /* set line-in to output, unmute it */
1150 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1151 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1155 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1156 { 6, alc880_fivestack_ch6_init },
1157 { 8, alc880_fivestack_ch8_init },
1162 * ALC880 6-stack model
1164 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1165 * Side = 0x05 (0x0f)
1166 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1167 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1170 static hda_nid_t alc880_6st_dac_nids[4] = {
1171 /* front, rear, clfe, rear_surr */
1172 0x02, 0x03, 0x04, 0x05
1175 static struct hda_input_mux alc880_6stack_capture_source = {
1179 { "Front Mic", 0x1 },
1185 /* fixed 8-channels */
1186 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1190 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1191 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1192 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1193 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1194 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1195 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1196 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1197 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1198 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1199 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1200 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1201 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1202 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1205 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1206 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1207 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1208 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1209 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1210 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1213 .name = "Channel Mode",
1214 .info = alc_ch_mode_info,
1215 .get = alc_ch_mode_get,
1216 .put = alc_ch_mode_put,
1225 * W810 has rear IO for:
1228 * Center/LFE (DAC 04)
1231 * The system also has a pair of internal speakers, and a headphone jack.
1232 * These are both connected to Line2 on the codec, hence to DAC 02.
1234 * There is a variable resistor to control the speaker or headphone
1235 * volume. This is a hardware-only device without a software API.
1237 * Plugging headphones in will disable the internal speakers. This is
1238 * implemented in hardware, not via the driver using jack sense. In
1239 * a similar fashion, plugging into the rear socket marked "front" will
1240 * disable both the speakers and headphones.
1242 * For input, there's a microphone jack, and an "audio in" jack.
1243 * These may not do anything useful with this driver yet, because I
1244 * haven't setup any initialization verbs for these yet...
1247 static hda_nid_t alc880_w810_dac_nids[3] = {
1248 /* front, rear/surround, clfe */
1252 /* fixed 6 channels */
1253 static struct hda_channel_mode alc880_w810_modes[1] = {
1257 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1258 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1261 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1262 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1263 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1264 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1265 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1266 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1275 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1276 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1280 static hda_nid_t alc880_z71v_dac_nids[1] = {
1283 #define ALC880_Z71V_HP_DAC 0x03
1285 /* fixed 2 channels */
1286 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1290 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1293 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1294 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1296 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1304 * ALC880 F1734 model
1306 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1307 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1310 static hda_nid_t alc880_f1734_dac_nids[1] = {
1313 #define ALC880_F1734_HP_DAC 0x02
1315 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1316 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1317 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1318 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1319 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1331 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1332 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1333 * Mic = 0x18, Line = 0x1a
1336 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1337 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1339 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1342 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1343 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1356 .name = "Channel Mode",
1357 .info = alc_ch_mode_info,
1358 .get = alc_ch_mode_get,
1359 .put = alc_ch_mode_put,
1365 * ALC880 ASUS W1V model
1367 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1368 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1369 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1372 /* additional mixers to alc880_asus_mixer */
1373 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1374 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1375 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1379 /* additional mixers to alc880_asus_mixer */
1380 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1381 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1382 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1387 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1388 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1389 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1390 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1392 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1393 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1394 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1395 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1396 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1399 /* The multiple "Capture Source" controls confuse alsamixer
1400 * So call somewhat different..
1402 /* .name = "Capture Source", */
1403 .name = "Input Source",
1405 .info = alc_mux_enum_info,
1406 .get = alc_mux_enum_get,
1407 .put = alc_mux_enum_put,
1413 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1414 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1415 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1416 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1417 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1418 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1419 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1420 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1421 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1422 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1423 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1425 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1428 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1429 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1430 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1431 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1434 .name = "Channel Mode",
1435 .info = alc_ch_mode_info,
1436 .get = alc_ch_mode_get,
1437 .put = alc_ch_mode_put,
1442 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1443 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1444 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1445 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1446 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1447 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1448 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1449 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1450 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1451 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1452 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1456 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1457 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1458 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1460 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1467 * virtual master controls
1471 * slave controls for virtual master
1473 static const char *alc_slave_vols[] = {
1474 "Front Playback Volume",
1475 "Surround Playback Volume",
1476 "Center Playback Volume",
1477 "LFE Playback Volume",
1478 "Side Playback Volume",
1479 "Headphone Playback Volume",
1480 "Speaker Playback Volume",
1481 "Mono Playback Volume",
1482 "Line-Out Playback Volume",
1486 static const char *alc_slave_sws[] = {
1487 "Front Playback Switch",
1488 "Surround Playback Switch",
1489 "Center Playback Switch",
1490 "LFE Playback Switch",
1491 "Side Playback Switch",
1492 "Headphone Playback Switch",
1493 "Speaker Playback Switch",
1494 "Mono Playback Switch",
1499 * build control elements
1501 static int alc_build_controls(struct hda_codec *codec)
1503 struct alc_spec *spec = codec->spec;
1507 for (i = 0; i < spec->num_mixers; i++) {
1508 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1513 if (spec->multiout.dig_out_nid) {
1514 err = snd_hda_create_spdif_out_ctls(codec,
1515 spec->multiout.dig_out_nid);
1519 if (spec->dig_in_nid) {
1520 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1525 /* if we have no master control, let's create it */
1526 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1527 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1528 HDA_OUTPUT, spec->vmaster_tlv);
1529 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1530 spec->vmaster_tlv, alc_slave_vols);
1534 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1535 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1536 NULL, alc_slave_sws);
1546 * initialize the codec volumes, etc
1550 * generic initialization of ADC, input mixers and output mixers
1552 static struct hda_verb alc880_volume_init_verbs[] = {
1554 * Unmute ADC0-2 and set the default input to mic-in
1556 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1558 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1560 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1563 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1565 * Note: PASD motherboards uses the Line In 2 as the input for front
1568 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1578 * Set up output mixers (0x0c - 0x0f)
1580 /* set vol=0 to output mixers */
1581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1584 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1585 /* set up input amps for analog loopback */
1586 /* Amp Indices: DAC = 0, mixer = 1 */
1587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1600 * 3-stack pin configuration:
1601 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1603 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1605 * preset connection lists of input pins
1606 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1608 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1609 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1610 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1613 * Set pin mode and muting
1615 /* set front pin widgets 0x14 for output */
1616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1618 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1621 /* Mic2 (as headphone out) for HP output */
1622 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1624 /* Line In pin widget for input */
1625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1627 /* Line2 (as front mic) pin widget for input and vref at 80% */
1628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1630 /* CD pin widget for input */
1631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1637 * 5-stack pin configuration:
1638 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1639 * line-in/side = 0x1a, f-mic = 0x1b
1641 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1643 * preset connection lists of input pins
1644 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1646 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1647 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1650 * Set pin mode and muting
1652 /* set pin widgets 0x14-0x17 for output */
1653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1656 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1657 /* unmute pins for output (no gain on this amp) */
1658 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1661 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1666 /* Mic2 (as headphone out) for HP output */
1667 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1669 /* Line In pin widget for input */
1670 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1672 /* Line2 (as front mic) pin widget for input and vref at 80% */
1673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1674 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1675 /* CD pin widget for input */
1676 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1682 * W810 pin configuration:
1683 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1685 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1686 /* hphone/speaker input selector: front DAC */
1687 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1693 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1694 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1697 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1703 * Z71V pin configuration:
1704 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1706 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1709 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1712 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1713 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1714 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1715 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1721 * 6-stack pin configuration:
1722 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1723 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1725 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1726 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1732 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1734 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1735 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1737 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1739 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1740 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1741 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1743 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1744 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1751 * Uniwill pin configuration:
1752 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1755 static struct hda_verb alc880_uniwill_init_verbs[] = {
1756 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1759 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1762 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1763 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1764 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1765 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1766 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1769 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1770 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1771 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1774 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1777 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1779 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1780 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1781 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1783 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1784 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1791 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1793 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1794 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1800 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1805 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1807 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1811 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1813 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1816 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1817 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1822 static struct hda_verb alc880_beep_init_verbs[] = {
1823 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1827 /* toggle speaker-output according to the hp-jack state */
1828 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1830 unsigned int present;
1833 present = snd_hda_codec_read(codec, 0x14, 0,
1834 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1835 bits = present ? HDA_AMP_MUTE : 0;
1836 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1837 HDA_AMP_MUTE, bits);
1838 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1839 HDA_AMP_MUTE, bits);
1842 /* auto-toggle front mic */
1843 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1845 unsigned int present;
1848 present = snd_hda_codec_read(codec, 0x18, 0,
1849 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1850 bits = present ? HDA_AMP_MUTE : 0;
1851 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1854 static void alc880_uniwill_automute(struct hda_codec *codec)
1856 alc880_uniwill_hp_automute(codec);
1857 alc880_uniwill_mic_automute(codec);
1860 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1863 /* Looks like the unsol event is incompatible with the standard
1864 * definition. 4bit tag is placed at 28 bit!
1866 switch (res >> 28) {
1867 case ALC880_HP_EVENT:
1868 alc880_uniwill_hp_automute(codec);
1870 case ALC880_MIC_EVENT:
1871 alc880_uniwill_mic_automute(codec);
1876 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1878 unsigned int present;
1881 present = snd_hda_codec_read(codec, 0x14, 0,
1882 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1883 bits = present ? HDA_AMP_MUTE : 0;
1884 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1887 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1889 unsigned int present;
1891 present = snd_hda_codec_read(codec, 0x21, 0,
1892 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1893 present &= HDA_AMP_VOLMASK;
1894 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1895 HDA_AMP_VOLMASK, present);
1896 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1897 HDA_AMP_VOLMASK, present);
1900 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1903 /* Looks like the unsol event is incompatible with the standard
1904 * definition. 4bit tag is placed at 28 bit!
1906 if ((res >> 28) == ALC880_HP_EVENT)
1907 alc880_uniwill_p53_hp_automute(codec);
1908 if ((res >> 28) == ALC880_DCVOL_EVENT)
1909 alc880_uniwill_p53_dcvol_automute(codec);
1913 * F1734 pin configuration:
1914 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1916 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1917 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1918 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1919 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1920 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1924 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1929 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1930 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1934 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1935 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1941 * ASUS pin configuration:
1942 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1944 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1945 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1946 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1947 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1948 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1953 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1954 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1955 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1957 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1961 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1962 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1963 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1965 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1967 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1972 /* Enable GPIO mask and set output */
1973 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1974 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1976 /* Clevo m520g init */
1977 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1978 /* headphone output */
1979 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1982 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1984 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1985 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1987 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1988 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1989 /* Mic1 (rear panel) */
1990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1991 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1992 /* Mic2 (front panel) */
1993 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1994 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1997 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1998 /* change to EAPD mode */
1999 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2000 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2005 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2006 /* change to EAPD mode */
2007 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2008 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2010 /* Headphone output */
2011 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2014 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2016 /* Line In pin widget for input */
2017 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2018 /* CD pin widget for input */
2019 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2020 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2023 /* change to EAPD mode */
2024 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2025 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2031 * LG m1 express dual
2034 * Rear Line-In/Out (blue): 0x14
2035 * Build-in Mic-In: 0x15
2037 * HP-Out (green): 0x1b
2038 * Mic-In/Out (red): 0x19
2042 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2043 static hda_nid_t alc880_lg_dac_nids[3] = {
2047 /* seems analog CD is not working */
2048 static struct hda_input_mux alc880_lg_capture_source = {
2053 { "Internal Mic", 0x6 },
2057 /* 2,4,6 channel modes */
2058 static struct hda_verb alc880_lg_ch2_init[] = {
2059 /* set line-in and mic-in to input */
2060 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2061 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2065 static struct hda_verb alc880_lg_ch4_init[] = {
2066 /* set line-in to out and mic-in to input */
2067 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2068 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2072 static struct hda_verb alc880_lg_ch6_init[] = {
2073 /* set line-in and mic-in to output */
2074 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2075 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2079 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2080 { 2, alc880_lg_ch2_init },
2081 { 4, alc880_lg_ch4_init },
2082 { 6, alc880_lg_ch6_init },
2085 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2087 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2088 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2089 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2090 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2091 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2092 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2093 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2098 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2099 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2101 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2102 .name = "Channel Mode",
2103 .info = alc_ch_mode_info,
2104 .get = alc_ch_mode_get,
2105 .put = alc_ch_mode_put,
2110 static struct hda_verb alc880_lg_init_verbs[] = {
2111 /* set capture source to mic-in */
2112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2113 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2114 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2115 /* mute all amp mixer inputs */
2116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2119 /* line-in to input */
2120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2126 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2127 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 /* mic-in to input */
2129 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2130 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2133 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2134 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2135 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2137 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2141 /* toggle speaker-output according to the hp-jack state */
2142 static void alc880_lg_automute(struct hda_codec *codec)
2144 unsigned int present;
2147 present = snd_hda_codec_read(codec, 0x1b, 0,
2148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2149 bits = present ? HDA_AMP_MUTE : 0;
2150 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2151 HDA_AMP_MUTE, bits);
2154 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2156 /* Looks like the unsol event is incompatible with the standard
2157 * definition. 4bit tag is placed at 28 bit!
2159 if ((res >> 28) == 0x01)
2160 alc880_lg_automute(codec);
2169 * Built-in Mic-In: 0x19
2175 static struct hda_input_mux alc880_lg_lw_capture_source = {
2179 { "Internal Mic", 0x1 },
2184 #define alc880_lg_lw_modes alc880_threestack_modes
2186 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2190 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2200 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2203 .name = "Channel Mode",
2204 .info = alc_ch_mode_info,
2205 .get = alc_ch_mode_get,
2206 .put = alc_ch_mode_put,
2211 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2212 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2213 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2214 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2216 /* set capture source to mic-in */
2217 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2222 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2223 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2227 /* mic-in to input */
2228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2238 /* toggle speaker-output according to the hp-jack state */
2239 static void alc880_lg_lw_automute(struct hda_codec *codec)
2241 unsigned int present;
2244 present = snd_hda_codec_read(codec, 0x1b, 0,
2245 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2246 bits = present ? HDA_AMP_MUTE : 0;
2247 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2248 HDA_AMP_MUTE, bits);
2251 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2253 /* Looks like the unsol event is incompatible with the standard
2254 * definition. 4bit tag is placed at 28 bit!
2256 if ((res >> 28) == 0x01)
2257 alc880_lg_lw_automute(codec);
2260 #ifdef CONFIG_SND_HDA_POWER_SAVE
2261 static struct hda_amp_list alc880_loopbacks[] = {
2262 { 0x0b, HDA_INPUT, 0 },
2263 { 0x0b, HDA_INPUT, 1 },
2264 { 0x0b, HDA_INPUT, 2 },
2265 { 0x0b, HDA_INPUT, 3 },
2266 { 0x0b, HDA_INPUT, 4 },
2270 static struct hda_amp_list alc880_lg_loopbacks[] = {
2271 { 0x0b, HDA_INPUT, 1 },
2272 { 0x0b, HDA_INPUT, 6 },
2273 { 0x0b, HDA_INPUT, 7 },
2282 static int alc_init(struct hda_codec *codec)
2284 struct alc_spec *spec = codec->spec;
2287 for (i = 0; i < spec->num_init_verbs; i++)
2288 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2290 if (spec->init_hook)
2291 spec->init_hook(codec);
2296 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2298 struct alc_spec *spec = codec->spec;
2300 if (spec->unsol_event)
2301 spec->unsol_event(codec, res);
2304 #ifdef CONFIG_SND_HDA_POWER_SAVE
2305 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2307 struct alc_spec *spec = codec->spec;
2308 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2313 * Analog playback callbacks
2315 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2316 struct hda_codec *codec,
2317 struct snd_pcm_substream *substream)
2319 struct alc_spec *spec = codec->spec;
2320 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2323 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2324 struct hda_codec *codec,
2325 unsigned int stream_tag,
2326 unsigned int format,
2327 struct snd_pcm_substream *substream)
2329 struct alc_spec *spec = codec->spec;
2330 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2331 stream_tag, format, substream);
2334 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2335 struct hda_codec *codec,
2336 struct snd_pcm_substream *substream)
2338 struct alc_spec *spec = codec->spec;
2339 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2345 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2346 struct hda_codec *codec,
2347 struct snd_pcm_substream *substream)
2349 struct alc_spec *spec = codec->spec;
2350 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2353 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2354 struct hda_codec *codec,
2355 unsigned int stream_tag,
2356 unsigned int format,
2357 struct snd_pcm_substream *substream)
2359 struct alc_spec *spec = codec->spec;
2360 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2361 stream_tag, format, substream);
2364 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2365 struct hda_codec *codec,
2366 struct snd_pcm_substream *substream)
2368 struct alc_spec *spec = codec->spec;
2369 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2375 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2376 struct hda_codec *codec,
2377 unsigned int stream_tag,
2378 unsigned int format,
2379 struct snd_pcm_substream *substream)
2381 struct alc_spec *spec = codec->spec;
2383 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2384 stream_tag, 0, format);
2388 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2389 struct hda_codec *codec,
2390 struct snd_pcm_substream *substream)
2392 struct alc_spec *spec = codec->spec;
2394 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2402 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2406 /* NID is set in alc_build_pcms */
2408 .open = alc880_playback_pcm_open,
2409 .prepare = alc880_playback_pcm_prepare,
2410 .cleanup = alc880_playback_pcm_cleanup
2414 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2418 /* NID is set in alc_build_pcms */
2421 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2425 /* NID is set in alc_build_pcms */
2428 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2429 .substreams = 2, /* can be overridden */
2432 /* NID is set in alc_build_pcms */
2434 .prepare = alc880_alt_capture_pcm_prepare,
2435 .cleanup = alc880_alt_capture_pcm_cleanup
2439 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2443 /* NID is set in alc_build_pcms */
2445 .open = alc880_dig_playback_pcm_open,
2446 .close = alc880_dig_playback_pcm_close,
2447 .prepare = alc880_dig_playback_pcm_prepare
2451 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2455 /* NID is set in alc_build_pcms */
2458 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2459 static struct hda_pcm_stream alc_pcm_null_stream = {
2465 static int alc_build_pcms(struct hda_codec *codec)
2467 struct alc_spec *spec = codec->spec;
2468 struct hda_pcm *info = spec->pcm_rec;
2471 codec->num_pcms = 1;
2472 codec->pcm_info = info;
2474 info->name = spec->stream_name_analog;
2475 if (spec->stream_analog_playback) {
2476 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2477 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2478 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2480 if (spec->stream_analog_capture) {
2481 snd_assert(spec->adc_nids, return -EINVAL);
2482 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2483 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2486 if (spec->channel_mode) {
2487 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2488 for (i = 0; i < spec->num_channel_mode; i++) {
2489 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2490 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2495 /* SPDIF for stream index #1 */
2496 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2497 codec->num_pcms = 2;
2498 info = spec->pcm_rec + 1;
2499 info->name = spec->stream_name_digital;
2500 if (spec->multiout.dig_out_nid &&
2501 spec->stream_digital_playback) {
2502 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2503 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2505 if (spec->dig_in_nid &&
2506 spec->stream_digital_capture) {
2507 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2508 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2512 /* If the use of more than one ADC is requested for the current
2513 * model, configure a second analog capture-only PCM.
2515 /* Additional Analaog capture for index #2 */
2516 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2517 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2518 codec->num_pcms = 3;
2519 info = spec->pcm_rec + 2;
2520 info->name = spec->stream_name_analog;
2521 if (spec->alt_dac_nid) {
2522 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2523 *spec->stream_analog_alt_playback;
2524 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2527 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2528 alc_pcm_null_stream;
2529 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2531 if (spec->num_adc_nids > 1) {
2532 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2533 *spec->stream_analog_alt_capture;
2534 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2536 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2537 spec->num_adc_nids - 1;
2539 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2540 alc_pcm_null_stream;
2541 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2548 static void alc_free(struct hda_codec *codec)
2550 struct alc_spec *spec = codec->spec;
2556 if (spec->kctl_alloc) {
2557 for (i = 0; i < spec->num_kctl_used; i++)
2558 kfree(spec->kctl_alloc[i].name);
2559 kfree(spec->kctl_alloc);
2566 static struct hda_codec_ops alc_patch_ops = {
2567 .build_controls = alc_build_controls,
2568 .build_pcms = alc_build_pcms,
2571 .unsol_event = alc_unsol_event,
2572 #ifdef CONFIG_SND_HDA_POWER_SAVE
2573 .check_power_status = alc_check_power_status,
2579 * Test configuration for debugging
2581 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2584 #ifdef CONFIG_SND_DEBUG
2585 static hda_nid_t alc880_test_dac_nids[4] = {
2586 0x02, 0x03, 0x04, 0x05
2589 static struct hda_input_mux alc880_test_capture_source = {
2598 { "Surround", 0x6 },
2602 static struct hda_channel_mode alc880_test_modes[4] = {
2609 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2610 struct snd_ctl_elem_info *uinfo)
2612 static char *texts[] = {
2613 "N/A", "Line Out", "HP Out",
2614 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2616 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2618 uinfo->value.enumerated.items = 8;
2619 if (uinfo->value.enumerated.item >= 8)
2620 uinfo->value.enumerated.item = 7;
2621 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2625 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2626 struct snd_ctl_elem_value *ucontrol)
2628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2629 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2630 unsigned int pin_ctl, item = 0;
2632 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2633 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2634 if (pin_ctl & AC_PINCTL_OUT_EN) {
2635 if (pin_ctl & AC_PINCTL_HP_EN)
2639 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2640 switch (pin_ctl & AC_PINCTL_VREFEN) {
2641 case AC_PINCTL_VREF_HIZ: item = 3; break;
2642 case AC_PINCTL_VREF_50: item = 4; break;
2643 case AC_PINCTL_VREF_GRD: item = 5; break;
2644 case AC_PINCTL_VREF_80: item = 6; break;
2645 case AC_PINCTL_VREF_100: item = 7; break;
2648 ucontrol->value.enumerated.item[0] = item;
2652 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2653 struct snd_ctl_elem_value *ucontrol)
2655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2656 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2657 static unsigned int ctls[] = {
2658 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2659 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2660 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2661 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2662 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2663 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2665 unsigned int old_ctl, new_ctl;
2667 old_ctl = snd_hda_codec_read(codec, nid, 0,
2668 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2669 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2670 if (old_ctl != new_ctl) {
2672 snd_hda_codec_write_cache(codec, nid, 0,
2673 AC_VERB_SET_PIN_WIDGET_CONTROL,
2675 val = ucontrol->value.enumerated.item[0] >= 3 ?
2677 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2684 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2685 struct snd_ctl_elem_info *uinfo)
2687 static char *texts[] = {
2688 "Front", "Surround", "CLFE", "Side"
2690 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2692 uinfo->value.enumerated.items = 4;
2693 if (uinfo->value.enumerated.item >= 4)
2694 uinfo->value.enumerated.item = 3;
2695 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2699 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2700 struct snd_ctl_elem_value *ucontrol)
2702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2703 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2706 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2707 ucontrol->value.enumerated.item[0] = sel & 3;
2711 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2712 struct snd_ctl_elem_value *ucontrol)
2714 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2715 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2718 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2719 if (ucontrol->value.enumerated.item[0] != sel) {
2720 sel = ucontrol->value.enumerated.item[0] & 3;
2721 snd_hda_codec_write_cache(codec, nid, 0,
2722 AC_VERB_SET_CONNECT_SEL, sel);
2728 #define PIN_CTL_TEST(xname,nid) { \
2729 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2731 .info = alc_test_pin_ctl_info, \
2732 .get = alc_test_pin_ctl_get, \
2733 .put = alc_test_pin_ctl_put, \
2734 .private_value = nid \
2737 #define PIN_SRC_TEST(xname,nid) { \
2738 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2740 .info = alc_test_pin_src_info, \
2741 .get = alc_test_pin_src_get, \
2742 .put = alc_test_pin_src_put, \
2743 .private_value = nid \
2746 static struct snd_kcontrol_new alc880_test_mixer[] = {
2747 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2748 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2749 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2750 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2751 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2752 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2753 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2754 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2755 PIN_CTL_TEST("Front Pin Mode", 0x14),
2756 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2757 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2758 PIN_CTL_TEST("Side Pin Mode", 0x17),
2759 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2760 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2761 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2762 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2763 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2764 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2765 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2766 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2767 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2768 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2769 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2770 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2771 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2772 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2773 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2774 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2778 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2779 .name = "Channel Mode",
2780 .info = alc_ch_mode_info,
2781 .get = alc_ch_mode_get,
2782 .put = alc_ch_mode_put,
2787 static struct hda_verb alc880_test_init_verbs[] = {
2788 /* Unmute inputs of 0x0c - 0x0f */
2789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2790 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2793 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2794 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2796 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2797 /* Vol output for 0x0c-0x0f */
2798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2802 /* Set output pins 0x14-0x17 */
2803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 /* Unmute output pins 0x14-0x17 */
2808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2812 /* Set input pins 0x18-0x1c */
2813 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2818 /* Mute input pins 0x18-0x1b */
2819 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2820 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2822 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2825 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2827 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2829 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2830 /* Analog input/passthru */
2831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2843 static const char *alc880_models[ALC880_MODEL_LAST] = {
2844 [ALC880_3ST] = "3stack",
2845 [ALC880_TCL_S700] = "tcl",
2846 [ALC880_3ST_DIG] = "3stack-digout",
2847 [ALC880_CLEVO] = "clevo",
2848 [ALC880_5ST] = "5stack",
2849 [ALC880_5ST_DIG] = "5stack-digout",
2850 [ALC880_W810] = "w810",
2851 [ALC880_Z71V] = "z71v",
2852 [ALC880_6ST] = "6stack",
2853 [ALC880_6ST_DIG] = "6stack-digout",
2854 [ALC880_ASUS] = "asus",
2855 [ALC880_ASUS_W1V] = "asus-w1v",
2856 [ALC880_ASUS_DIG] = "asus-dig",
2857 [ALC880_ASUS_DIG2] = "asus-dig2",
2858 [ALC880_UNIWILL_DIG] = "uniwill",
2859 [ALC880_UNIWILL_P53] = "uniwill-p53",
2860 [ALC880_FUJITSU] = "fujitsu",
2861 [ALC880_F1734] = "F1734",
2863 [ALC880_LG_LW] = "lg-lw",
2864 #ifdef CONFIG_SND_DEBUG
2865 [ALC880_TEST] = "test",
2867 [ALC880_AUTO] = "auto",
2870 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2871 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2872 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2873 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2874 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2875 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2876 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2877 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2878 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2879 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2880 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2881 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2882 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2883 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2884 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2885 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2886 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2887 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2888 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2889 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2890 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2891 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2892 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2893 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2894 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2895 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2896 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2897 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2898 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2899 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2900 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2901 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2902 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2903 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2904 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2905 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2906 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2907 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2908 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2909 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2910 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2911 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2912 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2913 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2914 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2915 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2916 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2917 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2918 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2919 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2920 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2921 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2922 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2923 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2924 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2925 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2926 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2927 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2928 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2929 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2930 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2931 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2932 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2933 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2934 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2935 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2936 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2937 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2938 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2939 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2944 * ALC880 codec presets
2946 static struct alc_config_preset alc880_presets[] = {
2948 .mixers = { alc880_three_stack_mixer },
2949 .init_verbs = { alc880_volume_init_verbs,
2950 alc880_pin_3stack_init_verbs },
2951 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2952 .dac_nids = alc880_dac_nids,
2953 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2954 .channel_mode = alc880_threestack_modes,
2956 .input_mux = &alc880_capture_source,
2958 [ALC880_3ST_DIG] = {
2959 .mixers = { alc880_three_stack_mixer },
2960 .init_verbs = { alc880_volume_init_verbs,
2961 alc880_pin_3stack_init_verbs },
2962 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2963 .dac_nids = alc880_dac_nids,
2964 .dig_out_nid = ALC880_DIGOUT_NID,
2965 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2966 .channel_mode = alc880_threestack_modes,
2968 .input_mux = &alc880_capture_source,
2970 [ALC880_TCL_S700] = {
2971 .mixers = { alc880_tcl_s700_mixer },
2972 .init_verbs = { alc880_volume_init_verbs,
2973 alc880_pin_tcl_S700_init_verbs,
2974 alc880_gpio2_init_verbs },
2975 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2976 .dac_nids = alc880_dac_nids,
2978 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2979 .channel_mode = alc880_2_jack_modes,
2980 .input_mux = &alc880_capture_source,
2983 .mixers = { alc880_three_stack_mixer,
2984 alc880_five_stack_mixer},
2985 .init_verbs = { alc880_volume_init_verbs,
2986 alc880_pin_5stack_init_verbs },
2987 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2988 .dac_nids = alc880_dac_nids,
2989 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2990 .channel_mode = alc880_fivestack_modes,
2991 .input_mux = &alc880_capture_source,
2993 [ALC880_5ST_DIG] = {
2994 .mixers = { alc880_three_stack_mixer,
2995 alc880_five_stack_mixer },
2996 .init_verbs = { alc880_volume_init_verbs,
2997 alc880_pin_5stack_init_verbs },
2998 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2999 .dac_nids = alc880_dac_nids,
3000 .dig_out_nid = ALC880_DIGOUT_NID,
3001 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3002 .channel_mode = alc880_fivestack_modes,
3003 .input_mux = &alc880_capture_source,
3006 .mixers = { alc880_six_stack_mixer },
3007 .init_verbs = { alc880_volume_init_verbs,
3008 alc880_pin_6stack_init_verbs },
3009 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3010 .dac_nids = alc880_6st_dac_nids,
3011 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3012 .channel_mode = alc880_sixstack_modes,
3013 .input_mux = &alc880_6stack_capture_source,
3015 [ALC880_6ST_DIG] = {
3016 .mixers = { alc880_six_stack_mixer },
3017 .init_verbs = { alc880_volume_init_verbs,
3018 alc880_pin_6stack_init_verbs },
3019 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3020 .dac_nids = alc880_6st_dac_nids,
3021 .dig_out_nid = ALC880_DIGOUT_NID,
3022 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3023 .channel_mode = alc880_sixstack_modes,
3024 .input_mux = &alc880_6stack_capture_source,
3027 .mixers = { alc880_w810_base_mixer },
3028 .init_verbs = { alc880_volume_init_verbs,
3029 alc880_pin_w810_init_verbs,
3030 alc880_gpio2_init_verbs },
3031 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3032 .dac_nids = alc880_w810_dac_nids,
3033 .dig_out_nid = ALC880_DIGOUT_NID,
3034 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3035 .channel_mode = alc880_w810_modes,
3036 .input_mux = &alc880_capture_source,
3039 .mixers = { alc880_z71v_mixer },
3040 .init_verbs = { alc880_volume_init_verbs,
3041 alc880_pin_z71v_init_verbs },
3042 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3043 .dac_nids = alc880_z71v_dac_nids,
3044 .dig_out_nid = ALC880_DIGOUT_NID,
3046 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3047 .channel_mode = alc880_2_jack_modes,
3048 .input_mux = &alc880_capture_source,
3051 .mixers = { alc880_f1734_mixer },
3052 .init_verbs = { alc880_volume_init_verbs,
3053 alc880_pin_f1734_init_verbs },
3054 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3055 .dac_nids = alc880_f1734_dac_nids,
3057 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3058 .channel_mode = alc880_2_jack_modes,
3059 .input_mux = &alc880_capture_source,
3062 .mixers = { alc880_asus_mixer },
3063 .init_verbs = { alc880_volume_init_verbs,
3064 alc880_pin_asus_init_verbs,
3065 alc880_gpio1_init_verbs },
3066 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3067 .dac_nids = alc880_asus_dac_nids,
3068 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3069 .channel_mode = alc880_asus_modes,
3071 .input_mux = &alc880_capture_source,
3073 [ALC880_ASUS_DIG] = {
3074 .mixers = { alc880_asus_mixer },
3075 .init_verbs = { alc880_volume_init_verbs,
3076 alc880_pin_asus_init_verbs,
3077 alc880_gpio1_init_verbs },
3078 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3079 .dac_nids = alc880_asus_dac_nids,
3080 .dig_out_nid = ALC880_DIGOUT_NID,
3081 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3082 .channel_mode = alc880_asus_modes,
3084 .input_mux = &alc880_capture_source,
3086 [ALC880_ASUS_DIG2] = {
3087 .mixers = { alc880_asus_mixer },
3088 .init_verbs = { alc880_volume_init_verbs,
3089 alc880_pin_asus_init_verbs,
3090 alc880_gpio2_init_verbs }, /* use GPIO2 */
3091 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3092 .dac_nids = alc880_asus_dac_nids,
3093 .dig_out_nid = ALC880_DIGOUT_NID,
3094 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3095 .channel_mode = alc880_asus_modes,
3097 .input_mux = &alc880_capture_source,
3099 [ALC880_ASUS_W1V] = {
3100 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3101 .init_verbs = { alc880_volume_init_verbs,
3102 alc880_pin_asus_init_verbs,
3103 alc880_gpio1_init_verbs },
3104 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3105 .dac_nids = alc880_asus_dac_nids,
3106 .dig_out_nid = ALC880_DIGOUT_NID,
3107 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3108 .channel_mode = alc880_asus_modes,
3110 .input_mux = &alc880_capture_source,
3112 [ALC880_UNIWILL_DIG] = {
3113 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3114 .init_verbs = { alc880_volume_init_verbs,
3115 alc880_pin_asus_init_verbs },
3116 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3117 .dac_nids = alc880_asus_dac_nids,
3118 .dig_out_nid = ALC880_DIGOUT_NID,
3119 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3120 .channel_mode = alc880_asus_modes,
3122 .input_mux = &alc880_capture_source,
3124 [ALC880_UNIWILL] = {
3125 .mixers = { alc880_uniwill_mixer },
3126 .init_verbs = { alc880_volume_init_verbs,
3127 alc880_uniwill_init_verbs },
3128 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3129 .dac_nids = alc880_asus_dac_nids,
3130 .dig_out_nid = ALC880_DIGOUT_NID,
3131 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3132 .channel_mode = alc880_threestack_modes,
3134 .input_mux = &alc880_capture_source,
3135 .unsol_event = alc880_uniwill_unsol_event,
3136 .init_hook = alc880_uniwill_automute,
3138 [ALC880_UNIWILL_P53] = {
3139 .mixers = { alc880_uniwill_p53_mixer },
3140 .init_verbs = { alc880_volume_init_verbs,
3141 alc880_uniwill_p53_init_verbs },
3142 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3143 .dac_nids = alc880_asus_dac_nids,
3144 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3145 .channel_mode = alc880_threestack_modes,
3146 .input_mux = &alc880_capture_source,
3147 .unsol_event = alc880_uniwill_p53_unsol_event,
3148 .init_hook = alc880_uniwill_p53_hp_automute,
3150 [ALC880_FUJITSU] = {
3151 .mixers = { alc880_fujitsu_mixer,
3152 alc880_pcbeep_mixer, },
3153 .init_verbs = { alc880_volume_init_verbs,
3154 alc880_uniwill_p53_init_verbs,
3155 alc880_beep_init_verbs },
3156 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3157 .dac_nids = alc880_dac_nids,
3158 .dig_out_nid = ALC880_DIGOUT_NID,
3159 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3160 .channel_mode = alc880_2_jack_modes,
3161 .input_mux = &alc880_capture_source,
3162 .unsol_event = alc880_uniwill_p53_unsol_event,
3163 .init_hook = alc880_uniwill_p53_hp_automute,
3166 .mixers = { alc880_three_stack_mixer },
3167 .init_verbs = { alc880_volume_init_verbs,
3168 alc880_pin_clevo_init_verbs },
3169 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3170 .dac_nids = alc880_dac_nids,
3172 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3173 .channel_mode = alc880_threestack_modes,
3175 .input_mux = &alc880_capture_source,
3178 .mixers = { alc880_lg_mixer },
3179 .init_verbs = { alc880_volume_init_verbs,
3180 alc880_lg_init_verbs },
3181 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3182 .dac_nids = alc880_lg_dac_nids,
3183 .dig_out_nid = ALC880_DIGOUT_NID,
3184 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3185 .channel_mode = alc880_lg_ch_modes,
3187 .input_mux = &alc880_lg_capture_source,
3188 .unsol_event = alc880_lg_unsol_event,
3189 .init_hook = alc880_lg_automute,
3190 #ifdef CONFIG_SND_HDA_POWER_SAVE
3191 .loopbacks = alc880_lg_loopbacks,
3195 .mixers = { alc880_lg_lw_mixer },
3196 .init_verbs = { alc880_volume_init_verbs,
3197 alc880_lg_lw_init_verbs },
3198 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3199 .dac_nids = alc880_dac_nids,
3200 .dig_out_nid = ALC880_DIGOUT_NID,
3201 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3202 .channel_mode = alc880_lg_lw_modes,
3203 .input_mux = &alc880_lg_lw_capture_source,
3204 .unsol_event = alc880_lg_lw_unsol_event,
3205 .init_hook = alc880_lg_lw_automute,
3207 #ifdef CONFIG_SND_DEBUG
3209 .mixers = { alc880_test_mixer },
3210 .init_verbs = { alc880_test_init_verbs },
3211 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3212 .dac_nids = alc880_test_dac_nids,
3213 .dig_out_nid = ALC880_DIGOUT_NID,
3214 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3215 .channel_mode = alc880_test_modes,
3216 .input_mux = &alc880_test_capture_source,
3222 * Automatic parse of I/O pins from the BIOS configuration
3225 #define NUM_CONTROL_ALLOC 32
3226 #define NUM_VERB_ALLOC 32
3230 ALC_CTL_WIDGET_MUTE,
3233 static struct snd_kcontrol_new alc880_control_templates[] = {
3234 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3235 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3236 HDA_BIND_MUTE(NULL, 0, 0, 0),
3239 /* add dynamic controls */
3240 static int add_control(struct alc_spec *spec, int type, const char *name,
3243 struct snd_kcontrol_new *knew;
3245 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3246 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3248 /* array + terminator */
3249 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3252 if (spec->kctl_alloc) {
3253 memcpy(knew, spec->kctl_alloc,
3254 sizeof(*knew) * spec->num_kctl_alloc);
3255 kfree(spec->kctl_alloc);
3257 spec->kctl_alloc = knew;
3258 spec->num_kctl_alloc = num;
3261 knew = &spec->kctl_alloc[spec->num_kctl_used];
3262 *knew = alc880_control_templates[type];
3263 knew->name = kstrdup(name, GFP_KERNEL);
3266 knew->private_value = val;
3267 spec->num_kctl_used++;
3271 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3272 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3273 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3274 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3275 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3276 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3277 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3278 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3279 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3280 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3281 #define ALC880_PIN_CD_NID 0x1c
3283 /* fill in the dac_nids table from the parsed pin configuration */
3284 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3285 const struct auto_pin_cfg *cfg)
3291 memset(assigned, 0, sizeof(assigned));
3292 spec->multiout.dac_nids = spec->private_dac_nids;
3294 /* check the pins hardwired to audio widget */
3295 for (i = 0; i < cfg->line_outs; i++) {
3296 nid = cfg->line_out_pins[i];
3297 if (alc880_is_fixed_pin(nid)) {
3298 int idx = alc880_fixed_pin_idx(nid);
3299 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3303 /* left pins can be connect to any audio widget */
3304 for (i = 0; i < cfg->line_outs; i++) {
3305 nid = cfg->line_out_pins[i];
3306 if (alc880_is_fixed_pin(nid))
3308 /* search for an empty channel */
3309 for (j = 0; j < cfg->line_outs; j++) {
3311 spec->multiout.dac_nids[i] =
3312 alc880_idx_to_dac(j);
3318 spec->multiout.num_dacs = cfg->line_outs;
3322 /* add playback controls from the parsed DAC table */
3323 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3324 const struct auto_pin_cfg *cfg)
3327 static const char *chname[4] = {
3328 "Front", "Surround", NULL /*CLFE*/, "Side"
3333 for (i = 0; i < cfg->line_outs; i++) {
3334 if (!spec->multiout.dac_nids[i])
3336 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3339 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3340 "Center Playback Volume",
3341 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3345 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3346 "LFE Playback Volume",
3347 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3351 err = add_control(spec, ALC_CTL_BIND_MUTE,
3352 "Center Playback Switch",
3353 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3357 err = add_control(spec, ALC_CTL_BIND_MUTE,
3358 "LFE Playback Switch",
3359 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3364 sprintf(name, "%s Playback Volume", chname[i]);
3365 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3366 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3370 sprintf(name, "%s Playback Switch", chname[i]);
3371 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3372 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3381 /* add playback controls for speaker and HP outputs */
3382 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3392 if (alc880_is_fixed_pin(pin)) {
3393 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3394 /* specify the DAC as the extra output */
3395 if (!spec->multiout.hp_nid)
3396 spec->multiout.hp_nid = nid;
3398 spec->multiout.extra_out_nid[0] = nid;
3399 /* control HP volume/switch on the output mixer amp */
3400 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3401 sprintf(name, "%s Playback Volume", pfx);
3402 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3403 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3406 sprintf(name, "%s Playback Switch", pfx);
3407 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3408 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3411 } else if (alc880_is_multi_pin(pin)) {
3412 /* set manual connection */
3413 /* we have only a switch on HP-out PIN */
3414 sprintf(name, "%s Playback Switch", pfx);
3415 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3416 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3423 /* create input playback/capture controls for the given pin */
3424 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3425 const char *ctlname,
3426 int idx, hda_nid_t mix_nid)
3431 sprintf(name, "%s Playback Volume", ctlname);
3432 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3433 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3436 sprintf(name, "%s Playback Switch", ctlname);
3437 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3438 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3444 /* create playback/capture controls for input pins */
3445 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3446 const struct auto_pin_cfg *cfg)
3448 struct hda_input_mux *imux = &spec->private_imux;
3451 for (i = 0; i < AUTO_PIN_LAST; i++) {
3452 if (alc880_is_input_pin(cfg->input_pins[i])) {
3453 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3454 err = new_analog_input(spec, cfg->input_pins[i],
3455 auto_pin_cfg_labels[i],
3459 imux->items[imux->num_items].label =
3460 auto_pin_cfg_labels[i];
3461 imux->items[imux->num_items].index =
3462 alc880_input_pin_idx(cfg->input_pins[i]);
3469 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3470 hda_nid_t nid, int pin_type,
3474 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3476 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3478 /* need the manual connection? */
3479 if (alc880_is_multi_pin(nid)) {
3480 struct alc_spec *spec = codec->spec;
3481 int idx = alc880_multi_pin_idx(nid);
3482 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3483 AC_VERB_SET_CONNECT_SEL,
3484 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3488 static int get_pin_type(int line_out_type)
3490 if (line_out_type == AUTO_PIN_HP_OUT)
3496 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3498 struct alc_spec *spec = codec->spec;
3501 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3502 for (i = 0; i < spec->autocfg.line_outs; i++) {
3503 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3504 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3505 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3509 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3511 struct alc_spec *spec = codec->spec;
3514 pin = spec->autocfg.speaker_pins[0];
3515 if (pin) /* connect to front */
3516 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3517 pin = spec->autocfg.hp_pins[0];
3518 if (pin) /* connect to front */
3519 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3522 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3524 struct alc_spec *spec = codec->spec;
3527 for (i = 0; i < AUTO_PIN_LAST; i++) {
3528 hda_nid_t nid = spec->autocfg.input_pins[i];
3529 if (alc880_is_input_pin(nid)) {
3530 snd_hda_codec_write(codec, nid, 0,
3531 AC_VERB_SET_PIN_WIDGET_CONTROL,
3532 i <= AUTO_PIN_FRONT_MIC ?
3533 PIN_VREF80 : PIN_IN);
3534 if (nid != ALC880_PIN_CD_NID)
3535 snd_hda_codec_write(codec, nid, 0,
3536 AC_VERB_SET_AMP_GAIN_MUTE,
3542 /* parse the BIOS configuration and set up the alc_spec */
3543 /* return 1 if successful, 0 if the proper config is not found,
3544 * or a negative error code
3546 static int alc880_parse_auto_config(struct hda_codec *codec)
3548 struct alc_spec *spec = codec->spec;
3550 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3552 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3556 if (!spec->autocfg.line_outs)
3557 return 0; /* can't find valid BIOS pin config */
3559 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3562 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3565 err = alc880_auto_create_extra_out(spec,
3566 spec->autocfg.speaker_pins[0],
3570 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3574 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3578 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3580 if (spec->autocfg.dig_out_pin)
3581 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3582 if (spec->autocfg.dig_in_pin)
3583 spec->dig_in_nid = ALC880_DIGIN_NID;
3585 if (spec->kctl_alloc)
3586 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3588 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3590 spec->num_mux_defs = 1;
3591 spec->input_mux = &spec->private_imux;
3596 /* additional initialization for auto-configuration model */
3597 static void alc880_auto_init(struct hda_codec *codec)
3599 alc880_auto_init_multi_out(codec);
3600 alc880_auto_init_extra_out(codec);
3601 alc880_auto_init_analog_input(codec);
3605 * OK, here we have finally the patch for ALC880
3608 static int patch_alc880(struct hda_codec *codec)
3610 struct alc_spec *spec;
3614 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3620 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3623 if (board_config < 0) {
3624 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3625 "trying auto-probe from BIOS...\n");
3626 board_config = ALC880_AUTO;
3629 if (board_config == ALC880_AUTO) {
3630 /* automatic parse from the BIOS config */
3631 err = alc880_parse_auto_config(codec);
3637 "hda_codec: Cannot set up configuration "
3638 "from BIOS. Using 3-stack mode...\n");
3639 board_config = ALC880_3ST;
3643 if (board_config != ALC880_AUTO)
3644 setup_preset(spec, &alc880_presets[board_config]);
3646 spec->stream_name_analog = "ALC880 Analog";
3647 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3648 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3649 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3651 spec->stream_name_digital = "ALC880 Digital";
3652 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3653 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3655 if (!spec->adc_nids && spec->input_mux) {
3656 /* check whether NID 0x07 is valid */
3657 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3659 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3660 if (wcap != AC_WID_AUD_IN) {
3661 spec->adc_nids = alc880_adc_nids_alt;
3662 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3663 spec->mixers[spec->num_mixers] =
3664 alc880_capture_alt_mixer;
3667 spec->adc_nids = alc880_adc_nids;
3668 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3669 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3674 spec->vmaster_nid = 0x0c;
3676 codec->patch_ops = alc_patch_ops;
3677 if (board_config == ALC880_AUTO)
3678 spec->init_hook = alc880_auto_init;
3679 #ifdef CONFIG_SND_HDA_POWER_SAVE
3680 if (!spec->loopback.amplist)
3681 spec->loopback.amplist = alc880_loopbacks;
3692 static hda_nid_t alc260_dac_nids[1] = {
3697 static hda_nid_t alc260_adc_nids[1] = {
3702 static hda_nid_t alc260_adc_nids_alt[1] = {
3707 static hda_nid_t alc260_hp_adc_nids[2] = {
3712 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3713 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3715 static hda_nid_t alc260_dual_adc_nids[2] = {
3720 #define ALC260_DIGOUT_NID 0x03
3721 #define ALC260_DIGIN_NID 0x06
3723 static struct hda_input_mux alc260_capture_source = {
3727 { "Front Mic", 0x1 },
3733 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3734 * headphone jack and the internal CD lines since these are the only pins at
3735 * which audio can appear. For flexibility, also allow the option of
3736 * recording the mixer output on the second ADC (ADC0 doesn't have a
3737 * connection to the mixer output).
3739 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3743 { "Mic/Line", 0x0 },
3745 { "Headphone", 0x2 },
3751 { "Mic/Line", 0x0 },
3753 { "Headphone", 0x2 },
3760 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3761 * the Fujitsu S702x, but jacks are marked differently.
3763 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3770 { "Headphone", 0x5 },
3779 { "Headphone", 0x6 },
3785 * This is just place-holder, so there's something for alc_build_pcms to look
3786 * at when it calculates the maximum number of channels. ALC260 has no mixer
3787 * element which allows changing the channel mode, so the verb list is
3790 static struct hda_channel_mode alc260_modes[1] = {
3795 /* Mixer combinations
3797 * basic: base_output + input + pc_beep + capture
3798 * HP: base_output + input + capture_alt
3799 * HP_3013: hp_3013 + input + capture
3800 * fujitsu: fujitsu + capture
3801 * acer: acer + capture
3804 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3805 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3806 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3807 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3808 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3809 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3810 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3814 static struct snd_kcontrol_new alc260_input_mixer[] = {
3815 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3816 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3817 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3818 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3819 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3820 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3821 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3822 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3826 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3827 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3828 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3832 /* update HP, line and mono out pins according to the master switch */
3833 static void alc260_hp_master_update(struct hda_codec *codec,
3834 hda_nid_t hp, hda_nid_t line,
3837 struct alc_spec *spec = codec->spec;
3838 unsigned int val = spec->master_sw ? PIN_HP : 0;
3839 /* change HP and line-out pins */
3840 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3842 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3844 /* mono (speaker) depending on the HP jack sense */
3845 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3846 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3850 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3851 struct snd_ctl_elem_value *ucontrol)
3853 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3854 struct alc_spec *spec = codec->spec;
3855 *ucontrol->value.integer.value = spec->master_sw;
3859 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3860 struct snd_ctl_elem_value *ucontrol)
3862 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3863 struct alc_spec *spec = codec->spec;
3864 int val = !!*ucontrol->value.integer.value;
3865 hda_nid_t hp, line, mono;
3867 if (val == spec->master_sw)
3869 spec->master_sw = val;
3870 hp = (kcontrol->private_value >> 16) & 0xff;
3871 line = (kcontrol->private_value >> 8) & 0xff;
3872 mono = kcontrol->private_value & 0xff;
3873 alc260_hp_master_update(codec, hp, line, mono);
3877 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
3879 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3880 .name = "Master Playback Switch",
3881 .info = snd_ctl_boolean_mono_info,
3882 .get = alc260_hp_master_sw_get,
3883 .put = alc260_hp_master_sw_put,
3884 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
3886 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3887 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3889 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3890 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
3892 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3896 static struct hda_verb alc260_hp_unsol_verbs[] = {
3897 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3901 static void alc260_hp_automute(struct hda_codec *codec)
3903 struct alc_spec *spec = codec->spec;
3904 unsigned int present;
3906 present = snd_hda_codec_read(codec, 0x10, 0,
3907 AC_VERB_GET_PIN_SENSE, 0);
3908 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3909 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
3912 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3914 if ((res >> 26) == ALC880_HP_EVENT)
3915 alc260_hp_automute(codec);
3918 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3921 .name = "Master Playback Switch",
3922 .info = snd_ctl_boolean_mono_info,
3923 .get = alc260_hp_master_sw_get,
3924 .put = alc260_hp_master_sw_put,
3925 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
3927 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3928 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3929 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3930 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3931 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3933 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3934 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3938 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
3939 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3943 static void alc260_hp_3013_automute(struct hda_codec *codec)
3945 struct alc_spec *spec = codec->spec;
3946 unsigned int present;
3948 present = snd_hda_codec_read(codec, 0x15, 0,
3949 AC_VERB_GET_PIN_SENSE, 0);
3950 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3951 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
3954 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
3957 if ((res >> 26) == ALC880_HP_EVENT)
3958 alc260_hp_3013_automute(codec);
3961 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3962 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3964 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3965 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3966 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3967 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3968 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3969 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3970 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3971 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3972 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3973 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3974 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3975 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3976 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3980 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3981 * versions of the ALC260 don't act on requests to enable mic bias from NID
3982 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3983 * datasheet doesn't mention this restriction. At this stage it's not clear
3984 * whether this behaviour is intentional or is a hardware bug in chip
3985 * revisions available in early 2006. Therefore for now allow the
3986 * "Headphone Jack Mode" control to span all choices, but if it turns out
3987 * that the lack of mic bias for this NID is intentional we could change the
3988 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3990 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3991 * don't appear to make the mic bias available from the "line" jack, even
3992 * though the NID used for this jack (0x14) can supply it. The theory is
3993 * that perhaps Acer have included blocking capacitors between the ALC260
3994 * and the output jack. If this turns out to be the case for all such
3995 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3996 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3998 * The C20x Tablet series have a mono internal speaker which is controlled
3999 * via the chip's Mono sum widget and pin complex, so include the necessary
4000 * controls for such models. On models without a "mono speaker" the control
4001 * won't do anything.
4003 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4004 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4005 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4006 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4007 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
4009 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
4011 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4012 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4014 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4015 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4016 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4017 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4018 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4019 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4020 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4024 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4025 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4027 static struct snd_kcontrol_new alc260_will_mixer[] = {
4028 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4029 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4031 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4032 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4033 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4034 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4035 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4036 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4037 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4038 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4039 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4043 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4044 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4046 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4047 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4048 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4050 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4051 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4052 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4053 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4054 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4055 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4056 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4060 /* capture mixer elements */
4061 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4062 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4063 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4064 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4065 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4068 /* The multiple "Capture Source" controls confuse alsamixer
4069 * So call somewhat different..
4071 /* .name = "Capture Source", */
4072 .name = "Input Source",
4074 .info = alc_mux_enum_info,
4075 .get = alc_mux_enum_get,
4076 .put = alc_mux_enum_put,
4081 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4082 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4083 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4086 /* The multiple "Capture Source" controls confuse alsamixer
4087 * So call somewhat different..
4089 /* .name = "Capture Source", */
4090 .name = "Input Source",
4092 .info = alc_mux_enum_info,
4093 .get = alc_mux_enum_get,
4094 .put = alc_mux_enum_put,
4100 * initialization verbs
4102 static struct hda_verb alc260_init_verbs[] = {
4103 /* Line In pin widget for input */
4104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4105 /* CD pin widget for input */
4106 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4107 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4108 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4109 /* Mic2 (front panel) pin widget for input and vref at 80% */
4110 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4111 /* LINE-2 is used for line-out in rear */
4112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4113 /* select line-out */
4114 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4116 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4118 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4120 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4121 /* mute capture amp left and right */
4122 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4123 /* set connection select to line in (default select for this ADC) */
4124 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4125 /* mute capture amp left and right */
4126 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4127 /* set connection select to line in (default select for this ADC) */
4128 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4129 /* set vol=0 Line-Out mixer amp left and right */
4130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4131 /* unmute pin widget amp left and right (no gain on this amp) */
4132 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4133 /* set vol=0 HP mixer amp left and right */
4134 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4135 /* unmute pin widget amp left and right (no gain on this amp) */
4136 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4137 /* set vol=0 Mono mixer amp left and right */
4138 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4139 /* unmute pin widget amp left and right (no gain on this amp) */
4140 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4141 /* unmute LINE-2 out pin */
4142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4143 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4146 /* mute analog inputs */
4147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4151 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4152 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4153 /* mute Front out path */
4154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4155 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4156 /* mute Headphone out path */
4157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4159 /* mute Mono out path */
4160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4161 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4165 #if 0 /* should be identical with alc260_init_verbs? */
4166 static struct hda_verb alc260_hp_init_verbs[] = {
4167 /* Headphone and output */
4168 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4170 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4171 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4172 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4173 /* Mic2 (front panel) pin widget for input and vref at 80% */
4174 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4175 /* Line In pin widget for input */
4176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4177 /* Line-2 pin widget for output */
4178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4179 /* CD pin widget for input */
4180 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4181 /* unmute amp left and right */
4182 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4183 /* set connection select to line in (default select for this ADC) */
4184 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4185 /* unmute Line-Out mixer amp left and right (volume = 0) */
4186 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4187 /* mute pin widget amp left and right (no gain on this amp) */
4188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4189 /* unmute HP mixer amp left and right (volume = 0) */
4190 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4191 /* mute pin widget amp left and right (no gain on this amp) */
4192 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4193 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4196 /* mute analog inputs */
4197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4202 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4203 /* Unmute Front out path */
4204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4206 /* Unmute Headphone out path */
4207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4208 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4209 /* Unmute Mono out path */
4210 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4211 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4216 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4217 /* Line out and output */
4218 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4220 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4221 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4222 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4223 /* Mic2 (front panel) pin widget for input and vref at 80% */
4224 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4225 /* Line In pin widget for input */
4226 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4227 /* Headphone pin widget for output */
4228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4229 /* CD pin widget for input */
4230 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4231 /* unmute amp left and right */
4232 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4233 /* set connection select to line in (default select for this ADC) */
4234 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4235 /* unmute Line-Out mixer amp left and right (volume = 0) */
4236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4237 /* mute pin widget amp left and right (no gain on this amp) */
4238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4239 /* unmute HP mixer amp left and right (volume = 0) */
4240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4241 /* mute pin widget amp left and right (no gain on this amp) */
4242 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4243 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4246 /* mute analog inputs */
4247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4252 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4253 /* Unmute Front out path */
4254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4255 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4256 /* Unmute Headphone out path */
4257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4258 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4259 /* Unmute Mono out path */
4260 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4261 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4265 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4266 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4267 * audio = 0x16, internal speaker = 0x10.
4269 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4270 /* Disable all GPIOs */
4271 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4272 /* Internal speaker is connected to headphone pin */
4273 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4274 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4276 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4277 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4278 /* Ensure all other unused pins are disabled and muted. */
4279 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4281 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4282 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4283 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4284 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4288 /* Disable digital (SPDIF) pins */
4289 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4290 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4292 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4293 * when acting as an output.
4295 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4297 /* Start with output sum widgets muted and their output gains at min */
4298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4303 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4304 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4305 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4306 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4308 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4309 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4310 /* Unmute Line1 pin widget output buffer since it starts as an output.
4311 * If the pin mode is changed by the user the pin mode control will
4312 * take care of enabling the pin's input/output buffers as needed.
4313 * Therefore there's no need to enable the input buffer at this
4316 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4317 /* Unmute input buffer of pin widget used for Line-in (no equiv
4320 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4322 /* Mute capture amp left and right */
4323 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4324 /* Set ADC connection select to match default mixer setting - line
4327 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4329 /* Do the same for the second ADC: mute capture input amp and
4330 * set ADC connection to line in (on mic1 pin)
4332 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4333 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4335 /* Mute all inputs to mixer widget (even unconnected ones) */
4336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4348 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4349 * similar laptops (adapted from Fujitsu init verbs).
4351 static struct hda_verb alc260_acer_init_verbs[] = {
4352 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4353 * the headphone jack. Turn this on and rely on the standard mute
4354 * methods whenever the user wants to turn these outputs off.
4356 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4357 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4358 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4359 /* Internal speaker/Headphone jack is connected to Line-out pin */
4360 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4361 /* Internal microphone/Mic jack is connected to Mic1 pin */
4362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4363 /* Line In jack is connected to Line1 pin */
4364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4365 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4366 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4367 /* Ensure all other unused pins are disabled and muted. */
4368 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4369 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4370 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4371 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4374 /* Disable digital (SPDIF) pins */
4375 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4376 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4378 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4379 * bus when acting as outputs.
4381 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4382 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4384 /* Start with output sum widgets muted and their output gains at min */
4385 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4391 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4392 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4393 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4395 /* Unmute Line-out pin widget amp left and right
4396 * (no equiv mixer ctrl)
4398 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4399 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4401 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4402 * inputs. If the pin mode is changed by the user the pin mode control
4403 * will take care of enabling the pin's input/output buffers as needed.
4404 * Therefore there's no need to enable the input buffer at this
4407 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4408 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4410 /* Mute capture amp left and right */
4411 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4412 /* Set ADC connection select to match default mixer setting - mic
4415 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4417 /* Do similar with the second ADC: mute capture input amp and
4418 * set ADC connection to mic to match ALSA's default state.
4420 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4421 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4423 /* Mute all inputs to mixer widget (even unconnected ones) */
4424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4426 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4430 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4436 static struct hda_verb alc260_will_verbs[] = {
4437 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4438 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4439 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4440 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4441 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4442 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4446 static struct hda_verb alc260_replacer_672v_verbs[] = {
4447 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4448 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4449 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4451 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4452 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4453 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4455 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4459 /* toggle speaker-output according to the hp-jack state */
4460 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4462 unsigned int present;
4464 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4465 present = snd_hda_codec_read(codec, 0x0f, 0,
4466 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4468 snd_hda_codec_write_cache(codec, 0x01, 0,
4469 AC_VERB_SET_GPIO_DATA, 1);
4470 snd_hda_codec_write_cache(codec, 0x0f, 0,
4471 AC_VERB_SET_PIN_WIDGET_CONTROL,
4474 snd_hda_codec_write_cache(codec, 0x01, 0,
4475 AC_VERB_SET_GPIO_DATA, 0);
4476 snd_hda_codec_write_cache(codec, 0x0f, 0,
4477 AC_VERB_SET_PIN_WIDGET_CONTROL,
4482 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4485 if ((res >> 26) == ALC880_HP_EVENT)
4486 alc260_replacer_672v_automute(codec);
4489 /* Test configuration for debugging, modelled after the ALC880 test
4492 #ifdef CONFIG_SND_DEBUG
4493 static hda_nid_t alc260_test_dac_nids[1] = {
4496 static hda_nid_t alc260_test_adc_nids[2] = {
4499 /* For testing the ALC260, each input MUX needs its own definition since
4500 * the signal assignments are different. This assumes that the first ADC
4503 static struct hda_input_mux alc260_test_capture_sources[2] = {
4507 { "MIC1 pin", 0x0 },
4508 { "MIC2 pin", 0x1 },
4509 { "LINE1 pin", 0x2 },
4510 { "LINE2 pin", 0x3 },
4512 { "LINE-OUT pin", 0x5 },
4513 { "HP-OUT pin", 0x6 },
4519 { "MIC1 pin", 0x0 },
4520 { "MIC2 pin", 0x1 },
4521 { "LINE1 pin", 0x2 },
4522 { "LINE2 pin", 0x3 },
4525 { "LINE-OUT pin", 0x6 },
4526 { "HP-OUT pin", 0x7 },
4530 static struct snd_kcontrol_new alc260_test_mixer[] = {
4531 /* Output driver widgets */
4532 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4533 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4534 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4535 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4536 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4537 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4539 /* Modes for retasking pin widgets
4540 * Note: the ALC260 doesn't seem to act on requests to enable mic
4541 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4542 * mention this restriction. At this stage it's not clear whether
4543 * this behaviour is intentional or is a hardware bug in chip
4544 * revisions available at least up until early 2006. Therefore for
4545 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4546 * choices, but if it turns out that the lack of mic bias for these
4547 * NIDs is intentional we could change their modes from
4548 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4550 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4551 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4552 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4553 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4554 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4555 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4557 /* Loopback mixer controls */
4558 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4559 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4560 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4561 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4562 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4563 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4564 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4565 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4566 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4567 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4568 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4569 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4570 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4571 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4572 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4573 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4575 /* Controls for GPIO pins, assuming they are configured as outputs */
4576 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4577 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4578 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4579 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4581 /* Switches to allow the digital IO pins to be enabled. The datasheet
4582 * is ambigious as to which NID is which; testing on laptops which
4583 * make this output available should provide clarification.
4585 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4586 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4588 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4589 * this output to turn on an external amplifier.
4591 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4592 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4596 static struct hda_verb alc260_test_init_verbs[] = {
4597 /* Enable all GPIOs as outputs with an initial value of 0 */
4598 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4599 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4600 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4602 /* Enable retasking pins as output, initially without power amp */
4603 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4604 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4607 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4610 /* Disable digital (SPDIF) pins initially, but users can enable
4611 * them via a mixer switch. In the case of SPDIF-out, this initverb
4612 * payload also sets the generation to 0, output to be in "consumer"
4613 * PCM format, copyright asserted, no pre-emphasis and no validity
4616 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4617 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4619 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4620 * OUT1 sum bus when acting as an output.
4622 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4623 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4624 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4625 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4627 /* Start with output sum widgets muted and their output gains at min */
4628 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4634 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4635 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4636 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4638 /* Unmute retasking pin widget output buffers since the default
4639 * state appears to be output. As the pin mode is changed by the
4640 * user the pin mode control will take care of enabling the pin's
4641 * input/output buffers as needed.
4643 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4644 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4647 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4648 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4649 /* Also unmute the mono-out pin widget */
4650 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4652 /* Mute capture amp left and right */
4653 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4654 /* Set ADC connection select to match default mixer setting (mic1
4657 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4659 /* Do the same for the second ADC: mute capture input amp and
4660 * set ADC connection to mic1 pin
4662 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4663 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4665 /* Mute all inputs to mixer widget (even unconnected ones) */
4666 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4669 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4679 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4680 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4682 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4683 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4686 * for BIOS auto-configuration
4689 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4693 unsigned long vol_val, sw_val;
4697 if (nid >= 0x0f && nid < 0x11) {
4698 nid_vol = nid - 0x7;
4699 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4700 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4701 } else if (nid == 0x11) {
4702 nid_vol = nid - 0x7;
4703 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4704 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4705 } else if (nid >= 0x12 && nid <= 0x15) {
4707 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4708 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4712 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4713 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4716 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4717 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4723 /* add playback controls from the parsed DAC table */
4724 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4725 const struct auto_pin_cfg *cfg)
4730 spec->multiout.num_dacs = 1;
4731 spec->multiout.dac_nids = spec->private_dac_nids;
4732 spec->multiout.dac_nids[0] = 0x02;
4734 nid = cfg->line_out_pins[0];
4736 err = alc260_add_playback_controls(spec, nid, "Front");
4741 nid = cfg->speaker_pins[0];
4743 err = alc260_add_playback_controls(spec, nid, "Speaker");
4748 nid = cfg->hp_pins[0];
4750 err = alc260_add_playback_controls(spec, nid, "Headphone");
4757 /* create playback/capture controls for input pins */
4758 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4759 const struct auto_pin_cfg *cfg)
4761 struct hda_input_mux *imux = &spec->private_imux;
4764 for (i = 0; i < AUTO_PIN_LAST; i++) {
4765 if (cfg->input_pins[i] >= 0x12) {
4766 idx = cfg->input_pins[i] - 0x12;
4767 err = new_analog_input(spec, cfg->input_pins[i],
4768 auto_pin_cfg_labels[i], idx,
4772 imux->items[imux->num_items].label =
4773 auto_pin_cfg_labels[i];
4774 imux->items[imux->num_items].index = idx;
4777 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4778 idx = cfg->input_pins[i] - 0x09;
4779 err = new_analog_input(spec, cfg->input_pins[i],
4780 auto_pin_cfg_labels[i], idx,
4784 imux->items[imux->num_items].label =
4785 auto_pin_cfg_labels[i];
4786 imux->items[imux->num_items].index = idx;
4793 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4794 hda_nid_t nid, int pin_type,
4798 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4800 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4802 /* need the manual connection? */
4804 int idx = nid - 0x12;
4805 snd_hda_codec_write(codec, idx + 0x0b, 0,
4806 AC_VERB_SET_CONNECT_SEL, sel_idx);
4810 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4812 struct alc_spec *spec = codec->spec;
4815 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4816 nid = spec->autocfg.line_out_pins[0];
4818 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4819 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4822 nid = spec->autocfg.speaker_pins[0];
4824 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4826 nid = spec->autocfg.hp_pins[0];
4828 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4831 #define ALC260_PIN_CD_NID 0x16
4832 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4834 struct alc_spec *spec = codec->spec;
4837 for (i = 0; i < AUTO_PIN_LAST; i++) {
4838 hda_nid_t nid = spec->autocfg.input_pins[i];
4840 snd_hda_codec_write(codec, nid, 0,
4841 AC_VERB_SET_PIN_WIDGET_CONTROL,
4842 i <= AUTO_PIN_FRONT_MIC ?
4843 PIN_VREF80 : PIN_IN);
4844 if (nid != ALC260_PIN_CD_NID)
4845 snd_hda_codec_write(codec, nid, 0,
4846 AC_VERB_SET_AMP_GAIN_MUTE,
4853 * generic initialization of ADC, input mixers and output mixers
4855 static struct hda_verb alc260_volume_init_verbs[] = {
4857 * Unmute ADC0-1 and set the default input to mic-in
4859 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4860 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4861 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4862 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4864 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4866 * Note: PASD motherboards uses the Line In 2 as the input for
4867 * front panel mic (mic 2)
4869 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4870 /* mute analog inputs */
4871 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4872 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4873 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4878 * Set up output mixers (0x08 - 0x0a)
4880 /* set vol=0 to output mixers */
4881 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4882 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4883 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4884 /* set up input amps for analog loopback */
4885 /* Amp Indices: DAC = 0, mixer = 1 */
4886 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4888 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4889 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4890 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4891 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4896 static int alc260_parse_auto_config(struct hda_codec *codec)
4898 struct alc_spec *spec = codec->spec;
4901 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4903 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4907 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4910 if (!spec->kctl_alloc)
4911 return 0; /* can't find valid BIOS pin config */
4912 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4916 spec->multiout.max_channels = 2;
4918 if (spec->autocfg.dig_out_pin)
4919 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4920 if (spec->kctl_alloc)
4921 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4923 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4925 spec->num_mux_defs = 1;
4926 spec->input_mux = &spec->private_imux;
4928 /* check whether NID 0x04 is valid */
4929 wcap = get_wcaps(codec, 0x04);
4930 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4931 if (wcap != AC_WID_AUD_IN) {
4932 spec->adc_nids = alc260_adc_nids_alt;
4933 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4934 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4936 spec->adc_nids = alc260_adc_nids;
4937 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4938 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4945 /* additional initialization for auto-configuration model */
4946 static void alc260_auto_init(struct hda_codec *codec)
4948 alc260_auto_init_multi_out(codec);
4949 alc260_auto_init_analog_input(codec);
4952 #ifdef CONFIG_SND_HDA_POWER_SAVE
4953 static struct hda_amp_list alc260_loopbacks[] = {
4954 { 0x07, HDA_INPUT, 0 },
4955 { 0x07, HDA_INPUT, 1 },
4956 { 0x07, HDA_INPUT, 2 },
4957 { 0x07, HDA_INPUT, 3 },
4958 { 0x07, HDA_INPUT, 4 },
4964 * ALC260 configurations
4966 static const char *alc260_models[ALC260_MODEL_LAST] = {
4967 [ALC260_BASIC] = "basic",
4969 [ALC260_HP_3013] = "hp-3013",
4970 [ALC260_FUJITSU_S702X] = "fujitsu",
4971 [ALC260_ACER] = "acer",
4972 [ALC260_WILL] = "will",
4973 [ALC260_REPLACER_672V] = "replacer",
4974 #ifdef CONFIG_SND_DEBUG
4975 [ALC260_TEST] = "test",
4977 [ALC260_AUTO] = "auto",
4980 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4981 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4982 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4983 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4984 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4985 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4986 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4987 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4988 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4989 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4990 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4991 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4992 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4993 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4994 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4995 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4996 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4997 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4998 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5002 static struct alc_config_preset alc260_presets[] = {
5004 .mixers = { alc260_base_output_mixer,
5006 alc260_pc_beep_mixer,
5007 alc260_capture_mixer },
5008 .init_verbs = { alc260_init_verbs },
5009 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5010 .dac_nids = alc260_dac_nids,
5011 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5012 .adc_nids = alc260_adc_nids,
5013 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5014 .channel_mode = alc260_modes,
5015 .input_mux = &alc260_capture_source,
5018 .mixers = { alc260_hp_output_mixer,
5020 alc260_capture_alt_mixer },
5021 .init_verbs = { alc260_init_verbs,
5022 alc260_hp_unsol_verbs },
5023 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5024 .dac_nids = alc260_dac_nids,
5025 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5026 .adc_nids = alc260_hp_adc_nids,
5027 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5028 .channel_mode = alc260_modes,
5029 .input_mux = &alc260_capture_source,
5030 .unsol_event = alc260_hp_unsol_event,
5031 .init_hook = alc260_hp_automute,
5033 [ALC260_HP_3013] = {
5034 .mixers = { alc260_hp_3013_mixer,
5036 alc260_capture_alt_mixer },
5037 .init_verbs = { alc260_hp_3013_init_verbs,
5038 alc260_hp_3013_unsol_verbs },
5039 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5040 .dac_nids = alc260_dac_nids,
5041 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5042 .adc_nids = alc260_hp_adc_nids,
5043 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5044 .channel_mode = alc260_modes,
5045 .input_mux = &alc260_capture_source,
5046 .unsol_event = alc260_hp_3013_unsol_event,
5047 .init_hook = alc260_hp_3013_automute,
5049 [ALC260_FUJITSU_S702X] = {
5050 .mixers = { alc260_fujitsu_mixer,
5051 alc260_capture_mixer },
5052 .init_verbs = { alc260_fujitsu_init_verbs },
5053 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5054 .dac_nids = alc260_dac_nids,
5055 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5056 .adc_nids = alc260_dual_adc_nids,
5057 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5058 .channel_mode = alc260_modes,
5059 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5060 .input_mux = alc260_fujitsu_capture_sources,
5063 .mixers = { alc260_acer_mixer,
5064 alc260_capture_mixer },
5065 .init_verbs = { alc260_acer_init_verbs },
5066 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5067 .dac_nids = alc260_dac_nids,
5068 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5069 .adc_nids = alc260_dual_adc_nids,
5070 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5071 .channel_mode = alc260_modes,
5072 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5073 .input_mux = alc260_acer_capture_sources,
5076 .mixers = { alc260_will_mixer,
5077 alc260_capture_mixer },
5078 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5079 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5080 .dac_nids = alc260_dac_nids,
5081 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5082 .adc_nids = alc260_adc_nids,
5083 .dig_out_nid = ALC260_DIGOUT_NID,
5084 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5085 .channel_mode = alc260_modes,
5086 .input_mux = &alc260_capture_source,
5088 [ALC260_REPLACER_672V] = {
5089 .mixers = { alc260_replacer_672v_mixer,
5090 alc260_capture_mixer },
5091 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5092 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5093 .dac_nids = alc260_dac_nids,
5094 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5095 .adc_nids = alc260_adc_nids,
5096 .dig_out_nid = ALC260_DIGOUT_NID,
5097 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5098 .channel_mode = alc260_modes,
5099 .input_mux = &alc260_capture_source,
5100 .unsol_event = alc260_replacer_672v_unsol_event,
5101 .init_hook = alc260_replacer_672v_automute,
5103 #ifdef CONFIG_SND_DEBUG
5105 .mixers = { alc260_test_mixer,
5106 alc260_capture_mixer },
5107 .init_verbs = { alc260_test_init_verbs },
5108 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5109 .dac_nids = alc260_test_dac_nids,
5110 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5111 .adc_nids = alc260_test_adc_nids,
5112 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5113 .channel_mode = alc260_modes,
5114 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5115 .input_mux = alc260_test_capture_sources,
5120 static int patch_alc260(struct hda_codec *codec)
5122 struct alc_spec *spec;
5123 int err, board_config;
5125 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5131 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5134 if (board_config < 0) {
5135 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5136 "trying auto-probe from BIOS...\n");
5137 board_config = ALC260_AUTO;
5140 if (board_config == ALC260_AUTO) {
5141 /* automatic parse from the BIOS config */
5142 err = alc260_parse_auto_config(codec);
5148 "hda_codec: Cannot set up configuration "
5149 "from BIOS. Using base mode...\n");
5150 board_config = ALC260_BASIC;
5154 if (board_config != ALC260_AUTO)
5155 setup_preset(spec, &alc260_presets[board_config]);
5157 spec->stream_name_analog = "ALC260 Analog";
5158 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5159 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5161 spec->stream_name_digital = "ALC260 Digital";
5162 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5163 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5165 spec->vmaster_nid = 0x08;
5167 codec->patch_ops = alc_patch_ops;
5168 if (board_config == ALC260_AUTO)
5169 spec->init_hook = alc260_auto_init;
5170 #ifdef CONFIG_SND_HDA_POWER_SAVE
5171 if (!spec->loopback.amplist)
5172 spec->loopback.amplist = alc260_loopbacks;
5182 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5183 * configuration. Each pin widget can choose any input DACs and a mixer.
5184 * Each ADC is connected from a mixer of all inputs. This makes possible
5185 * 6-channel independent captures.
5187 * In addition, an independent DAC for the multi-playback (not used in this
5190 #define ALC882_DIGOUT_NID 0x06
5191 #define ALC882_DIGIN_NID 0x0a
5193 static struct hda_channel_mode alc882_ch_modes[1] = {
5197 static hda_nid_t alc882_dac_nids[4] = {
5198 /* front, rear, clfe, rear_surr */
5199 0x02, 0x03, 0x04, 0x05
5202 /* identical with ALC880 */
5203 #define alc882_adc_nids alc880_adc_nids
5204 #define alc882_adc_nids_alt alc880_adc_nids_alt
5207 /* FIXME: should be a matrix-type input source selection */
5209 static struct hda_input_mux alc882_capture_source = {
5213 { "Front Mic", 0x1 },
5218 #define alc882_mux_enum_info alc_mux_enum_info
5219 #define alc882_mux_enum_get alc_mux_enum_get
5221 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5222 struct snd_ctl_elem_value *ucontrol)
5224 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5225 struct alc_spec *spec = codec->spec;
5226 const struct hda_input_mux *imux = spec->input_mux;
5227 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5228 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5229 hda_nid_t nid = capture_mixers[adc_idx];
5230 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5231 unsigned int i, idx;
5233 idx = ucontrol->value.enumerated.item[0];
5234 if (idx >= imux->num_items)
5235 idx = imux->num_items - 1;
5236 if (*cur_val == idx)
5238 for (i = 0; i < imux->num_items; i++) {
5239 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5240 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5241 imux->items[i].index,
5251 static struct hda_verb alc882_3ST_ch2_init[] = {
5252 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5253 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5254 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5255 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5262 static struct hda_verb alc882_3ST_ch6_init[] = {
5263 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5264 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5265 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5266 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5267 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5268 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5272 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5273 { 2, alc882_3ST_ch2_init },
5274 { 6, alc882_3ST_ch6_init },
5280 static struct hda_verb alc882_sixstack_ch6_init[] = {
5281 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5282 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5283 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5284 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5291 static struct hda_verb alc882_sixstack_ch8_init[] = {
5292 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5293 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5294 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5295 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5299 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5300 { 6, alc882_sixstack_ch6_init },
5301 { 8, alc882_sixstack_ch8_init },
5305 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5311 static struct hda_verb alc885_mbp_ch2_init[] = {
5312 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5313 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5314 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5321 static struct hda_verb alc885_mbp_ch6_init[] = {
5322 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5323 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5324 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5325 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5326 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5330 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5331 { 2, alc885_mbp_ch2_init },
5332 { 6, alc885_mbp_ch6_init },
5336 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5337 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5339 static struct snd_kcontrol_new alc882_base_mixer[] = {
5340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5341 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5342 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5343 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5348 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5349 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5351 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5352 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5353 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5354 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5358 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5359 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5360 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5361 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5362 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5366 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5367 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5368 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5369 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5370 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5372 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5374 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5375 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5379 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5380 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5381 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5382 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5383 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5389 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5390 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5394 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5395 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5396 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5398 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5399 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
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, 0x0, HDA_INPUT),
5403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5404 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5405 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5407 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5411 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5412 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5414 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5416 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5418 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5419 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5420 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5421 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5422 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5423 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5424 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5425 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5426 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5431 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5432 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5440 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5442 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5443 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5447 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5450 .name = "Channel Mode",
5451 .info = alc_ch_mode_info,
5452 .get = alc_ch_mode_get,
5453 .put = alc_ch_mode_put,
5458 static struct hda_verb alc882_init_verbs[] = {
5459 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5476 /* Front Pin: output 0 (0x0c) */
5477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5479 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5480 /* Rear Pin: output 1 (0x0d) */
5481 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5484 /* CLFE Pin: output 2 (0x0e) */
5485 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5486 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5487 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5488 /* Side Pin: output 3 (0x0f) */
5489 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5490 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5491 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5492 /* Mic (rear) pin: input vref at 80% */
5493 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5494 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5495 /* Front Mic pin: input vref at 80% */
5496 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5497 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5498 /* Line In pin: input */
5499 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5501 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5502 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5503 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5504 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5505 /* CD pin widget for input */
5506 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5508 /* FIXME: use matrix-type input source selection */
5509 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5510 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5511 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5512 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5521 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5522 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5525 /* ADC1: mute amp left and right */
5526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5527 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5528 /* ADC2: mute amp left and right */
5529 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5530 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5531 /* ADC3: mute amp left and right */
5532 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5533 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5538 static struct hda_verb alc882_eapd_verbs[] = {
5539 /* change to EAPD mode */
5540 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5541 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5546 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5547 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5548 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5549 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5552 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5553 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5557 static struct hda_verb alc882_macpro_init_verbs[] = {
5558 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5562 /* Front Pin: output 0 (0x0c) */
5563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5566 /* Front Mic pin: input vref at 80% */
5567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5569 /* Speaker: output */
5570 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5573 /* Headphone output (output 0 - 0x0c) */
5574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5576 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5578 /* FIXME: use matrix-type input source selection */
5579 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5580 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5595 /* ADC1: mute amp left and right */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5598 /* ADC2: mute amp left and right */
5599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5601 /* ADC3: mute amp left and right */
5602 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5603 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5608 /* Macbook Pro rev3 */
5609 static struct hda_verb alc885_mbp3_init_verbs[] = {
5610 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5618 /* Front Pin: output 0 (0x0c) */
5619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5621 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5622 /* HP Pin: output 0 (0x0d) */
5623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5625 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5627 /* Mic (rear) pin: input vref at 80% */
5628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5630 /* Front Mic pin: input vref at 80% */
5631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5632 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5633 /* Line In pin: use output 1 when in LineOut mode */
5634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5636 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5638 /* FIXME: use matrix-type input source selection */
5639 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5640 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5647 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5655 /* ADC1: mute amp left and right */
5656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5657 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5658 /* ADC2: mute amp left and right */
5659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5660 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5661 /* ADC3: mute amp left and right */
5662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5663 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5668 /* iMac 24 mixer. */
5669 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5670 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5671 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5675 /* iMac 24 init verbs. */
5676 static struct hda_verb alc885_imac24_init_verbs[] = {
5677 /* Internal speakers: output 0 (0x0c) */
5678 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5679 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5680 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5681 /* Internal speakers: output 0 (0x0c) */
5682 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5684 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5685 /* Headphone: output 0 (0x0c) */
5686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5688 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5689 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5690 /* Front Mic: input vref at 80% */
5691 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5696 /* Toggle speaker-output according to the hp-jack state */
5697 static void alc885_imac24_automute(struct hda_codec *codec)
5699 unsigned int present;
5701 present = snd_hda_codec_read(codec, 0x14, 0,
5702 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5703 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5704 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5705 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5706 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5709 /* Processes unsolicited events. */
5710 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5713 /* Headphone insertion or removal. */
5714 if ((res >> 26) == ALC880_HP_EVENT)
5715 alc885_imac24_automute(codec);
5718 static void alc885_mbp3_automute(struct hda_codec *codec)
5720 unsigned int present;
5722 present = snd_hda_codec_read(codec, 0x15, 0,
5723 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5724 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5725 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5726 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5727 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5730 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5733 /* Headphone insertion or removal. */
5734 if ((res >> 26) == ALC880_HP_EVENT)
5735 alc885_mbp3_automute(codec);
5739 static struct hda_verb alc882_targa_verbs[] = {
5740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5746 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5747 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5748 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5750 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5751 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5752 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5753 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5757 /* toggle speaker-output according to the hp-jack state */
5758 static void alc882_targa_automute(struct hda_codec *codec)
5760 unsigned int present;
5762 present = snd_hda_codec_read(codec, 0x14, 0,
5763 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5764 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5765 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5766 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5770 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5772 /* Looks like the unsol event is incompatible with the standard
5773 * definition. 4bit tag is placed at 26 bit!
5775 if (((res >> 26) == ALC880_HP_EVENT)) {
5776 alc882_targa_automute(codec);
5780 static struct hda_verb alc882_asus_a7j_verbs[] = {
5781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5784 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5786 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5788 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5790 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5792 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5793 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5794 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5798 static struct hda_verb alc882_asus_a7m_verbs[] = {
5799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5803 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5804 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5806 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5807 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5808 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5810 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5811 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5812 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5816 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5818 unsigned int gpiostate, gpiomask, gpiodir;
5820 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5821 AC_VERB_GET_GPIO_DATA, 0);
5824 gpiostate |= (1 << pin);
5826 gpiostate &= ~(1 << pin);
5828 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5829 AC_VERB_GET_GPIO_MASK, 0);
5830 gpiomask |= (1 << pin);
5832 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5833 AC_VERB_GET_GPIO_DIRECTION, 0);
5834 gpiodir |= (1 << pin);
5837 snd_hda_codec_write(codec, codec->afg, 0,
5838 AC_VERB_SET_GPIO_MASK, gpiomask);
5839 snd_hda_codec_write(codec, codec->afg, 0,
5840 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5844 snd_hda_codec_write(codec, codec->afg, 0,
5845 AC_VERB_SET_GPIO_DATA, gpiostate);
5848 /* set up GPIO at initialization */
5849 static void alc885_macpro_init_hook(struct hda_codec *codec)
5851 alc882_gpio_mute(codec, 0, 0);
5852 alc882_gpio_mute(codec, 1, 0);
5855 /* set up GPIO and update auto-muting at initialization */
5856 static void alc885_imac24_init_hook(struct hda_codec *codec)
5858 alc885_macpro_init_hook(codec);
5859 alc885_imac24_automute(codec);
5863 * generic initialization of ADC, input mixers and output mixers
5865 static struct hda_verb alc882_auto_init_verbs[] = {
5867 * Unmute ADC0-2 and set the default input to mic-in
5869 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5870 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5871 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5872 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5873 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5874 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5876 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5878 * Note: PASD motherboards uses the Line In 2 as the input for
5879 * front panel mic (mic 2)
5881 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5883 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5884 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5885 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5886 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5889 * Set up output mixers (0x0c - 0x0f)
5891 /* set vol=0 to output mixers */
5892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5893 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5894 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5895 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5896 /* set up input amps for analog loopback */
5897 /* Amp Indices: DAC = 0, mixer = 1 */
5898 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5900 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5902 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5904 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5905 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5906 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5907 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5909 /* FIXME: use matrix-type input source selection */
5910 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5911 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5917 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5930 /* capture mixer elements */
5931 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5932 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5933 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5934 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5935 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5938 /* The multiple "Capture Source" controls confuse alsamixer
5939 * So call somewhat different..
5941 /* .name = "Capture Source", */
5942 .name = "Input Source",
5944 .info = alc882_mux_enum_info,
5945 .get = alc882_mux_enum_get,
5946 .put = alc882_mux_enum_put,
5951 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5952 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5953 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5954 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5955 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5956 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5957 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5959 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5960 /* The multiple "Capture Source" controls confuse alsamixer
5961 * So call somewhat different..
5963 /* .name = "Capture Source", */
5964 .name = "Input Source",
5966 .info = alc882_mux_enum_info,
5967 .get = alc882_mux_enum_get,
5968 .put = alc882_mux_enum_put,
5973 #ifdef CONFIG_SND_HDA_POWER_SAVE
5974 #define alc882_loopbacks alc880_loopbacks
5977 /* pcm configuration: identiacal with ALC880 */
5978 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5979 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5980 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5981 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5984 * configuration and preset
5986 static const char *alc882_models[ALC882_MODEL_LAST] = {
5987 [ALC882_3ST_DIG] = "3stack-dig",
5988 [ALC882_6ST_DIG] = "6stack-dig",
5989 [ALC882_ARIMA] = "arima",
5990 [ALC882_W2JC] = "w2jc",
5991 [ALC882_TARGA] = "targa",
5992 [ALC882_ASUS_A7J] = "asus-a7j",
5993 [ALC882_ASUS_A7M] = "asus-a7m",
5994 [ALC885_MACPRO] = "macpro",
5995 [ALC885_MBP3] = "mbp3",
5996 [ALC885_IMAC24] = "imac24",
5997 [ALC882_AUTO] = "auto",
6000 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6001 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6002 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6003 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6004 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6005 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6006 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6007 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6008 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6009 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6010 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6011 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6012 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6016 static struct alc_config_preset alc882_presets[] = {
6017 [ALC882_3ST_DIG] = {
6018 .mixers = { alc882_base_mixer },
6019 .init_verbs = { alc882_init_verbs },
6020 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6021 .dac_nids = alc882_dac_nids,
6022 .dig_out_nid = ALC882_DIGOUT_NID,
6023 .dig_in_nid = ALC882_DIGIN_NID,
6024 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6025 .channel_mode = alc882_ch_modes,
6027 .input_mux = &alc882_capture_source,
6029 [ALC882_6ST_DIG] = {
6030 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6031 .init_verbs = { alc882_init_verbs },
6032 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6033 .dac_nids = alc882_dac_nids,
6034 .dig_out_nid = ALC882_DIGOUT_NID,
6035 .dig_in_nid = ALC882_DIGIN_NID,
6036 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6037 .channel_mode = alc882_sixstack_modes,
6038 .input_mux = &alc882_capture_source,
6041 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6042 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6043 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6044 .dac_nids = alc882_dac_nids,
6045 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6046 .channel_mode = alc882_sixstack_modes,
6047 .input_mux = &alc882_capture_source,
6050 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6051 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6052 alc880_gpio1_init_verbs },
6053 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6054 .dac_nids = alc882_dac_nids,
6055 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6056 .channel_mode = alc880_threestack_modes,
6058 .input_mux = &alc882_capture_source,
6059 .dig_out_nid = ALC882_DIGOUT_NID,
6062 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6063 .init_verbs = { alc885_mbp3_init_verbs,
6064 alc880_gpio1_init_verbs },
6065 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6066 .dac_nids = alc882_dac_nids,
6067 .channel_mode = alc885_mbp_6ch_modes,
6068 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6069 .input_mux = &alc882_capture_source,
6070 .dig_out_nid = ALC882_DIGOUT_NID,
6071 .dig_in_nid = ALC882_DIGIN_NID,
6072 .unsol_event = alc885_mbp3_unsol_event,
6073 .init_hook = alc885_mbp3_automute,
6076 .mixers = { alc882_macpro_mixer },
6077 .init_verbs = { alc882_macpro_init_verbs },
6078 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6079 .dac_nids = alc882_dac_nids,
6080 .dig_out_nid = ALC882_DIGOUT_NID,
6081 .dig_in_nid = ALC882_DIGIN_NID,
6082 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6083 .channel_mode = alc882_ch_modes,
6084 .input_mux = &alc882_capture_source,
6085 .init_hook = alc885_macpro_init_hook,
6088 .mixers = { alc885_imac24_mixer },
6089 .init_verbs = { alc885_imac24_init_verbs },
6090 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6091 .dac_nids = alc882_dac_nids,
6092 .dig_out_nid = ALC882_DIGOUT_NID,
6093 .dig_in_nid = ALC882_DIGIN_NID,
6094 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6095 .channel_mode = alc882_ch_modes,
6096 .input_mux = &alc882_capture_source,
6097 .unsol_event = alc885_imac24_unsol_event,
6098 .init_hook = alc885_imac24_init_hook,
6101 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6102 alc882_capture_mixer },
6103 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6104 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6105 .dac_nids = alc882_dac_nids,
6106 .dig_out_nid = ALC882_DIGOUT_NID,
6107 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6108 .adc_nids = alc882_adc_nids,
6109 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6110 .channel_mode = alc882_3ST_6ch_modes,
6112 .input_mux = &alc882_capture_source,
6113 .unsol_event = alc882_targa_unsol_event,
6114 .init_hook = alc882_targa_automute,
6116 [ALC882_ASUS_A7J] = {
6117 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6118 alc882_capture_mixer },
6119 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6120 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6121 .dac_nids = alc882_dac_nids,
6122 .dig_out_nid = ALC882_DIGOUT_NID,
6123 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6124 .adc_nids = alc882_adc_nids,
6125 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6126 .channel_mode = alc882_3ST_6ch_modes,
6128 .input_mux = &alc882_capture_source,
6130 [ALC882_ASUS_A7M] = {
6131 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6132 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6133 alc880_gpio1_init_verbs,
6134 alc882_asus_a7m_verbs },
6135 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6136 .dac_nids = alc882_dac_nids,
6137 .dig_out_nid = ALC882_DIGOUT_NID,
6138 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6139 .channel_mode = alc880_threestack_modes,
6141 .input_mux = &alc882_capture_source,
6150 PINFIX_ABIT_AW9D_MAX
6153 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6154 { 0x15, 0x01080104 }, /* side */
6155 { 0x16, 0x01011012 }, /* rear */
6156 { 0x17, 0x01016011 }, /* clfe */
6160 static const struct alc_pincfg *alc882_pin_fixes[] = {
6161 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6164 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6165 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6170 * BIOS auto configuration
6172 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6173 hda_nid_t nid, int pin_type,
6177 struct alc_spec *spec = codec->spec;
6180 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6183 idx = spec->multiout.dac_nids[dac_idx] - 2;
6185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6187 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6193 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6195 struct alc_spec *spec = codec->spec;
6198 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6199 for (i = 0; i <= HDA_SIDE; i++) {
6200 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6201 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6203 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6208 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6210 struct alc_spec *spec = codec->spec;
6213 pin = spec->autocfg.hp_pins[0];
6214 if (pin) /* connect to front */
6216 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6219 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6220 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6222 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6224 struct alc_spec *spec = codec->spec;
6227 for (i = 0; i < AUTO_PIN_LAST; i++) {
6228 hda_nid_t nid = spec->autocfg.input_pins[i];
6229 if (alc882_is_input_pin(nid)) {
6230 snd_hda_codec_write(codec, nid, 0,
6231 AC_VERB_SET_PIN_WIDGET_CONTROL,
6232 i <= AUTO_PIN_FRONT_MIC ?
6233 PIN_VREF80 : PIN_IN);
6234 if (nid != ALC882_PIN_CD_NID)
6235 snd_hda_codec_write(codec, nid, 0,
6236 AC_VERB_SET_AMP_GAIN_MUTE,
6242 /* add mic boosts if needed */
6243 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6245 struct alc_spec *spec = codec->spec;
6249 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6250 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6251 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6253 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6257 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6258 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6259 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6261 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6268 /* almost identical with ALC880 parser... */
6269 static int alc882_parse_auto_config(struct hda_codec *codec)
6271 struct alc_spec *spec = codec->spec;
6272 int err = alc880_parse_auto_config(codec);
6277 return 0; /* no config found */
6279 err = alc_auto_add_mic_boost(codec);
6283 /* hack - override the init verbs */
6284 spec->init_verbs[0] = alc882_auto_init_verbs;
6286 return 1; /* config found */
6289 /* additional initialization for auto-configuration model */
6290 static void alc882_auto_init(struct hda_codec *codec)
6292 alc882_auto_init_multi_out(codec);
6293 alc882_auto_init_hp_out(codec);
6294 alc882_auto_init_analog_input(codec);
6297 static int patch_alc882(struct hda_codec *codec)
6299 struct alc_spec *spec;
6300 int err, board_config;
6302 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6308 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6312 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6313 /* Pick up systems that don't supply PCI SSID */
6314 switch (codec->subsystem_id) {
6315 case 0x106b0c00: /* Mac Pro */
6316 board_config = ALC885_MACPRO;
6318 case 0x106b1000: /* iMac 24 */
6319 board_config = ALC885_IMAC24;
6321 case 0x106b00a1: /* Macbook */
6322 case 0x106b2c00: /* Macbook Pro rev3 */
6323 board_config = ALC885_MBP3;
6326 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6327 "trying auto-probe from BIOS...\n");
6328 board_config = ALC882_AUTO;
6332 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6334 if (board_config == ALC882_AUTO) {
6335 /* automatic parse from the BIOS config */
6336 err = alc882_parse_auto_config(codec);
6342 "hda_codec: Cannot set up configuration "
6343 "from BIOS. Using base mode...\n");
6344 board_config = ALC882_3ST_DIG;
6348 if (board_config != ALC882_AUTO)
6349 setup_preset(spec, &alc882_presets[board_config]);
6351 spec->stream_name_analog = "ALC882 Analog";
6352 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6353 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6354 /* FIXME: setup DAC5 */
6355 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6356 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6358 spec->stream_name_digital = "ALC882 Digital";
6359 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6360 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6362 if (!spec->adc_nids && spec->input_mux) {
6363 /* check whether NID 0x07 is valid */
6364 unsigned int wcap = get_wcaps(codec, 0x07);
6366 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6367 if (wcap != AC_WID_AUD_IN) {
6368 spec->adc_nids = alc882_adc_nids_alt;
6369 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6370 spec->mixers[spec->num_mixers] =
6371 alc882_capture_alt_mixer;
6374 spec->adc_nids = alc882_adc_nids;
6375 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6376 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6381 spec->vmaster_nid = 0x0c;
6383 codec->patch_ops = alc_patch_ops;
6384 if (board_config == ALC882_AUTO)
6385 spec->init_hook = alc882_auto_init;
6386 #ifdef CONFIG_SND_HDA_POWER_SAVE
6387 if (!spec->loopback.amplist)
6388 spec->loopback.amplist = alc882_loopbacks;
6397 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6398 * configuration. Each pin widget can choose any input DACs and a mixer.
6399 * Each ADC is connected from a mixer of all inputs. This makes possible
6400 * 6-channel independent captures.
6402 * In addition, an independent DAC for the multi-playback (not used in this
6405 #define ALC883_DIGOUT_NID 0x06
6406 #define ALC883_DIGIN_NID 0x0a
6408 static hda_nid_t alc883_dac_nids[4] = {
6409 /* front, rear, clfe, rear_surr */
6410 0x02, 0x04, 0x03, 0x05
6413 static hda_nid_t alc883_adc_nids[2] = {
6419 /* FIXME: should be a matrix-type input source selection */
6421 static struct hda_input_mux alc883_capture_source = {
6425 { "Front Mic", 0x1 },
6431 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6439 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6449 #define alc883_mux_enum_info alc_mux_enum_info
6450 #define alc883_mux_enum_get alc_mux_enum_get
6452 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6453 struct snd_ctl_elem_value *ucontrol)
6455 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6456 struct alc_spec *spec = codec->spec;
6457 const struct hda_input_mux *imux = spec->input_mux;
6458 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6459 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6460 hda_nid_t nid = capture_mixers[adc_idx];
6461 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6462 unsigned int i, idx;
6464 idx = ucontrol->value.enumerated.item[0];
6465 if (idx >= imux->num_items)
6466 idx = imux->num_items - 1;
6467 if (*cur_val == idx)
6469 for (i = 0; i < imux->num_items; i++) {
6470 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6471 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6472 imux->items[i].index,
6482 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6489 static struct hda_verb alc883_3ST_ch2_init[] = {
6490 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6491 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6492 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6493 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6500 static struct hda_verb alc883_3ST_ch4_init[] = {
6501 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6502 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6503 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6504 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6505 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6512 static struct hda_verb alc883_3ST_ch6_init[] = {
6513 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6514 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6515 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6516 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6517 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6518 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6522 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6523 { 2, alc883_3ST_ch2_init },
6524 { 4, alc883_3ST_ch4_init },
6525 { 6, alc883_3ST_ch6_init },
6531 static struct hda_verb alc883_sixstack_ch6_init[] = {
6532 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6533 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6534 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6535 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6542 static struct hda_verb alc883_sixstack_ch8_init[] = {
6543 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6544 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6545 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6546 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6550 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6551 { 6, alc883_sixstack_ch6_init },
6552 { 8, alc883_sixstack_ch8_init },
6555 static struct hda_verb alc883_medion_eapd_verbs[] = {
6556 /* eanable EAPD on medion laptop */
6557 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6558 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6562 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6563 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6566 static struct snd_kcontrol_new alc883_base_mixer[] = {
6567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6568 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6569 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6570 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6571 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6572 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6573 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6574 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6575 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6576 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6580 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6581 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6583 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6585 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6586 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6588 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6589 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6590 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6591 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6592 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6593 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6596 /* .name = "Capture Source", */
6597 .name = "Input Source",
6599 .info = alc883_mux_enum_info,
6600 .get = alc883_mux_enum_get,
6601 .put = alc883_mux_enum_put,
6606 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6607 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6608 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6609 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6610 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6611 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6612 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6616 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6617 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6618 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6620 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6621 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6622 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6623 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6626 /* .name = "Capture Source", */
6627 .name = "Input Source",
6629 .info = alc883_mux_enum_info,
6630 .get = alc883_mux_enum_get,
6631 .put = alc883_mux_enum_put,
6636 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6640 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6641 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6642 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6643 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6647 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6648 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6649 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6650 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6651 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6652 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6653 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6654 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6655 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6657 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6658 /* .name = "Capture Source", */
6659 .name = "Input Source",
6661 .info = alc883_mux_enum_info,
6662 .get = alc883_mux_enum_get,
6663 .put = alc883_mux_enum_put,
6668 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6669 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6670 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6671 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6672 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6673 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6675 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6676 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6680 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6681 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6685 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6686 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6688 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6689 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6690 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6691 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6692 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6693 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6695 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6696 /* .name = "Capture Source", */
6697 .name = "Input Source",
6699 .info = alc883_mux_enum_info,
6700 .get = alc883_mux_enum_get,
6701 .put = alc883_mux_enum_put,
6706 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6707 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6708 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6709 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6710 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6711 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6712 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6713 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6714 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6716 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6717 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6724 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6726 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6727 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6728 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6729 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6732 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6733 /* .name = "Capture Source", */
6734 .name = "Input Source",
6736 .info = alc883_mux_enum_info,
6737 .get = alc883_mux_enum_get,
6738 .put = alc883_mux_enum_put,
6743 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6746 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6748 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6749 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6750 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6751 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6752 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6755 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6756 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6758 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6760 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6761 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6762 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6763 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6765 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6766 /* .name = "Capture Source", */
6767 .name = "Input Source",
6769 .info = alc883_mux_enum_info,
6770 .get = alc883_mux_enum_get,
6771 .put = alc883_mux_enum_put,
6776 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6777 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6779 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6780 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6781 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6783 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6785 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6786 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6787 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6788 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6790 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6791 /* .name = "Capture Source", */
6792 .name = "Input Source",
6794 .info = alc883_mux_enum_info,
6795 .get = alc883_mux_enum_get,
6796 .put = alc883_mux_enum_put,
6801 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6802 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6803 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6804 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6805 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6810 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6811 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6814 /* .name = "Capture Source", */
6815 .name = "Input Source",
6817 .info = alc883_mux_enum_info,
6818 .get = alc883_mux_enum_get,
6819 .put = alc883_mux_enum_put,
6824 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6826 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6832 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6833 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6834 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6835 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6836 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6837 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6839 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6840 /* .name = "Capture Source", */
6841 .name = "Input Source",
6843 .info = alc883_mux_enum_info,
6844 .get = alc883_mux_enum_get,
6845 .put = alc883_mux_enum_put,
6850 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6852 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6853 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6854 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6855 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6860 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6861 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6862 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6863 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6866 /* .name = "Capture Source", */
6867 .name = "Input Source",
6869 .info = alc883_mux_enum_info,
6870 .get = alc883_mux_enum_get,
6871 .put = alc883_mux_enum_put,
6876 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6880 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6885 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6886 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6895 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6897 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6898 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6899 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6900 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6901 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6902 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6903 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6906 /* .name = "Capture Source", */
6907 .name = "Input Source",
6909 .info = alc883_mux_enum_info,
6910 .get = alc883_mux_enum_get,
6911 .put = alc883_mux_enum_put,
6916 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6918 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6919 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6920 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6934 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6936 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6937 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6938 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6939 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6940 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6941 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6944 /* .name = "Capture Source", */
6945 .name = "Input Source",
6947 .info = alc883_mux_enum_info,
6948 .get = alc883_mux_enum_get,
6949 .put = alc883_mux_enum_put,
6954 static struct snd_kcontrol_new alc888_6st_dell_mixer[] = {
6955 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6956 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6957 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6958 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6959 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6960 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6961 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6962 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6963 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6964 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6966 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6967 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6968 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6969 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6970 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6973 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6975 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6976 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6977 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6978 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6979 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6980 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6981 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6983 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6984 /* .name = "Capture Source", */
6985 .name = "Input Source",
6987 .info = alc883_mux_enum_info,
6988 .get = alc883_mux_enum_get,
6989 .put = alc883_mux_enum_put,
6994 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6995 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6996 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7003 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7004 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7005 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7006 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7009 /* .name = "Capture Source", */
7010 .name = "Input Source",
7012 .info = alc883_mux_enum_info,
7013 .get = alc883_mux_enum_get,
7014 .put = alc883_mux_enum_put,
7019 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7022 .name = "Channel Mode",
7023 .info = alc_ch_mode_info,
7024 .get = alc_ch_mode_get,
7025 .put = alc_ch_mode_put,
7030 static struct hda_verb alc883_init_verbs[] = {
7031 /* ADC1: mute amp left and right */
7032 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7033 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7034 /* ADC2: mute amp left and right */
7035 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7036 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7037 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7040 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7042 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7048 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7051 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7052 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7054 /* mute analog input loopbacks */
7055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7057 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7058 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7061 /* Front Pin: output 0 (0x0c) */
7062 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7064 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7065 /* Rear Pin: output 1 (0x0d) */
7066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7069 /* CLFE Pin: output 2 (0x0e) */
7070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7072 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7073 /* Side Pin: output 3 (0x0f) */
7074 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7076 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7077 /* Mic (rear) pin: input vref at 80% */
7078 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7079 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7080 /* Front Mic pin: input vref at 80% */
7081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7082 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7083 /* Line In pin: input */
7084 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7085 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7086 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7089 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7090 /* CD pin widget for input */
7091 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7093 /* FIXME: use matrix-type input source selection */
7094 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7108 /* toggle speaker-output according to the hp-jack state */
7109 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7111 unsigned int present;
7113 present = snd_hda_codec_read(codec, 0x15, 0,
7114 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7115 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7116 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7117 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7118 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7121 /* auto-toggle front mic */
7123 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7125 unsigned int present;
7128 present = snd_hda_codec_read(codec, 0x18, 0,
7129 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7130 bits = present ? HDA_AMP_MUTE : 0;
7131 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7135 static void alc883_mitac_automute(struct hda_codec *codec)
7137 alc883_mitac_hp_automute(codec);
7138 /* alc883_mitac_mic_automute(codec); */
7141 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7144 switch (res >> 26) {
7145 case ALC880_HP_EVENT:
7146 alc883_mitac_hp_automute(codec);
7148 case ALC880_MIC_EVENT:
7149 /* alc883_mitac_mic_automute(codec); */
7154 static struct hda_verb alc883_mitac_verbs[] = {
7156 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7159 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7160 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7162 /* enable unsolicited event */
7163 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7164 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7169 static struct hda_verb alc883_tagra_verbs[] = {
7170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7174 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7176 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7177 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7178 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7180 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7181 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7182 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7183 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7188 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7189 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7190 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7191 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7195 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7196 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7198 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7199 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7203 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7206 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7207 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7212 static struct hda_verb alc883_haier_w66_verbs[] = {
7213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7218 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7219 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7221 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7225 static struct hda_verb alc888_6st_hp_verbs[] = {
7226 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7227 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
7228 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
7229 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7233 static struct hda_verb alc888_3st_hp_verbs[] = {
7234 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7235 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7236 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7240 static struct hda_verb alc888_6st_dell_verbs[] = {
7241 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7242 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */
7243 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */
7244 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
7245 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7249 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7250 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7251 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7252 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7253 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7257 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7258 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7259 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7260 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7261 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7265 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7266 { 2, alc888_3st_hp_2ch_init },
7267 { 6, alc888_3st_hp_6ch_init },
7270 /* toggle front-jack and RCA according to the hp-jack state */
7271 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7273 unsigned int present;
7275 present = snd_hda_codec_read(codec, 0x1b, 0,
7276 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7277 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7278 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7279 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7280 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7283 /* toggle RCA according to the front-jack state */
7284 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7286 unsigned int present;
7288 present = snd_hda_codec_read(codec, 0x14, 0,
7289 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7290 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7291 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7294 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7297 if ((res >> 26) == ALC880_HP_EVENT)
7298 alc888_lenovo_ms7195_front_automute(codec);
7299 if ((res >> 26) == ALC880_FRONT_EVENT)
7300 alc888_lenovo_ms7195_rca_automute(codec);
7303 static struct hda_verb alc883_medion_md2_verbs[] = {
7304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7309 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7313 /* toggle speaker-output according to the hp-jack state */
7314 static void alc883_medion_md2_automute(struct hda_codec *codec)
7316 unsigned int present;
7318 present = snd_hda_codec_read(codec, 0x14, 0,
7319 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7320 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7321 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7324 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7327 if ((res >> 26) == ALC880_HP_EVENT)
7328 alc883_medion_md2_automute(codec);
7331 /* toggle speaker-output according to the hp-jack state */
7332 static void alc883_tagra_automute(struct hda_codec *codec)
7334 unsigned int present;
7337 present = snd_hda_codec_read(codec, 0x14, 0,
7338 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7339 bits = present ? HDA_AMP_MUTE : 0;
7340 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7341 HDA_AMP_MUTE, bits);
7342 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7346 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7348 if ((res >> 26) == ALC880_HP_EVENT)
7349 alc883_tagra_automute(codec);
7352 static void alc883_haier_w66_automute(struct hda_codec *codec)
7354 unsigned int present;
7357 present = snd_hda_codec_read(codec, 0x1b, 0,
7358 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7359 bits = present ? 0x80 : 0;
7360 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7364 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7367 if ((res >> 26) == ALC880_HP_EVENT)
7368 alc883_haier_w66_automute(codec);
7371 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7373 unsigned int present;
7376 present = snd_hda_codec_read(codec, 0x14, 0,
7377 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7378 bits = present ? HDA_AMP_MUTE : 0;
7379 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7380 HDA_AMP_MUTE, bits);
7383 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7385 unsigned int present;
7388 present = snd_hda_codec_read(codec, 0x1b, 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);
7393 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7394 HDA_AMP_MUTE, bits);
7397 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7400 if ((res >> 26) == ALC880_HP_EVENT)
7401 alc883_lenovo_101e_all_automute(codec);
7402 if ((res >> 26) == ALC880_FRONT_EVENT)
7403 alc883_lenovo_101e_ispeaker_automute(codec);
7406 /* toggle speaker-output according to the hp-jack state */
7407 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7409 unsigned int present;
7411 present = snd_hda_codec_read(codec, 0x14, 0,
7412 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7413 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7414 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7415 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7416 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7419 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7422 if ((res >> 26) == ALC880_HP_EVENT)
7423 alc883_acer_aspire_automute(codec);
7426 static struct hda_verb alc883_acer_eapd_verbs[] = {
7427 /* HP Pin: output 0 (0x0c) */
7428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7430 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7431 /* Front Pin: output 0 (0x0c) */
7432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7433 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7434 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7435 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7436 /* eanable EAPD on medion laptop */
7437 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7438 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7439 /* enable unsolicited event */
7440 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7444 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7446 unsigned int present;
7448 present = snd_hda_codec_read(codec, 0x1b, 0,
7449 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7450 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7451 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7452 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7453 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7454 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7455 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7456 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7457 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7460 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7463 switch (res >> 26) {
7464 case ALC880_HP_EVENT:
7465 printk("hp_event\n");
7466 alc888_6st_dell_front_automute(codec);
7472 * generic initialization of ADC, input mixers and output mixers
7474 static struct hda_verb alc883_auto_init_verbs[] = {
7476 * Unmute ADC0-2 and set the default input to mic-in
7478 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7479 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7480 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7481 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7483 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7485 * Note: PASD motherboards uses the Line In 2 as the input for
7486 * front panel mic (mic 2)
7488 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7493 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7496 * Set up output mixers (0x0c - 0x0f)
7498 /* set vol=0 to output mixers */
7499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7503 /* set up input amps for analog loopback */
7504 /* Amp Indices: DAC = 0, mixer = 1 */
7505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7508 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7509 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7510 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7511 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7512 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7513 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7514 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7516 /* FIXME: use matrix-type input source selection */
7517 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7522 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7528 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7534 /* capture mixer elements */
7535 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7536 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7537 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7538 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7539 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7541 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7542 /* The multiple "Capture Source" controls confuse alsamixer
7543 * So call somewhat different..
7545 /* .name = "Capture Source", */
7546 .name = "Input Source",
7548 .info = alc882_mux_enum_info,
7549 .get = alc882_mux_enum_get,
7550 .put = alc882_mux_enum_put,
7555 #ifdef CONFIG_SND_HDA_POWER_SAVE
7556 #define alc883_loopbacks alc880_loopbacks
7559 /* pcm configuration: identiacal with ALC880 */
7560 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7561 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7562 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7563 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7564 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7567 * configuration and preset
7569 static const char *alc883_models[ALC883_MODEL_LAST] = {
7570 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7571 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7572 [ALC883_3ST_6ch] = "3stack-6ch",
7573 [ALC883_6ST_DIG] = "6stack-dig",
7574 [ALC883_TARGA_DIG] = "targa-dig",
7575 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7576 [ALC883_ACER] = "acer",
7577 [ALC883_ACER_ASPIRE] = "acer-aspire",
7578 [ALC883_MEDION] = "medion",
7579 [ALC883_MEDION_MD2] = "medion-md2",
7580 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7581 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7582 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7583 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7584 [ALC883_HAIER_W66] = "haier-w66",
7585 [ALC888_6ST_HP] = "6stack-hp",
7586 [ALC888_3ST_HP] = "3stack-hp",
7587 [ALC888_6ST_DELL] = "6stack-dell",
7588 [ALC883_MITAC] = "mitac",
7589 [ALC883_AUTO] = "auto",
7592 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7593 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7594 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7595 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7596 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7597 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7598 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7599 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7600 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7601 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7602 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7603 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7604 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7605 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7606 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7607 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7608 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7609 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7610 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7611 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7612 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7613 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7614 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7615 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7616 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7617 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7618 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7619 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7620 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7621 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7622 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7623 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7624 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7625 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7626 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7627 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7628 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7629 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7630 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7631 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7632 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7633 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7634 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7635 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7636 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7637 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7638 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7642 static struct alc_config_preset alc883_presets[] = {
7643 [ALC883_3ST_2ch_DIG] = {
7644 .mixers = { alc883_3ST_2ch_mixer },
7645 .init_verbs = { alc883_init_verbs },
7646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7647 .dac_nids = alc883_dac_nids,
7648 .dig_out_nid = ALC883_DIGOUT_NID,
7649 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7650 .adc_nids = alc883_adc_nids,
7651 .dig_in_nid = ALC883_DIGIN_NID,
7652 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7653 .channel_mode = alc883_3ST_2ch_modes,
7654 .input_mux = &alc883_capture_source,
7656 [ALC883_3ST_6ch_DIG] = {
7657 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_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 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7663 .adc_nids = alc883_adc_nids,
7664 .dig_in_nid = ALC883_DIGIN_NID,
7665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7666 .channel_mode = alc883_3ST_6ch_modes,
7668 .input_mux = &alc883_capture_source,
7670 [ALC883_3ST_6ch] = {
7671 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7672 .init_verbs = { alc883_init_verbs },
7673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7674 .dac_nids = alc883_dac_nids,
7675 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7676 .adc_nids = alc883_adc_nids,
7677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7678 .channel_mode = alc883_3ST_6ch_modes,
7680 .input_mux = &alc883_capture_source,
7682 [ALC883_6ST_DIG] = {
7683 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7684 .init_verbs = { alc883_init_verbs },
7685 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7686 .dac_nids = alc883_dac_nids,
7687 .dig_out_nid = ALC883_DIGOUT_NID,
7688 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7689 .adc_nids = alc883_adc_nids,
7690 .dig_in_nid = ALC883_DIGIN_NID,
7691 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7692 .channel_mode = alc883_sixstack_modes,
7693 .input_mux = &alc883_capture_source,
7695 [ALC883_TARGA_DIG] = {
7696 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7697 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7699 .dac_nids = alc883_dac_nids,
7700 .dig_out_nid = ALC883_DIGOUT_NID,
7701 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7702 .adc_nids = alc883_adc_nids,
7703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7704 .channel_mode = alc883_3ST_6ch_modes,
7706 .input_mux = &alc883_capture_source,
7707 .unsol_event = alc883_tagra_unsol_event,
7708 .init_hook = alc883_tagra_automute,
7710 [ALC883_TARGA_2ch_DIG] = {
7711 .mixers = { alc883_tagra_2ch_mixer},
7712 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7714 .dac_nids = alc883_dac_nids,
7715 .dig_out_nid = ALC883_DIGOUT_NID,
7716 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7717 .adc_nids = alc883_adc_nids,
7718 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7719 .channel_mode = alc883_3ST_2ch_modes,
7720 .input_mux = &alc883_capture_source,
7721 .unsol_event = alc883_tagra_unsol_event,
7722 .init_hook = alc883_tagra_automute,
7725 .mixers = { alc883_base_mixer },
7726 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7727 * and the headphone jack. Turn this on and rely on the
7728 * standard mute methods whenever the user wants to turn
7729 * these outputs off.
7731 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7733 .dac_nids = alc883_dac_nids,
7734 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7735 .adc_nids = alc883_adc_nids,
7736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7737 .channel_mode = alc883_3ST_2ch_modes,
7738 .input_mux = &alc883_capture_source,
7740 [ALC883_ACER_ASPIRE] = {
7741 .mixers = { alc883_acer_aspire_mixer },
7742 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7743 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7744 .dac_nids = alc883_dac_nids,
7745 .dig_out_nid = ALC883_DIGOUT_NID,
7746 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7747 .adc_nids = alc883_adc_nids,
7748 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7749 .channel_mode = alc883_3ST_2ch_modes,
7750 .input_mux = &alc883_capture_source,
7751 .unsol_event = alc883_acer_aspire_unsol_event,
7752 .init_hook = alc883_acer_aspire_automute,
7755 .mixers = { alc883_fivestack_mixer,
7756 alc883_chmode_mixer },
7757 .init_verbs = { alc883_init_verbs,
7758 alc883_medion_eapd_verbs },
7759 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7760 .dac_nids = alc883_dac_nids,
7761 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7762 .adc_nids = alc883_adc_nids,
7763 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7764 .channel_mode = alc883_sixstack_modes,
7765 .input_mux = &alc883_capture_source,
7767 [ALC883_MEDION_MD2] = {
7768 .mixers = { alc883_medion_md2_mixer},
7769 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7770 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7771 .dac_nids = alc883_dac_nids,
7772 .dig_out_nid = ALC883_DIGOUT_NID,
7773 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7774 .adc_nids = alc883_adc_nids,
7775 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7776 .channel_mode = alc883_3ST_2ch_modes,
7777 .input_mux = &alc883_capture_source,
7778 .unsol_event = alc883_medion_md2_unsol_event,
7779 .init_hook = alc883_medion_md2_automute,
7781 [ALC883_LAPTOP_EAPD] = {
7782 .mixers = { alc883_base_mixer },
7783 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7784 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7785 .dac_nids = alc883_dac_nids,
7786 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7787 .adc_nids = alc883_adc_nids,
7788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7789 .channel_mode = alc883_3ST_2ch_modes,
7790 .input_mux = &alc883_capture_source,
7792 [ALC883_LENOVO_101E_2ch] = {
7793 .mixers = { alc883_lenovo_101e_2ch_mixer},
7794 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7796 .dac_nids = alc883_dac_nids,
7797 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7798 .adc_nids = alc883_adc_nids,
7799 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7800 .channel_mode = alc883_3ST_2ch_modes,
7801 .input_mux = &alc883_lenovo_101e_capture_source,
7802 .unsol_event = alc883_lenovo_101e_unsol_event,
7803 .init_hook = alc883_lenovo_101e_all_automute,
7805 [ALC883_LENOVO_NB0763] = {
7806 .mixers = { alc883_lenovo_nb0763_mixer },
7807 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7808 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7809 .dac_nids = alc883_dac_nids,
7810 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7811 .adc_nids = alc883_adc_nids,
7812 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7813 .channel_mode = alc883_3ST_2ch_modes,
7815 .input_mux = &alc883_lenovo_nb0763_capture_source,
7816 .unsol_event = alc883_medion_md2_unsol_event,
7817 .init_hook = alc883_medion_md2_automute,
7819 [ALC888_LENOVO_MS7195_DIG] = {
7820 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7821 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7822 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7823 .dac_nids = alc883_dac_nids,
7824 .dig_out_nid = ALC883_DIGOUT_NID,
7825 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7826 .adc_nids = alc883_adc_nids,
7827 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7828 .channel_mode = alc883_3ST_6ch_modes,
7830 .input_mux = &alc883_capture_source,
7831 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7832 .init_hook = alc888_lenovo_ms7195_front_automute,
7834 [ALC883_HAIER_W66] = {
7835 .mixers = { alc883_tagra_2ch_mixer},
7836 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7837 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7838 .dac_nids = alc883_dac_nids,
7839 .dig_out_nid = ALC883_DIGOUT_NID,
7840 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7841 .adc_nids = alc883_adc_nids,
7842 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7843 .channel_mode = alc883_3ST_2ch_modes,
7844 .input_mux = &alc883_capture_source,
7845 .unsol_event = alc883_haier_w66_unsol_event,
7846 .init_hook = alc883_haier_w66_automute,
7849 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7850 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7851 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7852 .dac_nids = alc883_dac_nids,
7853 .dig_out_nid = ALC883_DIGOUT_NID,
7854 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7855 .adc_nids = alc883_adc_nids,
7856 .dig_in_nid = ALC883_DIGIN_NID,
7857 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7858 .channel_mode = alc883_sixstack_modes,
7859 .input_mux = &alc883_capture_source,
7862 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7863 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7864 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7865 .dac_nids = alc883_dac_nids,
7866 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7867 .adc_nids = alc883_adc_nids,
7868 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7869 .channel_mode = alc888_3st_hp_modes,
7871 .input_mux = &alc883_capture_source,
7873 [ALC888_6ST_DELL] = {
7874 .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer },
7875 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7876 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7877 .dac_nids = alc883_dac_nids,
7878 .dig_out_nid = ALC883_DIGOUT_NID,
7879 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7880 .adc_nids = alc883_adc_nids,
7881 .dig_in_nid = ALC883_DIGIN_NID,
7882 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7883 .channel_mode = alc883_sixstack_modes,
7884 .input_mux = &alc883_capture_source,
7885 .unsol_event = alc888_6st_dell_unsol_event,
7886 .init_hook = alc888_6st_dell_front_automute,
7889 .mixers = { alc883_mitac_mixer },
7890 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7891 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7892 .dac_nids = alc883_dac_nids,
7893 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7894 .adc_nids = alc883_adc_nids,
7895 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7896 .channel_mode = alc883_3ST_2ch_modes,
7897 .input_mux = &alc883_capture_source,
7898 .unsol_event = alc883_mitac_unsol_event,
7899 .init_hook = alc883_mitac_automute,
7905 * BIOS auto configuration
7907 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7908 hda_nid_t nid, int pin_type,
7912 struct alc_spec *spec = codec->spec;
7915 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7918 idx = spec->multiout.dac_nids[dac_idx] - 2;
7920 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7922 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7924 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7928 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7930 struct alc_spec *spec = codec->spec;
7933 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7934 for (i = 0; i <= HDA_SIDE; i++) {
7935 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7936 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7938 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7943 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7945 struct alc_spec *spec = codec->spec;
7948 pin = spec->autocfg.hp_pins[0];
7949 if (pin) /* connect to front */
7951 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7954 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7955 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7957 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7959 struct alc_spec *spec = codec->spec;
7962 for (i = 0; i < AUTO_PIN_LAST; i++) {
7963 hda_nid_t nid = spec->autocfg.input_pins[i];
7964 if (alc883_is_input_pin(nid)) {
7965 snd_hda_codec_write(codec, nid, 0,
7966 AC_VERB_SET_PIN_WIDGET_CONTROL,
7967 (i <= AUTO_PIN_FRONT_MIC ?
7968 PIN_VREF80 : PIN_IN));
7969 if (nid != ALC883_PIN_CD_NID)
7970 snd_hda_codec_write(codec, nid, 0,
7971 AC_VERB_SET_AMP_GAIN_MUTE,
7977 /* almost identical with ALC880 parser... */
7978 static int alc883_parse_auto_config(struct hda_codec *codec)
7980 struct alc_spec *spec = codec->spec;
7981 int err = alc880_parse_auto_config(codec);
7986 return 0; /* no config found */
7988 err = alc_auto_add_mic_boost(codec);
7992 /* hack - override the init verbs */
7993 spec->init_verbs[0] = alc883_auto_init_verbs;
7994 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7997 return 1; /* config found */
8000 /* additional initialization for auto-configuration model */
8001 static void alc883_auto_init(struct hda_codec *codec)
8003 alc883_auto_init_multi_out(codec);
8004 alc883_auto_init_hp_out(codec);
8005 alc883_auto_init_analog_input(codec);
8008 static int patch_alc883(struct hda_codec *codec)
8010 struct alc_spec *spec;
8011 int err, board_config;
8013 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8019 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8022 if (board_config < 0) {
8023 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8024 "trying auto-probe from BIOS...\n");
8025 board_config = ALC883_AUTO;
8028 if (board_config == ALC883_AUTO) {
8029 /* automatic parse from the BIOS config */
8030 err = alc883_parse_auto_config(codec);
8036 "hda_codec: Cannot set up configuration "
8037 "from BIOS. Using base mode...\n");
8038 board_config = ALC883_3ST_2ch_DIG;
8042 if (board_config != ALC883_AUTO)
8043 setup_preset(spec, &alc883_presets[board_config]);
8045 spec->stream_name_analog = "ALC883 Analog";
8046 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8047 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8048 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8050 spec->stream_name_digital = "ALC883 Digital";
8051 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8052 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8054 if (!spec->adc_nids && spec->input_mux) {
8055 spec->adc_nids = alc883_adc_nids;
8056 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8059 spec->vmaster_nid = 0x0c;
8061 codec->patch_ops = alc_patch_ops;
8062 if (board_config == ALC883_AUTO)
8063 spec->init_hook = alc883_auto_init;
8064 #ifdef CONFIG_SND_HDA_POWER_SAVE
8065 if (!spec->loopback.amplist)
8066 spec->loopback.amplist = alc883_loopbacks;
8076 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8077 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8079 #define alc262_dac_nids alc260_dac_nids
8080 #define alc262_adc_nids alc882_adc_nids
8081 #define alc262_adc_nids_alt alc882_adc_nids_alt
8083 #define alc262_modes alc260_modes
8084 #define alc262_capture_source alc882_capture_source
8086 static struct snd_kcontrol_new alc262_base_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 Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8101 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8103 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8104 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8108 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8110 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8111 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8112 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8119 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8121 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8122 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8123 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8128 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8130 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8133 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8138 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8139 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8140 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8141 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8142 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8143 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8144 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8145 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8146 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8147 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8148 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8152 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8154 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8156 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8157 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8158 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8159 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8160 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8161 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8164 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8165 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8166 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8167 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8171 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8172 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8178 /* mute/unmute internal speaker according to the hp jack and mute state */
8179 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8181 struct alc_spec *spec = codec->spec;
8183 if (force || !spec->sense_updated) {
8184 unsigned int present;
8185 present = snd_hda_codec_read(codec, 0x15, 0,
8186 AC_VERB_GET_PIN_SENSE, 0);
8187 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8188 spec->sense_updated = 1;
8190 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8191 spec->jack_present ? HDA_AMP_MUTE : 0);
8194 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8197 if ((res >> 26) != ALC880_HP_EVENT)
8199 alc262_hp_t5735_automute(codec, 1);
8202 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8204 alc262_hp_t5735_automute(codec, 1);
8207 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8208 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8209 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8210 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8218 static struct hda_verb alc262_hp_t5735_verbs[] = {
8219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8226 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8227 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8229 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8230 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8236 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8237 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8238 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8239 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8241 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8242 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8250 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8257 /* bind hp and internal speaker mute (with plug check) */
8258 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8259 struct snd_ctl_elem_value *ucontrol)
8261 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8262 long *valp = ucontrol->value.integer.value;
8265 /* change hp mute */
8266 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8268 valp[0] ? 0 : HDA_AMP_MUTE);
8269 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8271 valp[1] ? 0 : HDA_AMP_MUTE);
8273 /* change speaker according to HP jack state */
8274 struct alc_spec *spec = codec->spec;
8276 if (spec->jack_present)
8277 mute = HDA_AMP_MUTE;
8279 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8281 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8282 HDA_AMP_MUTE, mute);
8287 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8288 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8290 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8291 .name = "Master Playback Switch",
8292 .info = snd_hda_mixer_amp_switch_info,
8293 .get = snd_hda_mixer_amp_switch_get,
8294 .put = alc262_sony_master_sw_put,
8295 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8299 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8300 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8304 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8306 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8307 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8310 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8311 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8315 #define alc262_capture_mixer alc882_capture_mixer
8316 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8319 * generic initialization of ADC, input mixers and output mixers
8321 static struct hda_verb alc262_init_verbs[] = {
8323 * Unmute ADC0-2 and set the default input to mic-in
8325 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8327 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8329 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8332 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8334 * Note: PASD motherboards uses the Line In 2 as the input for
8335 * front panel mic (mic 2)
8337 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8345 * Set up output mixers (0x0c - 0x0e)
8347 /* set vol=0 to output mixers */
8348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8351 /* set up input amps for analog loopback */
8352 /* Amp Indices: DAC = 0, mixer = 1 */
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8365 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8369 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8370 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8373 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8374 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8376 /* FIXME: use matrix-type input source selection */
8377 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8378 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8379 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8380 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8384 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8385 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8391 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8397 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8398 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8399 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8403 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8404 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8405 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8406 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8408 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8413 static struct hda_verb alc262_sony_unsol_verbs[] = {
8414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8415 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8416 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8422 /* mute/unmute internal speaker according to the hp jack and mute state */
8423 static void alc262_hippo_automute(struct hda_codec *codec)
8425 struct alc_spec *spec = codec->spec;
8427 unsigned int present;
8429 /* need to execute and sync at first */
8430 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8431 present = snd_hda_codec_read(codec, 0x15, 0,
8432 AC_VERB_GET_PIN_SENSE, 0);
8433 spec->jack_present = (present & 0x80000000) != 0;
8434 if (spec->jack_present) {
8435 /* mute internal speaker */
8436 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8437 HDA_AMP_MUTE, HDA_AMP_MUTE);
8439 /* unmute internal speaker if necessary */
8440 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8441 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8442 HDA_AMP_MUTE, mute);
8446 /* unsolicited event for HP jack sensing */
8447 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8450 if ((res >> 26) != ALC880_HP_EVENT)
8452 alc262_hippo_automute(codec);
8455 static void alc262_hippo1_automute(struct hda_codec *codec)
8458 unsigned int present;
8460 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8461 present = snd_hda_codec_read(codec, 0x1b, 0,
8462 AC_VERB_GET_PIN_SENSE, 0);
8463 present = (present & 0x80000000) != 0;
8465 /* mute internal speaker */
8466 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8467 HDA_AMP_MUTE, HDA_AMP_MUTE);
8469 /* unmute internal speaker if necessary */
8470 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8471 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8472 HDA_AMP_MUTE, mute);
8476 /* unsolicited event for HP jack sensing */
8477 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8480 if ((res >> 26) != ALC880_HP_EVENT)
8482 alc262_hippo1_automute(codec);
8487 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8490 #define ALC_HP_EVENT 0x37
8492 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8493 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8498 static struct hda_input_mux alc262_fujitsu_capture_source = {
8507 static struct hda_input_mux alc262_HP_capture_source = {
8511 { "Front Mic", 0x1 },
8518 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8522 { "Front Mic", 0x2 },
8528 /* mute/unmute internal speaker according to the hp jack and mute state */
8529 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8531 struct alc_spec *spec = codec->spec;
8534 if (force || !spec->sense_updated) {
8535 unsigned int present;
8536 /* need to execute and sync at first */
8537 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8538 present = snd_hda_codec_read(codec, 0x14, 0,
8539 AC_VERB_GET_PIN_SENSE, 0);
8540 spec->jack_present = (present & 0x80000000) != 0;
8541 spec->sense_updated = 1;
8543 if (spec->jack_present) {
8544 /* mute internal speaker */
8545 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8546 HDA_AMP_MUTE, HDA_AMP_MUTE);
8548 /* unmute internal speaker if necessary */
8549 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8550 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8551 HDA_AMP_MUTE, mute);
8555 /* unsolicited event for HP jack sensing */
8556 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8559 if ((res >> 26) != ALC_HP_EVENT)
8561 alc262_fujitsu_automute(codec, 1);
8564 /* bind volumes of both NID 0x0c and 0x0d */
8565 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8566 .ops = &snd_hda_bind_vol,
8568 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8569 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8574 /* bind hp and internal speaker mute (with plug check) */
8575 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8576 struct snd_ctl_elem_value *ucontrol)
8578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8579 long *valp = ucontrol->value.integer.value;
8582 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8584 valp[0] ? 0 : HDA_AMP_MUTE);
8585 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8587 valp[1] ? 0 : HDA_AMP_MUTE);
8589 alc262_fujitsu_automute(codec, 0);
8593 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8594 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8597 .name = "Master Playback Switch",
8598 .info = snd_hda_mixer_amp_switch_info,
8599 .get = snd_hda_mixer_amp_switch_get,
8600 .put = alc262_fujitsu_master_sw_put,
8601 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8608 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8609 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8610 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8614 /* additional init verbs for Benq laptops */
8615 static struct hda_verb alc262_EAPD_verbs[] = {
8616 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8617 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8621 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8622 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8623 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8625 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8626 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8630 /* Samsung Q1 Ultra Vista model setup */
8631 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8632 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8633 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8637 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8641 static struct hda_verb alc262_ultra_verbs[] = {
8642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8645 /* Mic is on Node 0x19 */
8646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8647 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8649 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8651 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8656 static struct hda_input_mux alc262_ultra_capture_source = {
8663 /* mute/unmute internal speaker according to the hp jack and mute state */
8664 static void alc262_ultra_automute(struct hda_codec *codec)
8666 struct alc_spec *spec = codec->spec;
8668 unsigned int present;
8670 /* need to execute and sync at first */
8671 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8672 present = snd_hda_codec_read(codec, 0x15, 0,
8673 AC_VERB_GET_PIN_SENSE, 0);
8674 spec->jack_present = (present & 0x80000000) != 0;
8675 if (spec->jack_present) {
8676 /* mute internal speaker */
8677 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8678 HDA_AMP_MUTE, HDA_AMP_MUTE);
8680 /* unmute internal speaker if necessary */
8681 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8682 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8683 HDA_AMP_MUTE, mute);
8687 /* unsolicited event for HP jack sensing */
8688 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8691 if ((res >> 26) != ALC880_HP_EVENT)
8693 alc262_ultra_automute(codec);
8696 /* add playback controls from the parsed DAC table */
8697 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8698 const struct auto_pin_cfg *cfg)
8703 spec->multiout.num_dacs = 1; /* only use one dac */
8704 spec->multiout.dac_nids = spec->private_dac_nids;
8705 spec->multiout.dac_nids[0] = 2;
8707 nid = cfg->line_out_pins[0];
8709 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8710 "Front Playback Volume",
8711 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8714 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8715 "Front Playback Switch",
8716 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8721 nid = cfg->speaker_pins[0];
8724 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8725 "Speaker Playback Volume",
8726 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8730 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8731 "Speaker Playback Switch",
8732 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8737 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8738 "Speaker Playback Switch",
8739 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8745 nid = cfg->hp_pins[0];
8747 /* spec->multiout.hp_nid = 2; */
8749 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8750 "Headphone Playback Volume",
8751 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8755 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8756 "Headphone Playback Switch",
8757 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8762 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8763 "Headphone Playback Switch",
8764 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8773 /* identical with ALC880 */
8774 #define alc262_auto_create_analog_input_ctls \
8775 alc880_auto_create_analog_input_ctls
8778 * generic initialization of ADC, input mixers and output mixers
8780 static struct hda_verb alc262_volume_init_verbs[] = {
8782 * Unmute ADC0-2 and set the default input to mic-in
8784 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8785 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8786 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8788 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8791 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8793 * Note: PASD motherboards uses the Line In 2 as the input for
8794 * front panel mic (mic 2)
8796 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8804 * Set up output mixers (0x0c - 0x0f)
8806 /* set vol=0 to output mixers */
8807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8811 /* set up input amps for analog loopback */
8812 /* Amp Indices: DAC = 0, mixer = 1 */
8813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8820 /* FIXME: use matrix-type input source selection */
8821 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8822 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8823 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8824 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8825 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8826 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8828 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8829 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8830 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8831 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8836 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8841 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8843 * Unmute ADC0-2 and set the default input to mic-in
8845 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8847 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8848 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8849 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8850 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8852 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8854 * Note: PASD motherboards uses the Line In 2 as the input for
8855 * front panel mic (mic 2)
8857 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8858 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8859 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8867 * Set up output mixers (0x0c - 0x0e)
8869 /* set vol=0 to output mixers */
8870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8871 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8872 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8874 /* set up input amps for analog loopback */
8875 /* Amp Indices: DAC = 0, mixer = 1 */
8876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8879 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8883 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8885 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8890 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8891 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8893 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8894 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8895 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8896 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8897 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8902 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8903 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8904 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8907 /* FIXME: use matrix-type input source selection */
8908 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8909 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8912 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8915 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8916 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8917 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8920 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8928 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8930 * Unmute ADC0-2 and set the default input to mic-in
8932 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8933 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8934 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8936 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8939 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8941 * Note: PASD motherboards uses the Line In 2 as the input for front
8944 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8954 * Set up output mixers (0x0c - 0x0e)
8956 /* set vol=0 to output mixers */
8957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8961 /* set up input amps for analog loopback */
8962 /* Amp Indices: DAC = 0, mixer = 1 */
8963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8965 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8966 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8967 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8973 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8976 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8977 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8979 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8982 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8983 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8985 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8986 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8989 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8990 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8992 /* FIXME: use matrix-type input source selection */
8993 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8994 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8996 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9000 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9008 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9016 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9022 #ifdef CONFIG_SND_HDA_POWER_SAVE
9023 #define alc262_loopbacks alc880_loopbacks
9026 /* pcm configuration: identiacal with ALC880 */
9027 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9028 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9029 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9030 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9033 * BIOS auto configuration
9035 static int alc262_parse_auto_config(struct hda_codec *codec)
9037 struct alc_spec *spec = codec->spec;
9039 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9041 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9045 if (!spec->autocfg.line_outs)
9046 return 0; /* can't find valid BIOS pin config */
9047 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9050 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9054 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9056 if (spec->autocfg.dig_out_pin)
9057 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9058 if (spec->autocfg.dig_in_pin)
9059 spec->dig_in_nid = ALC262_DIGIN_NID;
9061 if (spec->kctl_alloc)
9062 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9064 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9065 spec->num_mux_defs = 1;
9066 spec->input_mux = &spec->private_imux;
9068 err = alc_auto_add_mic_boost(codec);
9075 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9076 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9077 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9080 /* init callback for auto-configuration model -- overriding the default init */
9081 static void alc262_auto_init(struct hda_codec *codec)
9083 alc262_auto_init_multi_out(codec);
9084 alc262_auto_init_hp_out(codec);
9085 alc262_auto_init_analog_input(codec);
9089 * configuration and preset
9091 static const char *alc262_models[ALC262_MODEL_LAST] = {
9092 [ALC262_BASIC] = "basic",
9093 [ALC262_HIPPO] = "hippo",
9094 [ALC262_HIPPO_1] = "hippo_1",
9095 [ALC262_FUJITSU] = "fujitsu",
9096 [ALC262_HP_BPC] = "hp-bpc",
9097 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9098 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9099 [ALC262_HP_RP5700] = "hp-rp5700",
9100 [ALC262_BENQ_ED8] = "benq",
9101 [ALC262_BENQ_T31] = "benq-t31",
9102 [ALC262_SONY_ASSAMD] = "sony-assamd",
9103 [ALC262_ULTRA] = "ultra",
9104 [ALC262_AUTO] = "auto",
9107 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9108 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9109 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9110 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9111 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9112 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9113 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9114 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9115 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9116 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9117 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9118 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9119 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9120 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9121 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9122 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9123 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9124 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9125 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9126 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9127 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9128 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9129 ALC262_HP_TC_T5735),
9130 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9131 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9132 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9133 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9134 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9135 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9136 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9137 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9138 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9139 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9140 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9144 static struct alc_config_preset alc262_presets[] = {
9146 .mixers = { alc262_base_mixer },
9147 .init_verbs = { alc262_init_verbs },
9148 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9149 .dac_nids = alc262_dac_nids,
9151 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9152 .channel_mode = alc262_modes,
9153 .input_mux = &alc262_capture_source,
9156 .mixers = { alc262_base_mixer },
9157 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9158 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9159 .dac_nids = alc262_dac_nids,
9161 .dig_out_nid = ALC262_DIGOUT_NID,
9162 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9163 .channel_mode = alc262_modes,
9164 .input_mux = &alc262_capture_source,
9165 .unsol_event = alc262_hippo_unsol_event,
9166 .init_hook = alc262_hippo_automute,
9168 [ALC262_HIPPO_1] = {
9169 .mixers = { alc262_hippo1_mixer },
9170 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9171 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9172 .dac_nids = alc262_dac_nids,
9174 .dig_out_nid = ALC262_DIGOUT_NID,
9175 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9176 .channel_mode = alc262_modes,
9177 .input_mux = &alc262_capture_source,
9178 .unsol_event = alc262_hippo1_unsol_event,
9179 .init_hook = alc262_hippo1_automute,
9181 [ALC262_FUJITSU] = {
9182 .mixers = { alc262_fujitsu_mixer },
9183 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9184 alc262_fujitsu_unsol_verbs },
9185 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9186 .dac_nids = alc262_dac_nids,
9188 .dig_out_nid = ALC262_DIGOUT_NID,
9189 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9190 .channel_mode = alc262_modes,
9191 .input_mux = &alc262_fujitsu_capture_source,
9192 .unsol_event = alc262_fujitsu_unsol_event,
9195 .mixers = { alc262_HP_BPC_mixer },
9196 .init_verbs = { alc262_HP_BPC_init_verbs },
9197 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9198 .dac_nids = alc262_dac_nids,
9200 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9201 .channel_mode = alc262_modes,
9202 .input_mux = &alc262_HP_capture_source,
9204 [ALC262_HP_BPC_D7000_WF] = {
9205 .mixers = { alc262_HP_BPC_WildWest_mixer },
9206 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9207 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9208 .dac_nids = alc262_dac_nids,
9210 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9211 .channel_mode = alc262_modes,
9212 .input_mux = &alc262_HP_D7000_capture_source,
9214 [ALC262_HP_BPC_D7000_WL] = {
9215 .mixers = { alc262_HP_BPC_WildWest_mixer,
9216 alc262_HP_BPC_WildWest_option_mixer },
9217 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9218 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9219 .dac_nids = alc262_dac_nids,
9221 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9222 .channel_mode = alc262_modes,
9223 .input_mux = &alc262_HP_D7000_capture_source,
9225 [ALC262_HP_TC_T5735] = {
9226 .mixers = { alc262_hp_t5735_mixer },
9227 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9228 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9229 .dac_nids = alc262_dac_nids,
9231 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9232 .channel_mode = alc262_modes,
9233 .input_mux = &alc262_capture_source,
9234 .unsol_event = alc262_hp_t5735_unsol_event,
9235 .init_hook = alc262_hp_t5735_init_hook,
9237 [ALC262_HP_RP5700] = {
9238 .mixers = { alc262_hp_rp5700_mixer },
9239 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9240 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9241 .dac_nids = alc262_dac_nids,
9242 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9243 .channel_mode = alc262_modes,
9244 .input_mux = &alc262_hp_rp5700_capture_source,
9246 [ALC262_BENQ_ED8] = {
9247 .mixers = { alc262_base_mixer },
9248 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9249 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9250 .dac_nids = alc262_dac_nids,
9252 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9253 .channel_mode = alc262_modes,
9254 .input_mux = &alc262_capture_source,
9256 [ALC262_SONY_ASSAMD] = {
9257 .mixers = { alc262_sony_mixer },
9258 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9259 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9260 .dac_nids = alc262_dac_nids,
9262 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9263 .channel_mode = alc262_modes,
9264 .input_mux = &alc262_capture_source,
9265 .unsol_event = alc262_hippo_unsol_event,
9266 .init_hook = alc262_hippo_automute,
9268 [ALC262_BENQ_T31] = {
9269 .mixers = { alc262_benq_t31_mixer },
9270 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9271 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9272 .dac_nids = alc262_dac_nids,
9274 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9275 .channel_mode = alc262_modes,
9276 .input_mux = &alc262_capture_source,
9277 .unsol_event = alc262_hippo_unsol_event,
9278 .init_hook = alc262_hippo_automute,
9281 .mixers = { alc262_ultra_mixer },
9282 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
9283 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9284 .dac_nids = alc262_dac_nids,
9286 .dig_out_nid = ALC262_DIGOUT_NID,
9287 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9288 .channel_mode = alc262_modes,
9289 .input_mux = &alc262_ultra_capture_source,
9290 .unsol_event = alc262_ultra_unsol_event,
9291 .init_hook = alc262_ultra_automute,
9295 static int patch_alc262(struct hda_codec *codec)
9297 struct alc_spec *spec;
9301 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9307 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9312 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9313 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9314 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9315 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9319 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9323 if (board_config < 0) {
9324 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9325 "trying auto-probe from BIOS...\n");
9326 board_config = ALC262_AUTO;
9329 if (board_config == ALC262_AUTO) {
9330 /* automatic parse from the BIOS config */
9331 err = alc262_parse_auto_config(codec);
9337 "hda_codec: Cannot set up configuration "
9338 "from BIOS. Using base mode...\n");
9339 board_config = ALC262_BASIC;
9343 if (board_config != ALC262_AUTO)
9344 setup_preset(spec, &alc262_presets[board_config]);
9346 spec->stream_name_analog = "ALC262 Analog";
9347 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9348 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9350 spec->stream_name_digital = "ALC262 Digital";
9351 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9352 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9354 if (!spec->adc_nids && spec->input_mux) {
9355 /* check whether NID 0x07 is valid */
9356 unsigned int wcap = get_wcaps(codec, 0x07);
9359 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9360 if (wcap != AC_WID_AUD_IN) {
9361 spec->adc_nids = alc262_adc_nids_alt;
9362 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9363 spec->mixers[spec->num_mixers] =
9364 alc262_capture_alt_mixer;
9367 spec->adc_nids = alc262_adc_nids;
9368 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9369 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9374 spec->vmaster_nid = 0x0c;
9376 codec->patch_ops = alc_patch_ops;
9377 if (board_config == ALC262_AUTO)
9378 spec->init_hook = alc262_auto_init;
9379 #ifdef CONFIG_SND_HDA_POWER_SAVE
9380 if (!spec->loopback.amplist)
9381 spec->loopback.amplist = alc262_loopbacks;
9388 * ALC268 channel source setting (2 channel)
9390 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9391 #define alc268_modes alc260_modes
9393 static hda_nid_t alc268_dac_nids[2] = {
9398 static hda_nid_t alc268_adc_nids[2] = {
9403 static hda_nid_t alc268_adc_nids_alt[1] = {
9408 static struct snd_kcontrol_new alc268_base_mixer[] = {
9409 /* output mixer control */
9410 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9411 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9415 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9416 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9420 static struct hda_verb alc268_eapd_verbs[] = {
9421 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9422 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9426 /* Toshiba specific */
9427 #define alc268_toshiba_automute alc262_hippo_automute
9429 static struct hda_verb alc268_toshiba_verbs[] = {
9430 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9435 /* bind volumes of both NID 0x02 and 0x03 */
9436 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9437 .ops = &snd_hda_bind_vol,
9439 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9440 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9445 /* mute/unmute internal speaker according to the hp jack and mute state */
9446 static void alc268_acer_automute(struct hda_codec *codec, int force)
9448 struct alc_spec *spec = codec->spec;
9451 if (force || !spec->sense_updated) {
9452 unsigned int present;
9453 present = snd_hda_codec_read(codec, 0x14, 0,
9454 AC_VERB_GET_PIN_SENSE, 0);
9455 spec->jack_present = (present & 0x80000000) != 0;
9456 spec->sense_updated = 1;
9458 if (spec->jack_present)
9459 mute = HDA_AMP_MUTE; /* mute internal speaker */
9460 else /* unmute internal speaker if necessary */
9461 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9462 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9463 HDA_AMP_MUTE, mute);
9467 /* bind hp and internal speaker mute (with plug check) */
9468 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9469 struct snd_ctl_elem_value *ucontrol)
9471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9472 long *valp = ucontrol->value.integer.value;
9475 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9477 valp[0] ? 0 : HDA_AMP_MUTE);
9478 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9480 valp[1] ? 0 : HDA_AMP_MUTE);
9482 alc268_acer_automute(codec, 0);
9486 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9487 /* output mixer control */
9488 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9491 .name = "Master Playback Switch",
9492 .info = snd_hda_mixer_amp_switch_info,
9493 .get = snd_hda_mixer_amp_switch_get,
9494 .put = alc268_acer_master_sw_put,
9495 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9497 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9498 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9499 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9503 static struct hda_verb alc268_acer_verbs[] = {
9504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9507 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9511 /* unsolicited event for HP jack sensing */
9512 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9515 if ((res >> 26) != ALC880_HP_EVENT)
9517 alc268_toshiba_automute(codec);
9520 static void alc268_acer_unsol_event(struct hda_codec *codec,
9523 if ((res >> 26) != ALC880_HP_EVENT)
9525 alc268_acer_automute(codec, 1);
9528 static void alc268_acer_init_hook(struct hda_codec *codec)
9530 alc268_acer_automute(codec, 1);
9533 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9534 /* output mixer control */
9535 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9536 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9537 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9538 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9540 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9544 static struct hda_verb alc268_dell_verbs[] = {
9545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9547 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9551 /* mute/unmute internal speaker according to the hp jack and mute state */
9552 static void alc268_dell_automute(struct hda_codec *codec)
9554 unsigned int present;
9557 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9558 if (present & 0x80000000)
9559 mute = HDA_AMP_MUTE;
9561 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9562 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9563 HDA_AMP_MUTE, mute);
9566 static void alc268_dell_unsol_event(struct hda_codec *codec,
9569 if ((res >> 26) != ALC880_HP_EVENT)
9571 alc268_dell_automute(codec);
9574 #define alc268_dell_init_hook alc268_dell_automute
9577 * generic initialization of ADC, input mixers and output mixers
9579 static struct hda_verb alc268_base_init_verbs[] = {
9580 /* Unmute DAC0-1 and set vol = 0 */
9581 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9582 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9583 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9584 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9585 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9586 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9589 * Set up output mixers (0x0c - 0x0e)
9591 /* set vol=0 to output mixers */
9592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9595 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9598 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9602 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9603 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9604 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9605 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9607 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9609 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9611 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9614 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9615 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9616 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9618 /* Unmute Selector 23h,24h and set the default input to mic-in */
9620 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9622 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9623 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9629 * generic initialization of ADC, input mixers and output mixers
9631 static struct hda_verb alc268_volume_init_verbs[] = {
9632 /* set output DAC */
9633 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9634 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9635 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9636 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9638 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9639 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9640 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9641 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9642 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9648 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9651 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9653 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9655 /* set PCBEEP vol = 0 */
9656 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9661 #define alc268_mux_enum_info alc_mux_enum_info
9662 #define alc268_mux_enum_get alc_mux_enum_get
9664 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9665 struct snd_ctl_elem_value *ucontrol)
9667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9668 struct alc_spec *spec = codec->spec;
9670 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9671 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9672 hda_nid_t nid = capture_mixers[adc_idx];
9674 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9676 &spec->cur_mux[adc_idx]);
9679 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9680 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9681 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9684 /* The multiple "Capture Source" controls confuse alsamixer
9685 * So call somewhat different..
9687 /* .name = "Capture Source", */
9688 .name = "Input Source",
9690 .info = alc268_mux_enum_info,
9691 .get = alc268_mux_enum_get,
9692 .put = alc268_mux_enum_put,
9697 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9698 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9699 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9700 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9701 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9703 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9704 /* The multiple "Capture Source" controls confuse alsamixer
9705 * So call somewhat different..
9707 /* .name = "Capture Source", */
9708 .name = "Input Source",
9710 .info = alc268_mux_enum_info,
9711 .get = alc268_mux_enum_get,
9712 .put = alc268_mux_enum_put,
9717 static struct hda_input_mux alc268_capture_source = {
9721 { "Front Mic", 0x1 },
9727 #ifdef CONFIG_SND_DEBUG
9728 static struct snd_kcontrol_new alc268_test_mixer[] = {
9729 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9730 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9731 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9734 /* Volume widgets */
9735 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9736 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9737 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9738 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9739 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9740 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9741 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9742 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9743 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9744 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9745 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9746 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9747 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9748 /* The below appears problematic on some hardwares */
9749 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
9750 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9751 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9752 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9753 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9755 /* Modes for retasking pin widgets */
9756 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9757 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9758 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9759 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9761 /* Controls for GPIO pins, assuming they are configured as outputs */
9762 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9763 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9764 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9765 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9767 /* Switches to allow the digital SPDIF output pin to be enabled.
9768 * The ALC268 does not have an SPDIF input.
9770 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9772 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9773 * this output to turn on an external amplifier.
9775 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9776 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9782 /* create input playback/capture controls for the given pin */
9783 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9784 const char *ctlname, int idx)
9789 sprintf(name, "%s Playback Volume", ctlname);
9791 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9792 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9796 } else if (nid == 0x15) {
9797 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9798 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9804 sprintf(name, "%s Playback Switch", ctlname);
9805 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9806 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9812 /* add playback controls from the parsed DAC table */
9813 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9814 const struct auto_pin_cfg *cfg)
9819 spec->multiout.num_dacs = 2; /* only use one dac */
9820 spec->multiout.dac_nids = spec->private_dac_nids;
9821 spec->multiout.dac_nids[0] = 2;
9822 spec->multiout.dac_nids[1] = 3;
9824 nid = cfg->line_out_pins[0];
9826 alc268_new_analog_output(spec, nid, "Front", 0);
9828 nid = cfg->speaker_pins[0];
9830 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9831 "Speaker Playback Volume",
9832 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9836 nid = cfg->hp_pins[0];
9838 alc268_new_analog_output(spec, nid, "Headphone", 0);
9840 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9842 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9843 "Mono Playback Switch",
9844 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9851 /* create playback/capture controls for input pins */
9852 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9853 const struct auto_pin_cfg *cfg)
9855 struct hda_input_mux *imux = &spec->private_imux;
9858 for (i = 0; i < AUTO_PIN_LAST; i++) {
9859 switch(cfg->input_pins[i]) {
9861 idx1 = 0; /* Mic 1 */
9864 idx1 = 1; /* Mic 2 */
9867 idx1 = 2; /* Line In */
9875 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9876 imux->items[imux->num_items].index = idx1;
9882 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9884 struct alc_spec *spec = codec->spec;
9885 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9886 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9887 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9888 unsigned int dac_vol1, dac_vol2;
9891 snd_hda_codec_write(codec, speaker_nid, 0,
9892 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9893 snd_hda_codec_write(codec, 0x0f, 0,
9894 AC_VERB_SET_AMP_GAIN_MUTE,
9896 snd_hda_codec_write(codec, 0x10, 0,
9897 AC_VERB_SET_AMP_GAIN_MUTE,
9900 snd_hda_codec_write(codec, 0x0f, 0,
9901 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9902 snd_hda_codec_write(codec, 0x10, 0,
9903 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9906 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9907 if (line_nid == 0x14)
9908 dac_vol2 = AMP_OUT_ZERO;
9909 else if (line_nid == 0x15)
9910 dac_vol1 = AMP_OUT_ZERO;
9912 dac_vol2 = AMP_OUT_ZERO;
9913 else if (hp_nid == 0x15)
9914 dac_vol1 = AMP_OUT_ZERO;
9915 if (line_nid != 0x16 || hp_nid != 0x16 ||
9916 spec->autocfg.line_out_pins[1] != 0x16 ||
9917 spec->autocfg.line_out_pins[2] != 0x16)
9918 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9920 snd_hda_codec_write(codec, 0x02, 0,
9921 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9922 snd_hda_codec_write(codec, 0x03, 0,
9923 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9926 /* pcm configuration: identiacal with ALC880 */
9927 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9928 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9929 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9930 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9933 * BIOS auto configuration
9935 static int alc268_parse_auto_config(struct hda_codec *codec)
9937 struct alc_spec *spec = codec->spec;
9939 static hda_nid_t alc268_ignore[] = { 0 };
9941 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9945 if (!spec->autocfg.line_outs)
9946 return 0; /* can't find valid BIOS pin config */
9948 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9951 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9955 spec->multiout.max_channels = 2;
9957 /* digital only support output */
9958 if (spec->autocfg.dig_out_pin)
9959 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9961 if (spec->kctl_alloc)
9962 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9964 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9965 spec->num_mux_defs = 1;
9966 spec->input_mux = &spec->private_imux;
9968 err = alc_auto_add_mic_boost(codec);
9975 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9976 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9977 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9979 /* init callback for auto-configuration model -- overriding the default init */
9980 static void alc268_auto_init(struct hda_codec *codec)
9982 alc268_auto_init_multi_out(codec);
9983 alc268_auto_init_hp_out(codec);
9984 alc268_auto_init_mono_speaker_out(codec);
9985 alc268_auto_init_analog_input(codec);
9989 * configuration and preset
9991 static const char *alc268_models[ALC268_MODEL_LAST] = {
9992 [ALC268_3ST] = "3stack",
9993 [ALC268_TOSHIBA] = "toshiba",
9994 [ALC268_ACER] = "acer",
9995 [ALC268_DELL] = "dell",
9996 #ifdef CONFIG_SND_DEBUG
9997 [ALC268_TEST] = "test",
9999 [ALC268_AUTO] = "auto",
10002 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10003 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10004 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10005 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10006 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10007 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10008 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10009 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10010 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10011 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10012 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10016 static struct alc_config_preset alc268_presets[] = {
10018 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
10019 .init_verbs = { alc268_base_init_verbs },
10020 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10021 .dac_nids = alc268_dac_nids,
10022 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10023 .adc_nids = alc268_adc_nids_alt,
10025 .dig_out_nid = ALC268_DIGOUT_NID,
10026 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10027 .channel_mode = alc268_modes,
10028 .input_mux = &alc268_capture_source,
10030 [ALC268_TOSHIBA] = {
10031 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
10032 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10033 alc268_toshiba_verbs },
10034 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10035 .dac_nids = alc268_dac_nids,
10036 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10037 .adc_nids = alc268_adc_nids_alt,
10039 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10040 .channel_mode = alc268_modes,
10041 .input_mux = &alc268_capture_source,
10042 .unsol_event = alc268_toshiba_unsol_event,
10043 .init_hook = alc268_toshiba_automute,
10046 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
10047 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10048 alc268_acer_verbs },
10049 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10050 .dac_nids = alc268_dac_nids,
10051 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10052 .adc_nids = alc268_adc_nids_alt,
10054 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10055 .channel_mode = alc268_modes,
10056 .input_mux = &alc268_capture_source,
10057 .unsol_event = alc268_acer_unsol_event,
10058 .init_hook = alc268_acer_init_hook,
10061 .mixers = { alc268_dell_mixer },
10062 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10063 alc268_dell_verbs },
10064 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10065 .dac_nids = alc268_dac_nids,
10067 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10068 .channel_mode = alc268_modes,
10069 .unsol_event = alc268_dell_unsol_event,
10070 .init_hook = alc268_dell_init_hook,
10071 .input_mux = &alc268_capture_source,
10073 #ifdef CONFIG_SND_DEBUG
10075 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10076 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10077 alc268_volume_init_verbs },
10078 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10079 .dac_nids = alc268_dac_nids,
10080 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10081 .adc_nids = alc268_adc_nids_alt,
10083 .dig_out_nid = ALC268_DIGOUT_NID,
10084 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10085 .channel_mode = alc268_modes,
10086 .input_mux = &alc268_capture_source,
10091 static int patch_alc268(struct hda_codec *codec)
10093 struct alc_spec *spec;
10097 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10101 codec->spec = spec;
10103 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10107 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10108 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10109 "trying auto-probe from BIOS...\n");
10110 board_config = ALC268_AUTO;
10113 if (board_config == ALC268_AUTO) {
10114 /* automatic parse from the BIOS config */
10115 err = alc268_parse_auto_config(codec);
10121 "hda_codec: Cannot set up configuration "
10122 "from BIOS. Using base mode...\n");
10123 board_config = ALC268_3ST;
10127 if (board_config != ALC268_AUTO)
10128 setup_preset(spec, &alc268_presets[board_config]);
10130 spec->stream_name_analog = "ALC268 Analog";
10131 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10132 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10133 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10135 spec->stream_name_digital = "ALC268 Digital";
10136 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10138 if (!spec->adc_nids && spec->input_mux) {
10139 /* check whether NID 0x07 is valid */
10140 unsigned int wcap = get_wcaps(codec, 0x07);
10143 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10144 if (wcap != AC_WID_AUD_IN) {
10145 spec->adc_nids = alc268_adc_nids_alt;
10146 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10147 spec->mixers[spec->num_mixers] =
10148 alc268_capture_alt_mixer;
10149 spec->num_mixers++;
10151 spec->adc_nids = alc268_adc_nids;
10152 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10153 spec->mixers[spec->num_mixers] =
10154 alc268_capture_mixer;
10155 spec->num_mixers++;
10159 spec->vmaster_nid = 0x02;
10161 codec->patch_ops = alc_patch_ops;
10162 if (board_config == ALC268_AUTO)
10163 spec->init_hook = alc268_auto_init;
10169 * ALC269 channel source setting (2 channel)
10171 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10173 #define alc269_dac_nids alc260_dac_nids
10175 static hda_nid_t alc269_adc_nids[1] = {
10180 #define alc269_modes alc260_modes
10181 #define alc269_capture_source alc880_lg_lw_capture_source
10183 static struct snd_kcontrol_new alc269_base_mixer[] = {
10184 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10185 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10190 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10192 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10195 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10199 /* capture mixer elements */
10200 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10201 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10202 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10205 /* The multiple "Capture Source" controls confuse alsamixer
10206 * So call somewhat different..
10208 /* .name = "Capture Source", */
10209 .name = "Input Source",
10211 .info = alc_mux_enum_info,
10212 .get = alc_mux_enum_get,
10213 .put = alc_mux_enum_put,
10219 * generic initialization of ADC, input mixers and output mixers
10221 static struct hda_verb alc269_init_verbs[] = {
10223 * Unmute ADC0 and set the default input to mic-in
10225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10227 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10228 * analog-loopback mixer widget
10229 * Note: PASD motherboards uses the Line In 2 as the input for
10230 * front panel mic (mic 2)
10232 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10240 * Set up output mixers (0x0c - 0x0e)
10242 /* set vol=0 to output mixers */
10243 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10244 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10246 /* set up input amps for analog loopback */
10247 /* Amp Indices: DAC = 0, mixer = 1 */
10248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10263 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10265 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10269 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10271 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10274 /* FIXME: use matrix-type input source selection */
10275 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10276 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10283 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10284 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10288 /* add playback controls from the parsed DAC table */
10289 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10290 const struct auto_pin_cfg *cfg)
10295 spec->multiout.num_dacs = 1; /* only use one dac */
10296 spec->multiout.dac_nids = spec->private_dac_nids;
10297 spec->multiout.dac_nids[0] = 2;
10299 nid = cfg->line_out_pins[0];
10301 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10302 "Front Playback Volume",
10303 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10306 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10307 "Front Playback Switch",
10308 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10313 nid = cfg->speaker_pins[0];
10315 if (!cfg->line_out_pins[0]) {
10316 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10317 "Speaker Playback Volume",
10318 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10324 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10325 "Speaker Playback Switch",
10326 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10331 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10332 "Speaker Playback Switch",
10333 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10339 nid = cfg->hp_pins[0];
10341 /* spec->multiout.hp_nid = 2; */
10342 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10343 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10344 "Headphone Playback Volume",
10345 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10351 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10352 "Headphone Playback Switch",
10353 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10358 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10359 "Headphone Playback Switch",
10360 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10369 #define alc269_auto_create_analog_input_ctls \
10370 alc880_auto_create_analog_input_ctls
10372 #ifdef CONFIG_SND_HDA_POWER_SAVE
10373 #define alc269_loopbacks alc880_loopbacks
10376 /* pcm configuration: identiacal with ALC880 */
10377 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10378 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10379 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10380 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10383 * BIOS auto configuration
10385 static int alc269_parse_auto_config(struct hda_codec *codec)
10387 struct alc_spec *spec = codec->spec;
10389 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10391 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10396 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10399 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10403 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10405 if (spec->autocfg.dig_out_pin)
10406 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10408 if (spec->kctl_alloc)
10409 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10411 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10412 spec->num_mux_defs = 1;
10413 spec->input_mux = &spec->private_imux;
10415 err = alc_auto_add_mic_boost(codec);
10422 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10423 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10424 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10427 /* init callback for auto-configuration model -- overriding the default init */
10428 static void alc269_auto_init(struct hda_codec *codec)
10430 alc269_auto_init_multi_out(codec);
10431 alc269_auto_init_hp_out(codec);
10432 alc269_auto_init_analog_input(codec);
10436 * configuration and preset
10438 static const char *alc269_models[ALC269_MODEL_LAST] = {
10439 [ALC269_BASIC] = "basic",
10442 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10446 static struct alc_config_preset alc269_presets[] = {
10448 .mixers = { alc269_base_mixer },
10449 .init_verbs = { alc269_init_verbs },
10450 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10451 .dac_nids = alc269_dac_nids,
10453 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10454 .channel_mode = alc269_modes,
10455 .input_mux = &alc269_capture_source,
10459 static int patch_alc269(struct hda_codec *codec)
10461 struct alc_spec *spec;
10465 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10469 codec->spec = spec;
10471 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10475 if (board_config < 0) {
10476 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10477 "trying auto-probe from BIOS...\n");
10478 board_config = ALC269_AUTO;
10481 if (board_config == ALC269_AUTO) {
10482 /* automatic parse from the BIOS config */
10483 err = alc269_parse_auto_config(codec);
10489 "hda_codec: Cannot set up configuration "
10490 "from BIOS. Using base mode...\n");
10491 board_config = ALC269_BASIC;
10495 if (board_config != ALC269_AUTO)
10496 setup_preset(spec, &alc269_presets[board_config]);
10498 spec->stream_name_analog = "ALC269 Analog";
10499 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10500 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10502 spec->stream_name_digital = "ALC269 Digital";
10503 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10504 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10506 spec->adc_nids = alc269_adc_nids;
10507 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10508 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10509 spec->num_mixers++;
10511 codec->patch_ops = alc_patch_ops;
10512 if (board_config == ALC269_AUTO)
10513 spec->init_hook = alc269_auto_init;
10514 #ifdef CONFIG_SND_HDA_POWER_SAVE
10515 if (!spec->loopback.amplist)
10516 spec->loopback.amplist = alc269_loopbacks;
10523 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10527 * set the path ways for 2 channel output
10528 * need to set the codec line out and mic 1 pin widgets to inputs
10530 static struct hda_verb alc861_threestack_ch2_init[] = {
10531 /* set pin widget 1Ah (line in) for input */
10532 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10533 /* set pin widget 18h (mic1/2) for input, for mic also enable
10536 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10538 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10540 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10541 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10547 * need to set the codec line out and mic 1 pin widgets to outputs
10549 static struct hda_verb alc861_threestack_ch6_init[] = {
10550 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10551 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10552 /* set pin widget 18h (mic1) for output (CLFE)*/
10553 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10555 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10556 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10558 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10560 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10561 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10566 static struct hda_channel_mode alc861_threestack_modes[2] = {
10567 { 2, alc861_threestack_ch2_init },
10568 { 6, alc861_threestack_ch6_init },
10570 /* Set mic1 as input and unmute the mixer */
10571 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10572 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10573 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10576 /* Set mic1 as output and mute mixer */
10577 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10578 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10579 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10583 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10584 { 2, alc861_uniwill_m31_ch2_init },
10585 { 4, alc861_uniwill_m31_ch4_init },
10588 /* Set mic1 and line-in as input and unmute the mixer */
10589 static struct hda_verb alc861_asus_ch2_init[] = {
10590 /* set pin widget 1Ah (line in) for input */
10591 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10592 /* set pin widget 18h (mic1/2) for input, for mic also enable
10595 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10597 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10599 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10600 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10604 /* Set mic1 nad line-in as output and mute mixer */
10605 static struct hda_verb alc861_asus_ch6_init[] = {
10606 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10607 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10608 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10609 /* set pin widget 18h (mic1) for output (CLFE)*/
10610 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10611 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10612 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10613 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10615 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10617 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10618 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10623 static struct hda_channel_mode alc861_asus_modes[2] = {
10624 { 2, alc861_asus_ch2_init },
10625 { 6, alc861_asus_ch6_init },
10630 static struct snd_kcontrol_new alc861_base_mixer[] = {
10631 /* output mixer control */
10632 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10633 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10634 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10635 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10636 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10638 /*Input mixer control */
10639 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10640 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10641 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10642 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10643 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10644 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10646 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10650 /* Capture mixer control */
10651 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10652 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10654 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10655 .name = "Capture Source",
10657 .info = alc_mux_enum_info,
10658 .get = alc_mux_enum_get,
10659 .put = alc_mux_enum_put,
10664 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10665 /* output mixer control */
10666 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10667 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10668 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10669 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10670 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10672 /* Input mixer control */
10673 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10674 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10675 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10676 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10677 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10678 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10680 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10681 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10684 /* Capture mixer control */
10685 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10686 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10689 .name = "Capture Source",
10691 .info = alc_mux_enum_info,
10692 .get = alc_mux_enum_get,
10693 .put = alc_mux_enum_put,
10696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10697 .name = "Channel Mode",
10698 .info = alc_ch_mode_info,
10699 .get = alc_ch_mode_get,
10700 .put = alc_ch_mode_put,
10701 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10706 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10707 /* output mixer control */
10708 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10709 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10710 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10712 /*Capture mixer control */
10713 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10714 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10717 .name = "Capture Source",
10719 .info = alc_mux_enum_info,
10720 .get = alc_mux_enum_get,
10721 .put = alc_mux_enum_put,
10727 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10728 /* output mixer control */
10729 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10730 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10731 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10732 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10733 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10735 /* Input mixer control */
10736 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10737 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10738 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10739 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10740 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10741 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10743 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10744 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10747 /* Capture mixer control */
10748 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10749 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10751 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10752 .name = "Capture Source",
10754 .info = alc_mux_enum_info,
10755 .get = alc_mux_enum_get,
10756 .put = alc_mux_enum_put,
10759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10760 .name = "Channel Mode",
10761 .info = alc_ch_mode_info,
10762 .get = alc_ch_mode_get,
10763 .put = alc_ch_mode_put,
10764 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10769 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10770 /* output mixer control */
10771 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10772 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10773 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10774 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10775 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10777 /* Input mixer control */
10778 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10779 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10780 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10781 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10782 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10783 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10785 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10786 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10787 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10789 /* Capture mixer control */
10790 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10791 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10793 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10794 .name = "Capture Source",
10796 .info = alc_mux_enum_info,
10797 .get = alc_mux_enum_get,
10798 .put = alc_mux_enum_put,
10801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10802 .name = "Channel Mode",
10803 .info = alc_ch_mode_info,
10804 .get = alc_ch_mode_get,
10805 .put = alc_ch_mode_put,
10806 .private_value = ARRAY_SIZE(alc861_asus_modes),
10811 /* additional mixer */
10812 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10813 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10814 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10815 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10816 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10821 * generic initialization of ADC, input mixers and output mixers
10823 static struct hda_verb alc861_base_init_verbs[] = {
10825 * Unmute ADC0 and set the default input to mic-in
10827 /* port-A for surround (rear panel) */
10828 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10829 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10830 /* port-B for mic-in (rear panel) with vref */
10831 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10832 /* port-C for line-in (rear panel) */
10833 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10834 /* port-D for Front */
10835 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10836 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10837 /* port-E for HP out (front panel) */
10838 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10839 /* route front PCM to HP */
10840 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10841 /* port-F for mic-in (front panel) with vref */
10842 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10843 /* port-G for CLFE (rear panel) */
10844 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10845 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10846 /* port-H for side (rear panel) */
10847 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10848 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10850 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10851 /* route front mic to ADC1*/
10852 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10855 /* Unmute DAC0~3 & spdif out*/
10856 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10857 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10858 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10859 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10862 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10863 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10864 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10865 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10866 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10868 /* Unmute Stereo Mixer 15 */
10869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10876 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10882 /* hp used DAC 3 (Front) */
10883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10889 static struct hda_verb alc861_threestack_init_verbs[] = {
10891 * Unmute ADC0 and set the default input to mic-in
10893 /* port-A for surround (rear panel) */
10894 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10895 /* port-B for mic-in (rear panel) with vref */
10896 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10897 /* port-C for line-in (rear panel) */
10898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10899 /* port-D for Front */
10900 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10901 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10902 /* port-E for HP out (front panel) */
10903 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10904 /* route front PCM to HP */
10905 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10906 /* port-F for mic-in (front panel) with vref */
10907 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10908 /* port-G for CLFE (rear panel) */
10909 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10910 /* port-H for side (rear panel) */
10911 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10913 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10914 /* route front mic to ADC1*/
10915 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10916 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10917 /* Unmute DAC0~3 & spdif out*/
10918 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10919 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10920 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10921 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10922 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10924 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10925 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10926 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10927 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10928 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10930 /* Unmute Stereo Mixer 15 */
10931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10934 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10936 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10937 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10939 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10943 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10944 /* hp used DAC 3 (Front) */
10945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10946 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10950 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10952 * Unmute ADC0 and set the default input to mic-in
10954 /* port-A for surround (rear panel) */
10955 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10956 /* port-B for mic-in (rear panel) with vref */
10957 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10958 /* port-C for line-in (rear panel) */
10959 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10960 /* port-D for Front */
10961 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10962 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10963 /* port-E for HP out (front panel) */
10964 /* this has to be set to VREF80 */
10965 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10966 /* route front PCM to HP */
10967 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10968 /* port-F for mic-in (front panel) with vref */
10969 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10970 /* port-G for CLFE (rear panel) */
10971 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10972 /* port-H for side (rear panel) */
10973 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10975 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10976 /* route front mic to ADC1*/
10977 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10978 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10979 /* Unmute DAC0~3 & spdif out*/
10980 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10981 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10982 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10983 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10984 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10986 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10987 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10988 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10989 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10990 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10992 /* Unmute Stereo Mixer 15 */
10993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11005 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11006 /* hp used DAC 3 (Front) */
11007 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11008 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11012 static struct hda_verb alc861_asus_init_verbs[] = {
11014 * Unmute ADC0 and set the default input to mic-in
11016 /* port-A for surround (rear panel)
11017 * according to codec#0 this is the HP jack
11019 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11020 /* route front PCM to HP */
11021 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11022 /* port-B for mic-in (rear panel) with vref */
11023 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11024 /* port-C for line-in (rear panel) */
11025 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11026 /* port-D for Front */
11027 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11028 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11029 /* port-E for HP out (front panel) */
11030 /* this has to be set to VREF80 */
11031 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11032 /* route front PCM to HP */
11033 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11034 /* port-F for mic-in (front panel) with vref */
11035 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11036 /* port-G for CLFE (rear panel) */
11037 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11038 /* port-H for side (rear panel) */
11039 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11041 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11042 /* route front mic to ADC1*/
11043 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11044 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11045 /* Unmute DAC0~3 & spdif out*/
11046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11049 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11051 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11052 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11053 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11054 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11055 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11057 /* Unmute Stereo Mixer 15 */
11058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11063 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11065 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11067 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11071 /* hp used DAC 3 (Front) */
11072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11077 /* additional init verbs for ASUS laptops */
11078 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11079 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11080 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11085 * generic initialization of ADC, input mixers and output mixers
11087 static struct hda_verb alc861_auto_init_verbs[] = {
11089 * Unmute ADC0 and set the default input to mic-in
11091 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11092 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11094 /* Unmute DAC0~3 & spdif out*/
11095 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11096 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11097 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11098 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11101 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11102 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11103 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11104 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11105 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11107 /* Unmute Stereo Mixer 15 */
11108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11109 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11114 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11115 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11116 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11117 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11118 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11119 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11120 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11122 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11123 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11125 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11126 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11127 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11128 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11129 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11131 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11136 static struct hda_verb alc861_toshiba_init_verbs[] = {
11137 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11142 /* toggle speaker-output according to the hp-jack state */
11143 static void alc861_toshiba_automute(struct hda_codec *codec)
11145 unsigned int present;
11147 present = snd_hda_codec_read(codec, 0x0f, 0,
11148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11149 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11150 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11151 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11152 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11155 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11158 if ((res >> 26) == ALC880_HP_EVENT)
11159 alc861_toshiba_automute(codec);
11162 /* pcm configuration: identiacal with ALC880 */
11163 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11164 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11165 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11166 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11169 #define ALC861_DIGOUT_NID 0x07
11171 static struct hda_channel_mode alc861_8ch_modes[1] = {
11175 static hda_nid_t alc861_dac_nids[4] = {
11176 /* front, surround, clfe, side */
11177 0x03, 0x06, 0x05, 0x04
11180 static hda_nid_t alc660_dac_nids[3] = {
11181 /* front, clfe, surround */
11185 static hda_nid_t alc861_adc_nids[1] = {
11190 static struct hda_input_mux alc861_capture_source = {
11194 { "Front Mic", 0x3 },
11201 /* fill in the dac_nids table from the parsed pin configuration */
11202 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11203 const struct auto_pin_cfg *cfg)
11208 spec->multiout.dac_nids = spec->private_dac_nids;
11209 for (i = 0; i < cfg->line_outs; i++) {
11210 nid = cfg->line_out_pins[i];
11212 if (i >= ARRAY_SIZE(alc861_dac_nids))
11214 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11217 spec->multiout.num_dacs = cfg->line_outs;
11221 /* add playback controls from the parsed DAC table */
11222 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11223 const struct auto_pin_cfg *cfg)
11226 static const char *chname[4] = {
11227 "Front", "Surround", NULL /*CLFE*/, "Side"
11232 for (i = 0; i < cfg->line_outs; i++) {
11233 nid = spec->multiout.dac_nids[i];
11238 err = add_control(spec, ALC_CTL_BIND_MUTE,
11239 "Center Playback Switch",
11240 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11244 err = add_control(spec, ALC_CTL_BIND_MUTE,
11245 "LFE Playback Switch",
11246 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11251 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11253 if (nid == alc861_dac_nids[idx])
11255 sprintf(name, "%s Playback Switch", chname[idx]);
11256 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11257 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11266 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11274 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11276 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11277 "Headphone Playback Switch",
11278 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11281 spec->multiout.hp_nid = nid;
11286 /* create playback/capture controls for input pins */
11287 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11288 const struct auto_pin_cfg *cfg)
11290 struct hda_input_mux *imux = &spec->private_imux;
11291 int i, err, idx, idx1;
11293 for (i = 0; i < AUTO_PIN_LAST; i++) {
11294 switch (cfg->input_pins[i]) {
11297 idx = 2; /* Line In */
11301 idx = 2; /* Line In */
11305 idx = 1; /* Mic In */
11309 idx = 1; /* Mic In */
11319 err = new_analog_input(spec, cfg->input_pins[i],
11320 auto_pin_cfg_labels[i], idx, 0x15);
11324 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11325 imux->items[imux->num_items].index = idx1;
11331 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11332 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11333 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11337 /* The multiple "Capture Source" controls confuse alsamixer
11338 * So call somewhat different..
11340 /* .name = "Capture Source", */
11341 .name = "Input Source",
11343 .info = alc_mux_enum_info,
11344 .get = alc_mux_enum_get,
11345 .put = alc_mux_enum_put,
11350 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11352 int pin_type, int dac_idx)
11354 /* set as output */
11356 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11358 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
11363 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11365 struct alc_spec *spec = codec->spec;
11368 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11369 for (i = 0; i < spec->autocfg.line_outs; i++) {
11370 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11371 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11373 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11374 spec->multiout.dac_nids[i]);
11378 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11380 struct alc_spec *spec = codec->spec;
11383 pin = spec->autocfg.hp_pins[0];
11384 if (pin) /* connect to front */
11385 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11386 spec->multiout.dac_nids[0]);
11389 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11391 struct alc_spec *spec = codec->spec;
11394 for (i = 0; i < AUTO_PIN_LAST; i++) {
11395 hda_nid_t nid = spec->autocfg.input_pins[i];
11396 if (nid >= 0x0c && nid <= 0x11) {
11397 snd_hda_codec_write(codec, nid, 0,
11398 AC_VERB_SET_PIN_WIDGET_CONTROL,
11399 i <= AUTO_PIN_FRONT_MIC ?
11400 PIN_VREF80 : PIN_IN);
11405 /* parse the BIOS configuration and set up the alc_spec */
11406 /* return 1 if successful, 0 if the proper config is not found,
11407 * or a negative error code
11409 static int alc861_parse_auto_config(struct hda_codec *codec)
11411 struct alc_spec *spec = codec->spec;
11413 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11415 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11419 if (!spec->autocfg.line_outs)
11420 return 0; /* can't find valid BIOS pin config */
11422 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11425 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11428 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11431 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11435 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11437 if (spec->autocfg.dig_out_pin)
11438 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11440 if (spec->kctl_alloc)
11441 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11443 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11445 spec->num_mux_defs = 1;
11446 spec->input_mux = &spec->private_imux;
11448 spec->adc_nids = alc861_adc_nids;
11449 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11450 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11451 spec->num_mixers++;
11456 /* additional initialization for auto-configuration model */
11457 static void alc861_auto_init(struct hda_codec *codec)
11459 alc861_auto_init_multi_out(codec);
11460 alc861_auto_init_hp_out(codec);
11461 alc861_auto_init_analog_input(codec);
11464 #ifdef CONFIG_SND_HDA_POWER_SAVE
11465 static struct hda_amp_list alc861_loopbacks[] = {
11466 { 0x15, HDA_INPUT, 0 },
11467 { 0x15, HDA_INPUT, 1 },
11468 { 0x15, HDA_INPUT, 2 },
11469 { 0x15, HDA_INPUT, 3 },
11476 * configuration and preset
11478 static const char *alc861_models[ALC861_MODEL_LAST] = {
11479 [ALC861_3ST] = "3stack",
11480 [ALC660_3ST] = "3stack-660",
11481 [ALC861_3ST_DIG] = "3stack-dig",
11482 [ALC861_6ST_DIG] = "6stack-dig",
11483 [ALC861_UNIWILL_M31] = "uniwill-m31",
11484 [ALC861_TOSHIBA] = "toshiba",
11485 [ALC861_ASUS] = "asus",
11486 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11487 [ALC861_AUTO] = "auto",
11490 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11491 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11492 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11493 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11494 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11495 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11496 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11497 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11498 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11499 * Any other models that need this preset?
11501 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11502 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11503 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11504 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11505 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11506 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11507 /* FIXME: the below seems conflict */
11508 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11509 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11510 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11514 static struct alc_config_preset alc861_presets[] = {
11516 .mixers = { alc861_3ST_mixer },
11517 .init_verbs = { alc861_threestack_init_verbs },
11518 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11519 .dac_nids = alc861_dac_nids,
11520 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11521 .channel_mode = alc861_threestack_modes,
11523 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11524 .adc_nids = alc861_adc_nids,
11525 .input_mux = &alc861_capture_source,
11527 [ALC861_3ST_DIG] = {
11528 .mixers = { alc861_base_mixer },
11529 .init_verbs = { alc861_threestack_init_verbs },
11530 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11531 .dac_nids = alc861_dac_nids,
11532 .dig_out_nid = ALC861_DIGOUT_NID,
11533 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11534 .channel_mode = alc861_threestack_modes,
11536 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11537 .adc_nids = alc861_adc_nids,
11538 .input_mux = &alc861_capture_source,
11540 [ALC861_6ST_DIG] = {
11541 .mixers = { alc861_base_mixer },
11542 .init_verbs = { alc861_base_init_verbs },
11543 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11544 .dac_nids = alc861_dac_nids,
11545 .dig_out_nid = ALC861_DIGOUT_NID,
11546 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11547 .channel_mode = alc861_8ch_modes,
11548 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11549 .adc_nids = alc861_adc_nids,
11550 .input_mux = &alc861_capture_source,
11553 .mixers = { alc861_3ST_mixer },
11554 .init_verbs = { alc861_threestack_init_verbs },
11555 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11556 .dac_nids = alc660_dac_nids,
11557 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11558 .channel_mode = alc861_threestack_modes,
11560 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11561 .adc_nids = alc861_adc_nids,
11562 .input_mux = &alc861_capture_source,
11564 [ALC861_UNIWILL_M31] = {
11565 .mixers = { alc861_uniwill_m31_mixer },
11566 .init_verbs = { alc861_uniwill_m31_init_verbs },
11567 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11568 .dac_nids = alc861_dac_nids,
11569 .dig_out_nid = ALC861_DIGOUT_NID,
11570 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11571 .channel_mode = alc861_uniwill_m31_modes,
11573 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11574 .adc_nids = alc861_adc_nids,
11575 .input_mux = &alc861_capture_source,
11577 [ALC861_TOSHIBA] = {
11578 .mixers = { alc861_toshiba_mixer },
11579 .init_verbs = { alc861_base_init_verbs,
11580 alc861_toshiba_init_verbs },
11581 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11582 .dac_nids = alc861_dac_nids,
11583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11584 .channel_mode = alc883_3ST_2ch_modes,
11585 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11586 .adc_nids = alc861_adc_nids,
11587 .input_mux = &alc861_capture_source,
11588 .unsol_event = alc861_toshiba_unsol_event,
11589 .init_hook = alc861_toshiba_automute,
11592 .mixers = { alc861_asus_mixer },
11593 .init_verbs = { alc861_asus_init_verbs },
11594 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11595 .dac_nids = alc861_dac_nids,
11596 .dig_out_nid = ALC861_DIGOUT_NID,
11597 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11598 .channel_mode = alc861_asus_modes,
11601 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11602 .adc_nids = alc861_adc_nids,
11603 .input_mux = &alc861_capture_source,
11605 [ALC861_ASUS_LAPTOP] = {
11606 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11607 .init_verbs = { alc861_asus_init_verbs,
11608 alc861_asus_laptop_init_verbs },
11609 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11610 .dac_nids = alc861_dac_nids,
11611 .dig_out_nid = ALC861_DIGOUT_NID,
11612 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11613 .channel_mode = alc883_3ST_2ch_modes,
11615 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11616 .adc_nids = alc861_adc_nids,
11617 .input_mux = &alc861_capture_source,
11622 static int patch_alc861(struct hda_codec *codec)
11624 struct alc_spec *spec;
11628 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11632 codec->spec = spec;
11634 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11638 if (board_config < 0) {
11639 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11640 "trying auto-probe from BIOS...\n");
11641 board_config = ALC861_AUTO;
11644 if (board_config == ALC861_AUTO) {
11645 /* automatic parse from the BIOS config */
11646 err = alc861_parse_auto_config(codec);
11652 "hda_codec: Cannot set up configuration "
11653 "from BIOS. Using base mode...\n");
11654 board_config = ALC861_3ST_DIG;
11658 if (board_config != ALC861_AUTO)
11659 setup_preset(spec, &alc861_presets[board_config]);
11661 spec->stream_name_analog = "ALC861 Analog";
11662 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11663 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11665 spec->stream_name_digital = "ALC861 Digital";
11666 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11667 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11669 spec->vmaster_nid = 0x03;
11671 codec->patch_ops = alc_patch_ops;
11672 if (board_config == ALC861_AUTO)
11673 spec->init_hook = alc861_auto_init;
11674 #ifdef CONFIG_SND_HDA_POWER_SAVE
11675 if (!spec->loopback.amplist)
11676 spec->loopback.amplist = alc861_loopbacks;
11683 * ALC861-VD support
11687 * In addition, an independent DAC
11689 #define ALC861VD_DIGOUT_NID 0x06
11691 static hda_nid_t alc861vd_dac_nids[4] = {
11692 /* front, surr, clfe, side surr */
11693 0x02, 0x03, 0x04, 0x05
11696 /* dac_nids for ALC660vd are in a different order - according to
11697 * Realtek's driver.
11698 * This should probably tesult in a different mixer for 6stack models
11699 * of ALC660vd codecs, but for now there is only 3stack mixer
11700 * - and it is the same as in 861vd.
11701 * adc_nids in ALC660vd are (is) the same as in 861vd
11703 static hda_nid_t alc660vd_dac_nids[3] = {
11704 /* front, rear, clfe, rear_surr */
11708 static hda_nid_t alc861vd_adc_nids[1] = {
11714 /* FIXME: should be a matrix-type input source selection */
11715 static struct hda_input_mux alc861vd_capture_source = {
11719 { "Front Mic", 0x1 },
11725 static struct hda_input_mux alc861vd_dallas_capture_source = {
11728 { "Front Mic", 0x0 },
11729 { "ATAPI Mic", 0x1 },
11730 { "Line In", 0x5 },
11734 static struct hda_input_mux alc861vd_hp_capture_source = {
11737 { "Front Mic", 0x0 },
11738 { "ATAPI Mic", 0x1 },
11742 #define alc861vd_mux_enum_info alc_mux_enum_info
11743 #define alc861vd_mux_enum_get alc_mux_enum_get
11745 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11746 struct snd_ctl_elem_value *ucontrol)
11748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11749 struct alc_spec *spec = codec->spec;
11750 const struct hda_input_mux *imux = spec->input_mux;
11751 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11752 static hda_nid_t capture_mixers[1] = { 0x22 };
11753 hda_nid_t nid = capture_mixers[adc_idx];
11754 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11755 unsigned int i, idx;
11757 idx = ucontrol->value.enumerated.item[0];
11758 if (idx >= imux->num_items)
11759 idx = imux->num_items - 1;
11760 if (*cur_val == idx)
11762 for (i = 0; i < imux->num_items; i++) {
11763 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11764 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11765 imux->items[i].index,
11775 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11782 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11783 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11784 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11785 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11786 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11793 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11794 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11795 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11796 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11797 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11801 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11802 { 6, alc861vd_6stack_ch6_init },
11803 { 8, alc861vd_6stack_ch8_init },
11806 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11809 .name = "Channel Mode",
11810 .info = alc_ch_mode_info,
11811 .get = alc_ch_mode_get,
11812 .put = alc_ch_mode_put,
11817 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11818 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11819 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11822 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11823 /* The multiple "Capture Source" controls confuse alsamixer
11824 * So call somewhat different..
11826 /* .name = "Capture Source", */
11827 .name = "Input Source",
11829 .info = alc861vd_mux_enum_info,
11830 .get = alc861vd_mux_enum_get,
11831 .put = alc861vd_mux_enum_put,
11836 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11837 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11839 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11840 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11841 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11843 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11844 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11846 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11848 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11850 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11851 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11853 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11854 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11858 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11862 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11863 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11866 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11867 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11869 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11870 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11872 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11873 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11878 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11879 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11888 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11889 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11890 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11898 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11899 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11904 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11905 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11906 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11907 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11911 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11915 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11916 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11917 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11919 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11920 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11925 /* Pin assignment: Front=0x14, HP = 0x15,
11926 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11928 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11929 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11930 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11931 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11932 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11933 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11934 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11935 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11936 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11937 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11938 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11942 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11943 * Front Mic=0x18, ATAPI Mic = 0x19,
11945 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11946 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11947 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11948 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11949 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11951 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11952 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11953 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11959 * generic initialization of ADC, input mixers and output mixers
11961 static struct hda_verb alc861vd_volume_init_verbs[] = {
11963 * Unmute ADC0 and set the default input to mic-in
11965 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11966 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11968 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11969 * the analog-loopback mixer widget
11971 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11973 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11976 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11978 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11985 * Set up output mixers (0x02 - 0x05)
11987 /* set vol=0 to output mixers */
11988 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11989 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11990 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11993 /* set up input amps for analog loopback */
11994 /* Amp Indices: DAC = 0, mixer = 1 */
11995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11997 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12000 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12001 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12002 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12008 * 3-stack pin configuration:
12009 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12011 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12013 * Set pin mode and muting
12015 /* set front pin widgets 0x14 for output */
12016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12018 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12020 /* Mic (rear) pin: input vref at 80% */
12021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12022 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12023 /* Front Mic pin: input vref at 80% */
12024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12026 /* Line In pin: input */
12027 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12028 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12029 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12030 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12031 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12032 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12033 /* CD pin widget for input */
12034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12040 * 6-stack pin configuration:
12042 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12044 * Set pin mode and muting
12046 /* set front pin widgets 0x14 for output */
12047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12049 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12051 /* Rear Pin: output 1 (0x0d) */
12052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12054 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12055 /* CLFE Pin: output 2 (0x0e) */
12056 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12058 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12059 /* Side Pin: output 3 (0x0f) */
12060 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12061 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12062 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12064 /* Mic (rear) pin: input vref at 80% */
12065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12067 /* Front Mic pin: input vref at 80% */
12068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12070 /* Line In pin: input */
12071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12073 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12076 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12077 /* CD pin widget for input */
12078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12083 static struct hda_verb alc861vd_eapd_verbs[] = {
12084 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12088 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12092 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12093 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12097 /* toggle speaker-output according to the hp-jack state */
12098 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12100 unsigned int present;
12101 unsigned char bits;
12103 present = snd_hda_codec_read(codec, 0x1b, 0,
12104 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12105 bits = present ? HDA_AMP_MUTE : 0;
12106 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12107 HDA_AMP_MUTE, bits);
12110 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12112 unsigned int present;
12113 unsigned char bits;
12115 present = snd_hda_codec_read(codec, 0x18, 0,
12116 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12117 bits = present ? HDA_AMP_MUTE : 0;
12118 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12119 HDA_AMP_MUTE, bits);
12122 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12124 alc861vd_lenovo_hp_automute(codec);
12125 alc861vd_lenovo_mic_automute(codec);
12128 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12131 switch (res >> 26) {
12132 case ALC880_HP_EVENT:
12133 alc861vd_lenovo_hp_automute(codec);
12135 case ALC880_MIC_EVENT:
12136 alc861vd_lenovo_mic_automute(codec);
12141 static struct hda_verb alc861vd_dallas_verbs[] = {
12142 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12143 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12145 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12156 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12158 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12160 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12161 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12162 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12163 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12167 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12169 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12170 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12171 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12172 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12179 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12180 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12181 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12186 /* toggle speaker-output according to the hp-jack state */
12187 static void alc861vd_dallas_automute(struct hda_codec *codec)
12189 unsigned int present;
12191 present = snd_hda_codec_read(codec, 0x15, 0,
12192 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12193 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12194 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12197 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12199 if ((res >> 26) == ALC880_HP_EVENT)
12200 alc861vd_dallas_automute(codec);
12203 #ifdef CONFIG_SND_HDA_POWER_SAVE
12204 #define alc861vd_loopbacks alc880_loopbacks
12207 /* pcm configuration: identiacal with ALC880 */
12208 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12209 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12210 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12211 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12214 * configuration and preset
12216 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12217 [ALC660VD_3ST] = "3stack-660",
12218 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12219 [ALC861VD_3ST] = "3stack",
12220 [ALC861VD_3ST_DIG] = "3stack-digout",
12221 [ALC861VD_6ST_DIG] = "6stack-digout",
12222 [ALC861VD_LENOVO] = "lenovo",
12223 [ALC861VD_DALLAS] = "dallas",
12224 [ALC861VD_HP] = "hp",
12225 [ALC861VD_AUTO] = "auto",
12228 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12229 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12230 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12231 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12232 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12233 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12234 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12235 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12236 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12237 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12238 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12239 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12240 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12241 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12242 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12246 static struct alc_config_preset alc861vd_presets[] = {
12248 .mixers = { alc861vd_3st_mixer },
12249 .init_verbs = { alc861vd_volume_init_verbs,
12250 alc861vd_3stack_init_verbs },
12251 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12252 .dac_nids = alc660vd_dac_nids,
12253 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12254 .adc_nids = alc861vd_adc_nids,
12255 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12256 .channel_mode = alc861vd_3stack_2ch_modes,
12257 .input_mux = &alc861vd_capture_source,
12259 [ALC660VD_3ST_DIG] = {
12260 .mixers = { alc861vd_3st_mixer },
12261 .init_verbs = { alc861vd_volume_init_verbs,
12262 alc861vd_3stack_init_verbs },
12263 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12264 .dac_nids = alc660vd_dac_nids,
12265 .dig_out_nid = ALC861VD_DIGOUT_NID,
12266 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12267 .adc_nids = alc861vd_adc_nids,
12268 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12269 .channel_mode = alc861vd_3stack_2ch_modes,
12270 .input_mux = &alc861vd_capture_source,
12273 .mixers = { alc861vd_3st_mixer },
12274 .init_verbs = { alc861vd_volume_init_verbs,
12275 alc861vd_3stack_init_verbs },
12276 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12277 .dac_nids = alc861vd_dac_nids,
12278 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12279 .channel_mode = alc861vd_3stack_2ch_modes,
12280 .input_mux = &alc861vd_capture_source,
12282 [ALC861VD_3ST_DIG] = {
12283 .mixers = { alc861vd_3st_mixer },
12284 .init_verbs = { alc861vd_volume_init_verbs,
12285 alc861vd_3stack_init_verbs },
12286 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12287 .dac_nids = alc861vd_dac_nids,
12288 .dig_out_nid = ALC861VD_DIGOUT_NID,
12289 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12290 .channel_mode = alc861vd_3stack_2ch_modes,
12291 .input_mux = &alc861vd_capture_source,
12293 [ALC861VD_6ST_DIG] = {
12294 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12295 .init_verbs = { alc861vd_volume_init_verbs,
12296 alc861vd_6stack_init_verbs },
12297 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12298 .dac_nids = alc861vd_dac_nids,
12299 .dig_out_nid = ALC861VD_DIGOUT_NID,
12300 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12301 .channel_mode = alc861vd_6stack_modes,
12302 .input_mux = &alc861vd_capture_source,
12304 [ALC861VD_LENOVO] = {
12305 .mixers = { alc861vd_lenovo_mixer },
12306 .init_verbs = { alc861vd_volume_init_verbs,
12307 alc861vd_3stack_init_verbs,
12308 alc861vd_eapd_verbs,
12309 alc861vd_lenovo_unsol_verbs },
12310 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12311 .dac_nids = alc660vd_dac_nids,
12312 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12313 .adc_nids = alc861vd_adc_nids,
12314 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12315 .channel_mode = alc861vd_3stack_2ch_modes,
12316 .input_mux = &alc861vd_capture_source,
12317 .unsol_event = alc861vd_lenovo_unsol_event,
12318 .init_hook = alc861vd_lenovo_automute,
12320 [ALC861VD_DALLAS] = {
12321 .mixers = { alc861vd_dallas_mixer },
12322 .init_verbs = { alc861vd_dallas_verbs },
12323 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12324 .dac_nids = alc861vd_dac_nids,
12325 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12326 .adc_nids = alc861vd_adc_nids,
12327 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12328 .channel_mode = alc861vd_3stack_2ch_modes,
12329 .input_mux = &alc861vd_dallas_capture_source,
12330 .unsol_event = alc861vd_dallas_unsol_event,
12331 .init_hook = alc861vd_dallas_automute,
12334 .mixers = { alc861vd_hp_mixer },
12335 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12336 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12337 .dac_nids = alc861vd_dac_nids,
12338 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12339 .dig_out_nid = ALC861VD_DIGOUT_NID,
12340 .adc_nids = alc861vd_adc_nids,
12341 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12342 .channel_mode = alc861vd_3stack_2ch_modes,
12343 .input_mux = &alc861vd_hp_capture_source,
12344 .unsol_event = alc861vd_dallas_unsol_event,
12345 .init_hook = alc861vd_dallas_automute,
12350 * BIOS auto configuration
12352 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12353 hda_nid_t nid, int pin_type, int dac_idx)
12355 /* set as output */
12356 snd_hda_codec_write(codec, nid, 0,
12357 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12358 snd_hda_codec_write(codec, nid, 0,
12359 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12362 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12364 struct alc_spec *spec = codec->spec;
12367 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12368 for (i = 0; i <= HDA_SIDE; i++) {
12369 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12370 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12372 alc861vd_auto_set_output_and_unmute(codec, nid,
12378 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12380 struct alc_spec *spec = codec->spec;
12383 pin = spec->autocfg.hp_pins[0];
12384 if (pin) /* connect to front and use dac 0 */
12385 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12388 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12389 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12391 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12393 struct alc_spec *spec = codec->spec;
12396 for (i = 0; i < AUTO_PIN_LAST; i++) {
12397 hda_nid_t nid = spec->autocfg.input_pins[i];
12398 if (alc861vd_is_input_pin(nid)) {
12399 snd_hda_codec_write(codec, nid, 0,
12400 AC_VERB_SET_PIN_WIDGET_CONTROL,
12401 i <= AUTO_PIN_FRONT_MIC ?
12402 PIN_VREF80 : PIN_IN);
12403 if (nid != ALC861VD_PIN_CD_NID)
12404 snd_hda_codec_write(codec, nid, 0,
12405 AC_VERB_SET_AMP_GAIN_MUTE,
12411 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12412 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12414 /* add playback controls from the parsed DAC table */
12415 /* Based on ALC880 version. But ALC861VD has separate,
12416 * different NIDs for mute/unmute switch and volume control */
12417 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12418 const struct auto_pin_cfg *cfg)
12421 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12422 hda_nid_t nid_v, nid_s;
12425 for (i = 0; i < cfg->line_outs; i++) {
12426 if (!spec->multiout.dac_nids[i])
12428 nid_v = alc861vd_idx_to_mixer_vol(
12430 spec->multiout.dac_nids[i]));
12431 nid_s = alc861vd_idx_to_mixer_switch(
12433 spec->multiout.dac_nids[i]));
12437 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12438 "Center Playback Volume",
12439 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12443 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12444 "LFE Playback Volume",
12445 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12449 err = add_control(spec, ALC_CTL_BIND_MUTE,
12450 "Center Playback Switch",
12451 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12455 err = add_control(spec, ALC_CTL_BIND_MUTE,
12456 "LFE Playback Switch",
12457 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12462 sprintf(name, "%s Playback Volume", chname[i]);
12463 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12464 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12468 sprintf(name, "%s Playback Switch", chname[i]);
12469 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12470 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12479 /* add playback controls for speaker and HP outputs */
12480 /* Based on ALC880 version. But ALC861VD has separate,
12481 * different NIDs for mute/unmute switch and volume control */
12482 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12483 hda_nid_t pin, const char *pfx)
12485 hda_nid_t nid_v, nid_s;
12492 if (alc880_is_fixed_pin(pin)) {
12493 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12494 /* specify the DAC as the extra output */
12495 if (!spec->multiout.hp_nid)
12496 spec->multiout.hp_nid = nid_v;
12498 spec->multiout.extra_out_nid[0] = nid_v;
12499 /* control HP volume/switch on the output mixer amp */
12500 nid_v = alc861vd_idx_to_mixer_vol(
12501 alc880_fixed_pin_idx(pin));
12502 nid_s = alc861vd_idx_to_mixer_switch(
12503 alc880_fixed_pin_idx(pin));
12505 sprintf(name, "%s Playback Volume", pfx);
12506 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12507 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12510 sprintf(name, "%s Playback Switch", pfx);
12511 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12512 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12515 } else if (alc880_is_multi_pin(pin)) {
12516 /* set manual connection */
12517 /* we have only a switch on HP-out PIN */
12518 sprintf(name, "%s Playback Switch", pfx);
12519 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12520 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12527 /* parse the BIOS configuration and set up the alc_spec
12528 * return 1 if successful, 0 if the proper config is not found,
12529 * or a negative error code
12530 * Based on ALC880 version - had to change it to override
12531 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12532 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12534 struct alc_spec *spec = codec->spec;
12536 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12538 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12542 if (!spec->autocfg.line_outs)
12543 return 0; /* can't find valid BIOS pin config */
12545 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12548 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12551 err = alc861vd_auto_create_extra_out(spec,
12552 spec->autocfg.speaker_pins[0],
12556 err = alc861vd_auto_create_extra_out(spec,
12557 spec->autocfg.hp_pins[0],
12561 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12565 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12567 if (spec->autocfg.dig_out_pin)
12568 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12570 if (spec->kctl_alloc)
12571 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12573 spec->init_verbs[spec->num_init_verbs++]
12574 = alc861vd_volume_init_verbs;
12576 spec->num_mux_defs = 1;
12577 spec->input_mux = &spec->private_imux;
12579 err = alc_auto_add_mic_boost(codec);
12586 /* additional initialization for auto-configuration model */
12587 static void alc861vd_auto_init(struct hda_codec *codec)
12589 alc861vd_auto_init_multi_out(codec);
12590 alc861vd_auto_init_hp_out(codec);
12591 alc861vd_auto_init_analog_input(codec);
12594 static int patch_alc861vd(struct hda_codec *codec)
12596 struct alc_spec *spec;
12597 int err, board_config;
12599 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12603 codec->spec = spec;
12605 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12609 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12610 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12611 "ALC861VD, trying auto-probe from BIOS...\n");
12612 board_config = ALC861VD_AUTO;
12615 if (board_config == ALC861VD_AUTO) {
12616 /* automatic parse from the BIOS config */
12617 err = alc861vd_parse_auto_config(codec);
12623 "hda_codec: Cannot set up configuration "
12624 "from BIOS. Using base mode...\n");
12625 board_config = ALC861VD_3ST;
12629 if (board_config != ALC861VD_AUTO)
12630 setup_preset(spec, &alc861vd_presets[board_config]);
12632 spec->stream_name_analog = "ALC861VD Analog";
12633 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12634 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12636 spec->stream_name_digital = "ALC861VD Digital";
12637 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12638 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12640 spec->adc_nids = alc861vd_adc_nids;
12641 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12643 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12644 spec->num_mixers++;
12646 spec->vmaster_nid = 0x02;
12648 codec->patch_ops = alc_patch_ops;
12650 if (board_config == ALC861VD_AUTO)
12651 spec->init_hook = alc861vd_auto_init;
12652 #ifdef CONFIG_SND_HDA_POWER_SAVE
12653 if (!spec->loopback.amplist)
12654 spec->loopback.amplist = alc861vd_loopbacks;
12663 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12664 * configuration. Each pin widget can choose any input DACs and a mixer.
12665 * Each ADC is connected from a mixer of all inputs. This makes possible
12666 * 6-channel independent captures.
12668 * In addition, an independent DAC for the multi-playback (not used in this
12671 #define ALC662_DIGOUT_NID 0x06
12672 #define ALC662_DIGIN_NID 0x0a
12674 static hda_nid_t alc662_dac_nids[4] = {
12675 /* front, rear, clfe, rear_surr */
12679 static hda_nid_t alc662_adc_nids[1] = {
12684 /* FIXME: should be a matrix-type input source selection */
12686 static struct hda_input_mux alc662_capture_source = {
12690 { "Front Mic", 0x1 },
12696 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12704 static struct hda_input_mux alc662_eeepc_capture_source = {
12712 #define alc662_mux_enum_info alc_mux_enum_info
12713 #define alc662_mux_enum_get alc_mux_enum_get
12715 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12716 struct snd_ctl_elem_value *ucontrol)
12718 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12719 struct alc_spec *spec = codec->spec;
12720 const struct hda_input_mux *imux = spec->input_mux;
12721 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12722 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12723 hda_nid_t nid = capture_mixers[adc_idx];
12724 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12725 unsigned int i, idx;
12727 idx = ucontrol->value.enumerated.item[0];
12728 if (idx >= imux->num_items)
12729 idx = imux->num_items - 1;
12730 if (*cur_val == idx)
12732 for (i = 0; i < imux->num_items; i++) {
12733 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12734 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12735 imux->items[i].index,
12744 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12751 static struct hda_verb alc662_3ST_ch2_init[] = {
12752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12762 static struct hda_verb alc662_3ST_ch6_init[] = {
12763 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12764 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12765 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12766 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12767 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12768 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12772 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12773 { 2, alc662_3ST_ch2_init },
12774 { 6, alc662_3ST_ch6_init },
12780 static struct hda_verb alc662_sixstack_ch6_init[] = {
12781 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12782 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12783 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12790 static struct hda_verb alc662_sixstack_ch8_init[] = {
12791 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12792 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12793 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12797 static struct hda_channel_mode alc662_5stack_modes[2] = {
12798 { 2, alc662_sixstack_ch6_init },
12799 { 6, alc662_sixstack_ch8_init },
12802 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12803 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12806 static struct snd_kcontrol_new alc662_base_mixer[] = {
12807 /* output mixer control */
12808 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12809 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12810 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12811 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12812 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12813 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12814 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12815 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12818 /*Input mixer control */
12819 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12820 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12821 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12822 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12823 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12824 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12830 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12831 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12832 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12840 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12842 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12843 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12847 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12848 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12849 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12850 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12851 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12852 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12853 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12854 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12855 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12857 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12858 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12862 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12863 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12865 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12866 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12870 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12871 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12872 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12873 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12874 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
12875 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12883 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12884 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12886 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12887 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12889 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12890 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12891 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12893 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12894 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12895 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12899 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
12900 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12901 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12903 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
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("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12909 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
12910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12917 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12919 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12920 .name = "Channel Mode",
12921 .info = alc_ch_mode_info,
12922 .get = alc_ch_mode_get,
12923 .put = alc_ch_mode_put,
12928 static struct hda_verb alc662_init_verbs[] = {
12929 /* ADC: mute amp left and right */
12930 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12931 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12932 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12947 /* Front Pin: output 0 (0x0c) */
12948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12951 /* Rear Pin: output 1 (0x0d) */
12952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12953 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12955 /* CLFE Pin: output 2 (0x0e) */
12956 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12957 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12959 /* Mic (rear) pin: input vref at 80% */
12960 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12961 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12962 /* Front Mic pin: input vref at 80% */
12963 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12964 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12965 /* Line In pin: input */
12966 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12967 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12968 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12969 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12970 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12971 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12972 /* CD pin widget for input */
12973 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12975 /* FIXME: use matrix-type input source selection */
12976 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12985 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12986 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12990 static struct hda_verb alc662_sue_init_verbs[] = {
12991 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12992 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12996 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12997 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13002 /* Set Unsolicited Event*/
13003 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13005 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13010 * generic initialization of ADC, input mixers and output mixers
13012 static struct hda_verb alc662_auto_init_verbs[] = {
13014 * Unmute ADC and set the default input to mic-in
13016 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13019 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13021 * Note: PASD motherboards uses the Line In 2 as the input for front
13022 * panel mic (mic 2)
13024 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13032 * Set up output mixers (0x0c - 0x0f)
13034 /* set vol=0 to output mixers */
13035 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13036 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13037 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13039 /* set up input amps for analog loopback */
13040 /* Amp Indices: DAC = 0, mixer = 1 */
13041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13049 /* FIXME: use matrix-type input source selection */
13050 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13057 /* capture mixer elements */
13058 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13059 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13060 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13062 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13063 /* The multiple "Capture Source" controls confuse alsamixer
13064 * So call somewhat different..
13066 /* .name = "Capture Source", */
13067 .name = "Input Source",
13069 .info = alc662_mux_enum_info,
13070 .get = alc662_mux_enum_get,
13071 .put = alc662_mux_enum_put,
13076 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13078 unsigned int present;
13079 unsigned char bits;
13081 present = snd_hda_codec_read(codec, 0x14, 0,
13082 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13083 bits = present ? HDA_AMP_MUTE : 0;
13084 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13085 HDA_AMP_MUTE, bits);
13088 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13090 unsigned int present;
13091 unsigned char bits;
13093 present = snd_hda_codec_read(codec, 0x1b, 0,
13094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13095 bits = present ? HDA_AMP_MUTE : 0;
13096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13097 HDA_AMP_MUTE, bits);
13098 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13099 HDA_AMP_MUTE, bits);
13102 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13105 if ((res >> 26) == ALC880_HP_EVENT)
13106 alc662_lenovo_101e_all_automute(codec);
13107 if ((res >> 26) == ALC880_FRONT_EVENT)
13108 alc662_lenovo_101e_ispeaker_automute(codec);
13111 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13113 unsigned int present;
13115 present = snd_hda_codec_read(codec, 0x18, 0,
13116 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13117 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13118 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13119 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13120 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13121 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13122 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13123 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13124 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13127 /* unsolicited event for HP jack sensing */
13128 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13131 if ((res >> 26) == ALC880_HP_EVENT)
13132 alc262_hippo1_automute( codec );
13134 if ((res >> 26) == ALC880_MIC_EVENT)
13135 alc662_eeepc_mic_automute(codec);
13138 static void alc662_eeepc_inithook(struct hda_codec *codec)
13140 alc262_hippo1_automute( codec );
13141 alc662_eeepc_mic_automute(codec);
13144 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13147 unsigned int present;
13149 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13150 present = snd_hda_codec_read(codec, 0x14, 0,
13151 AC_VERB_GET_PIN_SENSE, 0);
13152 present = (present & 0x80000000) != 0;
13154 /* mute internal speaker */
13155 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13156 HDA_AMP_MUTE, HDA_AMP_MUTE);
13158 /* unmute internal speaker if necessary */
13159 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13160 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13161 HDA_AMP_MUTE, mute);
13165 /* unsolicited event for HP jack sensing */
13166 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13169 if ((res >> 26) == ALC880_HP_EVENT)
13170 alc662_eeepc_ep20_automute(codec);
13173 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13175 alc662_eeepc_ep20_automute(codec);
13178 #ifdef CONFIG_SND_HDA_POWER_SAVE
13179 #define alc662_loopbacks alc880_loopbacks
13183 /* pcm configuration: identiacal with ALC880 */
13184 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13185 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13186 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13187 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13190 * configuration and preset
13192 static const char *alc662_models[ALC662_MODEL_LAST] = {
13193 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13194 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13195 [ALC662_3ST_6ch] = "3stack-6ch",
13196 [ALC662_5ST_DIG] = "6stack-dig",
13197 [ALC662_LENOVO_101E] = "lenovo-101e",
13198 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13199 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13200 [ALC662_AUTO] = "auto",
13203 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13204 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13205 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13206 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13210 static struct alc_config_preset alc662_presets[] = {
13211 [ALC662_3ST_2ch_DIG] = {
13212 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13213 .init_verbs = { alc662_init_verbs },
13214 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13215 .dac_nids = alc662_dac_nids,
13216 .dig_out_nid = ALC662_DIGOUT_NID,
13217 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13218 .adc_nids = alc662_adc_nids,
13219 .dig_in_nid = ALC662_DIGIN_NID,
13220 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13221 .channel_mode = alc662_3ST_2ch_modes,
13222 .input_mux = &alc662_capture_source,
13224 [ALC662_3ST_6ch_DIG] = {
13225 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13226 alc662_capture_mixer },
13227 .init_verbs = { alc662_init_verbs },
13228 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13229 .dac_nids = alc662_dac_nids,
13230 .dig_out_nid = ALC662_DIGOUT_NID,
13231 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13232 .adc_nids = alc662_adc_nids,
13233 .dig_in_nid = ALC662_DIGIN_NID,
13234 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13235 .channel_mode = alc662_3ST_6ch_modes,
13237 .input_mux = &alc662_capture_source,
13239 [ALC662_3ST_6ch] = {
13240 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13241 alc662_capture_mixer },
13242 .init_verbs = { alc662_init_verbs },
13243 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13244 .dac_nids = alc662_dac_nids,
13245 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13246 .adc_nids = alc662_adc_nids,
13247 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13248 .channel_mode = alc662_3ST_6ch_modes,
13250 .input_mux = &alc662_capture_source,
13252 [ALC662_5ST_DIG] = {
13253 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13254 alc662_capture_mixer },
13255 .init_verbs = { alc662_init_verbs },
13256 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13257 .dac_nids = alc662_dac_nids,
13258 .dig_out_nid = ALC662_DIGOUT_NID,
13259 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13260 .adc_nids = alc662_adc_nids,
13261 .dig_in_nid = ALC662_DIGIN_NID,
13262 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13263 .channel_mode = alc662_5stack_modes,
13264 .input_mux = &alc662_capture_source,
13266 [ALC662_LENOVO_101E] = {
13267 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13268 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13269 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13270 .dac_nids = alc662_dac_nids,
13271 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13272 .adc_nids = alc662_adc_nids,
13273 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13274 .channel_mode = alc662_3ST_2ch_modes,
13275 .input_mux = &alc662_lenovo_101e_capture_source,
13276 .unsol_event = alc662_lenovo_101e_unsol_event,
13277 .init_hook = alc662_lenovo_101e_all_automute,
13279 [ALC662_ASUS_EEEPC_P701] = {
13280 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13281 .init_verbs = { alc662_init_verbs,
13282 alc662_eeepc_sue_init_verbs },
13283 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13284 .dac_nids = alc662_dac_nids,
13285 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
13286 .adc_nids = alc662_adc_nids,
13287 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13288 .channel_mode = alc662_3ST_2ch_modes,
13289 .input_mux = &alc662_eeepc_capture_source,
13290 .unsol_event = alc662_eeepc_unsol_event,
13291 .init_hook = alc662_eeepc_inithook,
13293 [ALC662_ASUS_EEEPC_EP20] = {
13294 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13295 alc662_chmode_mixer },
13296 .init_verbs = { alc662_init_verbs,
13297 alc662_eeepc_ep20_sue_init_verbs },
13298 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13299 .dac_nids = alc662_dac_nids,
13300 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
13301 .adc_nids = alc662_adc_nids,
13302 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13303 .channel_mode = alc662_3ST_6ch_modes,
13304 .input_mux = &alc662_lenovo_101e_capture_source,
13305 .unsol_event = alc662_eeepc_ep20_unsol_event,
13306 .init_hook = alc662_eeepc_ep20_inithook,
13313 * BIOS auto configuration
13316 /* add playback controls from the parsed DAC table */
13317 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13318 const struct auto_pin_cfg *cfg)
13321 static const char *chname[4] = {
13322 "Front", "Surround", NULL /*CLFE*/, "Side"
13327 for (i = 0; i < cfg->line_outs; i++) {
13328 if (!spec->multiout.dac_nids[i])
13330 nid = alc880_idx_to_dac(i);
13333 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13334 "Center Playback Volume",
13335 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13339 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13340 "LFE Playback Volume",
13341 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13345 err = add_control(spec, ALC_CTL_BIND_MUTE,
13346 "Center Playback Switch",
13347 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13351 err = add_control(spec, ALC_CTL_BIND_MUTE,
13352 "LFE Playback Switch",
13353 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13358 sprintf(name, "%s Playback Volume", chname[i]);
13359 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13360 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13364 sprintf(name, "%s Playback Switch", chname[i]);
13365 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13366 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13375 /* add playback controls for speaker and HP outputs */
13376 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13386 if (alc880_is_fixed_pin(pin)) {
13387 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13388 /* printk("DAC nid=%x\n",nid); */
13389 /* specify the DAC as the extra output */
13390 if (!spec->multiout.hp_nid)
13391 spec->multiout.hp_nid = nid;
13393 spec->multiout.extra_out_nid[0] = nid;
13394 /* control HP volume/switch on the output mixer amp */
13395 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13396 sprintf(name, "%s Playback Volume", pfx);
13397 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13398 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13401 sprintf(name, "%s Playback Switch", pfx);
13402 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13403 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13406 } else if (alc880_is_multi_pin(pin)) {
13407 /* set manual connection */
13408 /* we have only a switch on HP-out PIN */
13409 sprintf(name, "%s Playback Switch", pfx);
13410 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13411 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13418 /* create playback/capture controls for input pins */
13419 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13420 const struct auto_pin_cfg *cfg)
13422 struct hda_input_mux *imux = &spec->private_imux;
13425 for (i = 0; i < AUTO_PIN_LAST; i++) {
13426 if (alc880_is_input_pin(cfg->input_pins[i])) {
13427 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13428 err = new_analog_input(spec, cfg->input_pins[i],
13429 auto_pin_cfg_labels[i],
13433 imux->items[imux->num_items].label =
13434 auto_pin_cfg_labels[i];
13435 imux->items[imux->num_items].index =
13436 alc880_input_pin_idx(cfg->input_pins[i]);
13443 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13444 hda_nid_t nid, int pin_type,
13447 /* set as output */
13448 snd_hda_codec_write(codec, nid, 0,
13449 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13450 snd_hda_codec_write(codec, nid, 0,
13451 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13452 /* need the manual connection? */
13453 if (alc880_is_multi_pin(nid)) {
13454 struct alc_spec *spec = codec->spec;
13455 int idx = alc880_multi_pin_idx(nid);
13456 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13457 AC_VERB_SET_CONNECT_SEL,
13458 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13462 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13464 struct alc_spec *spec = codec->spec;
13467 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13468 for (i = 0; i <= HDA_SIDE; i++) {
13469 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13470 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13472 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13477 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13479 struct alc_spec *spec = codec->spec;
13482 pin = spec->autocfg.hp_pins[0];
13483 if (pin) /* connect to front */
13485 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13488 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13489 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13491 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13493 struct alc_spec *spec = codec->spec;
13496 for (i = 0; i < AUTO_PIN_LAST; i++) {
13497 hda_nid_t nid = spec->autocfg.input_pins[i];
13498 if (alc662_is_input_pin(nid)) {
13499 snd_hda_codec_write(codec, nid, 0,
13500 AC_VERB_SET_PIN_WIDGET_CONTROL,
13501 (i <= AUTO_PIN_FRONT_MIC ?
13502 PIN_VREF80 : PIN_IN));
13503 if (nid != ALC662_PIN_CD_NID)
13504 snd_hda_codec_write(codec, nid, 0,
13505 AC_VERB_SET_AMP_GAIN_MUTE,
13511 static int alc662_parse_auto_config(struct hda_codec *codec)
13513 struct alc_spec *spec = codec->spec;
13515 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13517 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13521 if (!spec->autocfg.line_outs)
13522 return 0; /* can't find valid BIOS pin config */
13524 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13527 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13530 err = alc662_auto_create_extra_out(spec,
13531 spec->autocfg.speaker_pins[0],
13535 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13539 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13543 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13545 if (spec->autocfg.dig_out_pin)
13546 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13548 if (spec->kctl_alloc)
13549 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13551 spec->num_mux_defs = 1;
13552 spec->input_mux = &spec->private_imux;
13554 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13555 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13556 spec->num_mixers++;
13560 /* additional initialization for auto-configuration model */
13561 static void alc662_auto_init(struct hda_codec *codec)
13563 alc662_auto_init_multi_out(codec);
13564 alc662_auto_init_hp_out(codec);
13565 alc662_auto_init_analog_input(codec);
13568 static int patch_alc662(struct hda_codec *codec)
13570 struct alc_spec *spec;
13571 int err, board_config;
13573 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13577 codec->spec = spec;
13579 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13582 if (board_config < 0) {
13583 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13584 "trying auto-probe from BIOS...\n");
13585 board_config = ALC662_AUTO;
13588 if (board_config == ALC662_AUTO) {
13589 /* automatic parse from the BIOS config */
13590 err = alc662_parse_auto_config(codec);
13596 "hda_codec: Cannot set up configuration "
13597 "from BIOS. Using base mode...\n");
13598 board_config = ALC662_3ST_2ch_DIG;
13602 if (board_config != ALC662_AUTO)
13603 setup_preset(spec, &alc662_presets[board_config]);
13605 spec->stream_name_analog = "ALC662 Analog";
13606 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13607 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13609 spec->stream_name_digital = "ALC662 Digital";
13610 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13611 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13613 if (!spec->adc_nids && spec->input_mux) {
13614 spec->adc_nids = alc662_adc_nids;
13615 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13618 spec->vmaster_nid = 0x02;
13620 codec->patch_ops = alc_patch_ops;
13621 if (board_config == ALC662_AUTO)
13622 spec->init_hook = alc662_auto_init;
13623 #ifdef CONFIG_SND_HDA_POWER_SAVE
13624 if (!spec->loopback.amplist)
13625 spec->loopback.amplist = alc662_loopbacks;
13634 struct hda_codec_preset snd_hda_preset_realtek[] = {
13635 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13636 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13637 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13638 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13639 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13640 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13641 .patch = patch_alc861 },
13642 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13643 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13644 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13645 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13646 .patch = patch_alc883 },
13647 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13648 .patch = patch_alc662 },
13649 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13650 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13651 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13652 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13653 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13654 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13655 {} /* terminator */