2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST /* last tag */
79 #ifdef CONFIG_SND_DEBUG
83 ALC260_MODEL_LAST /* last tag */
93 ALC262_HP_BPC_D7000_WL,
94 ALC262_HP_BPC_D7000_WF,
103 ALC262_MODEL_LAST /* last tag */
114 #ifdef CONFIG_SND_DEBUG
118 ALC268_MODEL_LAST /* last tag */
125 ALC269_MODEL_LAST /* last tag */
142 /* ALC861-VD models */
163 ALC662_ASUS_EEEPC_P701,
164 ALC662_ASUS_EEEPC_EP20,
192 ALC883_TARGA_2ch_DIG,
198 ALC883_LENOVO_101E_2ch,
199 ALC883_LENOVO_NB0763,
200 ALC888_LENOVO_MS7195_DIG,
206 ALC883_FUJITSU_PI2515,
212 #define GPIO_MASK 0x03
215 /* codec parameterization */
216 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
217 unsigned int num_mixers;
219 const struct hda_verb *init_verbs[5]; /* initialization verbs
223 unsigned int num_init_verbs;
225 char *stream_name_analog; /* analog PCM stream */
226 struct hda_pcm_stream *stream_analog_playback;
227 struct hda_pcm_stream *stream_analog_capture;
228 struct hda_pcm_stream *stream_analog_alt_playback;
229 struct hda_pcm_stream *stream_analog_alt_capture;
231 char *stream_name_digital; /* digital PCM stream */
232 struct hda_pcm_stream *stream_digital_playback;
233 struct hda_pcm_stream *stream_digital_capture;
236 struct hda_multi_out multiout; /* playback set-up
237 * max_channels, dacs must be set
238 * dig_out_nid and hp_nid are optional
240 hda_nid_t alt_dac_nid;
243 unsigned int num_adc_nids;
245 hda_nid_t *capsrc_nids;
246 hda_nid_t dig_in_nid; /* digital-in NID; optional */
249 unsigned int num_mux_defs;
250 const struct hda_input_mux *input_mux;
251 unsigned int cur_mux[3];
254 const struct hda_channel_mode *channel_mode;
255 int num_channel_mode;
258 /* PCM information */
259 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
261 /* dynamic controls, init_verbs and input_mux */
262 struct auto_pin_cfg autocfg;
263 unsigned int num_kctl_alloc, num_kctl_used;
264 struct snd_kcontrol_new *kctl_alloc;
265 struct hda_input_mux private_imux;
266 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
269 void (*init_hook)(struct hda_codec *codec);
270 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
272 /* for pin sensing */
273 unsigned int sense_updated: 1;
274 unsigned int jack_present: 1;
275 unsigned int master_sw: 1;
277 /* for virtual master */
278 hda_nid_t vmaster_nid;
279 #ifdef CONFIG_SND_HDA_POWER_SAVE
280 struct hda_loopback_check loopback;
285 * configuration template - to be copied to the spec instance
287 struct alc_config_preset {
288 struct snd_kcontrol_new *mixers[5]; /* should be identical size
291 const struct hda_verb *init_verbs[5];
292 unsigned int num_dacs;
294 hda_nid_t dig_out_nid; /* optional */
295 hda_nid_t hp_nid; /* optional */
296 unsigned int num_adc_nids;
298 hda_nid_t *capsrc_nids;
299 hda_nid_t dig_in_nid;
300 unsigned int num_channel_mode;
301 const struct hda_channel_mode *channel_mode;
303 unsigned int num_mux_defs;
304 const struct hda_input_mux *input_mux;
305 void (*unsol_event)(struct hda_codec *, unsigned int);
306 void (*init_hook)(struct hda_codec *);
307 #ifdef CONFIG_SND_HDA_POWER_SAVE
308 struct hda_amp_list *loopbacks;
316 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
317 struct snd_ctl_elem_info *uinfo)
319 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
320 struct alc_spec *spec = codec->spec;
321 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
322 if (mux_idx >= spec->num_mux_defs)
324 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
327 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
328 struct snd_ctl_elem_value *ucontrol)
330 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
331 struct alc_spec *spec = codec->spec;
332 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
334 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
338 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
339 struct snd_ctl_elem_value *ucontrol)
341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
342 struct alc_spec *spec = codec->spec;
343 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
344 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
345 hda_nid_t nid = spec->capsrc_nids ?
346 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
347 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
348 nid, &spec->cur_mux[adc_idx]);
353 * channel mode setting
355 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_info *uinfo)
358 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
359 struct alc_spec *spec = codec->spec;
360 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
361 spec->num_channel_mode);
364 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_value *ucontrol)
367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
368 struct alc_spec *spec = codec->spec;
369 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
370 spec->num_channel_mode,
371 spec->multiout.max_channels);
374 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
375 struct snd_ctl_elem_value *ucontrol)
377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
378 struct alc_spec *spec = codec->spec;
379 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
380 spec->num_channel_mode,
381 &spec->multiout.max_channels);
382 if (err >= 0 && spec->need_dac_fix)
383 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
388 * Control the mode of pin widget settings via the mixer. "pc" is used
389 * instead of "%" to avoid consequences of accidently treating the % as
390 * being part of a format specifier. Maximum allowed length of a value is
391 * 63 characters plus NULL terminator.
393 * Note: some retasking pin complexes seem to ignore requests for input
394 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
395 * are requested. Therefore order this list so that this behaviour will not
396 * cause problems when mixer clients move through the enum sequentially.
397 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
400 static char *alc_pin_mode_names[] = {
401 "Mic 50pc bias", "Mic 80pc bias",
402 "Line in", "Line out", "Headphone out",
404 static unsigned char alc_pin_mode_values[] = {
405 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
407 /* The control can present all 5 options, or it can limit the options based
408 * in the pin being assumed to be exclusively an input or an output pin. In
409 * addition, "input" pins may or may not process the mic bias option
410 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
411 * accept requests for bias as of chip versions up to March 2006) and/or
412 * wiring in the computer.
414 #define ALC_PIN_DIR_IN 0x00
415 #define ALC_PIN_DIR_OUT 0x01
416 #define ALC_PIN_DIR_INOUT 0x02
417 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
418 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
420 /* Info about the pin modes supported by the different pin direction modes.
421 * For each direction the minimum and maximum values are given.
423 static signed char alc_pin_mode_dir_info[5][2] = {
424 { 0, 2 }, /* ALC_PIN_DIR_IN */
425 { 3, 4 }, /* ALC_PIN_DIR_OUT */
426 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
427 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
428 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
430 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
431 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
432 #define alc_pin_mode_n_items(_dir) \
433 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
435 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_info *uinfo)
438 unsigned int item_num = uinfo->value.enumerated.item;
439 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
441 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
443 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
445 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
446 item_num = alc_pin_mode_min(dir);
447 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
451 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
452 struct snd_ctl_elem_value *ucontrol)
455 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
456 hda_nid_t nid = kcontrol->private_value & 0xffff;
457 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
458 long *valp = ucontrol->value.integer.value;
459 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
460 AC_VERB_GET_PIN_WIDGET_CONTROL,
463 /* Find enumerated value for current pinctl setting */
464 i = alc_pin_mode_min(dir);
465 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
467 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
471 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_value *ucontrol)
475 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
476 hda_nid_t nid = kcontrol->private_value & 0xffff;
477 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
478 long val = *ucontrol->value.integer.value;
479 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
480 AC_VERB_GET_PIN_WIDGET_CONTROL,
483 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
484 val = alc_pin_mode_min(dir);
486 change = pinctl != alc_pin_mode_values[val];
488 /* Set pin mode to that requested */
489 snd_hda_codec_write_cache(codec, nid, 0,
490 AC_VERB_SET_PIN_WIDGET_CONTROL,
491 alc_pin_mode_values[val]);
493 /* Also enable the retasking pin's input/output as required
494 * for the requested pin mode. Enum values of 2 or less are
497 * Dynamically switching the input/output buffers probably
498 * reduces noise slightly (particularly on input) so we'll
499 * do it. However, having both input and output buffers
500 * enabled simultaneously doesn't seem to be problematic if
501 * this turns out to be necessary in the future.
504 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
505 HDA_AMP_MUTE, HDA_AMP_MUTE);
506 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
509 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
510 HDA_AMP_MUTE, HDA_AMP_MUTE);
511 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
518 #define ALC_PIN_MODE(xname, nid, dir) \
519 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
520 .info = alc_pin_mode_info, \
521 .get = alc_pin_mode_get, \
522 .put = alc_pin_mode_put, \
523 .private_value = nid | (dir<<16) }
525 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
526 * together using a mask with more than one bit set. This control is
527 * currently used only by the ALC260 test model. At this stage they are not
528 * needed for any "production" models.
530 #ifdef CONFIG_SND_DEBUG
531 #define alc_gpio_data_info snd_ctl_boolean_mono_info
533 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
534 struct snd_ctl_elem_value *ucontrol)
536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
537 hda_nid_t nid = kcontrol->private_value & 0xffff;
538 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
539 long *valp = ucontrol->value.integer.value;
540 unsigned int val = snd_hda_codec_read(codec, nid, 0,
541 AC_VERB_GET_GPIO_DATA, 0x00);
543 *valp = (val & mask) != 0;
546 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
547 struct snd_ctl_elem_value *ucontrol)
550 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
551 hda_nid_t nid = kcontrol->private_value & 0xffff;
552 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
553 long val = *ucontrol->value.integer.value;
554 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
555 AC_VERB_GET_GPIO_DATA,
558 /* Set/unset the masked GPIO bit(s) as needed */
559 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
564 snd_hda_codec_write_cache(codec, nid, 0,
565 AC_VERB_SET_GPIO_DATA, gpio_data);
569 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
570 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
571 .info = alc_gpio_data_info, \
572 .get = alc_gpio_data_get, \
573 .put = alc_gpio_data_put, \
574 .private_value = nid | (mask<<16) }
575 #endif /* CONFIG_SND_DEBUG */
577 /* A switch control to allow the enabling of the digital IO pins on the
578 * ALC260. This is incredibly simplistic; the intention of this control is
579 * to provide something in the test model allowing digital outputs to be
580 * identified if present. If models are found which can utilise these
581 * outputs a more complete mixer control can be devised for those models if
584 #ifdef CONFIG_SND_DEBUG
585 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
587 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
590 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
591 hda_nid_t nid = kcontrol->private_value & 0xffff;
592 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
593 long *valp = ucontrol->value.integer.value;
594 unsigned int val = snd_hda_codec_read(codec, nid, 0,
595 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
597 *valp = (val & mask) != 0;
600 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_value *ucontrol)
604 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
605 hda_nid_t nid = kcontrol->private_value & 0xffff;
606 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
607 long val = *ucontrol->value.integer.value;
608 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
609 AC_VERB_GET_DIGI_CONVERT_1,
612 /* Set/unset the masked control bit(s) as needed */
613 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
618 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
623 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
624 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
625 .info = alc_spdif_ctrl_info, \
626 .get = alc_spdif_ctrl_get, \
627 .put = alc_spdif_ctrl_put, \
628 .private_value = nid | (mask<<16) }
629 #endif /* CONFIG_SND_DEBUG */
631 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
632 * Again, this is only used in the ALC26x test models to help identify when
633 * the EAPD line must be asserted for features to work.
635 #ifdef CONFIG_SND_DEBUG
636 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
638 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
639 struct snd_ctl_elem_value *ucontrol)
641 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
642 hda_nid_t nid = kcontrol->private_value & 0xffff;
643 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
644 long *valp = ucontrol->value.integer.value;
645 unsigned int val = snd_hda_codec_read(codec, nid, 0,
646 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
648 *valp = (val & mask) != 0;
652 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
653 struct snd_ctl_elem_value *ucontrol)
656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
657 hda_nid_t nid = kcontrol->private_value & 0xffff;
658 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
659 long val = *ucontrol->value.integer.value;
660 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
661 AC_VERB_GET_EAPD_BTLENABLE,
664 /* Set/unset the masked control bit(s) as needed */
665 change = (!val ? 0 : mask) != (ctrl_data & mask);
670 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
676 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
677 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
678 .info = alc_eapd_ctrl_info, \
679 .get = alc_eapd_ctrl_get, \
680 .put = alc_eapd_ctrl_put, \
681 .private_value = nid | (mask<<16) }
682 #endif /* CONFIG_SND_DEBUG */
685 * set up from the preset table
687 static void setup_preset(struct alc_spec *spec,
688 const struct alc_config_preset *preset)
692 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
693 spec->mixers[spec->num_mixers++] = preset->mixers[i];
694 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
696 spec->init_verbs[spec->num_init_verbs++] =
697 preset->init_verbs[i];
699 spec->channel_mode = preset->channel_mode;
700 spec->num_channel_mode = preset->num_channel_mode;
701 spec->need_dac_fix = preset->need_dac_fix;
703 spec->multiout.max_channels = spec->channel_mode[0].channels;
705 spec->multiout.num_dacs = preset->num_dacs;
706 spec->multiout.dac_nids = preset->dac_nids;
707 spec->multiout.dig_out_nid = preset->dig_out_nid;
708 spec->multiout.hp_nid = preset->hp_nid;
710 spec->num_mux_defs = preset->num_mux_defs;
711 if (!spec->num_mux_defs)
712 spec->num_mux_defs = 1;
713 spec->input_mux = preset->input_mux;
715 spec->num_adc_nids = preset->num_adc_nids;
716 spec->adc_nids = preset->adc_nids;
717 spec->capsrc_nids = preset->capsrc_nids;
718 spec->dig_in_nid = preset->dig_in_nid;
720 spec->unsol_event = preset->unsol_event;
721 spec->init_hook = preset->init_hook;
722 #ifdef CONFIG_SND_HDA_POWER_SAVE
723 spec->loopback.amplist = preset->loopbacks;
727 /* Enable GPIO mask and set output */
728 static struct hda_verb alc_gpio1_init_verbs[] = {
729 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
730 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
731 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
735 static struct hda_verb alc_gpio2_init_verbs[] = {
736 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
737 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
738 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
742 static struct hda_verb alc_gpio3_init_verbs[] = {
743 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
744 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
745 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
749 static void alc_sku_automute(struct hda_codec *codec)
751 struct alc_spec *spec = codec->spec;
752 unsigned int present;
753 unsigned int hp_nid = spec->autocfg.hp_pins[0];
754 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
756 /* need to execute and sync at first */
757 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
758 present = snd_hda_codec_read(codec, hp_nid, 0,
759 AC_VERB_GET_PIN_SENSE, 0);
760 spec->jack_present = (present & 0x80000000) != 0;
761 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
762 spec->jack_present ? 0 : PIN_OUT);
765 /* unsolicited event for HP jack sensing */
766 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
768 if (codec->vendor_id == 0x10ec0880)
772 if (res != ALC880_HP_EVENT)
775 alc_sku_automute(codec);
778 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
779 * 31 ~ 16 : Manufacture ID
781 * 7 ~ 0 : Assembly ID
782 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
784 static void alc_subsystem_id(struct hda_codec *codec,
785 unsigned int porta, unsigned int porte,
788 unsigned int ass, tmp, i;
790 struct alc_spec *spec = codec->spec;
792 ass = codec->subsystem_id & 0xffff;
793 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
797 * 31~30 : port conetcivity
800 * 19~16 : Check sum (15:1)
805 if (codec->vendor_id == 0x10ec0260)
807 ass = snd_hda_codec_read(codec, nid, 0,
808 AC_VERB_GET_CONFIG_DEFAULT, 0);
809 if (!(ass & 1) && !(ass & 0x100000))
811 if ((ass >> 30) != 1) /* no physical connection */
816 for (i = 1; i < 16; i++) {
820 if (((ass >> 16) & 0xf) != tmp)
826 * 2 : 0 --> Desktop, 1 --> Laptop
827 * 3~5 : External Amplifier control
830 tmp = (ass & 0x38) >> 3; /* external Amp control */
833 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
836 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
839 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
841 case 5: /* set EAPD output high */
842 switch (codec->vendor_id) {
844 snd_hda_codec_write(codec, 0x0f, 0,
845 AC_VERB_SET_EAPD_BTLENABLE, 2);
846 snd_hda_codec_write(codec, 0x10, 0,
847 AC_VERB_SET_EAPD_BTLENABLE, 2);
855 snd_hda_codec_write(codec, 0x14, 0,
856 AC_VERB_SET_EAPD_BTLENABLE, 2);
857 snd_hda_codec_write(codec, 0x15, 0,
858 AC_VERB_SET_EAPD_BTLENABLE, 2);
861 switch (codec->vendor_id) {
863 snd_hda_codec_write(codec, 0x1a, 0,
864 AC_VERB_SET_COEF_INDEX, 7);
865 tmp = snd_hda_codec_read(codec, 0x1a, 0,
866 AC_VERB_GET_PROC_COEF, 0);
867 snd_hda_codec_write(codec, 0x1a, 0,
868 AC_VERB_SET_COEF_INDEX, 7);
869 snd_hda_codec_write(codec, 0x1a, 0,
870 AC_VERB_SET_PROC_COEF,
879 snd_hda_codec_write(codec, 0x20, 0,
880 AC_VERB_SET_COEF_INDEX, 7);
881 tmp = snd_hda_codec_read(codec, 0x20, 0,
882 AC_VERB_GET_PROC_COEF, 0);
883 snd_hda_codec_write(codec, 0x20, 0,
884 AC_VERB_SET_COEF_INDEX, 7);
885 snd_hda_codec_write(codec, 0x20, 0,
886 AC_VERB_SET_PROC_COEF,
891 snd_hda_codec_write(codec, 0x20, 0,
892 AC_VERB_SET_COEF_INDEX, 7);
893 tmp = snd_hda_codec_read(codec, 0x20, 0,
894 AC_VERB_GET_PROC_COEF, 0);
895 snd_hda_codec_write(codec, 0x20, 0,
896 AC_VERB_SET_COEF_INDEX, 7);
897 snd_hda_codec_write(codec, 0x20, 0,
898 AC_VERB_SET_PROC_COEF,
906 /* is laptop or Desktop and enable the function "Mute internal speaker
907 * when the external headphone out jack is plugged"
912 * 10~8 : Jack location
913 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
915 * 15 : 1 --> enable the function "Mute internal speaker
916 * when the external headphone out jack is plugged"
918 if (!spec->autocfg.speaker_pins[0]) {
919 if (spec->autocfg.line_out_pins[0])
920 spec->autocfg.speaker_pins[0] =
921 spec->autocfg.line_out_pins[0];
926 if (!spec->autocfg.hp_pins[0]) {
927 tmp = (ass >> 11) & 0x3; /* HP to chassis */
929 spec->autocfg.hp_pins[0] = porta;
931 spec->autocfg.hp_pins[0] = porte;
933 spec->autocfg.hp_pins[0] = portd;
938 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
939 AC_VERB_SET_UNSOLICITED_ENABLE,
940 AC_USRSP_EN | ALC880_HP_EVENT);
941 spec->unsol_event = alc_sku_unsol_event;
942 spec->init_hook = alc_sku_automute;
946 * Fix-up pin default configurations
954 static void alc_fix_pincfg(struct hda_codec *codec,
955 const struct snd_pci_quirk *quirk,
956 const struct alc_pincfg **pinfix)
958 const struct alc_pincfg *cfg;
960 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
964 cfg = pinfix[quirk->value];
965 for (; cfg->nid; cfg++) {
968 for (i = 0; i < 4; i++) {
969 snd_hda_codec_write(codec, cfg->nid, 0,
970 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
978 * ALC880 3-stack model
980 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
981 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
982 * F-Mic = 0x1b, HP = 0x19
985 static hda_nid_t alc880_dac_nids[4] = {
986 /* front, rear, clfe, rear_surr */
987 0x02, 0x05, 0x04, 0x03
990 static hda_nid_t alc880_adc_nids[3] = {
995 /* The datasheet says the node 0x07 is connected from inputs,
996 * but it shows zero connection in the real implementation on some devices.
997 * Note: this is a 915GAV bug, fixed on 915GLV
999 static hda_nid_t alc880_adc_nids_alt[2] = {
1004 #define ALC880_DIGOUT_NID 0x06
1005 #define ALC880_DIGIN_NID 0x0a
1007 static struct hda_input_mux alc880_capture_source = {
1011 { "Front Mic", 0x3 },
1017 /* channel source setting (2/6 channel selection for 3-stack) */
1019 static struct hda_verb alc880_threestack_ch2_init[] = {
1020 /* set line-in to input, mute it */
1021 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1022 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1023 /* set mic-in to input vref 80%, mute it */
1024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1025 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1030 static struct hda_verb alc880_threestack_ch6_init[] = {
1031 /* set line-in to output, unmute it */
1032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1034 /* set mic-in to output, unmute it */
1035 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1036 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1040 static struct hda_channel_mode alc880_threestack_modes[2] = {
1041 { 2, alc880_threestack_ch2_init },
1042 { 6, alc880_threestack_ch6_init },
1045 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1046 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1047 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1048 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1049 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1050 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1051 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1052 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1053 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1054 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1055 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1060 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1061 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1062 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1063 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1067 .name = "Channel Mode",
1068 .info = alc_ch_mode_info,
1069 .get = alc_ch_mode_get,
1070 .put = alc_ch_mode_put,
1075 /* capture mixer elements */
1076 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1079 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1080 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1081 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1082 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1084 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1085 /* The multiple "Capture Source" controls confuse alsamixer
1086 * So call somewhat different..
1088 /* .name = "Capture Source", */
1089 .name = "Input Source",
1091 .info = alc_mux_enum_info,
1092 .get = alc_mux_enum_get,
1093 .put = alc_mux_enum_put,
1098 /* capture mixer elements (in case NID 0x07 not available) */
1099 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1100 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1101 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1102 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1103 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1106 /* The multiple "Capture Source" controls confuse alsamixer
1107 * So call somewhat different..
1109 /* .name = "Capture Source", */
1110 .name = "Input Source",
1112 .info = alc_mux_enum_info,
1113 .get = alc_mux_enum_get,
1114 .put = alc_mux_enum_put,
1122 * ALC880 5-stack model
1124 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1126 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1127 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1130 /* additional mixers to alc880_three_stack_mixer */
1131 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1132 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1133 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1137 /* channel source setting (6/8 channel selection for 5-stack) */
1139 static struct hda_verb alc880_fivestack_ch6_init[] = {
1140 /* set line-in to input, mute it */
1141 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1142 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1147 static struct hda_verb alc880_fivestack_ch8_init[] = {
1148 /* set line-in to output, unmute it */
1149 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1150 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1154 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1155 { 6, alc880_fivestack_ch6_init },
1156 { 8, alc880_fivestack_ch8_init },
1161 * ALC880 6-stack model
1163 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1164 * Side = 0x05 (0x0f)
1165 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1166 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1169 static hda_nid_t alc880_6st_dac_nids[4] = {
1170 /* front, rear, clfe, rear_surr */
1171 0x02, 0x03, 0x04, 0x05
1174 static struct hda_input_mux alc880_6stack_capture_source = {
1178 { "Front Mic", 0x1 },
1184 /* fixed 8-channels */
1185 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1189 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1192 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1193 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1194 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1195 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1197 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1199 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1206 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1208 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1209 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1212 .name = "Channel Mode",
1213 .info = alc_ch_mode_info,
1214 .get = alc_ch_mode_get,
1215 .put = alc_ch_mode_put,
1224 * W810 has rear IO for:
1227 * Center/LFE (DAC 04)
1230 * The system also has a pair of internal speakers, and a headphone jack.
1231 * These are both connected to Line2 on the codec, hence to DAC 02.
1233 * There is a variable resistor to control the speaker or headphone
1234 * volume. This is a hardware-only device without a software API.
1236 * Plugging headphones in will disable the internal speakers. This is
1237 * implemented in hardware, not via the driver using jack sense. In
1238 * a similar fashion, plugging into the rear socket marked "front" will
1239 * disable both the speakers and headphones.
1241 * For input, there's a microphone jack, and an "audio in" jack.
1242 * These may not do anything useful with this driver yet, because I
1243 * haven't setup any initialization verbs for these yet...
1246 static hda_nid_t alc880_w810_dac_nids[3] = {
1247 /* front, rear/surround, clfe */
1251 /* fixed 6 channels */
1252 static struct hda_channel_mode alc880_w810_modes[1] = {
1256 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1257 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1274 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1275 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1279 static hda_nid_t alc880_z71v_dac_nids[1] = {
1282 #define ALC880_Z71V_HP_DAC 0x03
1284 /* fixed 2 channels */
1285 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1289 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1293 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1303 * ALC880 F1734 model
1305 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1306 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1309 static hda_nid_t alc880_f1734_dac_nids[1] = {
1312 #define ALC880_F1734_HP_DAC 0x02
1314 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1315 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1316 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1317 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1318 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1326 static struct hda_input_mux alc880_f1734_capture_source = {
1338 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1339 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1340 * Mic = 0x18, Line = 0x1a
1343 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1344 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1346 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1347 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1348 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1349 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1350 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1351 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1352 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1353 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1354 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1362 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1363 .name = "Channel Mode",
1364 .info = alc_ch_mode_info,
1365 .get = alc_ch_mode_get,
1366 .put = alc_ch_mode_put,
1372 * ALC880 ASUS W1V model
1374 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1375 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1376 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1379 /* additional mixers to alc880_asus_mixer */
1380 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1381 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1382 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1386 /* additional mixers to alc880_asus_mixer */
1387 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1388 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1389 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1394 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1395 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1396 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1398 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1399 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1402 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1403 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1406 /* The multiple "Capture Source" controls confuse alsamixer
1407 * So call somewhat different..
1409 /* .name = "Capture Source", */
1410 .name = "Input Source",
1412 .info = alc_mux_enum_info,
1413 .get = alc_mux_enum_get,
1414 .put = alc_mux_enum_put,
1420 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1421 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1422 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1423 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1424 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1425 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1426 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1427 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1428 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1429 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1430 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1435 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1436 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1437 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1438 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1441 .name = "Channel Mode",
1442 .info = alc_ch_mode_info,
1443 .get = alc_ch_mode_get,
1444 .put = alc_ch_mode_put,
1449 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1450 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1451 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1452 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1453 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1454 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1455 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1456 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1457 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1458 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1459 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1463 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1465 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1467 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1474 * virtual master controls
1478 * slave controls for virtual master
1480 static const char *alc_slave_vols[] = {
1481 "Front Playback Volume",
1482 "Surround Playback Volume",
1483 "Center Playback Volume",
1484 "LFE Playback Volume",
1485 "Side Playback Volume",
1486 "Headphone Playback Volume",
1487 "Speaker Playback Volume",
1488 "Mono Playback Volume",
1489 "Line-Out Playback Volume",
1493 static const char *alc_slave_sws[] = {
1494 "Front Playback Switch",
1495 "Surround Playback Switch",
1496 "Center Playback Switch",
1497 "LFE Playback Switch",
1498 "Side Playback Switch",
1499 "Headphone Playback Switch",
1500 "Speaker Playback Switch",
1501 "Mono Playback Switch",
1502 "IEC958 Playback Switch",
1507 * build control elements
1509 static int alc_build_controls(struct hda_codec *codec)
1511 struct alc_spec *spec = codec->spec;
1515 for (i = 0; i < spec->num_mixers; i++) {
1516 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1521 if (spec->multiout.dig_out_nid) {
1522 err = snd_hda_create_spdif_out_ctls(codec,
1523 spec->multiout.dig_out_nid);
1526 err = snd_hda_create_spdif_share_sw(codec,
1530 spec->multiout.share_spdif = 1;
1532 if (spec->dig_in_nid) {
1533 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1538 /* if we have no master control, let's create it */
1539 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
1540 unsigned int vmaster_tlv[4];
1541 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
1542 HDA_OUTPUT, vmaster_tlv);
1543 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
1544 vmaster_tlv, alc_slave_vols);
1548 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
1549 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
1550 NULL, alc_slave_sws);
1560 * initialize the codec volumes, etc
1564 * generic initialization of ADC, input mixers and output mixers
1566 static struct hda_verb alc880_volume_init_verbs[] = {
1568 * Unmute ADC0-2 and set the default input to mic-in
1570 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1571 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1572 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1573 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1574 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1577 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1579 * Note: PASD motherboards uses the Line In 2 as the input for front
1582 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1592 * Set up output mixers (0x0c - 0x0f)
1594 /* set vol=0 to output mixers */
1595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1596 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1599 /* set up input amps for analog loopback */
1600 /* Amp Indices: DAC = 0, mixer = 1 */
1601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1607 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1614 * 3-stack pin configuration:
1615 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1617 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1619 * preset connection lists of input pins
1620 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1622 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1623 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1624 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1627 * Set pin mode and muting
1629 /* set front pin widgets 0x14 for output */
1630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1631 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1632 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1633 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1635 /* Mic2 (as headphone out) for HP output */
1636 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1638 /* Line In pin widget for input */
1639 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1641 /* Line2 (as front mic) pin widget for input and vref at 80% */
1642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1643 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1644 /* CD pin widget for input */
1645 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1651 * 5-stack pin configuration:
1652 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1653 * line-in/side = 0x1a, f-mic = 0x1b
1655 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1657 * preset connection lists of input pins
1658 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1660 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1661 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1664 * Set pin mode and muting
1666 /* set pin widgets 0x14-0x17 for output */
1667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1669 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1670 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1671 /* unmute pins for output (no gain on this amp) */
1672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1674 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1675 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1677 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1678 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1679 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1680 /* Mic2 (as headphone out) for HP output */
1681 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1682 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1683 /* Line In pin widget for input */
1684 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1685 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1686 /* Line2 (as front mic) pin widget for input and vref at 80% */
1687 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1688 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1689 /* CD pin widget for input */
1690 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1696 * W810 pin configuration:
1697 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1699 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1700 /* hphone/speaker input selector: front DAC */
1701 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1703 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1708 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1717 * Z71V pin configuration:
1718 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1720 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1722 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1726 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1727 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1729 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1735 * 6-stack pin configuration:
1736 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1737 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1739 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1740 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1748 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1749 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1751 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1752 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1755 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1756 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1757 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1758 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1759 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1765 * Uniwill pin configuration:
1766 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1769 static struct hda_verb alc880_uniwill_init_verbs[] = {
1770 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1776 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1777 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1778 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1779 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1783 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1785 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1787 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1788 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1789 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1790 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1791 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1792 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1793 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1794 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1795 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1797 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1798 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1805 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1807 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1808 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1824 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1825 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1827 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1828 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1830 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1831 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1836 static struct hda_verb alc880_beep_init_verbs[] = {
1837 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1841 /* toggle speaker-output according to the hp-jack state */
1842 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1844 unsigned int present;
1847 present = snd_hda_codec_read(codec, 0x14, 0,
1848 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1849 bits = present ? HDA_AMP_MUTE : 0;
1850 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1851 HDA_AMP_MUTE, bits);
1852 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1853 HDA_AMP_MUTE, bits);
1856 /* auto-toggle front mic */
1857 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1859 unsigned int present;
1862 present = snd_hda_codec_read(codec, 0x18, 0,
1863 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1864 bits = present ? HDA_AMP_MUTE : 0;
1865 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1868 static void alc880_uniwill_automute(struct hda_codec *codec)
1870 alc880_uniwill_hp_automute(codec);
1871 alc880_uniwill_mic_automute(codec);
1874 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1877 /* Looks like the unsol event is incompatible with the standard
1878 * definition. 4bit tag is placed at 28 bit!
1880 switch (res >> 28) {
1881 case ALC880_HP_EVENT:
1882 alc880_uniwill_hp_automute(codec);
1884 case ALC880_MIC_EVENT:
1885 alc880_uniwill_mic_automute(codec);
1890 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1892 unsigned int present;
1895 present = snd_hda_codec_read(codec, 0x14, 0,
1896 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1897 bits = present ? HDA_AMP_MUTE : 0;
1898 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
1901 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1903 unsigned int present;
1905 present = snd_hda_codec_read(codec, 0x21, 0,
1906 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1907 present &= HDA_AMP_VOLMASK;
1908 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1909 HDA_AMP_VOLMASK, present);
1910 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1911 HDA_AMP_VOLMASK, present);
1914 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1917 /* Looks like the unsol event is incompatible with the standard
1918 * definition. 4bit tag is placed at 28 bit!
1920 if ((res >> 28) == ALC880_HP_EVENT)
1921 alc880_uniwill_p53_hp_automute(codec);
1922 if ((res >> 28) == ALC880_DCVOL_EVENT)
1923 alc880_uniwill_p53_dcvol_automute(codec);
1927 * F1734 pin configuration:
1928 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1930 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1931 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
1932 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1933 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1934 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1935 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1937 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1938 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1948 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1949 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1950 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1952 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
1953 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
1959 * ASUS pin configuration:
1960 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1962 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1963 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1964 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1965 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1966 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1969 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1971 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1973 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1974 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1979 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1981 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1982 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1983 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1985 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1990 /* Enable GPIO mask and set output */
1991 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1992 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1994 /* Clevo m520g init */
1995 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1996 /* headphone output */
1997 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2006 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2007 /* Mic1 (rear panel) */
2008 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2009 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2010 /* Mic2 (front panel) */
2011 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2012 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2014 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2016 /* change to EAPD mode */
2017 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2018 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2023 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2024 /* change to EAPD mode */
2025 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2026 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2028 /* Headphone output */
2029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2032 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2034 /* Line In pin widget for input */
2035 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2036 /* CD pin widget for input */
2037 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2038 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2039 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2041 /* change to EAPD mode */
2042 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2043 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2049 * LG m1 express dual
2052 * Rear Line-In/Out (blue): 0x14
2053 * Build-in Mic-In: 0x15
2055 * HP-Out (green): 0x1b
2056 * Mic-In/Out (red): 0x19
2060 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2061 static hda_nid_t alc880_lg_dac_nids[3] = {
2065 /* seems analog CD is not working */
2066 static struct hda_input_mux alc880_lg_capture_source = {
2071 { "Internal Mic", 0x6 },
2075 /* 2,4,6 channel modes */
2076 static struct hda_verb alc880_lg_ch2_init[] = {
2077 /* set line-in and mic-in to input */
2078 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2079 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2083 static struct hda_verb alc880_lg_ch4_init[] = {
2084 /* set line-in to out and mic-in to input */
2085 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2086 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2090 static struct hda_verb alc880_lg_ch6_init[] = {
2091 /* set line-in and mic-in to output */
2092 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2093 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2097 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2098 { 2, alc880_lg_ch2_init },
2099 { 4, alc880_lg_ch4_init },
2100 { 6, alc880_lg_ch6_init },
2103 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2104 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2107 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2108 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2109 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2110 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2111 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2116 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2117 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2120 .name = "Channel Mode",
2121 .info = alc_ch_mode_info,
2122 .get = alc_ch_mode_get,
2123 .put = alc_ch_mode_put,
2128 static struct hda_verb alc880_lg_init_verbs[] = {
2129 /* set capture source to mic-in */
2130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2133 /* mute all amp mixer inputs */
2134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2137 /* line-in to input */
2138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2144 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2145 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2146 /* mic-in to input */
2147 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2148 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2151 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2152 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2153 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2155 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2159 /* toggle speaker-output according to the hp-jack state */
2160 static void alc880_lg_automute(struct hda_codec *codec)
2162 unsigned int present;
2165 present = snd_hda_codec_read(codec, 0x1b, 0,
2166 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2167 bits = present ? HDA_AMP_MUTE : 0;
2168 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2169 HDA_AMP_MUTE, bits);
2172 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2174 /* Looks like the unsol event is incompatible with the standard
2175 * definition. 4bit tag is placed at 28 bit!
2177 if ((res >> 28) == 0x01)
2178 alc880_lg_automute(codec);
2187 * Built-in Mic-In: 0x19
2193 static struct hda_input_mux alc880_lg_lw_capture_source = {
2197 { "Internal Mic", 0x1 },
2202 #define alc880_lg_lw_modes alc880_threestack_modes
2204 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2208 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2210 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2211 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2212 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2218 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2221 .name = "Channel Mode",
2222 .info = alc_ch_mode_info,
2223 .get = alc_ch_mode_get,
2224 .put = alc_ch_mode_put,
2229 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2230 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2231 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2232 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2234 /* set capture source to mic-in */
2235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2243 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2244 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2245 /* mic-in to input */
2246 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2256 /* toggle speaker-output according to the hp-jack state */
2257 static void alc880_lg_lw_automute(struct hda_codec *codec)
2259 unsigned int present;
2262 present = snd_hda_codec_read(codec, 0x1b, 0,
2263 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2264 bits = present ? HDA_AMP_MUTE : 0;
2265 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2266 HDA_AMP_MUTE, bits);
2269 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2271 /* Looks like the unsol event is incompatible with the standard
2272 * definition. 4bit tag is placed at 28 bit!
2274 if ((res >> 28) == 0x01)
2275 alc880_lg_lw_automute(codec);
2278 #ifdef CONFIG_SND_HDA_POWER_SAVE
2279 static struct hda_amp_list alc880_loopbacks[] = {
2280 { 0x0b, HDA_INPUT, 0 },
2281 { 0x0b, HDA_INPUT, 1 },
2282 { 0x0b, HDA_INPUT, 2 },
2283 { 0x0b, HDA_INPUT, 3 },
2284 { 0x0b, HDA_INPUT, 4 },
2288 static struct hda_amp_list alc880_lg_loopbacks[] = {
2289 { 0x0b, HDA_INPUT, 1 },
2290 { 0x0b, HDA_INPUT, 6 },
2291 { 0x0b, HDA_INPUT, 7 },
2300 static int alc_init(struct hda_codec *codec)
2302 struct alc_spec *spec = codec->spec;
2305 for (i = 0; i < spec->num_init_verbs; i++)
2306 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2308 if (spec->init_hook)
2309 spec->init_hook(codec);
2314 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2316 struct alc_spec *spec = codec->spec;
2318 if (spec->unsol_event)
2319 spec->unsol_event(codec, res);
2322 #ifdef CONFIG_SND_HDA_POWER_SAVE
2323 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2325 struct alc_spec *spec = codec->spec;
2326 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2331 * Analog playback callbacks
2333 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2334 struct hda_codec *codec,
2335 struct snd_pcm_substream *substream)
2337 struct alc_spec *spec = codec->spec;
2338 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2342 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2343 struct hda_codec *codec,
2344 unsigned int stream_tag,
2345 unsigned int format,
2346 struct snd_pcm_substream *substream)
2348 struct alc_spec *spec = codec->spec;
2349 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2350 stream_tag, format, substream);
2353 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2354 struct hda_codec *codec,
2355 struct snd_pcm_substream *substream)
2357 struct alc_spec *spec = codec->spec;
2358 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2364 static int alc880_dig_playback_pcm_open(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_open(codec, &spec->multiout);
2372 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2373 struct hda_codec *codec,
2374 unsigned int stream_tag,
2375 unsigned int format,
2376 struct snd_pcm_substream *substream)
2378 struct alc_spec *spec = codec->spec;
2379 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2380 stream_tag, format, substream);
2383 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2384 struct hda_codec *codec,
2385 struct snd_pcm_substream *substream)
2387 struct alc_spec *spec = codec->spec;
2388 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2394 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2395 struct hda_codec *codec,
2396 unsigned int stream_tag,
2397 unsigned int format,
2398 struct snd_pcm_substream *substream)
2400 struct alc_spec *spec = codec->spec;
2402 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
2403 stream_tag, 0, format);
2407 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2408 struct hda_codec *codec,
2409 struct snd_pcm_substream *substream)
2411 struct alc_spec *spec = codec->spec;
2413 snd_hda_codec_cleanup_stream(codec,
2414 spec->adc_nids[substream->number + 1]);
2421 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2425 /* NID is set in alc_build_pcms */
2427 .open = alc880_playback_pcm_open,
2428 .prepare = alc880_playback_pcm_prepare,
2429 .cleanup = alc880_playback_pcm_cleanup
2433 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2437 /* NID is set in alc_build_pcms */
2440 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
2444 /* NID is set in alc_build_pcms */
2447 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
2448 .substreams = 2, /* can be overridden */
2451 /* NID is set in alc_build_pcms */
2453 .prepare = alc880_alt_capture_pcm_prepare,
2454 .cleanup = alc880_alt_capture_pcm_cleanup
2458 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2462 /* NID is set in alc_build_pcms */
2464 .open = alc880_dig_playback_pcm_open,
2465 .close = alc880_dig_playback_pcm_close,
2466 .prepare = alc880_dig_playback_pcm_prepare
2470 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2474 /* NID is set in alc_build_pcms */
2477 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2478 static struct hda_pcm_stream alc_pcm_null_stream = {
2484 static int alc_build_pcms(struct hda_codec *codec)
2486 struct alc_spec *spec = codec->spec;
2487 struct hda_pcm *info = spec->pcm_rec;
2490 codec->num_pcms = 1;
2491 codec->pcm_info = info;
2493 info->name = spec->stream_name_analog;
2494 if (spec->stream_analog_playback) {
2495 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2496 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2497 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2499 if (spec->stream_analog_capture) {
2500 snd_assert(spec->adc_nids, return -EINVAL);
2501 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2502 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2505 if (spec->channel_mode) {
2506 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2507 for (i = 0; i < spec->num_channel_mode; i++) {
2508 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2509 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2514 /* SPDIF for stream index #1 */
2515 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2516 codec->num_pcms = 2;
2517 info = spec->pcm_rec + 1;
2518 info->name = spec->stream_name_digital;
2519 info->pcm_type = HDA_PCM_TYPE_SPDIF;
2520 if (spec->multiout.dig_out_nid &&
2521 spec->stream_digital_playback) {
2522 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2523 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2525 if (spec->dig_in_nid &&
2526 spec->stream_digital_capture) {
2527 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2528 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2532 /* If the use of more than one ADC is requested for the current
2533 * model, configure a second analog capture-only PCM.
2535 /* Additional Analaog capture for index #2 */
2536 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
2537 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
2538 codec->num_pcms = 3;
2539 info = spec->pcm_rec + 2;
2540 info->name = spec->stream_name_analog;
2541 if (spec->alt_dac_nid) {
2542 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2543 *spec->stream_analog_alt_playback;
2544 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2547 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
2548 alc_pcm_null_stream;
2549 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2551 if (spec->num_adc_nids > 1) {
2552 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2553 *spec->stream_analog_alt_capture;
2554 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
2556 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
2557 spec->num_adc_nids - 1;
2559 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
2560 alc_pcm_null_stream;
2561 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
2568 static void alc_free(struct hda_codec *codec)
2570 struct alc_spec *spec = codec->spec;
2576 if (spec->kctl_alloc) {
2577 for (i = 0; i < spec->num_kctl_used; i++)
2578 kfree(spec->kctl_alloc[i].name);
2579 kfree(spec->kctl_alloc);
2582 codec->spec = NULL; /* to be sure */
2587 static struct hda_codec_ops alc_patch_ops = {
2588 .build_controls = alc_build_controls,
2589 .build_pcms = alc_build_pcms,
2592 .unsol_event = alc_unsol_event,
2593 #ifdef CONFIG_SND_HDA_POWER_SAVE
2594 .check_power_status = alc_check_power_status,
2600 * Test configuration for debugging
2602 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2605 #ifdef CONFIG_SND_DEBUG
2606 static hda_nid_t alc880_test_dac_nids[4] = {
2607 0x02, 0x03, 0x04, 0x05
2610 static struct hda_input_mux alc880_test_capture_source = {
2619 { "Surround", 0x6 },
2623 static struct hda_channel_mode alc880_test_modes[4] = {
2630 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2631 struct snd_ctl_elem_info *uinfo)
2633 static char *texts[] = {
2634 "N/A", "Line Out", "HP Out",
2635 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2637 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2639 uinfo->value.enumerated.items = 8;
2640 if (uinfo->value.enumerated.item >= 8)
2641 uinfo->value.enumerated.item = 7;
2642 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2646 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2647 struct snd_ctl_elem_value *ucontrol)
2649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2650 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2651 unsigned int pin_ctl, item = 0;
2653 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2654 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2655 if (pin_ctl & AC_PINCTL_OUT_EN) {
2656 if (pin_ctl & AC_PINCTL_HP_EN)
2660 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2661 switch (pin_ctl & AC_PINCTL_VREFEN) {
2662 case AC_PINCTL_VREF_HIZ: item = 3; break;
2663 case AC_PINCTL_VREF_50: item = 4; break;
2664 case AC_PINCTL_VREF_GRD: item = 5; break;
2665 case AC_PINCTL_VREF_80: item = 6; break;
2666 case AC_PINCTL_VREF_100: item = 7; break;
2669 ucontrol->value.enumerated.item[0] = item;
2673 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2674 struct snd_ctl_elem_value *ucontrol)
2676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2677 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2678 static unsigned int ctls[] = {
2679 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2680 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2681 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2682 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2683 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2684 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2686 unsigned int old_ctl, new_ctl;
2688 old_ctl = snd_hda_codec_read(codec, nid, 0,
2689 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2690 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2691 if (old_ctl != new_ctl) {
2693 snd_hda_codec_write_cache(codec, nid, 0,
2694 AC_VERB_SET_PIN_WIDGET_CONTROL,
2696 val = ucontrol->value.enumerated.item[0] >= 3 ?
2698 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2705 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2706 struct snd_ctl_elem_info *uinfo)
2708 static char *texts[] = {
2709 "Front", "Surround", "CLFE", "Side"
2711 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2713 uinfo->value.enumerated.items = 4;
2714 if (uinfo->value.enumerated.item >= 4)
2715 uinfo->value.enumerated.item = 3;
2716 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2720 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2721 struct snd_ctl_elem_value *ucontrol)
2723 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2724 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2727 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2728 ucontrol->value.enumerated.item[0] = sel & 3;
2732 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2733 struct snd_ctl_elem_value *ucontrol)
2735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2736 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2739 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2740 if (ucontrol->value.enumerated.item[0] != sel) {
2741 sel = ucontrol->value.enumerated.item[0] & 3;
2742 snd_hda_codec_write_cache(codec, nid, 0,
2743 AC_VERB_SET_CONNECT_SEL, sel);
2749 #define PIN_CTL_TEST(xname,nid) { \
2750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2752 .info = alc_test_pin_ctl_info, \
2753 .get = alc_test_pin_ctl_get, \
2754 .put = alc_test_pin_ctl_put, \
2755 .private_value = nid \
2758 #define PIN_SRC_TEST(xname,nid) { \
2759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2761 .info = alc_test_pin_src_info, \
2762 .get = alc_test_pin_src_get, \
2763 .put = alc_test_pin_src_put, \
2764 .private_value = nid \
2767 static struct snd_kcontrol_new alc880_test_mixer[] = {
2768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2769 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2770 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2771 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2772 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2773 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2774 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2775 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2776 PIN_CTL_TEST("Front Pin Mode", 0x14),
2777 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2778 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2779 PIN_CTL_TEST("Side Pin Mode", 0x17),
2780 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2781 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2782 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2783 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2784 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2785 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2786 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2787 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2788 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2789 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2790 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2791 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2792 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2793 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2794 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2795 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2796 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2797 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2799 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2800 .name = "Channel Mode",
2801 .info = alc_ch_mode_info,
2802 .get = alc_ch_mode_get,
2803 .put = alc_ch_mode_put,
2808 static struct hda_verb alc880_test_init_verbs[] = {
2809 /* Unmute inputs of 0x0c - 0x0f */
2810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2816 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2817 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2818 /* Vol output for 0x0c-0x0f */
2819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2822 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2823 /* Set output pins 0x14-0x17 */
2824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2826 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2828 /* Unmute output pins 0x14-0x17 */
2829 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2831 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2832 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2833 /* Set input pins 0x18-0x1c */
2834 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2836 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2838 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2839 /* Mute input pins 0x18-0x1b */
2840 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2843 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2846 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2848 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2850 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2851 /* Analog input/passthru */
2852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2864 static const char *alc880_models[ALC880_MODEL_LAST] = {
2865 [ALC880_3ST] = "3stack",
2866 [ALC880_TCL_S700] = "tcl",
2867 [ALC880_3ST_DIG] = "3stack-digout",
2868 [ALC880_CLEVO] = "clevo",
2869 [ALC880_5ST] = "5stack",
2870 [ALC880_5ST_DIG] = "5stack-digout",
2871 [ALC880_W810] = "w810",
2872 [ALC880_Z71V] = "z71v",
2873 [ALC880_6ST] = "6stack",
2874 [ALC880_6ST_DIG] = "6stack-digout",
2875 [ALC880_ASUS] = "asus",
2876 [ALC880_ASUS_W1V] = "asus-w1v",
2877 [ALC880_ASUS_DIG] = "asus-dig",
2878 [ALC880_ASUS_DIG2] = "asus-dig2",
2879 [ALC880_UNIWILL_DIG] = "uniwill",
2880 [ALC880_UNIWILL_P53] = "uniwill-p53",
2881 [ALC880_FUJITSU] = "fujitsu",
2882 [ALC880_F1734] = "F1734",
2884 [ALC880_LG_LW] = "lg-lw",
2885 #ifdef CONFIG_SND_DEBUG
2886 [ALC880_TEST] = "test",
2888 [ALC880_AUTO] = "auto",
2891 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2892 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2893 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2894 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2895 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2896 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2897 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2898 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2899 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2900 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2901 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2902 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2903 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2904 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2905 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2906 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2907 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2908 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2909 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2910 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2911 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2912 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2913 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2914 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2915 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2916 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2917 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2918 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2919 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2920 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2921 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2922 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2923 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2924 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2925 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2926 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2927 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2928 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2929 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2930 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2931 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2932 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2933 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2934 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2935 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2936 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2937 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2938 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2939 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2940 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2941 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2942 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2943 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2944 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2945 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2946 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2947 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2948 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2949 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2950 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2951 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2952 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2953 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2954 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2955 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2956 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2957 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2958 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2959 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2960 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2965 * ALC880 codec presets
2967 static struct alc_config_preset alc880_presets[] = {
2969 .mixers = { alc880_three_stack_mixer },
2970 .init_verbs = { alc880_volume_init_verbs,
2971 alc880_pin_3stack_init_verbs },
2972 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2973 .dac_nids = alc880_dac_nids,
2974 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2975 .channel_mode = alc880_threestack_modes,
2977 .input_mux = &alc880_capture_source,
2979 [ALC880_3ST_DIG] = {
2980 .mixers = { alc880_three_stack_mixer },
2981 .init_verbs = { alc880_volume_init_verbs,
2982 alc880_pin_3stack_init_verbs },
2983 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2984 .dac_nids = alc880_dac_nids,
2985 .dig_out_nid = ALC880_DIGOUT_NID,
2986 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2987 .channel_mode = alc880_threestack_modes,
2989 .input_mux = &alc880_capture_source,
2991 [ALC880_TCL_S700] = {
2992 .mixers = { alc880_tcl_s700_mixer },
2993 .init_verbs = { alc880_volume_init_verbs,
2994 alc880_pin_tcl_S700_init_verbs,
2995 alc880_gpio2_init_verbs },
2996 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2997 .dac_nids = alc880_dac_nids,
2999 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3000 .channel_mode = alc880_2_jack_modes,
3001 .input_mux = &alc880_capture_source,
3004 .mixers = { alc880_three_stack_mixer,
3005 alc880_five_stack_mixer},
3006 .init_verbs = { alc880_volume_init_verbs,
3007 alc880_pin_5stack_init_verbs },
3008 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3009 .dac_nids = alc880_dac_nids,
3010 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3011 .channel_mode = alc880_fivestack_modes,
3012 .input_mux = &alc880_capture_source,
3014 [ALC880_5ST_DIG] = {
3015 .mixers = { alc880_three_stack_mixer,
3016 alc880_five_stack_mixer },
3017 .init_verbs = { alc880_volume_init_verbs,
3018 alc880_pin_5stack_init_verbs },
3019 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3020 .dac_nids = alc880_dac_nids,
3021 .dig_out_nid = ALC880_DIGOUT_NID,
3022 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3023 .channel_mode = alc880_fivestack_modes,
3024 .input_mux = &alc880_capture_source,
3027 .mixers = { alc880_six_stack_mixer },
3028 .init_verbs = { alc880_volume_init_verbs,
3029 alc880_pin_6stack_init_verbs },
3030 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3031 .dac_nids = alc880_6st_dac_nids,
3032 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3033 .channel_mode = alc880_sixstack_modes,
3034 .input_mux = &alc880_6stack_capture_source,
3036 [ALC880_6ST_DIG] = {
3037 .mixers = { alc880_six_stack_mixer },
3038 .init_verbs = { alc880_volume_init_verbs,
3039 alc880_pin_6stack_init_verbs },
3040 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3041 .dac_nids = alc880_6st_dac_nids,
3042 .dig_out_nid = ALC880_DIGOUT_NID,
3043 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3044 .channel_mode = alc880_sixstack_modes,
3045 .input_mux = &alc880_6stack_capture_source,
3048 .mixers = { alc880_w810_base_mixer },
3049 .init_verbs = { alc880_volume_init_verbs,
3050 alc880_pin_w810_init_verbs,
3051 alc880_gpio2_init_verbs },
3052 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3053 .dac_nids = alc880_w810_dac_nids,
3054 .dig_out_nid = ALC880_DIGOUT_NID,
3055 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3056 .channel_mode = alc880_w810_modes,
3057 .input_mux = &alc880_capture_source,
3060 .mixers = { alc880_z71v_mixer },
3061 .init_verbs = { alc880_volume_init_verbs,
3062 alc880_pin_z71v_init_verbs },
3063 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3064 .dac_nids = alc880_z71v_dac_nids,
3065 .dig_out_nid = ALC880_DIGOUT_NID,
3067 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3068 .channel_mode = alc880_2_jack_modes,
3069 .input_mux = &alc880_capture_source,
3072 .mixers = { alc880_f1734_mixer },
3073 .init_verbs = { alc880_volume_init_verbs,
3074 alc880_pin_f1734_init_verbs },
3075 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3076 .dac_nids = alc880_f1734_dac_nids,
3078 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3079 .channel_mode = alc880_2_jack_modes,
3080 .input_mux = &alc880_f1734_capture_source,
3081 .unsol_event = alc880_uniwill_p53_unsol_event,
3082 .init_hook = alc880_uniwill_p53_hp_automute,
3085 .mixers = { alc880_asus_mixer },
3086 .init_verbs = { alc880_volume_init_verbs,
3087 alc880_pin_asus_init_verbs,
3088 alc880_gpio1_init_verbs },
3089 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3090 .dac_nids = alc880_asus_dac_nids,
3091 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3092 .channel_mode = alc880_asus_modes,
3094 .input_mux = &alc880_capture_source,
3096 [ALC880_ASUS_DIG] = {
3097 .mixers = { alc880_asus_mixer },
3098 .init_verbs = { alc880_volume_init_verbs,
3099 alc880_pin_asus_init_verbs,
3100 alc880_gpio1_init_verbs },
3101 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3102 .dac_nids = alc880_asus_dac_nids,
3103 .dig_out_nid = ALC880_DIGOUT_NID,
3104 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3105 .channel_mode = alc880_asus_modes,
3107 .input_mux = &alc880_capture_source,
3109 [ALC880_ASUS_DIG2] = {
3110 .mixers = { alc880_asus_mixer },
3111 .init_verbs = { alc880_volume_init_verbs,
3112 alc880_pin_asus_init_verbs,
3113 alc880_gpio2_init_verbs }, /* use GPIO2 */
3114 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3115 .dac_nids = alc880_asus_dac_nids,
3116 .dig_out_nid = ALC880_DIGOUT_NID,
3117 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3118 .channel_mode = alc880_asus_modes,
3120 .input_mux = &alc880_capture_source,
3122 [ALC880_ASUS_W1V] = {
3123 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3124 .init_verbs = { alc880_volume_init_verbs,
3125 alc880_pin_asus_init_verbs,
3126 alc880_gpio1_init_verbs },
3127 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3128 .dac_nids = alc880_asus_dac_nids,
3129 .dig_out_nid = ALC880_DIGOUT_NID,
3130 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3131 .channel_mode = alc880_asus_modes,
3133 .input_mux = &alc880_capture_source,
3135 [ALC880_UNIWILL_DIG] = {
3136 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3137 .init_verbs = { alc880_volume_init_verbs,
3138 alc880_pin_asus_init_verbs },
3139 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3140 .dac_nids = alc880_asus_dac_nids,
3141 .dig_out_nid = ALC880_DIGOUT_NID,
3142 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3143 .channel_mode = alc880_asus_modes,
3145 .input_mux = &alc880_capture_source,
3147 [ALC880_UNIWILL] = {
3148 .mixers = { alc880_uniwill_mixer },
3149 .init_verbs = { alc880_volume_init_verbs,
3150 alc880_uniwill_init_verbs },
3151 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3152 .dac_nids = alc880_asus_dac_nids,
3153 .dig_out_nid = ALC880_DIGOUT_NID,
3154 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3155 .channel_mode = alc880_threestack_modes,
3157 .input_mux = &alc880_capture_source,
3158 .unsol_event = alc880_uniwill_unsol_event,
3159 .init_hook = alc880_uniwill_automute,
3161 [ALC880_UNIWILL_P53] = {
3162 .mixers = { alc880_uniwill_p53_mixer },
3163 .init_verbs = { alc880_volume_init_verbs,
3164 alc880_uniwill_p53_init_verbs },
3165 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3166 .dac_nids = alc880_asus_dac_nids,
3167 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3168 .channel_mode = alc880_threestack_modes,
3169 .input_mux = &alc880_capture_source,
3170 .unsol_event = alc880_uniwill_p53_unsol_event,
3171 .init_hook = alc880_uniwill_p53_hp_automute,
3173 [ALC880_FUJITSU] = {
3174 .mixers = { alc880_fujitsu_mixer,
3175 alc880_pcbeep_mixer, },
3176 .init_verbs = { alc880_volume_init_verbs,
3177 alc880_uniwill_p53_init_verbs,
3178 alc880_beep_init_verbs },
3179 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3180 .dac_nids = alc880_dac_nids,
3181 .dig_out_nid = ALC880_DIGOUT_NID,
3182 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3183 .channel_mode = alc880_2_jack_modes,
3184 .input_mux = &alc880_capture_source,
3185 .unsol_event = alc880_uniwill_p53_unsol_event,
3186 .init_hook = alc880_uniwill_p53_hp_automute,
3189 .mixers = { alc880_three_stack_mixer },
3190 .init_verbs = { alc880_volume_init_verbs,
3191 alc880_pin_clevo_init_verbs },
3192 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3193 .dac_nids = alc880_dac_nids,
3195 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3196 .channel_mode = alc880_threestack_modes,
3198 .input_mux = &alc880_capture_source,
3201 .mixers = { alc880_lg_mixer },
3202 .init_verbs = { alc880_volume_init_verbs,
3203 alc880_lg_init_verbs },
3204 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3205 .dac_nids = alc880_lg_dac_nids,
3206 .dig_out_nid = ALC880_DIGOUT_NID,
3207 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3208 .channel_mode = alc880_lg_ch_modes,
3210 .input_mux = &alc880_lg_capture_source,
3211 .unsol_event = alc880_lg_unsol_event,
3212 .init_hook = alc880_lg_automute,
3213 #ifdef CONFIG_SND_HDA_POWER_SAVE
3214 .loopbacks = alc880_lg_loopbacks,
3218 .mixers = { alc880_lg_lw_mixer },
3219 .init_verbs = { alc880_volume_init_verbs,
3220 alc880_lg_lw_init_verbs },
3221 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3222 .dac_nids = alc880_dac_nids,
3223 .dig_out_nid = ALC880_DIGOUT_NID,
3224 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3225 .channel_mode = alc880_lg_lw_modes,
3226 .input_mux = &alc880_lg_lw_capture_source,
3227 .unsol_event = alc880_lg_lw_unsol_event,
3228 .init_hook = alc880_lg_lw_automute,
3230 #ifdef CONFIG_SND_DEBUG
3232 .mixers = { alc880_test_mixer },
3233 .init_verbs = { alc880_test_init_verbs },
3234 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3235 .dac_nids = alc880_test_dac_nids,
3236 .dig_out_nid = ALC880_DIGOUT_NID,
3237 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3238 .channel_mode = alc880_test_modes,
3239 .input_mux = &alc880_test_capture_source,
3245 * Automatic parse of I/O pins from the BIOS configuration
3248 #define NUM_CONTROL_ALLOC 32
3249 #define NUM_VERB_ALLOC 32
3253 ALC_CTL_WIDGET_MUTE,
3256 static struct snd_kcontrol_new alc880_control_templates[] = {
3257 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3258 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3259 HDA_BIND_MUTE(NULL, 0, 0, 0),
3262 /* add dynamic controls */
3263 static int add_control(struct alc_spec *spec, int type, const char *name,
3266 struct snd_kcontrol_new *knew;
3268 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3269 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3271 /* array + terminator */
3272 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3275 if (spec->kctl_alloc) {
3276 memcpy(knew, spec->kctl_alloc,
3277 sizeof(*knew) * spec->num_kctl_alloc);
3278 kfree(spec->kctl_alloc);
3280 spec->kctl_alloc = knew;
3281 spec->num_kctl_alloc = num;
3284 knew = &spec->kctl_alloc[spec->num_kctl_used];
3285 *knew = alc880_control_templates[type];
3286 knew->name = kstrdup(name, GFP_KERNEL);
3289 knew->private_value = val;
3290 spec->num_kctl_used++;
3294 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3295 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3296 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3297 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3298 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3299 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3300 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3301 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3302 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3303 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3304 #define ALC880_PIN_CD_NID 0x1c
3306 /* fill in the dac_nids table from the parsed pin configuration */
3307 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3308 const struct auto_pin_cfg *cfg)
3314 memset(assigned, 0, sizeof(assigned));
3315 spec->multiout.dac_nids = spec->private_dac_nids;
3317 /* check the pins hardwired to audio widget */
3318 for (i = 0; i < cfg->line_outs; i++) {
3319 nid = cfg->line_out_pins[i];
3320 if (alc880_is_fixed_pin(nid)) {
3321 int idx = alc880_fixed_pin_idx(nid);
3322 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3326 /* left pins can be connect to any audio widget */
3327 for (i = 0; i < cfg->line_outs; i++) {
3328 nid = cfg->line_out_pins[i];
3329 if (alc880_is_fixed_pin(nid))
3331 /* search for an empty channel */
3332 for (j = 0; j < cfg->line_outs; j++) {
3334 spec->multiout.dac_nids[i] =
3335 alc880_idx_to_dac(j);
3341 spec->multiout.num_dacs = cfg->line_outs;
3345 /* add playback controls from the parsed DAC table */
3346 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3347 const struct auto_pin_cfg *cfg)
3350 static const char *chname[4] = {
3351 "Front", "Surround", NULL /*CLFE*/, "Side"
3356 for (i = 0; i < cfg->line_outs; i++) {
3357 if (!spec->multiout.dac_nids[i])
3359 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3362 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3363 "Center Playback Volume",
3364 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3368 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3369 "LFE Playback Volume",
3370 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3374 err = add_control(spec, ALC_CTL_BIND_MUTE,
3375 "Center Playback Switch",
3376 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3380 err = add_control(spec, ALC_CTL_BIND_MUTE,
3381 "LFE Playback Switch",
3382 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3387 sprintf(name, "%s Playback Volume", chname[i]);
3388 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3389 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3393 sprintf(name, "%s Playback Switch", chname[i]);
3394 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3395 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3404 /* add playback controls for speaker and HP outputs */
3405 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3415 if (alc880_is_fixed_pin(pin)) {
3416 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3417 /* specify the DAC as the extra output */
3418 if (!spec->multiout.hp_nid)
3419 spec->multiout.hp_nid = nid;
3421 spec->multiout.extra_out_nid[0] = nid;
3422 /* control HP volume/switch on the output mixer amp */
3423 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3424 sprintf(name, "%s Playback Volume", pfx);
3425 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3426 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3429 sprintf(name, "%s Playback Switch", pfx);
3430 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3431 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3434 } else if (alc880_is_multi_pin(pin)) {
3435 /* set manual connection */
3436 /* we have only a switch on HP-out PIN */
3437 sprintf(name, "%s Playback Switch", pfx);
3438 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3439 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3446 /* create input playback/capture controls for the given pin */
3447 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3448 const char *ctlname,
3449 int idx, hda_nid_t mix_nid)
3454 sprintf(name, "%s Playback Volume", ctlname);
3455 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3456 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3459 sprintf(name, "%s Playback Switch", ctlname);
3460 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3461 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3467 /* create playback/capture controls for input pins */
3468 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3469 const struct auto_pin_cfg *cfg)
3471 struct hda_input_mux *imux = &spec->private_imux;
3474 for (i = 0; i < AUTO_PIN_LAST; i++) {
3475 if (alc880_is_input_pin(cfg->input_pins[i])) {
3476 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3477 err = new_analog_input(spec, cfg->input_pins[i],
3478 auto_pin_cfg_labels[i],
3482 imux->items[imux->num_items].label =
3483 auto_pin_cfg_labels[i];
3484 imux->items[imux->num_items].index =
3485 alc880_input_pin_idx(cfg->input_pins[i]);
3492 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
3493 unsigned int pin_type)
3495 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3498 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3502 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3503 hda_nid_t nid, int pin_type,
3506 alc_set_pin_output(codec, nid, pin_type);
3507 /* need the manual connection? */
3508 if (alc880_is_multi_pin(nid)) {
3509 struct alc_spec *spec = codec->spec;
3510 int idx = alc880_multi_pin_idx(nid);
3511 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3512 AC_VERB_SET_CONNECT_SEL,
3513 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3517 static int get_pin_type(int line_out_type)
3519 if (line_out_type == AUTO_PIN_HP_OUT)
3525 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3527 struct alc_spec *spec = codec->spec;
3530 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3531 for (i = 0; i < spec->autocfg.line_outs; i++) {
3532 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3533 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3534 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3538 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3540 struct alc_spec *spec = codec->spec;
3543 pin = spec->autocfg.speaker_pins[0];
3544 if (pin) /* connect to front */
3545 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3546 pin = spec->autocfg.hp_pins[0];
3547 if (pin) /* connect to front */
3548 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3551 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3553 struct alc_spec *spec = codec->spec;
3556 for (i = 0; i < AUTO_PIN_LAST; i++) {
3557 hda_nid_t nid = spec->autocfg.input_pins[i];
3558 if (alc880_is_input_pin(nid)) {
3559 snd_hda_codec_write(codec, nid, 0,
3560 AC_VERB_SET_PIN_WIDGET_CONTROL,
3561 i <= AUTO_PIN_FRONT_MIC ?
3562 PIN_VREF80 : PIN_IN);
3563 if (nid != ALC880_PIN_CD_NID)
3564 snd_hda_codec_write(codec, nid, 0,
3565 AC_VERB_SET_AMP_GAIN_MUTE,
3571 /* parse the BIOS configuration and set up the alc_spec */
3572 /* return 1 if successful, 0 if the proper config is not found,
3573 * or a negative error code
3575 static int alc880_parse_auto_config(struct hda_codec *codec)
3577 struct alc_spec *spec = codec->spec;
3579 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3581 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3585 if (!spec->autocfg.line_outs)
3586 return 0; /* can't find valid BIOS pin config */
3588 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3591 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3594 err = alc880_auto_create_extra_out(spec,
3595 spec->autocfg.speaker_pins[0],
3599 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3603 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3607 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3609 if (spec->autocfg.dig_out_pin)
3610 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3611 if (spec->autocfg.dig_in_pin)
3612 spec->dig_in_nid = ALC880_DIGIN_NID;
3614 if (spec->kctl_alloc)
3615 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3617 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3619 spec->num_mux_defs = 1;
3620 spec->input_mux = &spec->private_imux;
3625 /* additional initialization for auto-configuration model */
3626 static void alc880_auto_init(struct hda_codec *codec)
3628 struct alc_spec *spec = codec->spec;
3629 alc880_auto_init_multi_out(codec);
3630 alc880_auto_init_extra_out(codec);
3631 alc880_auto_init_analog_input(codec);
3632 if (spec->unsol_event)
3633 alc_sku_automute(codec);
3637 * OK, here we have finally the patch for ALC880
3640 static int patch_alc880(struct hda_codec *codec)
3642 struct alc_spec *spec;
3646 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3652 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3655 if (board_config < 0) {
3656 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3657 "trying auto-probe from BIOS...\n");
3658 board_config = ALC880_AUTO;
3661 if (board_config == ALC880_AUTO) {
3662 /* automatic parse from the BIOS config */
3663 err = alc880_parse_auto_config(codec);
3669 "hda_codec: Cannot set up configuration "
3670 "from BIOS. Using 3-stack mode...\n");
3671 board_config = ALC880_3ST;
3675 if (board_config != ALC880_AUTO)
3676 setup_preset(spec, &alc880_presets[board_config]);
3678 spec->stream_name_analog = "ALC880 Analog";
3679 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3680 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3681 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
3683 spec->stream_name_digital = "ALC880 Digital";
3684 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3685 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3687 if (!spec->adc_nids && spec->input_mux) {
3688 /* check whether NID 0x07 is valid */
3689 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3691 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3692 if (wcap != AC_WID_AUD_IN) {
3693 spec->adc_nids = alc880_adc_nids_alt;
3694 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3695 spec->mixers[spec->num_mixers] =
3696 alc880_capture_alt_mixer;
3699 spec->adc_nids = alc880_adc_nids;
3700 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3701 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3706 spec->vmaster_nid = 0x0c;
3708 codec->patch_ops = alc_patch_ops;
3709 if (board_config == ALC880_AUTO)
3710 spec->init_hook = alc880_auto_init;
3711 #ifdef CONFIG_SND_HDA_POWER_SAVE
3712 if (!spec->loopback.amplist)
3713 spec->loopback.amplist = alc880_loopbacks;
3724 static hda_nid_t alc260_dac_nids[1] = {
3729 static hda_nid_t alc260_adc_nids[1] = {
3734 static hda_nid_t alc260_adc_nids_alt[1] = {
3739 static hda_nid_t alc260_hp_adc_nids[2] = {
3744 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3745 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3747 static hda_nid_t alc260_dual_adc_nids[2] = {
3752 #define ALC260_DIGOUT_NID 0x03
3753 #define ALC260_DIGIN_NID 0x06
3755 static struct hda_input_mux alc260_capture_source = {
3759 { "Front Mic", 0x1 },
3765 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3766 * headphone jack and the internal CD lines since these are the only pins at
3767 * which audio can appear. For flexibility, also allow the option of
3768 * recording the mixer output on the second ADC (ADC0 doesn't have a
3769 * connection to the mixer output).
3771 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3775 { "Mic/Line", 0x0 },
3777 { "Headphone", 0x2 },
3783 { "Mic/Line", 0x0 },
3785 { "Headphone", 0x2 },
3792 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3793 * the Fujitsu S702x, but jacks are marked differently.
3795 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3802 { "Headphone", 0x5 },
3811 { "Headphone", 0x6 },
3817 * This is just place-holder, so there's something for alc_build_pcms to look
3818 * at when it calculates the maximum number of channels. ALC260 has no mixer
3819 * element which allows changing the channel mode, so the verb list is
3822 static struct hda_channel_mode alc260_modes[1] = {
3827 /* Mixer combinations
3829 * basic: base_output + input + pc_beep + capture
3830 * HP: base_output + input + capture_alt
3831 * HP_3013: hp_3013 + input + capture
3832 * fujitsu: fujitsu + capture
3833 * acer: acer + capture
3836 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3837 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3838 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3839 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3840 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3841 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3842 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3846 static struct snd_kcontrol_new alc260_input_mixer[] = {
3847 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3848 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3849 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3850 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3852 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3853 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3858 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3859 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3860 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3864 /* update HP, line and mono out pins according to the master switch */
3865 static void alc260_hp_master_update(struct hda_codec *codec,
3866 hda_nid_t hp, hda_nid_t line,
3869 struct alc_spec *spec = codec->spec;
3870 unsigned int val = spec->master_sw ? PIN_HP : 0;
3871 /* change HP and line-out pins */
3872 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3874 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3876 /* mono (speaker) depending on the HP jack sense */
3877 val = (val && !spec->jack_present) ? PIN_OUT : 0;
3878 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3882 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
3883 struct snd_ctl_elem_value *ucontrol)
3885 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3886 struct alc_spec *spec = codec->spec;
3887 *ucontrol->value.integer.value = spec->master_sw;
3891 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
3892 struct snd_ctl_elem_value *ucontrol)
3894 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3895 struct alc_spec *spec = codec->spec;
3896 int val = !!*ucontrol->value.integer.value;
3897 hda_nid_t hp, line, mono;
3899 if (val == spec->master_sw)
3901 spec->master_sw = val;
3902 hp = (kcontrol->private_value >> 16) & 0xff;
3903 line = (kcontrol->private_value >> 8) & 0xff;
3904 mono = kcontrol->private_value & 0xff;
3905 alc260_hp_master_update(codec, hp, line, mono);
3909 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
3911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3912 .name = "Master Playback Switch",
3913 .info = snd_ctl_boolean_mono_info,
3914 .get = alc260_hp_master_sw_get,
3915 .put = alc260_hp_master_sw_put,
3916 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
3918 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3919 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3921 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3922 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
3924 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3928 static struct hda_verb alc260_hp_unsol_verbs[] = {
3929 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3933 static void alc260_hp_automute(struct hda_codec *codec)
3935 struct alc_spec *spec = codec->spec;
3936 unsigned int present;
3938 present = snd_hda_codec_read(codec, 0x10, 0,
3939 AC_VERB_GET_PIN_SENSE, 0);
3940 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3941 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
3944 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
3946 if ((res >> 26) == ALC880_HP_EVENT)
3947 alc260_hp_automute(codec);
3950 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3953 .name = "Master Playback Switch",
3954 .info = snd_ctl_boolean_mono_info,
3955 .get = alc260_hp_master_sw_get,
3956 .put = alc260_hp_master_sw_put,
3957 .private_value = (0x10 << 16) | (0x15 << 8) | 0x11
3959 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3960 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3961 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3962 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3963 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3965 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3966 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3970 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
3971 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3975 static void alc260_hp_3013_automute(struct hda_codec *codec)
3977 struct alc_spec *spec = codec->spec;
3978 unsigned int present;
3980 present = snd_hda_codec_read(codec, 0x15, 0,
3981 AC_VERB_GET_PIN_SENSE, 0);
3982 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
3983 alc260_hp_master_update(codec, 0x10, 0x15, 0x11);
3986 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
3989 if ((res >> 26) == ALC880_HP_EVENT)
3990 alc260_hp_3013_automute(codec);
3993 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3994 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3996 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3997 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3998 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3999 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4000 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4001 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4002 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4003 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4004 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4005 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4006 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4007 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4008 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4012 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4013 * versions of the ALC260 don't act on requests to enable mic bias from NID
4014 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4015 * datasheet doesn't mention this restriction. At this stage it's not clear
4016 * whether this behaviour is intentional or is a hardware bug in chip
4017 * revisions available in early 2006. Therefore for now allow the
4018 * "Headphone Jack Mode" control to span all choices, but if it turns out
4019 * that the lack of mic bias for this NID is intentional we could change the
4020 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4022 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4023 * don't appear to make the mic bias available from the "line" jack, even
4024 * though the NID used for this jack (0x14) can supply it. The theory is
4025 * that perhaps Acer have included blocking capacitors between the ALC260
4026 * and the output jack. If this turns out to be the case for all such
4027 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4028 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4030 * The C20x Tablet series have a mono internal speaker which is controlled
4031 * via the chip's Mono sum widget and pin complex, so include the necessary
4032 * controls for such models. On models without a "mono speaker" the control
4033 * won't do anything.
4035 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4036 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4037 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4038 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4039 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4041 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4043 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4044 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4046 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4047 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4048 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4049 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4050 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4051 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4052 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4056 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4057 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4059 static struct snd_kcontrol_new alc260_will_mixer[] = {
4060 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4061 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4063 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4064 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4065 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4066 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4067 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4068 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4069 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4070 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4071 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4075 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4076 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4078 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
4079 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4080 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
4081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4082 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4083 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4084 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
4085 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
4086 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4087 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4088 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4092 /* capture mixer elements */
4093 static struct snd_kcontrol_new alc260_capture_mixer[] = {
4094 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
4095 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
4096 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
4097 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
4099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4100 /* The multiple "Capture Source" controls confuse alsamixer
4101 * So call somewhat different..
4103 /* .name = "Capture Source", */
4104 .name = "Input Source",
4106 .info = alc_mux_enum_info,
4107 .get = alc_mux_enum_get,
4108 .put = alc_mux_enum_put,
4113 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
4114 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
4115 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
4117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4118 /* The multiple "Capture Source" controls confuse alsamixer
4119 * So call somewhat different..
4121 /* .name = "Capture Source", */
4122 .name = "Input Source",
4124 .info = alc_mux_enum_info,
4125 .get = alc_mux_enum_get,
4126 .put = alc_mux_enum_put,
4132 * initialization verbs
4134 static struct hda_verb alc260_init_verbs[] = {
4135 /* Line In pin widget for input */
4136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4137 /* CD pin widget for input */
4138 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4139 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4140 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4141 /* Mic2 (front panel) pin widget for input and vref at 80% */
4142 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4143 /* LINE-2 is used for line-out in rear */
4144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4145 /* select line-out */
4146 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
4148 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4150 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4152 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4153 /* mute capture amp left and right */
4154 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4155 /* set connection select to line in (default select for this ADC) */
4156 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4157 /* mute capture amp left and right */
4158 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4159 /* set connection select to line in (default select for this ADC) */
4160 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
4161 /* set vol=0 Line-Out mixer amp left and right */
4162 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4163 /* unmute pin widget amp left and right (no gain on this amp) */
4164 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4165 /* set vol=0 HP mixer amp left and right */
4166 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4167 /* unmute pin widget amp left and right (no gain on this amp) */
4168 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4169 /* set vol=0 Mono mixer amp left and right */
4170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4171 /* unmute pin widget amp left and right (no gain on this amp) */
4172 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4173 /* unmute LINE-2 out pin */
4174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4175 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4178 /* mute analog inputs */
4179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4184 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4185 /* mute Front out path */
4186 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4187 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4188 /* mute Headphone out path */
4189 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4190 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4191 /* mute Mono out path */
4192 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4193 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4197 #if 0 /* should be identical with alc260_init_verbs? */
4198 static struct hda_verb alc260_hp_init_verbs[] = {
4199 /* Headphone and output */
4200 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4202 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4203 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4204 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4205 /* Mic2 (front panel) pin widget for input and vref at 80% */
4206 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4207 /* Line In pin widget for input */
4208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4209 /* Line-2 pin widget for output */
4210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4211 /* CD pin widget for input */
4212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4213 /* unmute amp left and right */
4214 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4215 /* set connection select to line in (default select for this ADC) */
4216 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4217 /* unmute Line-Out mixer amp left and right (volume = 0) */
4218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4219 /* mute pin widget amp left and right (no gain on this amp) */
4220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4221 /* unmute HP mixer amp left and right (volume = 0) */
4222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4223 /* mute pin widget amp left and right (no gain on this amp) */
4224 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4225 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4228 /* mute analog inputs */
4229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4234 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4235 /* Unmute Front out path */
4236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4238 /* Unmute Headphone out path */
4239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4241 /* Unmute Mono out path */
4242 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4243 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4248 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4249 /* Line out and output */
4250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4252 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4253 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4254 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4255 /* Mic2 (front panel) pin widget for input and vref at 80% */
4256 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4257 /* Line In pin widget for input */
4258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4259 /* Headphone pin widget for output */
4260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4261 /* CD pin widget for input */
4262 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4263 /* unmute amp left and right */
4264 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4265 /* set connection select to line in (default select for this ADC) */
4266 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4267 /* unmute Line-Out mixer amp left and right (volume = 0) */
4268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4269 /* mute pin widget amp left and right (no gain on this amp) */
4270 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4271 /* unmute HP mixer amp left and right (volume = 0) */
4272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4273 /* mute pin widget amp left and right (no gain on this amp) */
4274 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4275 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4278 /* mute analog inputs */
4279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4284 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4285 /* Unmute Front out path */
4286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4288 /* Unmute Headphone out path */
4289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4291 /* Unmute Mono out path */
4292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4293 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4297 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4298 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4299 * audio = 0x16, internal speaker = 0x10.
4301 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4302 /* Disable all GPIOs */
4303 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4304 /* Internal speaker is connected to headphone pin */
4305 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4306 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4308 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4309 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4310 /* Ensure all other unused pins are disabled and muted. */
4311 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4312 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4313 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4314 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4315 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4316 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4320 /* Disable digital (SPDIF) pins */
4321 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4322 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4324 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4325 * when acting as an output.
4327 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4329 /* Start with output sum widgets muted and their output gains at min */
4330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4331 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4332 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4333 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4334 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4335 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4336 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4337 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4338 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4340 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4341 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4342 /* Unmute Line1 pin widget output buffer since it starts as an output.
4343 * If the pin mode is changed by the user the pin mode control will
4344 * take care of enabling the pin's input/output buffers as needed.
4345 * Therefore there's no need to enable the input buffer at this
4348 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4349 /* Unmute input buffer of pin widget used for Line-in (no equiv
4352 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4354 /* Mute capture amp left and right */
4355 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4356 /* Set ADC connection select to match default mixer setting - line
4359 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4361 /* Do the same for the second ADC: mute capture input amp and
4362 * set ADC connection to line in (on mic1 pin)
4364 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4365 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4367 /* Mute all inputs to mixer widget (even unconnected ones) */
4368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4380 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4381 * similar laptops (adapted from Fujitsu init verbs).
4383 static struct hda_verb alc260_acer_init_verbs[] = {
4384 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4385 * the headphone jack. Turn this on and rely on the standard mute
4386 * methods whenever the user wants to turn these outputs off.
4388 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4389 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4390 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4391 /* Internal speaker/Headphone jack is connected to Line-out pin */
4392 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4393 /* Internal microphone/Mic jack is connected to Mic1 pin */
4394 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4395 /* Line In jack is connected to Line1 pin */
4396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4397 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4398 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4399 /* Ensure all other unused pins are disabled and muted. */
4400 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4401 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4402 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4403 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4406 /* Disable digital (SPDIF) pins */
4407 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4408 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4410 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4411 * bus when acting as outputs.
4413 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4414 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4416 /* Start with output sum widgets muted and their output gains at min */
4417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4419 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4422 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4423 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4424 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4425 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4427 /* Unmute Line-out pin widget amp left and right
4428 * (no equiv mixer ctrl)
4430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4431 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4432 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4433 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4434 * inputs. If the pin mode is changed by the user the pin mode control
4435 * will take care of enabling the pin's input/output buffers as needed.
4436 * Therefore there's no need to enable the input buffer at this
4439 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4442 /* Mute capture amp left and right */
4443 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4444 /* Set ADC connection select to match default mixer setting - mic
4447 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4449 /* Do similar with the second ADC: mute capture input amp and
4450 * set ADC connection to mic to match ALSA's default state.
4452 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4453 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4455 /* Mute all inputs to mixer widget (even unconnected ones) */
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4468 static struct hda_verb alc260_will_verbs[] = {
4469 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4470 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4471 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4472 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4473 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4474 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4478 static struct hda_verb alc260_replacer_672v_verbs[] = {
4479 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4480 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4481 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4483 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4484 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4485 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4487 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4491 /* toggle speaker-output according to the hp-jack state */
4492 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4494 unsigned int present;
4496 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4497 present = snd_hda_codec_read(codec, 0x0f, 0,
4498 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4500 snd_hda_codec_write_cache(codec, 0x01, 0,
4501 AC_VERB_SET_GPIO_DATA, 1);
4502 snd_hda_codec_write_cache(codec, 0x0f, 0,
4503 AC_VERB_SET_PIN_WIDGET_CONTROL,
4506 snd_hda_codec_write_cache(codec, 0x01, 0,
4507 AC_VERB_SET_GPIO_DATA, 0);
4508 snd_hda_codec_write_cache(codec, 0x0f, 0,
4509 AC_VERB_SET_PIN_WIDGET_CONTROL,
4514 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4517 if ((res >> 26) == ALC880_HP_EVENT)
4518 alc260_replacer_672v_automute(codec);
4521 /* Test configuration for debugging, modelled after the ALC880 test
4524 #ifdef CONFIG_SND_DEBUG
4525 static hda_nid_t alc260_test_dac_nids[1] = {
4528 static hda_nid_t alc260_test_adc_nids[2] = {
4531 /* For testing the ALC260, each input MUX needs its own definition since
4532 * the signal assignments are different. This assumes that the first ADC
4535 static struct hda_input_mux alc260_test_capture_sources[2] = {
4539 { "MIC1 pin", 0x0 },
4540 { "MIC2 pin", 0x1 },
4541 { "LINE1 pin", 0x2 },
4542 { "LINE2 pin", 0x3 },
4544 { "LINE-OUT pin", 0x5 },
4545 { "HP-OUT pin", 0x6 },
4551 { "MIC1 pin", 0x0 },
4552 { "MIC2 pin", 0x1 },
4553 { "LINE1 pin", 0x2 },
4554 { "LINE2 pin", 0x3 },
4557 { "LINE-OUT pin", 0x6 },
4558 { "HP-OUT pin", 0x7 },
4562 static struct snd_kcontrol_new alc260_test_mixer[] = {
4563 /* Output driver widgets */
4564 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4565 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4566 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4567 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4568 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4569 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4571 /* Modes for retasking pin widgets
4572 * Note: the ALC260 doesn't seem to act on requests to enable mic
4573 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4574 * mention this restriction. At this stage it's not clear whether
4575 * this behaviour is intentional or is a hardware bug in chip
4576 * revisions available at least up until early 2006. Therefore for
4577 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4578 * choices, but if it turns out that the lack of mic bias for these
4579 * NIDs is intentional we could change their modes from
4580 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4582 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4583 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4584 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4585 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4586 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4587 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4589 /* Loopback mixer controls */
4590 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4591 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4592 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4593 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4594 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4595 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4596 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4597 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4598 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4599 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4600 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4601 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4602 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4603 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4604 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4605 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4607 /* Controls for GPIO pins, assuming they are configured as outputs */
4608 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4609 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4610 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4611 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4613 /* Switches to allow the digital IO pins to be enabled. The datasheet
4614 * is ambigious as to which NID is which; testing on laptops which
4615 * make this output available should provide clarification.
4617 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4618 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4620 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4621 * this output to turn on an external amplifier.
4623 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4624 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4628 static struct hda_verb alc260_test_init_verbs[] = {
4629 /* Enable all GPIOs as outputs with an initial value of 0 */
4630 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4631 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4632 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4634 /* Enable retasking pins as output, initially without power amp */
4635 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4636 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4639 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4640 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4642 /* Disable digital (SPDIF) pins initially, but users can enable
4643 * them via a mixer switch. In the case of SPDIF-out, this initverb
4644 * payload also sets the generation to 0, output to be in "consumer"
4645 * PCM format, copyright asserted, no pre-emphasis and no validity
4648 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4649 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4651 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4652 * OUT1 sum bus when acting as an output.
4654 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4655 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4656 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4657 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4659 /* Start with output sum widgets muted and their output gains at min */
4660 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4663 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4665 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4666 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4667 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4668 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4670 /* Unmute retasking pin widget output buffers since the default
4671 * state appears to be output. As the pin mode is changed by the
4672 * user the pin mode control will take care of enabling the pin's
4673 * input/output buffers as needed.
4675 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4677 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4679 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4680 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4681 /* Also unmute the mono-out pin widget */
4682 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4684 /* Mute capture amp left and right */
4685 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4686 /* Set ADC connection select to match default mixer setting (mic1
4689 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4691 /* Do the same for the second ADC: mute capture input amp and
4692 * set ADC connection to mic1 pin
4694 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4695 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4697 /* Mute all inputs to mixer widget (even unconnected ones) */
4698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4711 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4712 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4714 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4715 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4718 * for BIOS auto-configuration
4721 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4725 unsigned long vol_val, sw_val;
4729 if (nid >= 0x0f && nid < 0x11) {
4730 nid_vol = nid - 0x7;
4731 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4732 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4733 } else if (nid == 0x11) {
4734 nid_vol = nid - 0x7;
4735 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4736 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4737 } else if (nid >= 0x12 && nid <= 0x15) {
4739 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4740 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4744 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4745 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4748 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4749 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4755 /* add playback controls from the parsed DAC table */
4756 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4757 const struct auto_pin_cfg *cfg)
4762 spec->multiout.num_dacs = 1;
4763 spec->multiout.dac_nids = spec->private_dac_nids;
4764 spec->multiout.dac_nids[0] = 0x02;
4766 nid = cfg->line_out_pins[0];
4768 err = alc260_add_playback_controls(spec, nid, "Front");
4773 nid = cfg->speaker_pins[0];
4775 err = alc260_add_playback_controls(spec, nid, "Speaker");
4780 nid = cfg->hp_pins[0];
4782 err = alc260_add_playback_controls(spec, nid, "Headphone");
4789 /* create playback/capture controls for input pins */
4790 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4791 const struct auto_pin_cfg *cfg)
4793 struct hda_input_mux *imux = &spec->private_imux;
4796 for (i = 0; i < AUTO_PIN_LAST; i++) {
4797 if (cfg->input_pins[i] >= 0x12) {
4798 idx = cfg->input_pins[i] - 0x12;
4799 err = new_analog_input(spec, cfg->input_pins[i],
4800 auto_pin_cfg_labels[i], idx,
4804 imux->items[imux->num_items].label =
4805 auto_pin_cfg_labels[i];
4806 imux->items[imux->num_items].index = idx;
4809 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4810 idx = cfg->input_pins[i] - 0x09;
4811 err = new_analog_input(spec, cfg->input_pins[i],
4812 auto_pin_cfg_labels[i], idx,
4816 imux->items[imux->num_items].label =
4817 auto_pin_cfg_labels[i];
4818 imux->items[imux->num_items].index = idx;
4825 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4826 hda_nid_t nid, int pin_type,
4829 alc_set_pin_output(codec, nid, pin_type);
4830 /* need the manual connection? */
4832 int idx = nid - 0x12;
4833 snd_hda_codec_write(codec, idx + 0x0b, 0,
4834 AC_VERB_SET_CONNECT_SEL, sel_idx);
4838 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4840 struct alc_spec *spec = codec->spec;
4843 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4844 nid = spec->autocfg.line_out_pins[0];
4846 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4847 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4850 nid = spec->autocfg.speaker_pins[0];
4852 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4854 nid = spec->autocfg.hp_pins[0];
4856 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4859 #define ALC260_PIN_CD_NID 0x16
4860 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4862 struct alc_spec *spec = codec->spec;
4865 for (i = 0; i < AUTO_PIN_LAST; i++) {
4866 hda_nid_t nid = spec->autocfg.input_pins[i];
4868 snd_hda_codec_write(codec, nid, 0,
4869 AC_VERB_SET_PIN_WIDGET_CONTROL,
4870 i <= AUTO_PIN_FRONT_MIC ?
4871 PIN_VREF80 : PIN_IN);
4872 if (nid != ALC260_PIN_CD_NID)
4873 snd_hda_codec_write(codec, nid, 0,
4874 AC_VERB_SET_AMP_GAIN_MUTE,
4881 * generic initialization of ADC, input mixers and output mixers
4883 static struct hda_verb alc260_volume_init_verbs[] = {
4885 * Unmute ADC0-1 and set the default input to mic-in
4887 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4888 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4889 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4890 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4892 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4894 * Note: PASD motherboards uses the Line In 2 as the input for
4895 * front panel mic (mic 2)
4897 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4898 /* mute analog inputs */
4899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4906 * Set up output mixers (0x08 - 0x0a)
4908 /* set vol=0 to output mixers */
4909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4910 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4911 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4912 /* set up input amps for analog loopback */
4913 /* Amp Indices: DAC = 0, mixer = 1 */
4914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4918 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4924 static int alc260_parse_auto_config(struct hda_codec *codec)
4926 struct alc_spec *spec = codec->spec;
4929 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4931 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4935 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4938 if (!spec->kctl_alloc)
4939 return 0; /* can't find valid BIOS pin config */
4940 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4944 spec->multiout.max_channels = 2;
4946 if (spec->autocfg.dig_out_pin)
4947 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4948 if (spec->kctl_alloc)
4949 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4951 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4953 spec->num_mux_defs = 1;
4954 spec->input_mux = &spec->private_imux;
4956 /* check whether NID 0x04 is valid */
4957 wcap = get_wcaps(codec, 0x04);
4958 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4959 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
4960 spec->adc_nids = alc260_adc_nids_alt;
4961 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4962 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4964 spec->adc_nids = alc260_adc_nids;
4965 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4966 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4973 /* additional initialization for auto-configuration model */
4974 static void alc260_auto_init(struct hda_codec *codec)
4976 struct alc_spec *spec = codec->spec;
4977 alc260_auto_init_multi_out(codec);
4978 alc260_auto_init_analog_input(codec);
4979 if (spec->unsol_event)
4980 alc_sku_automute(codec);
4983 #ifdef CONFIG_SND_HDA_POWER_SAVE
4984 static struct hda_amp_list alc260_loopbacks[] = {
4985 { 0x07, HDA_INPUT, 0 },
4986 { 0x07, HDA_INPUT, 1 },
4987 { 0x07, HDA_INPUT, 2 },
4988 { 0x07, HDA_INPUT, 3 },
4989 { 0x07, HDA_INPUT, 4 },
4995 * ALC260 configurations
4997 static const char *alc260_models[ALC260_MODEL_LAST] = {
4998 [ALC260_BASIC] = "basic",
5000 [ALC260_HP_3013] = "hp-3013",
5001 [ALC260_FUJITSU_S702X] = "fujitsu",
5002 [ALC260_ACER] = "acer",
5003 [ALC260_WILL] = "will",
5004 [ALC260_REPLACER_672V] = "replacer",
5005 #ifdef CONFIG_SND_DEBUG
5006 [ALC260_TEST] = "test",
5008 [ALC260_AUTO] = "auto",
5011 static struct snd_pci_quirk alc260_cfg_tbl[] = {
5012 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
5013 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
5014 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
5015 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
5016 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
5017 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
5018 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
5019 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
5020 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
5021 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
5022 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
5023 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
5024 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
5025 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
5026 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
5027 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
5028 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
5029 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
5033 static struct alc_config_preset alc260_presets[] = {
5035 .mixers = { alc260_base_output_mixer,
5037 alc260_pc_beep_mixer,
5038 alc260_capture_mixer },
5039 .init_verbs = { alc260_init_verbs },
5040 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5041 .dac_nids = alc260_dac_nids,
5042 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5043 .adc_nids = alc260_adc_nids,
5044 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5045 .channel_mode = alc260_modes,
5046 .input_mux = &alc260_capture_source,
5049 .mixers = { alc260_hp_output_mixer,
5051 alc260_capture_alt_mixer },
5052 .init_verbs = { alc260_init_verbs,
5053 alc260_hp_unsol_verbs },
5054 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5055 .dac_nids = alc260_dac_nids,
5056 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5057 .adc_nids = alc260_hp_adc_nids,
5058 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5059 .channel_mode = alc260_modes,
5060 .input_mux = &alc260_capture_source,
5061 .unsol_event = alc260_hp_unsol_event,
5062 .init_hook = alc260_hp_automute,
5064 [ALC260_HP_3013] = {
5065 .mixers = { alc260_hp_3013_mixer,
5067 alc260_capture_alt_mixer },
5068 .init_verbs = { alc260_hp_3013_init_verbs,
5069 alc260_hp_3013_unsol_verbs },
5070 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5071 .dac_nids = alc260_dac_nids,
5072 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
5073 .adc_nids = alc260_hp_adc_nids,
5074 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5075 .channel_mode = alc260_modes,
5076 .input_mux = &alc260_capture_source,
5077 .unsol_event = alc260_hp_3013_unsol_event,
5078 .init_hook = alc260_hp_3013_automute,
5080 [ALC260_FUJITSU_S702X] = {
5081 .mixers = { alc260_fujitsu_mixer,
5082 alc260_capture_mixer },
5083 .init_verbs = { alc260_fujitsu_init_verbs },
5084 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5085 .dac_nids = alc260_dac_nids,
5086 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5087 .adc_nids = alc260_dual_adc_nids,
5088 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5089 .channel_mode = alc260_modes,
5090 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
5091 .input_mux = alc260_fujitsu_capture_sources,
5094 .mixers = { alc260_acer_mixer,
5095 alc260_capture_mixer },
5096 .init_verbs = { alc260_acer_init_verbs },
5097 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5098 .dac_nids = alc260_dac_nids,
5099 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
5100 .adc_nids = alc260_dual_adc_nids,
5101 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5102 .channel_mode = alc260_modes,
5103 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
5104 .input_mux = alc260_acer_capture_sources,
5107 .mixers = { alc260_will_mixer,
5108 alc260_capture_mixer },
5109 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
5110 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5111 .dac_nids = alc260_dac_nids,
5112 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5113 .adc_nids = alc260_adc_nids,
5114 .dig_out_nid = ALC260_DIGOUT_NID,
5115 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5116 .channel_mode = alc260_modes,
5117 .input_mux = &alc260_capture_source,
5119 [ALC260_REPLACER_672V] = {
5120 .mixers = { alc260_replacer_672v_mixer,
5121 alc260_capture_mixer },
5122 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
5123 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
5124 .dac_nids = alc260_dac_nids,
5125 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
5126 .adc_nids = alc260_adc_nids,
5127 .dig_out_nid = ALC260_DIGOUT_NID,
5128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5129 .channel_mode = alc260_modes,
5130 .input_mux = &alc260_capture_source,
5131 .unsol_event = alc260_replacer_672v_unsol_event,
5132 .init_hook = alc260_replacer_672v_automute,
5134 #ifdef CONFIG_SND_DEBUG
5136 .mixers = { alc260_test_mixer,
5137 alc260_capture_mixer },
5138 .init_verbs = { alc260_test_init_verbs },
5139 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
5140 .dac_nids = alc260_test_dac_nids,
5141 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
5142 .adc_nids = alc260_test_adc_nids,
5143 .num_channel_mode = ARRAY_SIZE(alc260_modes),
5144 .channel_mode = alc260_modes,
5145 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
5146 .input_mux = alc260_test_capture_sources,
5151 static int patch_alc260(struct hda_codec *codec)
5153 struct alc_spec *spec;
5154 int err, board_config;
5156 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5162 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
5165 if (board_config < 0) {
5166 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
5167 "trying auto-probe from BIOS...\n");
5168 board_config = ALC260_AUTO;
5171 if (board_config == ALC260_AUTO) {
5172 /* automatic parse from the BIOS config */
5173 err = alc260_parse_auto_config(codec);
5179 "hda_codec: Cannot set up configuration "
5180 "from BIOS. Using base mode...\n");
5181 board_config = ALC260_BASIC;
5185 if (board_config != ALC260_AUTO)
5186 setup_preset(spec, &alc260_presets[board_config]);
5188 spec->stream_name_analog = "ALC260 Analog";
5189 spec->stream_analog_playback = &alc260_pcm_analog_playback;
5190 spec->stream_analog_capture = &alc260_pcm_analog_capture;
5192 spec->stream_name_digital = "ALC260 Digital";
5193 spec->stream_digital_playback = &alc260_pcm_digital_playback;
5194 spec->stream_digital_capture = &alc260_pcm_digital_capture;
5196 spec->vmaster_nid = 0x08;
5198 codec->patch_ops = alc_patch_ops;
5199 if (board_config == ALC260_AUTO)
5200 spec->init_hook = alc260_auto_init;
5201 #ifdef CONFIG_SND_HDA_POWER_SAVE
5202 if (!spec->loopback.amplist)
5203 spec->loopback.amplist = alc260_loopbacks;
5213 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5214 * configuration. Each pin widget can choose any input DACs and a mixer.
5215 * Each ADC is connected from a mixer of all inputs. This makes possible
5216 * 6-channel independent captures.
5218 * In addition, an independent DAC for the multi-playback (not used in this
5221 #define ALC882_DIGOUT_NID 0x06
5222 #define ALC882_DIGIN_NID 0x0a
5224 static struct hda_channel_mode alc882_ch_modes[1] = {
5228 static hda_nid_t alc882_dac_nids[4] = {
5229 /* front, rear, clfe, rear_surr */
5230 0x02, 0x03, 0x04, 0x05
5233 /* identical with ALC880 */
5234 #define alc882_adc_nids alc880_adc_nids
5235 #define alc882_adc_nids_alt alc880_adc_nids_alt
5237 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
5238 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
5241 /* FIXME: should be a matrix-type input source selection */
5243 static struct hda_input_mux alc882_capture_source = {
5247 { "Front Mic", 0x1 },
5252 #define alc882_mux_enum_info alc_mux_enum_info
5253 #define alc882_mux_enum_get alc_mux_enum_get
5255 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5256 struct snd_ctl_elem_value *ucontrol)
5258 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5259 struct alc_spec *spec = codec->spec;
5260 const struct hda_input_mux *imux = spec->input_mux;
5261 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5262 hda_nid_t nid = spec->capsrc_nids ?
5263 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5264 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5265 unsigned int i, idx;
5267 idx = ucontrol->value.enumerated.item[0];
5268 if (idx >= imux->num_items)
5269 idx = imux->num_items - 1;
5270 if (*cur_val == idx)
5272 for (i = 0; i < imux->num_items; i++) {
5273 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5274 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5275 imux->items[i].index,
5285 static struct hda_verb alc882_3ST_ch2_init[] = {
5286 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5287 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5288 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5289 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5296 static struct hda_verb alc882_3ST_ch6_init[] = {
5297 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5298 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5299 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5300 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5301 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5302 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5306 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5307 { 2, alc882_3ST_ch2_init },
5308 { 6, alc882_3ST_ch6_init },
5314 static struct hda_verb alc882_sixstack_ch6_init[] = {
5315 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5316 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5317 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5318 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5325 static struct hda_verb alc882_sixstack_ch8_init[] = {
5326 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5327 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5328 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5329 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5333 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5334 { 6, alc882_sixstack_ch6_init },
5335 { 8, alc882_sixstack_ch8_init },
5339 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5345 static struct hda_verb alc885_mbp_ch2_init[] = {
5346 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5347 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5355 static struct hda_verb alc885_mbp_ch6_init[] = {
5356 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5357 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5358 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5359 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5360 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5364 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5365 { 2, alc885_mbp_ch2_init },
5366 { 6, alc885_mbp_ch6_init },
5370 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5371 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5373 static struct snd_kcontrol_new alc882_base_mixer[] = {
5374 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5375 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5376 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5377 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5378 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5379 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5380 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5381 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5382 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5383 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5392 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5393 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5395 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5396 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5400 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5402 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
5403 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
5404 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
5405 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5406 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5408 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5409 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
5410 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5413 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5423 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5424 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5428 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5429 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5430 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5433 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5438 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5439 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5440 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5441 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5445 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5446 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5448 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5449 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5450 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5452 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5453 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5454 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5457 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5458 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5459 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5460 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5465 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5467 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5469 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5470 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5471 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5472 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5474 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5476 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5477 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5481 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5483 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5484 .name = "Channel Mode",
5485 .info = alc_ch_mode_info,
5486 .get = alc_ch_mode_get,
5487 .put = alc_ch_mode_put,
5492 static struct hda_verb alc882_init_verbs[] = {
5493 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5498 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5499 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5510 /* Front Pin: output 0 (0x0c) */
5511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5513 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5514 /* Rear Pin: output 1 (0x0d) */
5515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5518 /* CLFE Pin: output 2 (0x0e) */
5519 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5521 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5522 /* Side Pin: output 3 (0x0f) */
5523 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5524 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5525 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5526 /* Mic (rear) pin: input vref at 80% */
5527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5528 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5529 /* Front Mic pin: input vref at 80% */
5530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5531 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5532 /* Line In pin: input */
5533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5535 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5536 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5537 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5538 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5539 /* CD pin widget for input */
5540 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5542 /* FIXME: use matrix-type input source selection */
5543 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5544 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5553 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5559 /* ADC1: mute amp left and right */
5560 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5561 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5562 /* ADC2: mute amp left and right */
5563 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5564 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5565 /* ADC3: mute amp left and right */
5566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5567 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5572 static struct hda_verb alc882_eapd_verbs[] = {
5573 /* change to EAPD mode */
5574 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5575 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5580 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5581 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5582 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5583 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5584 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5585 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5586 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5587 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5591 static struct hda_verb alc882_macpro_init_verbs[] = {
5592 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 /* Front Pin: output 0 (0x0c) */
5597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5599 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5600 /* Front Mic pin: input vref at 80% */
5601 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5602 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5603 /* Speaker: output */
5604 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5605 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5606 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5607 /* Headphone output (output 0 - 0x0c) */
5608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5610 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5612 /* FIXME: use matrix-type input source selection */
5613 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5614 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5617 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5618 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5622 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5623 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5629 /* ADC1: mute amp left and right */
5630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5632 /* ADC2: mute amp left and right */
5633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5635 /* ADC3: mute amp left and right */
5636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5637 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5642 /* Macbook Pro rev3 */
5643 static struct hda_verb alc885_mbp3_init_verbs[] = {
5644 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5652 /* Front Pin: output 0 (0x0c) */
5653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5656 /* HP Pin: output 0 (0x0d) */
5657 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5661 /* Mic (rear) pin: input vref at 80% */
5662 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5664 /* Front Mic pin: input vref at 80% */
5665 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5667 /* Line In pin: use output 1 when in LineOut mode */
5668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5670 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5672 /* FIXME: use matrix-type input source selection */
5673 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5674 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5677 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5678 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5681 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5682 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5683 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5686 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5687 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5688 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5689 /* ADC1: mute amp left and right */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5691 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5692 /* ADC2: mute amp left and right */
5693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5694 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5695 /* ADC3: mute amp left and right */
5696 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5697 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5702 /* iMac 24 mixer. */
5703 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5704 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5705 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5709 /* iMac 24 init verbs. */
5710 static struct hda_verb alc885_imac24_init_verbs[] = {
5711 /* Internal speakers: output 0 (0x0c) */
5712 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5713 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5714 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5715 /* Internal speakers: output 0 (0x0c) */
5716 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5718 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5719 /* Headphone: output 0 (0x0c) */
5720 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5722 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5723 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5724 /* Front Mic: input vref at 80% */
5725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5730 /* Toggle speaker-output according to the hp-jack state */
5731 static void alc885_imac24_automute(struct hda_codec *codec)
5733 unsigned int present;
5735 present = snd_hda_codec_read(codec, 0x14, 0,
5736 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5737 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5738 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5739 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5740 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5743 /* Processes unsolicited events. */
5744 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5747 /* Headphone insertion or removal. */
5748 if ((res >> 26) == ALC880_HP_EVENT)
5749 alc885_imac24_automute(codec);
5752 static void alc885_mbp3_automute(struct hda_codec *codec)
5754 unsigned int present;
5756 present = snd_hda_codec_read(codec, 0x15, 0,
5757 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5758 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5759 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5760 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5761 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5764 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5767 /* Headphone insertion or removal. */
5768 if ((res >> 26) == ALC880_HP_EVENT)
5769 alc885_mbp3_automute(codec);
5773 static struct hda_verb alc882_targa_verbs[] = {
5774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5780 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5781 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5782 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5784 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5785 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5786 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5787 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5791 /* toggle speaker-output according to the hp-jack state */
5792 static void alc882_targa_automute(struct hda_codec *codec)
5794 unsigned int present;
5796 present = snd_hda_codec_read(codec, 0x14, 0,
5797 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5798 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5799 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5800 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5804 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5806 /* Looks like the unsol event is incompatible with the standard
5807 * definition. 4bit tag is placed at 26 bit!
5809 if (((res >> 26) == ALC880_HP_EVENT)) {
5810 alc882_targa_automute(codec);
5814 static struct hda_verb alc882_asus_a7j_verbs[] = {
5815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5818 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5819 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5820 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5822 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5823 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5824 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5826 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5827 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5828 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5832 static struct hda_verb alc882_asus_a7m_verbs[] = {
5833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5836 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5840 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5841 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5842 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5844 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5845 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5846 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5850 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5852 unsigned int gpiostate, gpiomask, gpiodir;
5854 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5855 AC_VERB_GET_GPIO_DATA, 0);
5858 gpiostate |= (1 << pin);
5860 gpiostate &= ~(1 << pin);
5862 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5863 AC_VERB_GET_GPIO_MASK, 0);
5864 gpiomask |= (1 << pin);
5866 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5867 AC_VERB_GET_GPIO_DIRECTION, 0);
5868 gpiodir |= (1 << pin);
5871 snd_hda_codec_write(codec, codec->afg, 0,
5872 AC_VERB_SET_GPIO_MASK, gpiomask);
5873 snd_hda_codec_write(codec, codec->afg, 0,
5874 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5878 snd_hda_codec_write(codec, codec->afg, 0,
5879 AC_VERB_SET_GPIO_DATA, gpiostate);
5882 /* set up GPIO at initialization */
5883 static void alc885_macpro_init_hook(struct hda_codec *codec)
5885 alc882_gpio_mute(codec, 0, 0);
5886 alc882_gpio_mute(codec, 1, 0);
5889 /* set up GPIO and update auto-muting at initialization */
5890 static void alc885_imac24_init_hook(struct hda_codec *codec)
5892 alc885_macpro_init_hook(codec);
5893 alc885_imac24_automute(codec);
5897 * generic initialization of ADC, input mixers and output mixers
5899 static struct hda_verb alc882_auto_init_verbs[] = {
5901 * Unmute ADC0-2 and set the default input to mic-in
5903 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5905 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5906 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5907 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5908 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5910 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5912 * Note: PASD motherboards uses the Line In 2 as the input for
5913 * front panel mic (mic 2)
5915 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5916 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5917 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5919 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5923 * Set up output mixers (0x0c - 0x0f)
5925 /* set vol=0 to output mixers */
5926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5927 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5928 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5929 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5930 /* set up input amps for analog loopback */
5931 /* Amp Indices: DAC = 0, mixer = 1 */
5932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5934 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5935 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5937 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5938 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5939 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5940 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5941 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5943 /* FIXME: use matrix-type input source selection */
5944 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5945 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5947 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5959 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5964 /* capture mixer elements */
5965 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5966 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5967 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5968 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5969 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5972 /* The multiple "Capture Source" controls confuse alsamixer
5973 * So call somewhat different..
5975 /* .name = "Capture Source", */
5976 .name = "Input Source",
5978 .info = alc882_mux_enum_info,
5979 .get = alc882_mux_enum_get,
5980 .put = alc882_mux_enum_put,
5985 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5986 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5987 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5988 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5989 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5990 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5991 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5994 /* The multiple "Capture Source" controls confuse alsamixer
5995 * So call somewhat different..
5997 /* .name = "Capture Source", */
5998 .name = "Input Source",
6000 .info = alc882_mux_enum_info,
6001 .get = alc882_mux_enum_get,
6002 .put = alc882_mux_enum_put,
6007 #ifdef CONFIG_SND_HDA_POWER_SAVE
6008 #define alc882_loopbacks alc880_loopbacks
6011 /* pcm configuration: identiacal with ALC880 */
6012 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6013 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6014 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6015 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6018 * configuration and preset
6020 static const char *alc882_models[ALC882_MODEL_LAST] = {
6021 [ALC882_3ST_DIG] = "3stack-dig",
6022 [ALC882_6ST_DIG] = "6stack-dig",
6023 [ALC882_ARIMA] = "arima",
6024 [ALC882_W2JC] = "w2jc",
6025 [ALC882_TARGA] = "targa",
6026 [ALC882_ASUS_A7J] = "asus-a7j",
6027 [ALC882_ASUS_A7M] = "asus-a7m",
6028 [ALC885_MACPRO] = "macpro",
6029 [ALC885_MBP3] = "mbp3",
6030 [ALC885_IMAC24] = "imac24",
6031 [ALC882_AUTO] = "auto",
6034 static struct snd_pci_quirk alc882_cfg_tbl[] = {
6035 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
6036 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
6037 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
6038 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
6039 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
6040 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
6041 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
6042 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
6043 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
6044 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
6045 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
6046 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
6050 static struct alc_config_preset alc882_presets[] = {
6051 [ALC882_3ST_DIG] = {
6052 .mixers = { alc882_base_mixer },
6053 .init_verbs = { alc882_init_verbs },
6054 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6055 .dac_nids = alc882_dac_nids,
6056 .dig_out_nid = ALC882_DIGOUT_NID,
6057 .dig_in_nid = ALC882_DIGIN_NID,
6058 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6059 .channel_mode = alc882_ch_modes,
6061 .input_mux = &alc882_capture_source,
6063 [ALC882_6ST_DIG] = {
6064 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6065 .init_verbs = { alc882_init_verbs },
6066 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6067 .dac_nids = alc882_dac_nids,
6068 .dig_out_nid = ALC882_DIGOUT_NID,
6069 .dig_in_nid = ALC882_DIGIN_NID,
6070 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6071 .channel_mode = alc882_sixstack_modes,
6072 .input_mux = &alc882_capture_source,
6075 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
6076 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
6077 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6078 .dac_nids = alc882_dac_nids,
6079 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
6080 .channel_mode = alc882_sixstack_modes,
6081 .input_mux = &alc882_capture_source,
6084 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
6085 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6086 alc880_gpio1_init_verbs },
6087 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6088 .dac_nids = alc882_dac_nids,
6089 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6090 .channel_mode = alc880_threestack_modes,
6092 .input_mux = &alc882_capture_source,
6093 .dig_out_nid = ALC882_DIGOUT_NID,
6096 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
6097 .init_verbs = { alc885_mbp3_init_verbs,
6098 alc880_gpio1_init_verbs },
6099 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6100 .dac_nids = alc882_dac_nids,
6101 .channel_mode = alc885_mbp_6ch_modes,
6102 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
6103 .input_mux = &alc882_capture_source,
6104 .dig_out_nid = ALC882_DIGOUT_NID,
6105 .dig_in_nid = ALC882_DIGIN_NID,
6106 .unsol_event = alc885_mbp3_unsol_event,
6107 .init_hook = alc885_mbp3_automute,
6110 .mixers = { alc882_macpro_mixer },
6111 .init_verbs = { alc882_macpro_init_verbs },
6112 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6113 .dac_nids = alc882_dac_nids,
6114 .dig_out_nid = ALC882_DIGOUT_NID,
6115 .dig_in_nid = ALC882_DIGIN_NID,
6116 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6117 .channel_mode = alc882_ch_modes,
6118 .input_mux = &alc882_capture_source,
6119 .init_hook = alc885_macpro_init_hook,
6122 .mixers = { alc885_imac24_mixer },
6123 .init_verbs = { alc885_imac24_init_verbs },
6124 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6125 .dac_nids = alc882_dac_nids,
6126 .dig_out_nid = ALC882_DIGOUT_NID,
6127 .dig_in_nid = ALC882_DIGIN_NID,
6128 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6129 .channel_mode = alc882_ch_modes,
6130 .input_mux = &alc882_capture_source,
6131 .unsol_event = alc885_imac24_unsol_event,
6132 .init_hook = alc885_imac24_init_hook,
6135 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
6136 alc882_capture_mixer },
6137 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
6138 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6139 .dac_nids = alc882_dac_nids,
6140 .dig_out_nid = ALC882_DIGOUT_NID,
6141 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6142 .adc_nids = alc882_adc_nids,
6143 .capsrc_nids = alc882_capsrc_nids,
6144 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6145 .channel_mode = alc882_3ST_6ch_modes,
6147 .input_mux = &alc882_capture_source,
6148 .unsol_event = alc882_targa_unsol_event,
6149 .init_hook = alc882_targa_automute,
6151 [ALC882_ASUS_A7J] = {
6152 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
6153 alc882_capture_mixer },
6154 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
6155 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6156 .dac_nids = alc882_dac_nids,
6157 .dig_out_nid = ALC882_DIGOUT_NID,
6158 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
6159 .adc_nids = alc882_adc_nids,
6160 .capsrc_nids = alc882_capsrc_nids,
6161 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
6162 .channel_mode = alc882_3ST_6ch_modes,
6164 .input_mux = &alc882_capture_source,
6166 [ALC882_ASUS_A7M] = {
6167 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
6168 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
6169 alc880_gpio1_init_verbs,
6170 alc882_asus_a7m_verbs },
6171 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
6172 .dac_nids = alc882_dac_nids,
6173 .dig_out_nid = ALC882_DIGOUT_NID,
6174 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
6175 .channel_mode = alc880_threestack_modes,
6177 .input_mux = &alc882_capture_source,
6186 PINFIX_ABIT_AW9D_MAX
6189 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
6190 { 0x15, 0x01080104 }, /* side */
6191 { 0x16, 0x01011012 }, /* rear */
6192 { 0x17, 0x01016011 }, /* clfe */
6196 static const struct alc_pincfg *alc882_pin_fixes[] = {
6197 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
6200 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
6201 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
6206 * BIOS auto configuration
6208 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
6209 hda_nid_t nid, int pin_type,
6213 struct alc_spec *spec = codec->spec;
6216 alc_set_pin_output(codec, nid, pin_type);
6217 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6220 idx = spec->multiout.dac_nids[dac_idx] - 2;
6221 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6225 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6227 struct alc_spec *spec = codec->spec;
6230 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6231 for (i = 0; i <= HDA_SIDE; i++) {
6232 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6233 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6235 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6240 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6242 struct alc_spec *spec = codec->spec;
6245 pin = spec->autocfg.hp_pins[0];
6246 if (pin) /* connect to front */
6248 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6249 pin = spec->autocfg.speaker_pins[0];
6251 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
6254 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6255 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6257 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6259 struct alc_spec *spec = codec->spec;
6262 for (i = 0; i < AUTO_PIN_LAST; i++) {
6263 hda_nid_t nid = spec->autocfg.input_pins[i];
6268 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6269 if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) &
6273 snd_hda_codec_write(codec, nid, 0,
6274 AC_VERB_SET_PIN_WIDGET_CONTROL, vref);
6275 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
6276 snd_hda_codec_write(codec, nid, 0,
6277 AC_VERB_SET_AMP_GAIN_MUTE,
6282 /* add mic boosts if needed */
6283 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6285 struct alc_spec *spec = codec->spec;
6289 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6290 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6291 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6293 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6297 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6298 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
6299 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6301 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6308 /* almost identical with ALC880 parser... */
6309 static int alc882_parse_auto_config(struct hda_codec *codec)
6311 struct alc_spec *spec = codec->spec;
6312 int err = alc880_parse_auto_config(codec);
6317 return 0; /* no config found */
6319 err = alc_auto_add_mic_boost(codec);
6323 /* hack - override the init verbs */
6324 spec->init_verbs[0] = alc882_auto_init_verbs;
6326 return 1; /* config found */
6329 /* additional initialization for auto-configuration model */
6330 static void alc882_auto_init(struct hda_codec *codec)
6332 struct alc_spec *spec = codec->spec;
6333 alc882_auto_init_multi_out(codec);
6334 alc882_auto_init_hp_out(codec);
6335 alc882_auto_init_analog_input(codec);
6336 if (spec->unsol_event)
6337 alc_sku_automute(codec);
6340 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
6342 static int patch_alc882(struct hda_codec *codec)
6344 struct alc_spec *spec;
6345 int err, board_config;
6347 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6353 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6357 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6358 /* Pick up systems that don't supply PCI SSID */
6359 switch (codec->subsystem_id) {
6360 case 0x106b0c00: /* Mac Pro */
6361 board_config = ALC885_MACPRO;
6363 case 0x106b1000: /* iMac 24 */
6364 board_config = ALC885_IMAC24;
6366 case 0x106b00a1: /* Macbook */
6367 case 0x106b2c00: /* Macbook Pro rev3 */
6368 board_config = ALC885_MBP3;
6371 /* ALC889A is handled better as ALC888-compatible */
6372 if (codec->revision_id == 0x100103) {
6374 return patch_alc883(codec);
6376 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6377 "trying auto-probe from BIOS...\n");
6378 board_config = ALC882_AUTO;
6382 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6384 if (board_config == ALC882_AUTO) {
6385 /* automatic parse from the BIOS config */
6386 err = alc882_parse_auto_config(codec);
6392 "hda_codec: Cannot set up configuration "
6393 "from BIOS. Using base mode...\n");
6394 board_config = ALC882_3ST_DIG;
6398 if (board_config != ALC882_AUTO)
6399 setup_preset(spec, &alc882_presets[board_config]);
6401 spec->stream_name_analog = "ALC882 Analog";
6402 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6403 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6404 /* FIXME: setup DAC5 */
6405 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6406 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6408 spec->stream_name_digital = "ALC882 Digital";
6409 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6410 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6412 if (!spec->adc_nids && spec->input_mux) {
6413 /* check whether NID 0x07 is valid */
6414 unsigned int wcap = get_wcaps(codec, 0x07);
6416 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6417 if (wcap != AC_WID_AUD_IN) {
6418 spec->adc_nids = alc882_adc_nids_alt;
6419 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6420 spec->capsrc_nids = alc882_capsrc_nids_alt;
6421 spec->mixers[spec->num_mixers] =
6422 alc882_capture_alt_mixer;
6425 spec->adc_nids = alc882_adc_nids;
6426 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6427 spec->capsrc_nids = alc882_capsrc_nids;
6428 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6433 spec->vmaster_nid = 0x0c;
6435 codec->patch_ops = alc_patch_ops;
6436 if (board_config == ALC882_AUTO)
6437 spec->init_hook = alc882_auto_init;
6438 #ifdef CONFIG_SND_HDA_POWER_SAVE
6439 if (!spec->loopback.amplist)
6440 spec->loopback.amplist = alc882_loopbacks;
6449 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6450 * configuration. Each pin widget can choose any input DACs and a mixer.
6451 * Each ADC is connected from a mixer of all inputs. This makes possible
6452 * 6-channel independent captures.
6454 * In addition, an independent DAC for the multi-playback (not used in this
6457 #define ALC883_DIGOUT_NID 0x06
6458 #define ALC883_DIGIN_NID 0x0a
6460 static hda_nid_t alc883_dac_nids[4] = {
6461 /* front, rear, clfe, rear_surr */
6462 0x02, 0x03, 0x04, 0x05
6465 static hda_nid_t alc883_adc_nids[2] = {
6470 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
6473 /* FIXME: should be a matrix-type input source selection */
6475 static struct hda_input_mux alc883_capture_source = {
6479 { "Front Mic", 0x1 },
6485 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6493 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6503 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6511 #define alc883_mux_enum_info alc_mux_enum_info
6512 #define alc883_mux_enum_get alc_mux_enum_get
6513 /* ALC883 has the ALC882-type input selection */
6514 #define alc883_mux_enum_put alc882_mux_enum_put
6519 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6526 static struct hda_verb alc883_3ST_ch2_init[] = {
6527 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6528 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6529 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6530 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6537 static struct hda_verb alc883_3ST_ch4_init[] = {
6538 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6539 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6540 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6541 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6542 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6549 static struct hda_verb alc883_3ST_ch6_init[] = {
6550 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6551 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6552 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6553 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6554 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6555 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6559 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6560 { 2, alc883_3ST_ch2_init },
6561 { 4, alc883_3ST_ch4_init },
6562 { 6, alc883_3ST_ch6_init },
6568 static struct hda_verb alc883_sixstack_ch6_init[] = {
6569 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6570 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6571 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6572 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6579 static struct hda_verb alc883_sixstack_ch8_init[] = {
6580 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6581 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6582 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6583 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6587 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6588 { 6, alc883_sixstack_ch6_init },
6589 { 8, alc883_sixstack_ch8_init },
6592 static struct hda_verb alc883_medion_eapd_verbs[] = {
6593 /* eanable EAPD on medion laptop */
6594 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6595 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6599 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6600 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6603 static struct snd_kcontrol_new alc883_base_mixer[] = {
6604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6605 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6606 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6607 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6608 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6609 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6610 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6611 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6612 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6613 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6614 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6615 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6616 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6620 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6622 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6623 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6625 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6626 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6627 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6628 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6629 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6630 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6633 /* .name = "Capture Source", */
6634 .name = "Input Source",
6636 .info = alc883_mux_enum_info,
6637 .get = alc883_mux_enum_get,
6638 .put = alc883_mux_enum_put,
6643 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6644 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6645 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6646 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6647 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6648 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6649 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6653 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6654 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6655 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6656 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6657 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6658 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6659 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6660 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6663 /* .name = "Capture Source", */
6664 .name = "Input Source",
6666 .info = alc883_mux_enum_info,
6667 .get = alc883_mux_enum_get,
6668 .put = alc883_mux_enum_put,
6673 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
6674 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6675 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6676 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6677 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6681 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6682 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6683 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6686 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6687 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6690 /* .name = "Capture Source", */
6691 .name = "Input Source",
6693 .info = alc883_mux_enum_info,
6694 .get = alc883_mux_enum_get,
6695 .put = alc883_mux_enum_put,
6700 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
6701 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6702 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
6703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6704 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6706 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6709 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6710 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6711 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6712 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6713 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6714 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6717 /* .name = "Capture Source", */
6718 .name = "Input Source",
6720 .info = alc883_mux_enum_info,
6721 .get = alc883_mux_enum_get,
6722 .put = alc883_mux_enum_put,
6727 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6729 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6736 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6738 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6739 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6741 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6742 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6743 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6744 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6745 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6746 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6749 /* .name = "Capture Source", */
6750 .name = "Input Source",
6752 .info = alc883_mux_enum_info,
6753 .get = alc883_mux_enum_get,
6754 .put = alc883_mux_enum_put,
6759 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6762 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6763 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6764 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6765 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6766 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6767 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6778 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6779 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6780 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6781 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6782 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6783 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6784 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6787 /* .name = "Capture Source", */
6788 .name = "Input Source",
6790 .info = alc883_mux_enum_info,
6791 .get = alc883_mux_enum_get,
6792 .put = alc883_mux_enum_put,
6797 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6798 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6799 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6800 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6801 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6802 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6803 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6804 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6805 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6807 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6808 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6809 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6810 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6812 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6815 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6816 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6817 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6818 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6819 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6820 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6823 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6824 /* .name = "Capture Source", */
6825 .name = "Input Source",
6827 .info = alc883_mux_enum_info,
6828 .get = alc883_mux_enum_get,
6829 .put = alc883_mux_enum_put,
6834 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6835 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6837 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6838 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6839 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6840 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6841 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6842 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6843 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6844 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6845 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6849 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6850 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6851 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6852 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6853 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6854 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6857 /* .name = "Capture Source", */
6858 .name = "Input Source",
6860 .info = alc883_mux_enum_info,
6861 .get = alc883_mux_enum_get,
6862 .put = alc883_mux_enum_put,
6867 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6868 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6870 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6871 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6872 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6876 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6877 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
6878 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6879 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6880 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6881 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6882 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6884 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6885 /* .name = "Capture Source", */
6886 .name = "Input Source",
6888 .info = alc883_mux_enum_info,
6889 .get = alc883_mux_enum_get,
6890 .put = alc883_mux_enum_put,
6895 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6897 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6898 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6899 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
6900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6902 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6904 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6905 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6908 /* .name = "Capture Source", */
6909 .name = "Input Source",
6911 .info = alc883_mux_enum_info,
6912 .get = alc883_mux_enum_get,
6913 .put = alc883_mux_enum_put,
6918 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6919 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6920 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6926 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6927 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6928 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6929 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6930 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6931 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6934 /* .name = "Capture Source", */
6935 .name = "Input Source",
6937 .info = alc883_mux_enum_info,
6938 .get = alc883_mux_enum_get,
6939 .put = alc883_mux_enum_put,
6944 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6947 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6952 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6953 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6954 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6955 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6956 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6957 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6959 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6960 /* .name = "Capture Source", */
6961 .name = "Input Source",
6963 .info = alc883_mux_enum_info,
6964 .get = alc883_mux_enum_get,
6965 .put = alc883_mux_enum_put,
6970 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6972 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6977 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6979 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6980 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6981 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6982 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6985 /* .name = "Capture Source", */
6986 .name = "Input Source",
6988 .info = alc883_mux_enum_info,
6989 .get = alc883_mux_enum_get,
6990 .put = alc883_mux_enum_put,
6995 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6998 .name = "Channel Mode",
6999 .info = alc_ch_mode_info,
7000 .get = alc_ch_mode_get,
7001 .put = alc_ch_mode_put,
7006 static struct hda_verb alc883_init_verbs[] = {
7007 /* ADC1: mute amp left and right */
7008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7009 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7010 /* ADC2: mute amp left and right */
7011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7012 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7013 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7027 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7030 /* mute analog input loopbacks */
7031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7037 /* Front Pin: output 0 (0x0c) */
7038 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7039 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7040 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7041 /* Rear Pin: output 1 (0x0d) */
7042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7044 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7045 /* CLFE Pin: output 2 (0x0e) */
7046 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7047 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7048 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7049 /* Side Pin: output 3 (0x0f) */
7050 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7051 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7052 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7053 /* Mic (rear) pin: input vref at 80% */
7054 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7055 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7056 /* Front Mic pin: input vref at 80% */
7057 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7058 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7059 /* Line In pin: input */
7060 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7061 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7062 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7065 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7066 /* CD pin widget for input */
7067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7069 /* FIXME: use matrix-type input source selection */
7070 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7084 /* toggle speaker-output according to the hp-jack state */
7085 static void alc883_mitac_hp_automute(struct hda_codec *codec)
7087 unsigned int present;
7089 present = snd_hda_codec_read(codec, 0x15, 0,
7090 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7091 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7092 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7093 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7094 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7097 /* auto-toggle front mic */
7099 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7101 unsigned int present;
7104 present = snd_hda_codec_read(codec, 0x18, 0,
7105 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7106 bits = present ? HDA_AMP_MUTE : 0;
7107 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7111 static void alc883_mitac_automute(struct hda_codec *codec)
7113 alc883_mitac_hp_automute(codec);
7114 /* alc883_mitac_mic_automute(codec); */
7117 static void alc883_mitac_unsol_event(struct hda_codec *codec,
7120 switch (res >> 26) {
7121 case ALC880_HP_EVENT:
7122 alc883_mitac_hp_automute(codec);
7124 case ALC880_MIC_EVENT:
7125 /* alc883_mitac_mic_automute(codec); */
7130 static struct hda_verb alc883_mitac_verbs[] = {
7132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7135 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7136 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7138 /* enable unsolicited event */
7139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7140 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7145 static struct hda_verb alc883_clevo_m720_verbs[] = {
7147 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7151 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7153 /* enable unsolicited event */
7154 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7160 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7165 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7168 /* enable unsolicited event */
7169 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7174 static struct hda_verb alc883_tagra_verbs[] = {
7175 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7179 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7181 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7182 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7183 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7185 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7186 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7187 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7188 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7193 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7195 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7196 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7200 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7203 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7208 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7209 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7210 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7212 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7213 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7217 static struct hda_verb alc883_haier_w66_verbs[] = {
7218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7221 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7223 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7225 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7226 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7230 static struct hda_verb alc888_3st_hp_verbs[] = {
7231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7232 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7233 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7237 static struct hda_verb alc888_6st_dell_verbs[] = {
7238 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7242 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7243 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7244 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7245 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7246 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7250 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7251 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7252 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7253 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7254 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7258 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7259 { 2, alc888_3st_hp_2ch_init },
7260 { 6, alc888_3st_hp_6ch_init },
7263 /* toggle front-jack and RCA according to the hp-jack state */
7264 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7266 unsigned int present;
7268 present = snd_hda_codec_read(codec, 0x1b, 0,
7269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7270 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7271 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7272 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7273 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7276 /* toggle RCA according to the front-jack state */
7277 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7279 unsigned int present;
7281 present = snd_hda_codec_read(codec, 0x14, 0,
7282 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7283 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7284 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7287 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7290 if ((res >> 26) == ALC880_HP_EVENT)
7291 alc888_lenovo_ms7195_front_automute(codec);
7292 if ((res >> 26) == ALC880_FRONT_EVENT)
7293 alc888_lenovo_ms7195_rca_automute(codec);
7296 static struct hda_verb alc883_medion_md2_verbs[] = {
7297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7298 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7302 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7306 /* toggle speaker-output according to the hp-jack state */
7307 static void alc883_medion_md2_automute(struct hda_codec *codec)
7309 unsigned int present;
7311 present = snd_hda_codec_read(codec, 0x14, 0,
7312 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7313 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7314 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7317 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7320 if ((res >> 26) == ALC880_HP_EVENT)
7321 alc883_medion_md2_automute(codec);
7324 /* toggle speaker-output according to the hp-jack state */
7325 static void alc883_tagra_automute(struct hda_codec *codec)
7327 unsigned int present;
7330 present = snd_hda_codec_read(codec, 0x14, 0,
7331 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7332 bits = present ? HDA_AMP_MUTE : 0;
7333 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7334 HDA_AMP_MUTE, bits);
7335 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7339 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7341 if ((res >> 26) == ALC880_HP_EVENT)
7342 alc883_tagra_automute(codec);
7345 /* toggle speaker-output according to the hp-jack state */
7346 static void alc883_clevo_m720_hp_automute(struct hda_codec *codec)
7348 unsigned int present;
7351 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
7352 & AC_PINSENSE_PRESENCE;
7353 bits = present ? HDA_AMP_MUTE : 0;
7354 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7355 HDA_AMP_MUTE, bits);
7358 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
7360 unsigned int present;
7362 present = snd_hda_codec_read(codec, 0x18, 0,
7363 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7364 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
7365 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7368 static void alc883_clevo_m720_automute(struct hda_codec *codec)
7370 alc883_clevo_m720_hp_automute(codec);
7371 alc883_clevo_m720_mic_automute(codec);
7374 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
7377 switch (res >> 26) {
7378 case ALC880_HP_EVENT:
7379 alc883_clevo_m720_hp_automute(codec);
7381 case ALC880_MIC_EVENT:
7382 alc883_clevo_m720_mic_automute(codec);
7387 /* toggle speaker-output according to the hp-jack state */
7388 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec)
7390 unsigned int present;
7393 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
7394 & AC_PINSENSE_PRESENCE;
7395 bits = present ? HDA_AMP_MUTE : 0;
7396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7397 HDA_AMP_MUTE, bits);
7400 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec,
7403 if ((res >> 26) == ALC880_HP_EVENT)
7404 alc883_2ch_fujitsu_pi2515_automute(codec);
7407 static void alc883_haier_w66_automute(struct hda_codec *codec)
7409 unsigned int present;
7412 present = snd_hda_codec_read(codec, 0x1b, 0,
7413 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7414 bits = present ? 0x80 : 0;
7415 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7419 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7422 if ((res >> 26) == ALC880_HP_EVENT)
7423 alc883_haier_w66_automute(codec);
7426 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7428 unsigned int present;
7431 present = snd_hda_codec_read(codec, 0x14, 0,
7432 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7433 bits = present ? HDA_AMP_MUTE : 0;
7434 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7435 HDA_AMP_MUTE, bits);
7438 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7440 unsigned int present;
7443 present = snd_hda_codec_read(codec, 0x1b, 0,
7444 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7445 bits = present ? HDA_AMP_MUTE : 0;
7446 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7447 HDA_AMP_MUTE, bits);
7448 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7449 HDA_AMP_MUTE, bits);
7452 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7455 if ((res >> 26) == ALC880_HP_EVENT)
7456 alc883_lenovo_101e_all_automute(codec);
7457 if ((res >> 26) == ALC880_FRONT_EVENT)
7458 alc883_lenovo_101e_ispeaker_automute(codec);
7461 /* toggle speaker-output according to the hp-jack state */
7462 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7464 unsigned int present;
7466 present = snd_hda_codec_read(codec, 0x14, 0,
7467 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7468 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7469 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7470 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7471 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7474 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7477 if ((res >> 26) == ALC880_HP_EVENT)
7478 alc883_acer_aspire_automute(codec);
7481 static struct hda_verb alc883_acer_eapd_verbs[] = {
7482 /* HP Pin: output 0 (0x0c) */
7483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7486 /* Front Pin: output 0 (0x0c) */
7487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7490 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* eanable EAPD on medion laptop */
7492 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7493 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7494 /* enable unsolicited event */
7495 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7499 static void alc888_6st_dell_front_automute(struct hda_codec *codec)
7501 unsigned int present;
7503 present = snd_hda_codec_read(codec, 0x1b, 0,
7504 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7505 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7506 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7507 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7508 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7509 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7510 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7511 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7512 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7515 static void alc888_6st_dell_unsol_event(struct hda_codec *codec,
7518 switch (res >> 26) {
7519 case ALC880_HP_EVENT:
7520 printk("hp_event\n");
7521 alc888_6st_dell_front_automute(codec);
7527 * generic initialization of ADC, input mixers and output mixers
7529 static struct hda_verb alc883_auto_init_verbs[] = {
7531 * Unmute ADC0-2 and set the default input to mic-in
7533 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7535 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7538 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7540 * Note: PASD motherboards uses the Line In 2 as the input for
7541 * front panel mic (mic 2)
7543 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7551 * Set up output mixers (0x0c - 0x0f)
7553 /* set vol=0 to output mixers */
7554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7556 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7557 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7558 /* set up input amps for analog loopback */
7559 /* Amp Indices: DAC = 0, mixer = 1 */
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7566 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7567 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7568 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7569 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7571 /* FIXME: use matrix-type input source selection */
7572 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7577 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7583 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7589 /* capture mixer elements */
7590 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7591 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7592 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7593 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7594 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7597 /* The multiple "Capture Source" controls confuse alsamixer
7598 * So call somewhat different..
7600 /* .name = "Capture Source", */
7601 .name = "Input Source",
7603 .info = alc882_mux_enum_info,
7604 .get = alc882_mux_enum_get,
7605 .put = alc882_mux_enum_put,
7610 #ifdef CONFIG_SND_HDA_POWER_SAVE
7611 #define alc883_loopbacks alc880_loopbacks
7614 /* pcm configuration: identiacal with ALC880 */
7615 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7616 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7617 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7618 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7619 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7622 * configuration and preset
7624 static const char *alc883_models[ALC883_MODEL_LAST] = {
7625 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7626 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7627 [ALC883_3ST_6ch] = "3stack-6ch",
7628 [ALC883_6ST_DIG] = "6stack-dig",
7629 [ALC883_TARGA_DIG] = "targa-dig",
7630 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7631 [ALC883_ACER] = "acer",
7632 [ALC883_ACER_ASPIRE] = "acer-aspire",
7633 [ALC883_MEDION] = "medion",
7634 [ALC883_MEDION_MD2] = "medion-md2",
7635 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7636 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7637 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7638 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7639 [ALC883_HAIER_W66] = "haier-w66",
7640 [ALC888_3ST_HP] = "3stack-hp",
7641 [ALC888_6ST_DELL] = "6stack-dell",
7642 [ALC883_MITAC] = "mitac",
7643 [ALC883_CLEVO_M720] = "clevo-m720",
7644 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
7645 [ALC883_AUTO] = "auto",
7648 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7649 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7650 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7651 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7652 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7653 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7654 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
7655 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7656 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7657 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7658 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
7659 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7660 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7661 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7662 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7663 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7664 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7665 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7666 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7667 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7668 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
7669 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7670 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
7671 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7672 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7673 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7674 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7675 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7676 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7677 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7678 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7679 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7680 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7681 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7682 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7683 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
7684 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7685 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7686 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7687 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7688 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
7689 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
7690 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7691 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7692 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7693 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
7694 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7695 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7696 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7697 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7698 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7699 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
7700 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7701 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7705 static struct alc_config_preset alc883_presets[] = {
7706 [ALC883_3ST_2ch_DIG] = {
7707 .mixers = { alc883_3ST_2ch_mixer },
7708 .init_verbs = { alc883_init_verbs },
7709 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7710 .dac_nids = alc883_dac_nids,
7711 .dig_out_nid = ALC883_DIGOUT_NID,
7712 .dig_in_nid = ALC883_DIGIN_NID,
7713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7714 .channel_mode = alc883_3ST_2ch_modes,
7715 .input_mux = &alc883_capture_source,
7717 [ALC883_3ST_6ch_DIG] = {
7718 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7719 .init_verbs = { alc883_init_verbs },
7720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7721 .dac_nids = alc883_dac_nids,
7722 .dig_out_nid = ALC883_DIGOUT_NID,
7723 .dig_in_nid = ALC883_DIGIN_NID,
7724 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7725 .channel_mode = alc883_3ST_6ch_modes,
7727 .input_mux = &alc883_capture_source,
7729 [ALC883_3ST_6ch] = {
7730 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7731 .init_verbs = { alc883_init_verbs },
7732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7733 .dac_nids = alc883_dac_nids,
7734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7735 .channel_mode = alc883_3ST_6ch_modes,
7737 .input_mux = &alc883_capture_source,
7739 [ALC883_6ST_DIG] = {
7740 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7741 .init_verbs = { alc883_init_verbs },
7742 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7743 .dac_nids = alc883_dac_nids,
7744 .dig_out_nid = ALC883_DIGOUT_NID,
7745 .dig_in_nid = ALC883_DIGIN_NID,
7746 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7747 .channel_mode = alc883_sixstack_modes,
7748 .input_mux = &alc883_capture_source,
7750 [ALC883_TARGA_DIG] = {
7751 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7752 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7754 .dac_nids = alc883_dac_nids,
7755 .dig_out_nid = ALC883_DIGOUT_NID,
7756 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7757 .channel_mode = alc883_3ST_6ch_modes,
7759 .input_mux = &alc883_capture_source,
7760 .unsol_event = alc883_tagra_unsol_event,
7761 .init_hook = alc883_tagra_automute,
7763 [ALC883_TARGA_2ch_DIG] = {
7764 .mixers = { alc883_tagra_2ch_mixer},
7765 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7767 .dac_nids = alc883_dac_nids,
7768 .dig_out_nid = ALC883_DIGOUT_NID,
7769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7770 .channel_mode = alc883_3ST_2ch_modes,
7771 .input_mux = &alc883_capture_source,
7772 .unsol_event = alc883_tagra_unsol_event,
7773 .init_hook = alc883_tagra_automute,
7776 .mixers = { alc883_base_mixer },
7777 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7778 * and the headphone jack. Turn this on and rely on the
7779 * standard mute methods whenever the user wants to turn
7780 * these outputs off.
7782 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7783 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7784 .dac_nids = alc883_dac_nids,
7785 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7786 .channel_mode = alc883_3ST_2ch_modes,
7787 .input_mux = &alc883_capture_source,
7789 [ALC883_ACER_ASPIRE] = {
7790 .mixers = { alc883_acer_aspire_mixer },
7791 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7793 .dac_nids = alc883_dac_nids,
7794 .dig_out_nid = ALC883_DIGOUT_NID,
7795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7796 .channel_mode = alc883_3ST_2ch_modes,
7797 .input_mux = &alc883_capture_source,
7798 .unsol_event = alc883_acer_aspire_unsol_event,
7799 .init_hook = alc883_acer_aspire_automute,
7802 .mixers = { alc883_fivestack_mixer,
7803 alc883_chmode_mixer },
7804 .init_verbs = { alc883_init_verbs,
7805 alc883_medion_eapd_verbs },
7806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7807 .dac_nids = alc883_dac_nids,
7808 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7809 .channel_mode = alc883_sixstack_modes,
7810 .input_mux = &alc883_capture_source,
7812 [ALC883_MEDION_MD2] = {
7813 .mixers = { alc883_medion_md2_mixer},
7814 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7816 .dac_nids = alc883_dac_nids,
7817 .dig_out_nid = ALC883_DIGOUT_NID,
7818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7819 .channel_mode = alc883_3ST_2ch_modes,
7820 .input_mux = &alc883_capture_source,
7821 .unsol_event = alc883_medion_md2_unsol_event,
7822 .init_hook = alc883_medion_md2_automute,
7824 [ALC883_LAPTOP_EAPD] = {
7825 .mixers = { alc883_base_mixer },
7826 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7827 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7828 .dac_nids = alc883_dac_nids,
7829 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7830 .channel_mode = alc883_3ST_2ch_modes,
7831 .input_mux = &alc883_capture_source,
7833 [ALC883_CLEVO_M720] = {
7834 .mixers = { alc883_clevo_m720_mixer },
7835 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
7836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7837 .dac_nids = alc883_dac_nids,
7838 .dig_out_nid = ALC883_DIGOUT_NID,
7839 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7840 .channel_mode = alc883_3ST_2ch_modes,
7841 .input_mux = &alc883_capture_source,
7842 .unsol_event = alc883_clevo_m720_unsol_event,
7843 .init_hook = alc883_clevo_m720_automute,
7845 [ALC883_LENOVO_101E_2ch] = {
7846 .mixers = { alc883_lenovo_101e_2ch_mixer},
7847 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7849 .dac_nids = alc883_dac_nids,
7850 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7851 .channel_mode = alc883_3ST_2ch_modes,
7852 .input_mux = &alc883_lenovo_101e_capture_source,
7853 .unsol_event = alc883_lenovo_101e_unsol_event,
7854 .init_hook = alc883_lenovo_101e_all_automute,
7856 [ALC883_LENOVO_NB0763] = {
7857 .mixers = { alc883_lenovo_nb0763_mixer },
7858 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7860 .dac_nids = alc883_dac_nids,
7861 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7862 .channel_mode = alc883_3ST_2ch_modes,
7864 .input_mux = &alc883_lenovo_nb0763_capture_source,
7865 .unsol_event = alc883_medion_md2_unsol_event,
7866 .init_hook = alc883_medion_md2_automute,
7868 [ALC888_LENOVO_MS7195_DIG] = {
7869 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7870 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7871 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7872 .dac_nids = alc883_dac_nids,
7873 .dig_out_nid = ALC883_DIGOUT_NID,
7874 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7875 .channel_mode = alc883_3ST_6ch_modes,
7877 .input_mux = &alc883_capture_source,
7878 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7879 .init_hook = alc888_lenovo_ms7195_front_automute,
7881 [ALC883_HAIER_W66] = {
7882 .mixers = { alc883_tagra_2ch_mixer},
7883 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7884 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7885 .dac_nids = alc883_dac_nids,
7886 .dig_out_nid = ALC883_DIGOUT_NID,
7887 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7888 .channel_mode = alc883_3ST_2ch_modes,
7889 .input_mux = &alc883_capture_source,
7890 .unsol_event = alc883_haier_w66_unsol_event,
7891 .init_hook = alc883_haier_w66_automute,
7894 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7895 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7896 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7897 .dac_nids = alc883_dac_nids,
7898 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7899 .channel_mode = alc888_3st_hp_modes,
7901 .input_mux = &alc883_capture_source,
7903 [ALC888_6ST_DELL] = {
7904 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7905 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
7906 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7907 .dac_nids = alc883_dac_nids,
7908 .dig_out_nid = ALC883_DIGOUT_NID,
7909 .dig_in_nid = ALC883_DIGIN_NID,
7910 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7911 .channel_mode = alc883_sixstack_modes,
7912 .input_mux = &alc883_capture_source,
7913 .unsol_event = alc888_6st_dell_unsol_event,
7914 .init_hook = alc888_6st_dell_front_automute,
7917 .mixers = { alc883_mitac_mixer },
7918 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7919 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7920 .dac_nids = alc883_dac_nids,
7921 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7922 .channel_mode = alc883_3ST_2ch_modes,
7923 .input_mux = &alc883_capture_source,
7924 .unsol_event = alc883_mitac_unsol_event,
7925 .init_hook = alc883_mitac_automute,
7927 [ALC883_FUJITSU_PI2515] = {
7928 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
7929 .init_verbs = { alc883_init_verbs,
7930 alc883_2ch_fujitsu_pi2515_verbs},
7931 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7932 .dac_nids = alc883_dac_nids,
7933 .dig_out_nid = ALC883_DIGOUT_NID,
7934 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7935 .channel_mode = alc883_3ST_2ch_modes,
7936 .input_mux = &alc883_fujitsu_pi2515_capture_source,
7937 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
7938 .init_hook = alc883_2ch_fujitsu_pi2515_automute,
7944 * BIOS auto configuration
7946 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7947 hda_nid_t nid, int pin_type,
7951 struct alc_spec *spec = codec->spec;
7954 alc_set_pin_output(codec, nid, pin_type);
7955 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7958 idx = spec->multiout.dac_nids[dac_idx] - 2;
7959 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7963 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7965 struct alc_spec *spec = codec->spec;
7968 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7969 for (i = 0; i <= HDA_SIDE; i++) {
7970 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7971 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7973 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7978 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7980 struct alc_spec *spec = codec->spec;
7983 pin = spec->autocfg.hp_pins[0];
7984 if (pin) /* connect to front */
7986 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7987 pin = spec->autocfg.speaker_pins[0];
7989 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7992 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7993 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7995 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7997 struct alc_spec *spec = codec->spec;
8000 for (i = 0; i < AUTO_PIN_LAST; i++) {
8001 hda_nid_t nid = spec->autocfg.input_pins[i];
8002 if (alc883_is_input_pin(nid)) {
8003 snd_hda_codec_write(codec, nid, 0,
8004 AC_VERB_SET_PIN_WIDGET_CONTROL,
8005 (i <= AUTO_PIN_FRONT_MIC ?
8006 PIN_VREF80 : PIN_IN));
8007 if (nid != ALC883_PIN_CD_NID)
8008 snd_hda_codec_write(codec, nid, 0,
8009 AC_VERB_SET_AMP_GAIN_MUTE,
8015 /* almost identical with ALC880 parser... */
8016 static int alc883_parse_auto_config(struct hda_codec *codec)
8018 struct alc_spec *spec = codec->spec;
8019 int err = alc880_parse_auto_config(codec);
8024 return 0; /* no config found */
8026 err = alc_auto_add_mic_boost(codec);
8030 /* hack - override the init verbs */
8031 spec->init_verbs[0] = alc883_auto_init_verbs;
8032 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
8035 return 1; /* config found */
8038 /* additional initialization for auto-configuration model */
8039 static void alc883_auto_init(struct hda_codec *codec)
8041 struct alc_spec *spec = codec->spec;
8042 alc883_auto_init_multi_out(codec);
8043 alc883_auto_init_hp_out(codec);
8044 alc883_auto_init_analog_input(codec);
8045 if (spec->unsol_event)
8046 alc_sku_automute(codec);
8049 static int patch_alc883(struct hda_codec *codec)
8051 struct alc_spec *spec;
8052 int err, board_config;
8054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8060 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
8063 if (board_config < 0) {
8064 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
8065 "trying auto-probe from BIOS...\n");
8066 board_config = ALC883_AUTO;
8069 if (board_config == ALC883_AUTO) {
8070 /* automatic parse from the BIOS config */
8071 err = alc883_parse_auto_config(codec);
8077 "hda_codec: Cannot set up configuration "
8078 "from BIOS. Using base mode...\n");
8079 board_config = ALC883_3ST_2ch_DIG;
8083 if (board_config != ALC883_AUTO)
8084 setup_preset(spec, &alc883_presets[board_config]);
8086 spec->stream_name_analog = "ALC883 Analog";
8087 spec->stream_analog_playback = &alc883_pcm_analog_playback;
8088 spec->stream_analog_capture = &alc883_pcm_analog_capture;
8089 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
8091 spec->stream_name_digital = "ALC883 Digital";
8092 spec->stream_digital_playback = &alc883_pcm_digital_playback;
8093 spec->stream_digital_capture = &alc883_pcm_digital_capture;
8095 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8096 spec->adc_nids = alc883_adc_nids;
8097 spec->capsrc_nids = alc883_capsrc_nids;
8099 spec->vmaster_nid = 0x0c;
8101 codec->patch_ops = alc_patch_ops;
8102 if (board_config == ALC883_AUTO)
8103 spec->init_hook = alc883_auto_init;
8104 #ifdef CONFIG_SND_HDA_POWER_SAVE
8105 if (!spec->loopback.amplist)
8106 spec->loopback.amplist = alc883_loopbacks;
8116 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8117 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8119 #define alc262_dac_nids alc260_dac_nids
8120 #define alc262_adc_nids alc882_adc_nids
8121 #define alc262_adc_nids_alt alc882_adc_nids_alt
8122 #define alc262_capsrc_nids alc882_capsrc_nids
8123 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8125 #define alc262_modes alc260_modes
8126 #define alc262_capture_source alc882_capture_source
8128 static struct snd_kcontrol_new alc262_base_mixer[] = {
8129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8130 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8134 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8142 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8143 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
8144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8145 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8146 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
8150 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
8151 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8152 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8156 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8158 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8161 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8163 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8164 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8165 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8170 /* update HP, line and mono-out pins according to the master switch */
8171 static void alc262_hp_master_update(struct hda_codec *codec)
8173 struct alc_spec *spec = codec->spec;
8174 int val = spec->master_sw;
8177 snd_hda_codec_write_cache(codec, 0x1b, 0,
8178 AC_VERB_SET_PIN_WIDGET_CONTROL,
8180 snd_hda_codec_write_cache(codec, 0x15, 0,
8181 AC_VERB_SET_PIN_WIDGET_CONTROL,
8183 /* mono (speaker) depending on the HP jack sense */
8184 val = val && !spec->jack_present;
8185 snd_hda_codec_write_cache(codec, 0x16, 0,
8186 AC_VERB_SET_PIN_WIDGET_CONTROL,
8190 static void alc262_hp_bpc_automute(struct hda_codec *codec)
8192 struct alc_spec *spec = codec->spec;
8193 unsigned int presence;
8194 presence = snd_hda_codec_read(codec, 0x1b, 0,
8195 AC_VERB_GET_PIN_SENSE, 0);
8196 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8197 alc262_hp_master_update(codec);
8200 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
8202 if ((res >> 26) != ALC880_HP_EVENT)
8204 alc262_hp_bpc_automute(codec);
8207 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
8209 struct alc_spec *spec = codec->spec;
8210 unsigned int presence;
8211 presence = snd_hda_codec_read(codec, 0x15, 0,
8212 AC_VERB_GET_PIN_SENSE, 0);
8213 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
8214 alc262_hp_master_update(codec);
8217 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
8220 if ((res >> 26) != ALC880_HP_EVENT)
8222 alc262_hp_wildwest_automute(codec);
8225 static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol,
8226 struct snd_ctl_elem_value *ucontrol)
8228 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8229 struct alc_spec *spec = codec->spec;
8230 *ucontrol->value.integer.value = spec->master_sw;
8234 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
8235 struct snd_ctl_elem_value *ucontrol)
8237 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8238 struct alc_spec *spec = codec->spec;
8239 int val = !!*ucontrol->value.integer.value;
8241 if (val == spec->master_sw)
8243 spec->master_sw = val;
8244 alc262_hp_master_update(codec);
8248 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
8250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8251 .name = "Master Playback Switch",
8252 .info = snd_ctl_boolean_mono_info,
8253 .get = alc262_hp_master_sw_get,
8254 .put = alc262_hp_master_sw_put,
8256 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8257 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8261 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8267 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8273 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8274 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8275 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
8276 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
8280 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
8282 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8283 .name = "Master Playback Switch",
8284 .info = snd_ctl_boolean_mono_info,
8285 .get = alc262_hp_master_sw_get,
8286 .put = alc262_hp_master_sw_put,
8288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8289 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8290 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8292 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8294 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8296 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
8297 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
8298 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
8299 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8300 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8301 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8302 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8303 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8304 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
8308 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
8309 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8310 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
8315 /* mute/unmute internal speaker according to the hp jack and mute state */
8316 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
8318 struct alc_spec *spec = codec->spec;
8320 if (force || !spec->sense_updated) {
8321 unsigned int present;
8322 present = snd_hda_codec_read(codec, 0x15, 0,
8323 AC_VERB_GET_PIN_SENSE, 0);
8324 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8325 spec->sense_updated = 1;
8327 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
8328 spec->jack_present ? HDA_AMP_MUTE : 0);
8331 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
8334 if ((res >> 26) != ALC880_HP_EVENT)
8336 alc262_hp_t5735_automute(codec, 1);
8339 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
8341 alc262_hp_t5735_automute(codec, 1);
8344 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
8345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8346 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8347 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8355 static struct hda_verb alc262_hp_t5735_verbs[] = {
8356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8359 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8363 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
8364 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8366 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8367 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8369 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8373 static struct hda_verb alc262_hp_rp5700_verbs[] = {
8374 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8375 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8376 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8378 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8379 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8381 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
8387 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
8394 /* bind hp and internal speaker mute (with plug check) */
8395 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
8396 struct snd_ctl_elem_value *ucontrol)
8398 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8399 long *valp = ucontrol->value.integer.value;
8402 /* change hp mute */
8403 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
8405 valp[0] ? 0 : HDA_AMP_MUTE);
8406 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
8408 valp[1] ? 0 : HDA_AMP_MUTE);
8410 /* change speaker according to HP jack state */
8411 struct alc_spec *spec = codec->spec;
8413 if (spec->jack_present)
8414 mute = HDA_AMP_MUTE;
8416 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
8418 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8419 HDA_AMP_MUTE, mute);
8424 static struct snd_kcontrol_new alc262_sony_mixer[] = {
8425 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8428 .name = "Master Playback Switch",
8429 .info = snd_hda_mixer_amp_switch_info,
8430 .get = snd_hda_mixer_amp_switch_get,
8431 .put = alc262_sony_master_sw_put,
8432 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
8434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8436 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8437 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8441 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8443 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8445 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8446 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8447 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8448 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8452 #define alc262_capture_mixer alc882_capture_mixer
8453 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8456 * generic initialization of ADC, input mixers and output mixers
8458 static struct hda_verb alc262_init_verbs[] = {
8460 * Unmute ADC0-2 and set the default input to mic-in
8462 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8467 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8469 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8471 * Note: PASD motherboards uses the Line In 2 as the input for
8472 * front panel mic (mic 2)
8474 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8482 * Set up output mixers (0x0c - 0x0e)
8484 /* set vol=0 to output mixers */
8485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8486 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8487 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8488 /* set up input amps for analog loopback */
8489 /* Amp Indices: DAC = 0, mixer = 1 */
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8493 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8494 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8495 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8502 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8506 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8510 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8511 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8513 /* FIXME: use matrix-type input source selection */
8514 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8515 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8522 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8534 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8540 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8542 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8545 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8550 static struct hda_verb alc262_sony_unsol_verbs[] = {
8551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8555 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8559 /* mute/unmute internal speaker according to the hp jack and mute state */
8560 static void alc262_hippo_automute(struct hda_codec *codec)
8562 struct alc_spec *spec = codec->spec;
8564 unsigned int present;
8566 /* need to execute and sync at first */
8567 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8568 present = snd_hda_codec_read(codec, 0x15, 0,
8569 AC_VERB_GET_PIN_SENSE, 0);
8570 spec->jack_present = (present & 0x80000000) != 0;
8571 if (spec->jack_present) {
8572 /* mute internal speaker */
8573 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8574 HDA_AMP_MUTE, HDA_AMP_MUTE);
8576 /* unmute internal speaker if necessary */
8577 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8578 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8579 HDA_AMP_MUTE, mute);
8583 /* unsolicited event for HP jack sensing */
8584 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8587 if ((res >> 26) != ALC880_HP_EVENT)
8589 alc262_hippo_automute(codec);
8592 static void alc262_hippo1_automute(struct hda_codec *codec)
8595 unsigned int present;
8597 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8598 present = snd_hda_codec_read(codec, 0x1b, 0,
8599 AC_VERB_GET_PIN_SENSE, 0);
8600 present = (present & 0x80000000) != 0;
8602 /* mute internal speaker */
8603 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8604 HDA_AMP_MUTE, HDA_AMP_MUTE);
8606 /* unmute internal speaker if necessary */
8607 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8608 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8609 HDA_AMP_MUTE, mute);
8613 /* unsolicited event for HP jack sensing */
8614 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8617 if ((res >> 26) != ALC880_HP_EVENT)
8619 alc262_hippo1_automute(codec);
8624 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8625 * 0x1b = port replicator headphone out
8628 #define ALC_HP_EVENT 0x37
8630 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8631 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8638 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
8639 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8644 static struct hda_input_mux alc262_fujitsu_capture_source = {
8653 static struct hda_input_mux alc262_HP_capture_source = {
8657 { "Front Mic", 0x1 },
8664 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8668 { "Front Mic", 0x2 },
8674 /* mute/unmute internal speaker according to the hp jack and mute state */
8675 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8677 struct alc_spec *spec = codec->spec;
8680 if (force || !spec->sense_updated) {
8681 unsigned int present_int_hp, present_dock_hp;
8682 /* need to execute and sync at first */
8683 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8684 present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
8685 AC_VERB_GET_PIN_SENSE, 0);
8686 snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
8687 present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
8688 AC_VERB_GET_PIN_SENSE, 0);
8689 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8690 spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
8691 spec->sense_updated = 1;
8693 if (spec->jack_present) {
8694 /* mute internal speaker */
8695 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8696 HDA_AMP_MUTE, HDA_AMP_MUTE);
8698 /* unmute internal speaker if necessary */
8699 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8700 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8701 HDA_AMP_MUTE, mute);
8705 /* unsolicited event for HP jack sensing */
8706 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8709 if ((res >> 26) != ALC_HP_EVENT)
8711 alc262_fujitsu_automute(codec, 1);
8714 /* bind volumes of both NID 0x0c and 0x0d */
8715 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8716 .ops = &snd_hda_bind_vol,
8718 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8719 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8724 /* mute/unmute internal speaker according to the hp jack and mute state */
8725 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
8727 struct alc_spec *spec = codec->spec;
8730 if (force || !spec->sense_updated) {
8731 unsigned int present_int_hp;
8732 /* need to execute and sync at first */
8733 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8734 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
8735 AC_VERB_GET_PIN_SENSE, 0);
8736 spec->jack_present = (present_int_hp & 0x80000000) != 0;
8737 spec->sense_updated = 1;
8739 if (spec->jack_present) {
8740 /* mute internal speaker */
8741 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8742 HDA_AMP_MUTE, HDA_AMP_MUTE);
8743 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8744 HDA_AMP_MUTE, HDA_AMP_MUTE);
8746 /* unmute internal speaker if necessary */
8747 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8748 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8749 HDA_AMP_MUTE, mute);
8750 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8751 HDA_AMP_MUTE, mute);
8755 /* unsolicited event for HP jack sensing */
8756 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
8759 if ((res >> 26) != ALC_HP_EVENT)
8761 alc262_lenovo_3000_automute(codec, 1);
8764 /* bind hp and internal speaker mute (with plug check) */
8765 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8766 struct snd_ctl_elem_value *ucontrol)
8768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8769 long *valp = ucontrol->value.integer.value;
8772 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8774 valp ? 0 : HDA_AMP_MUTE);
8775 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8777 valp ? 0 : HDA_AMP_MUTE);
8780 alc262_fujitsu_automute(codec, 0);
8784 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8785 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8787 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8788 .name = "Master Playback Switch",
8789 .info = snd_hda_mixer_amp_switch_info,
8790 .get = snd_hda_mixer_amp_switch_get,
8791 .put = alc262_fujitsu_master_sw_put,
8792 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8796 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),
8797 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),
8798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8800 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8803 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8807 /* bind hp and internal speaker mute (with plug check) */
8808 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
8809 struct snd_ctl_elem_value *ucontrol)
8811 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8812 long *valp = ucontrol->value.integer.value;
8815 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8817 valp ? 0 : HDA_AMP_MUTE);
8820 alc262_lenovo_3000_automute(codec, 0);
8824 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
8825 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8827 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8828 .name = "Master Playback Switch",
8829 .info = snd_hda_mixer_amp_switch_info,
8830 .get = snd_hda_mixer_amp_switch_get,
8831 .put = alc262_lenovo_3000_master_sw_put,
8832 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
8834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8836 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8840 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8841 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8845 /* additional init verbs for Benq laptops */
8846 static struct hda_verb alc262_EAPD_verbs[] = {
8847 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8848 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8852 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8853 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8854 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8856 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8857 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8861 /* Samsung Q1 Ultra Vista model setup */
8862 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8863 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8864 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8867 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8868 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
8872 static struct hda_verb alc262_ultra_verbs[] = {
8874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8880 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8881 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8886 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8889 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8891 /* ADC, choose mic */
8892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8898 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8900 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8901 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
8905 /* mute/unmute internal speaker according to the hp jack and mute state */
8906 static void alc262_ultra_automute(struct hda_codec *codec)
8908 struct alc_spec *spec = codec->spec;
8912 /* auto-mute only when HP is used as HP */
8913 if (!spec->cur_mux[0]) {
8914 unsigned int present;
8915 /* need to execute and sync at first */
8916 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8917 present = snd_hda_codec_read(codec, 0x15, 0,
8918 AC_VERB_GET_PIN_SENSE, 0);
8919 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
8920 if (spec->jack_present)
8921 mute = HDA_AMP_MUTE;
8923 /* mute/unmute internal speaker */
8924 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8925 HDA_AMP_MUTE, mute);
8926 /* mute/unmute HP */
8927 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8928 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
8931 /* unsolicited event for HP jack sensing */
8932 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8935 if ((res >> 26) != ALC880_HP_EVENT)
8937 alc262_ultra_automute(codec);
8940 static struct hda_input_mux alc262_ultra_capture_source = {
8944 { "Headphone", 0x7 },
8948 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
8949 struct snd_ctl_elem_value *ucontrol)
8951 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8952 struct alc_spec *spec = codec->spec;
8955 ret = alc882_mux_enum_put(kcontrol, ucontrol);
8958 /* reprogram the HP pin as mic or HP according to the input source */
8959 snd_hda_codec_write_cache(codec, 0x15, 0,
8960 AC_VERB_SET_PIN_WIDGET_CONTROL,
8961 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
8962 alc262_ultra_automute(codec); /* mute/unmute HP */
8966 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
8967 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
8968 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
8970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8971 .name = "Capture Source",
8972 .info = alc882_mux_enum_info,
8973 .get = alc882_mux_enum_get,
8974 .put = alc262_ultra_mux_enum_put,
8979 /* add playback controls from the parsed DAC table */
8980 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8981 const struct auto_pin_cfg *cfg)
8986 spec->multiout.num_dacs = 1; /* only use one dac */
8987 spec->multiout.dac_nids = spec->private_dac_nids;
8988 spec->multiout.dac_nids[0] = 2;
8990 nid = cfg->line_out_pins[0];
8992 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8993 "Front Playback Volume",
8994 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8997 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8998 "Front Playback Switch",
8999 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9004 nid = cfg->speaker_pins[0];
9007 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9008 "Speaker Playback Volume",
9009 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9013 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9014 "Speaker Playback Switch",
9015 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9020 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9021 "Speaker Playback Switch",
9022 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9028 nid = cfg->hp_pins[0];
9030 /* spec->multiout.hp_nid = 2; */
9032 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9033 "Headphone Playback Volume",
9034 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9038 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9039 "Headphone Playback Switch",
9040 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9045 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9046 "Headphone Playback Switch",
9047 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9056 /* identical with ALC880 */
9057 #define alc262_auto_create_analog_input_ctls \
9058 alc880_auto_create_analog_input_ctls
9061 * generic initialization of ADC, input mixers and output mixers
9063 static struct hda_verb alc262_volume_init_verbs[] = {
9065 * Unmute ADC0-2 and set the default input to mic-in
9067 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9069 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9071 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9074 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9076 * Note: PASD motherboards uses the Line In 2 as the input for
9077 * front panel mic (mic 2)
9079 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9087 * Set up output mixers (0x0c - 0x0f)
9089 /* set vol=0 to output mixers */
9090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9091 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9092 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9094 /* set up input amps for analog loopback */
9095 /* Amp Indices: DAC = 0, mixer = 1 */
9096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9098 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9099 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9101 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9103 /* FIXME: use matrix-type input source selection */
9104 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9105 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9124 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
9126 * Unmute ADC0-2 and set the default input to mic-in
9128 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9130 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9131 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9132 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9135 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9137 * Note: PASD motherboards uses the Line In 2 as the input for
9138 * front panel mic (mic 2)
9140 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9150 * Set up output mixers (0x0c - 0x0e)
9152 /* set vol=0 to output mixers */
9153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9157 /* set up input amps for analog loopback */
9158 /* Amp Indices: DAC = 0, mixer = 1 */
9159 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9161 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9162 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9163 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9173 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9174 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9179 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9180 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9182 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9183 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9186 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9187 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9190 /* FIXME: use matrix-type input source selection */
9191 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9192 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9208 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9213 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
9215 * Unmute ADC0-2 and set the default input to mic-in
9217 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9224 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9226 * Note: PASD motherboards uses the Line In 2 as the input for front
9229 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
9236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
9237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
9239 * Set up output mixers (0x0c - 0x0e)
9241 /* set vol=0 to output mixers */
9242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9246 /* set up input amps for analog loopback */
9247 /* Amp Indices: DAC = 0, mixer = 1 */
9248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
9257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
9258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
9259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
9260 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
9261 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
9262 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
9264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9267 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9268 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9270 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9272 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9273 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
9274 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9275 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
9277 /* FIXME: use matrix-type input source selection */
9278 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9279 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
9282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
9283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
9284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
9285 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
9288 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9289 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9293 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
9301 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
9304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9309 #ifdef CONFIG_SND_HDA_POWER_SAVE
9310 #define alc262_loopbacks alc880_loopbacks
9313 /* pcm configuration: identiacal with ALC880 */
9314 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9315 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9316 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9317 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9320 * BIOS auto configuration
9322 static int alc262_parse_auto_config(struct hda_codec *codec)
9324 struct alc_spec *spec = codec->spec;
9326 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
9328 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9332 if (!spec->autocfg.line_outs)
9333 return 0; /* can't find valid BIOS pin config */
9334 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
9337 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
9341 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9343 if (spec->autocfg.dig_out_pin)
9344 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
9345 if (spec->autocfg.dig_in_pin)
9346 spec->dig_in_nid = ALC262_DIGIN_NID;
9348 if (spec->kctl_alloc)
9349 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9351 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
9352 spec->num_mux_defs = 1;
9353 spec->input_mux = &spec->private_imux;
9355 err = alc_auto_add_mic_boost(codec);
9362 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9363 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9364 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9367 /* init callback for auto-configuration model -- overriding the default init */
9368 static void alc262_auto_init(struct hda_codec *codec)
9370 struct alc_spec *spec = codec->spec;
9371 alc262_auto_init_multi_out(codec);
9372 alc262_auto_init_hp_out(codec);
9373 alc262_auto_init_analog_input(codec);
9374 if (spec->unsol_event)
9375 alc_sku_automute(codec);
9379 * configuration and preset
9381 static const char *alc262_models[ALC262_MODEL_LAST] = {
9382 [ALC262_BASIC] = "basic",
9383 [ALC262_HIPPO] = "hippo",
9384 [ALC262_HIPPO_1] = "hippo_1",
9385 [ALC262_FUJITSU] = "fujitsu",
9386 [ALC262_HP_BPC] = "hp-bpc",
9387 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
9388 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
9389 [ALC262_HP_RP5700] = "hp-rp5700",
9390 [ALC262_BENQ_ED8] = "benq",
9391 [ALC262_BENQ_T31] = "benq-t31",
9392 [ALC262_SONY_ASSAMD] = "sony-assamd",
9393 [ALC262_ULTRA] = "ultra",
9394 [ALC262_LENOVO_3000] = "lenovo-3000",
9395 [ALC262_AUTO] = "auto",
9398 static struct snd_pci_quirk alc262_cfg_tbl[] = {
9399 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
9400 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
9401 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
9402 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
9403 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
9404 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
9405 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
9406 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
9407 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
9408 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
9409 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
9410 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
9411 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
9412 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
9413 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
9414 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
9415 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
9416 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
9417 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
9418 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
9419 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9420 ALC262_HP_TC_T5735),
9421 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
9422 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9423 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
9424 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9425 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
9426 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
9427 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
9428 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
9429 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
9430 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
9431 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
9432 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
9433 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
9434 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
9438 static struct alc_config_preset alc262_presets[] = {
9440 .mixers = { alc262_base_mixer },
9441 .init_verbs = { alc262_init_verbs },
9442 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9443 .dac_nids = alc262_dac_nids,
9445 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9446 .channel_mode = alc262_modes,
9447 .input_mux = &alc262_capture_source,
9450 .mixers = { alc262_base_mixer },
9451 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
9452 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9453 .dac_nids = alc262_dac_nids,
9455 .dig_out_nid = ALC262_DIGOUT_NID,
9456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9457 .channel_mode = alc262_modes,
9458 .input_mux = &alc262_capture_source,
9459 .unsol_event = alc262_hippo_unsol_event,
9460 .init_hook = alc262_hippo_automute,
9462 [ALC262_HIPPO_1] = {
9463 .mixers = { alc262_hippo1_mixer },
9464 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
9465 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9466 .dac_nids = alc262_dac_nids,
9468 .dig_out_nid = ALC262_DIGOUT_NID,
9469 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9470 .channel_mode = alc262_modes,
9471 .input_mux = &alc262_capture_source,
9472 .unsol_event = alc262_hippo1_unsol_event,
9473 .init_hook = alc262_hippo1_automute,
9475 [ALC262_FUJITSU] = {
9476 .mixers = { alc262_fujitsu_mixer },
9477 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9478 alc262_fujitsu_unsol_verbs },
9479 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9480 .dac_nids = alc262_dac_nids,
9482 .dig_out_nid = ALC262_DIGOUT_NID,
9483 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9484 .channel_mode = alc262_modes,
9485 .input_mux = &alc262_fujitsu_capture_source,
9486 .unsol_event = alc262_fujitsu_unsol_event,
9489 .mixers = { alc262_HP_BPC_mixer },
9490 .init_verbs = { alc262_HP_BPC_init_verbs },
9491 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9492 .dac_nids = alc262_dac_nids,
9494 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9495 .channel_mode = alc262_modes,
9496 .input_mux = &alc262_HP_capture_source,
9497 .unsol_event = alc262_hp_bpc_unsol_event,
9498 .init_hook = alc262_hp_bpc_automute,
9500 [ALC262_HP_BPC_D7000_WF] = {
9501 .mixers = { alc262_HP_BPC_WildWest_mixer },
9502 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9503 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9504 .dac_nids = alc262_dac_nids,
9506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9507 .channel_mode = alc262_modes,
9508 .input_mux = &alc262_HP_D7000_capture_source,
9509 .unsol_event = alc262_hp_wildwest_unsol_event,
9510 .init_hook = alc262_hp_wildwest_automute,
9512 [ALC262_HP_BPC_D7000_WL] = {
9513 .mixers = { alc262_HP_BPC_WildWest_mixer,
9514 alc262_HP_BPC_WildWest_option_mixer },
9515 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
9516 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9517 .dac_nids = alc262_dac_nids,
9519 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9520 .channel_mode = alc262_modes,
9521 .input_mux = &alc262_HP_D7000_capture_source,
9522 .unsol_event = alc262_hp_wildwest_unsol_event,
9523 .init_hook = alc262_hp_wildwest_automute,
9525 [ALC262_HP_TC_T5735] = {
9526 .mixers = { alc262_hp_t5735_mixer },
9527 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
9528 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9529 .dac_nids = alc262_dac_nids,
9531 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9532 .channel_mode = alc262_modes,
9533 .input_mux = &alc262_capture_source,
9534 .unsol_event = alc262_hp_t5735_unsol_event,
9535 .init_hook = alc262_hp_t5735_init_hook,
9537 [ALC262_HP_RP5700] = {
9538 .mixers = { alc262_hp_rp5700_mixer },
9539 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
9540 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9541 .dac_nids = alc262_dac_nids,
9542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9543 .channel_mode = alc262_modes,
9544 .input_mux = &alc262_hp_rp5700_capture_source,
9546 [ALC262_BENQ_ED8] = {
9547 .mixers = { alc262_base_mixer },
9548 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
9549 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9550 .dac_nids = alc262_dac_nids,
9552 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9553 .channel_mode = alc262_modes,
9554 .input_mux = &alc262_capture_source,
9556 [ALC262_SONY_ASSAMD] = {
9557 .mixers = { alc262_sony_mixer },
9558 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
9559 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9560 .dac_nids = alc262_dac_nids,
9562 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9563 .channel_mode = alc262_modes,
9564 .input_mux = &alc262_capture_source,
9565 .unsol_event = alc262_hippo_unsol_event,
9566 .init_hook = alc262_hippo_automute,
9568 [ALC262_BENQ_T31] = {
9569 .mixers = { alc262_benq_t31_mixer },
9570 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
9571 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9572 .dac_nids = alc262_dac_nids,
9574 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9575 .channel_mode = alc262_modes,
9576 .input_mux = &alc262_capture_source,
9577 .unsol_event = alc262_hippo_unsol_event,
9578 .init_hook = alc262_hippo_automute,
9581 .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
9582 .init_verbs = { alc262_ultra_verbs },
9583 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9584 .dac_nids = alc262_dac_nids,
9585 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9586 .channel_mode = alc262_modes,
9587 .input_mux = &alc262_ultra_capture_source,
9588 .adc_nids = alc262_adc_nids, /* ADC0 */
9589 .capsrc_nids = alc262_capsrc_nids,
9590 .num_adc_nids = 1, /* single ADC */
9591 .unsol_event = alc262_ultra_unsol_event,
9592 .init_hook = alc262_ultra_automute,
9594 [ALC262_LENOVO_3000] = {
9595 .mixers = { alc262_lenovo_3000_mixer },
9596 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
9597 alc262_lenovo_3000_unsol_verbs },
9598 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
9599 .dac_nids = alc262_dac_nids,
9601 .dig_out_nid = ALC262_DIGOUT_NID,
9602 .num_channel_mode = ARRAY_SIZE(alc262_modes),
9603 .channel_mode = alc262_modes,
9604 .input_mux = &alc262_fujitsu_capture_source,
9605 .unsol_event = alc262_lenovo_3000_unsol_event,
9609 static int patch_alc262(struct hda_codec *codec)
9611 struct alc_spec *spec;
9615 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9621 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9626 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9627 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9628 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9629 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9633 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9637 if (board_config < 0) {
9638 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9639 "trying auto-probe from BIOS...\n");
9640 board_config = ALC262_AUTO;
9643 if (board_config == ALC262_AUTO) {
9644 /* automatic parse from the BIOS config */
9645 err = alc262_parse_auto_config(codec);
9651 "hda_codec: Cannot set up configuration "
9652 "from BIOS. Using base mode...\n");
9653 board_config = ALC262_BASIC;
9657 if (board_config != ALC262_AUTO)
9658 setup_preset(spec, &alc262_presets[board_config]);
9660 spec->stream_name_analog = "ALC262 Analog";
9661 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9662 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9664 spec->stream_name_digital = "ALC262 Digital";
9665 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9666 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9668 if (!spec->adc_nids && spec->input_mux) {
9669 /* check whether NID 0x07 is valid */
9670 unsigned int wcap = get_wcaps(codec, 0x07);
9673 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9674 if (wcap != AC_WID_AUD_IN) {
9675 spec->adc_nids = alc262_adc_nids_alt;
9676 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9677 spec->capsrc_nids = alc262_capsrc_nids_alt;
9678 spec->mixers[spec->num_mixers] =
9679 alc262_capture_alt_mixer;
9682 spec->adc_nids = alc262_adc_nids;
9683 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9684 spec->capsrc_nids = alc262_capsrc_nids;
9685 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9690 spec->vmaster_nid = 0x0c;
9692 codec->patch_ops = alc_patch_ops;
9693 if (board_config == ALC262_AUTO)
9694 spec->init_hook = alc262_auto_init;
9695 #ifdef CONFIG_SND_HDA_POWER_SAVE
9696 if (!spec->loopback.amplist)
9697 spec->loopback.amplist = alc262_loopbacks;
9704 * ALC268 channel source setting (2 channel)
9706 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9707 #define alc268_modes alc260_modes
9709 static hda_nid_t alc268_dac_nids[2] = {
9714 static hda_nid_t alc268_adc_nids[2] = {
9719 static hda_nid_t alc268_adc_nids_alt[1] = {
9724 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
9726 static struct snd_kcontrol_new alc268_base_mixer[] = {
9727 /* output mixer control */
9728 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9729 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9732 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9733 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9734 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9738 /* bind Beep switches of both NID 0x0f and 0x10 */
9739 static struct hda_bind_ctls alc268_bind_beep_sw = {
9740 .ops = &snd_hda_bind_sw,
9742 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9743 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9748 static struct snd_kcontrol_new alc268_beep_mixer[] = {
9749 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9750 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9754 static struct hda_verb alc268_eapd_verbs[] = {
9755 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9756 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9760 /* Toshiba specific */
9761 #define alc268_toshiba_automute alc262_hippo_automute
9763 static struct hda_verb alc268_toshiba_verbs[] = {
9764 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9769 /* bind volumes of both NID 0x02 and 0x03 */
9770 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9771 .ops = &snd_hda_bind_vol,
9773 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9774 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9779 /* mute/unmute internal speaker according to the hp jack and mute state */
9780 static void alc268_acer_automute(struct hda_codec *codec, int force)
9782 struct alc_spec *spec = codec->spec;
9785 if (force || !spec->sense_updated) {
9786 unsigned int present;
9787 present = snd_hda_codec_read(codec, 0x14, 0,
9788 AC_VERB_GET_PIN_SENSE, 0);
9789 spec->jack_present = (present & 0x80000000) != 0;
9790 spec->sense_updated = 1;
9792 if (spec->jack_present)
9793 mute = HDA_AMP_MUTE; /* mute internal speaker */
9794 else /* unmute internal speaker if necessary */
9795 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9796 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9797 HDA_AMP_MUTE, mute);
9801 /* bind hp and internal speaker mute (with plug check) */
9802 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9803 struct snd_ctl_elem_value *ucontrol)
9805 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9806 long *valp = ucontrol->value.integer.value;
9809 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9811 valp[0] ? 0 : HDA_AMP_MUTE);
9812 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9814 valp[1] ? 0 : HDA_AMP_MUTE);
9816 alc268_acer_automute(codec, 0);
9820 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9821 /* output mixer control */
9822 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9825 .name = "Master Playback Switch",
9826 .info = snd_hda_mixer_amp_switch_info,
9827 .get = snd_hda_mixer_amp_switch_get,
9828 .put = alc268_acer_master_sw_put,
9829 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9831 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9832 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9833 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9837 static struct hda_verb alc268_acer_verbs[] = {
9838 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
9839 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9841 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9842 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9845 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9849 /* unsolicited event for HP jack sensing */
9850 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9853 if ((res >> 26) != ALC880_HP_EVENT)
9855 alc268_toshiba_automute(codec);
9858 static void alc268_acer_unsol_event(struct hda_codec *codec,
9861 if ((res >> 26) != ALC880_HP_EVENT)
9863 alc268_acer_automute(codec, 1);
9866 static void alc268_acer_init_hook(struct hda_codec *codec)
9868 alc268_acer_automute(codec, 1);
9871 static struct snd_kcontrol_new alc268_dell_mixer[] = {
9872 /* output mixer control */
9873 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9874 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9875 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9876 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9878 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9882 static struct hda_verb alc268_dell_verbs[] = {
9883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9885 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9889 /* mute/unmute internal speaker according to the hp jack and mute state */
9890 static void alc268_dell_automute(struct hda_codec *codec)
9892 unsigned int present;
9895 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
9896 if (present & 0x80000000)
9897 mute = HDA_AMP_MUTE;
9899 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9900 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9901 HDA_AMP_MUTE, mute);
9904 static void alc268_dell_unsol_event(struct hda_codec *codec,
9907 if ((res >> 26) != ALC880_HP_EVENT)
9909 alc268_dell_automute(codec);
9912 #define alc268_dell_init_hook alc268_dell_automute
9914 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
9915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9916 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9919 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9920 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
9921 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
9922 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
9926 static struct hda_verb alc267_quanta_il1_verbs[] = {
9927 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9928 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9932 static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
9934 unsigned int present;
9936 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
9937 & AC_PINSENSE_PRESENCE;
9938 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9939 present ? 0 : PIN_OUT);
9942 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
9944 unsigned int present;
9946 present = snd_hda_codec_read(codec, 0x18, 0,
9947 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9948 snd_hda_codec_write(codec, 0x23, 0,
9949 AC_VERB_SET_CONNECT_SEL,
9950 present ? 0x00 : 0x01);
9953 static void alc267_quanta_il1_automute(struct hda_codec *codec)
9955 alc267_quanta_il1_hp_automute(codec);
9956 alc267_quanta_il1_mic_automute(codec);
9959 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
9962 switch (res >> 26) {
9963 case ALC880_HP_EVENT:
9964 alc267_quanta_il1_hp_automute(codec);
9966 case ALC880_MIC_EVENT:
9967 alc267_quanta_il1_mic_automute(codec);
9973 * generic initialization of ADC, input mixers and output mixers
9975 static struct hda_verb alc268_base_init_verbs[] = {
9976 /* Unmute DAC0-1 and set vol = 0 */
9977 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9978 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9979 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9980 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9981 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9982 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9985 * Set up output mixers (0x0c - 0x0e)
9987 /* set vol=0 to output mixers */
9988 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9989 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9991 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9993 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9994 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9999 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10002 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10003 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10005 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10007 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10011 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10013 /* set PCBEEP vol = 0, mute connections */
10014 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10016 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10018 /* Unmute Selector 23h,24h and set the default input to mic-in */
10020 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
10021 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10022 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
10023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10029 * generic initialization of ADC, input mixers and output mixers
10031 static struct hda_verb alc268_volume_init_verbs[] = {
10032 /* set output DAC */
10033 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10034 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10035 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10036 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10039 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10040 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10041 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10042 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10044 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10047 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10048 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10050 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10051 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10053 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10055 /* set PCBEEP vol = 0, mute connections */
10056 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10058 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10063 #define alc268_mux_enum_info alc_mux_enum_info
10064 #define alc268_mux_enum_get alc_mux_enum_get
10065 #define alc268_mux_enum_put alc_mux_enum_put
10067 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
10068 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10069 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10071 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10072 /* The multiple "Capture Source" controls confuse alsamixer
10073 * So call somewhat different..
10075 /* .name = "Capture Source", */
10076 .name = "Input Source",
10078 .info = alc268_mux_enum_info,
10079 .get = alc268_mux_enum_get,
10080 .put = alc268_mux_enum_put,
10085 static struct snd_kcontrol_new alc268_capture_mixer[] = {
10086 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10087 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
10088 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
10089 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
10091 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10092 /* The multiple "Capture Source" controls confuse alsamixer
10093 * So call somewhat different..
10095 /* .name = "Capture Source", */
10096 .name = "Input Source",
10098 .info = alc268_mux_enum_info,
10099 .get = alc268_mux_enum_get,
10100 .put = alc268_mux_enum_put,
10105 static struct hda_input_mux alc268_capture_source = {
10109 { "Front Mic", 0x1 },
10115 static struct hda_input_mux alc268_acer_capture_source = {
10119 { "Internal Mic", 0x6 },
10124 #ifdef CONFIG_SND_DEBUG
10125 static struct snd_kcontrol_new alc268_test_mixer[] = {
10126 /* Volume widgets */
10127 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10128 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10129 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10130 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
10131 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
10132 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
10133 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
10134 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
10135 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
10136 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
10137 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
10138 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
10139 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
10140 /* The below appears problematic on some hardwares */
10141 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10142 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
10143 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
10144 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
10145 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
10147 /* Modes for retasking pin widgets */
10148 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
10149 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
10150 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
10151 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
10153 /* Controls for GPIO pins, assuming they are configured as outputs */
10154 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10155 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10156 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10157 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10159 /* Switches to allow the digital SPDIF output pin to be enabled.
10160 * The ALC268 does not have an SPDIF input.
10162 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10164 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10165 * this output to turn on an external amplifier.
10167 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10168 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10174 /* create input playback/capture controls for the given pin */
10175 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
10176 const char *ctlname, int idx)
10181 sprintf(name, "%s Playback Volume", ctlname);
10183 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10184 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
10188 } else if (nid == 0x15) {
10189 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10190 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
10196 sprintf(name, "%s Playback Switch", ctlname);
10197 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10198 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
10204 /* add playback controls from the parsed DAC table */
10205 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
10206 const struct auto_pin_cfg *cfg)
10211 spec->multiout.num_dacs = 2; /* only use one dac */
10212 spec->multiout.dac_nids = spec->private_dac_nids;
10213 spec->multiout.dac_nids[0] = 2;
10214 spec->multiout.dac_nids[1] = 3;
10216 nid = cfg->line_out_pins[0];
10218 alc268_new_analog_output(spec, nid, "Front", 0);
10220 nid = cfg->speaker_pins[0];
10222 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10223 "Speaker Playback Volume",
10224 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10228 nid = cfg->hp_pins[0];
10230 alc268_new_analog_output(spec, nid, "Headphone", 0);
10232 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
10234 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10235 "Mono Playback Switch",
10236 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
10243 /* create playback/capture controls for input pins */
10244 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
10245 const struct auto_pin_cfg *cfg)
10247 struct hda_input_mux *imux = &spec->private_imux;
10250 for (i = 0; i < AUTO_PIN_LAST; i++) {
10251 switch(cfg->input_pins[i]) {
10253 idx1 = 0; /* Mic 1 */
10256 idx1 = 1; /* Mic 2 */
10259 idx1 = 2; /* Line In */
10266 idx1 = 6; /* digital mics */
10271 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10272 imux->items[imux->num_items].index = idx1;
10278 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
10280 struct alc_spec *spec = codec->spec;
10281 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10282 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10283 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10284 unsigned int dac_vol1, dac_vol2;
10287 snd_hda_codec_write(codec, speaker_nid, 0,
10288 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
10289 snd_hda_codec_write(codec, 0x0f, 0,
10290 AC_VERB_SET_AMP_GAIN_MUTE,
10292 snd_hda_codec_write(codec, 0x10, 0,
10293 AC_VERB_SET_AMP_GAIN_MUTE,
10296 snd_hda_codec_write(codec, 0x0f, 0,
10297 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10298 snd_hda_codec_write(codec, 0x10, 0,
10299 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
10302 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
10303 if (line_nid == 0x14)
10304 dac_vol2 = AMP_OUT_ZERO;
10305 else if (line_nid == 0x15)
10306 dac_vol1 = AMP_OUT_ZERO;
10307 if (hp_nid == 0x14)
10308 dac_vol2 = AMP_OUT_ZERO;
10309 else if (hp_nid == 0x15)
10310 dac_vol1 = AMP_OUT_ZERO;
10311 if (line_nid != 0x16 || hp_nid != 0x16 ||
10312 spec->autocfg.line_out_pins[1] != 0x16 ||
10313 spec->autocfg.line_out_pins[2] != 0x16)
10314 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
10316 snd_hda_codec_write(codec, 0x02, 0,
10317 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
10318 snd_hda_codec_write(codec, 0x03, 0,
10319 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
10322 /* pcm configuration: identiacal with ALC880 */
10323 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10324 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10325 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10326 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10329 * BIOS auto configuration
10331 static int alc268_parse_auto_config(struct hda_codec *codec)
10333 struct alc_spec *spec = codec->spec;
10335 static hda_nid_t alc268_ignore[] = { 0 };
10337 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10341 if (!spec->autocfg.line_outs)
10342 return 0; /* can't find valid BIOS pin config */
10344 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
10347 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
10351 spec->multiout.max_channels = 2;
10353 /* digital only support output */
10354 if (spec->autocfg.dig_out_pin)
10355 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
10357 if (spec->kctl_alloc)
10358 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10360 if (spec->autocfg.speaker_pins[0] != 0x1d)
10361 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10363 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10364 spec->num_mux_defs = 1;
10365 spec->input_mux = &spec->private_imux;
10367 err = alc_auto_add_mic_boost(codec);
10374 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10375 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10376 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10378 /* init callback for auto-configuration model -- overriding the default init */
10379 static void alc268_auto_init(struct hda_codec *codec)
10381 struct alc_spec *spec = codec->spec;
10382 alc268_auto_init_multi_out(codec);
10383 alc268_auto_init_hp_out(codec);
10384 alc268_auto_init_mono_speaker_out(codec);
10385 alc268_auto_init_analog_input(codec);
10386 if (spec->unsol_event)
10387 alc_sku_automute(codec);
10391 * configuration and preset
10393 static const char *alc268_models[ALC268_MODEL_LAST] = {
10394 [ALC267_QUANTA_IL1] = "quanta-il1",
10395 [ALC268_3ST] = "3stack",
10396 [ALC268_TOSHIBA] = "toshiba",
10397 [ALC268_ACER] = "acer",
10398 [ALC268_DELL] = "dell",
10399 [ALC268_ZEPTO] = "zepto",
10400 #ifdef CONFIG_SND_DEBUG
10401 [ALC268_TEST] = "test",
10403 [ALC268_AUTO] = "auto",
10406 static struct snd_pci_quirk alc268_cfg_tbl[] = {
10407 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
10408 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
10409 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
10410 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
10411 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
10412 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
10413 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
10414 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
10415 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
10416 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
10417 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
10418 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
10419 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
10423 static struct alc_config_preset alc268_presets[] = {
10424 [ALC267_QUANTA_IL1] = {
10425 .mixers = { alc267_quanta_il1_mixer },
10426 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10427 alc267_quanta_il1_verbs },
10428 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10429 .dac_nids = alc268_dac_nids,
10430 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10431 .adc_nids = alc268_adc_nids_alt,
10433 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10434 .channel_mode = alc268_modes,
10435 .input_mux = &alc268_capture_source,
10436 .unsol_event = alc267_quanta_il1_unsol_event,
10437 .init_hook = alc267_quanta_il1_automute,
10440 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10441 alc268_beep_mixer },
10442 .init_verbs = { alc268_base_init_verbs },
10443 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10444 .dac_nids = alc268_dac_nids,
10445 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10446 .adc_nids = alc268_adc_nids_alt,
10447 .capsrc_nids = alc268_capsrc_nids,
10449 .dig_out_nid = ALC268_DIGOUT_NID,
10450 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10451 .channel_mode = alc268_modes,
10452 .input_mux = &alc268_capture_source,
10454 [ALC268_TOSHIBA] = {
10455 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10456 alc268_beep_mixer },
10457 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10458 alc268_toshiba_verbs },
10459 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10460 .dac_nids = alc268_dac_nids,
10461 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10462 .adc_nids = alc268_adc_nids_alt,
10463 .capsrc_nids = alc268_capsrc_nids,
10465 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10466 .channel_mode = alc268_modes,
10467 .input_mux = &alc268_capture_source,
10468 .unsol_event = alc268_toshiba_unsol_event,
10469 .init_hook = alc268_toshiba_automute,
10472 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10473 alc268_beep_mixer },
10474 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10475 alc268_acer_verbs },
10476 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10477 .dac_nids = alc268_dac_nids,
10478 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10479 .adc_nids = alc268_adc_nids_alt,
10480 .capsrc_nids = alc268_capsrc_nids,
10482 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10483 .channel_mode = alc268_modes,
10484 .input_mux = &alc268_acer_capture_source,
10485 .unsol_event = alc268_acer_unsol_event,
10486 .init_hook = alc268_acer_init_hook,
10489 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10490 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10491 alc268_dell_verbs },
10492 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10493 .dac_nids = alc268_dac_nids,
10495 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10496 .channel_mode = alc268_modes,
10497 .unsol_event = alc268_dell_unsol_event,
10498 .init_hook = alc268_dell_init_hook,
10499 .input_mux = &alc268_capture_source,
10502 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10503 alc268_beep_mixer },
10504 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10505 alc268_toshiba_verbs },
10506 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10507 .dac_nids = alc268_dac_nids,
10508 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10509 .adc_nids = alc268_adc_nids_alt,
10510 .capsrc_nids = alc268_capsrc_nids,
10512 .dig_out_nid = ALC268_DIGOUT_NID,
10513 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10514 .channel_mode = alc268_modes,
10515 .input_mux = &alc268_capture_source,
10516 .unsol_event = alc268_toshiba_unsol_event,
10517 .init_hook = alc268_toshiba_automute
10519 #ifdef CONFIG_SND_DEBUG
10521 .mixers = { alc268_test_mixer, alc268_capture_mixer },
10522 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10523 alc268_volume_init_verbs },
10524 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10525 .dac_nids = alc268_dac_nids,
10526 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
10527 .adc_nids = alc268_adc_nids_alt,
10528 .capsrc_nids = alc268_capsrc_nids,
10530 .dig_out_nid = ALC268_DIGOUT_NID,
10531 .num_channel_mode = ARRAY_SIZE(alc268_modes),
10532 .channel_mode = alc268_modes,
10533 .input_mux = &alc268_capture_source,
10538 static int patch_alc268(struct hda_codec *codec)
10540 struct alc_spec *spec;
10544 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
10548 codec->spec = spec;
10550 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
10554 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
10555 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
10556 "trying auto-probe from BIOS...\n");
10557 board_config = ALC268_AUTO;
10560 if (board_config == ALC268_AUTO) {
10561 /* automatic parse from the BIOS config */
10562 err = alc268_parse_auto_config(codec);
10568 "hda_codec: Cannot set up configuration "
10569 "from BIOS. Using base mode...\n");
10570 board_config = ALC268_3ST;
10574 if (board_config != ALC268_AUTO)
10575 setup_preset(spec, &alc268_presets[board_config]);
10577 spec->stream_name_analog = "ALC268 Analog";
10578 spec->stream_analog_playback = &alc268_pcm_analog_playback;
10579 spec->stream_analog_capture = &alc268_pcm_analog_capture;
10580 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
10582 spec->stream_name_digital = "ALC268 Digital";
10583 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10585 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10586 /* override the amp caps for beep generator */
10587 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10588 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10589 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10590 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10591 (0 << AC_AMPCAP_MUTE_SHIFT));
10593 if (!spec->adc_nids && spec->input_mux) {
10594 /* check whether NID 0x07 is valid */
10595 unsigned int wcap = get_wcaps(codec, 0x07);
10599 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
10600 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
10601 spec->adc_nids = alc268_adc_nids_alt;
10602 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
10603 spec->mixers[spec->num_mixers] =
10604 alc268_capture_alt_mixer;
10605 spec->num_mixers++;
10607 spec->adc_nids = alc268_adc_nids;
10608 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
10609 spec->mixers[spec->num_mixers] =
10610 alc268_capture_mixer;
10611 spec->num_mixers++;
10613 spec->capsrc_nids = alc268_capsrc_nids;
10614 /* set default input source */
10615 for (i = 0; i < spec->num_adc_nids; i++)
10616 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
10617 0, AC_VERB_SET_CONNECT_SEL,
10618 spec->input_mux->items[0].index);
10621 spec->vmaster_nid = 0x02;
10623 codec->patch_ops = alc_patch_ops;
10624 if (board_config == ALC268_AUTO)
10625 spec->init_hook = alc268_auto_init;
10631 * ALC269 channel source setting (2 channel)
10633 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10635 #define alc269_dac_nids alc260_dac_nids
10637 static hda_nid_t alc269_adc_nids[1] = {
10642 #define alc269_modes alc260_modes
10643 #define alc269_capture_source alc880_lg_lw_capture_source
10645 static struct snd_kcontrol_new alc269_base_mixer[] = {
10646 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10647 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10655 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10657 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10661 /* capture mixer elements */
10662 static struct snd_kcontrol_new alc269_capture_mixer[] = {
10663 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10664 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10667 /* The multiple "Capture Source" controls confuse alsamixer
10668 * So call somewhat different..
10670 /* .name = "Capture Source", */
10671 .name = "Input Source",
10673 .info = alc_mux_enum_info,
10674 .get = alc_mux_enum_get,
10675 .put = alc_mux_enum_put,
10681 * generic initialization of ADC, input mixers and output mixers
10683 static struct hda_verb alc269_init_verbs[] = {
10685 * Unmute ADC0 and set the default input to mic-in
10687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10689 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10690 * analog-loopback mixer widget
10691 * Note: PASD motherboards uses the Line In 2 as the input for
10692 * front panel mic (mic 2)
10694 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10702 * Set up output mixers (0x0c - 0x0e)
10704 /* set vol=0 to output mixers */
10705 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10706 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10708 /* set up input amps for analog loopback */
10709 /* Amp Indices: DAC = 0, mixer = 1 */
10710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10719 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10721 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10723 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10727 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10730 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10731 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10733 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10736 /* FIXME: use matrix-type input source selection */
10737 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10738 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10745 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10746 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10750 /* add playback controls from the parsed DAC table */
10751 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
10752 const struct auto_pin_cfg *cfg)
10757 spec->multiout.num_dacs = 1; /* only use one dac */
10758 spec->multiout.dac_nids = spec->private_dac_nids;
10759 spec->multiout.dac_nids[0] = 2;
10761 nid = cfg->line_out_pins[0];
10763 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10764 "Front Playback Volume",
10765 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
10768 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10769 "Front Playback Switch",
10770 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10775 nid = cfg->speaker_pins[0];
10777 if (!cfg->line_out_pins[0]) {
10778 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10779 "Speaker Playback Volume",
10780 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10786 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10787 "Speaker Playback Switch",
10788 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10793 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10794 "Speaker Playback Switch",
10795 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10801 nid = cfg->hp_pins[0];
10803 /* spec->multiout.hp_nid = 2; */
10804 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
10805 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10806 "Headphone Playback Volume",
10807 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10813 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10814 "Headphone Playback Switch",
10815 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10820 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10821 "Headphone Playback Switch",
10822 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10831 #define alc269_auto_create_analog_input_ctls \
10832 alc880_auto_create_analog_input_ctls
10834 #ifdef CONFIG_SND_HDA_POWER_SAVE
10835 #define alc269_loopbacks alc880_loopbacks
10838 /* pcm configuration: identiacal with ALC880 */
10839 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10840 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10841 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10842 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10845 * BIOS auto configuration
10847 static int alc269_parse_auto_config(struct hda_codec *codec)
10849 struct alc_spec *spec = codec->spec;
10851 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10853 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10858 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10861 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10865 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10867 if (spec->autocfg.dig_out_pin)
10868 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10870 if (spec->kctl_alloc)
10871 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10873 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10874 spec->num_mux_defs = 1;
10875 spec->input_mux = &spec->private_imux;
10877 err = alc_auto_add_mic_boost(codec);
10884 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10885 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10886 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10889 /* init callback for auto-configuration model -- overriding the default init */
10890 static void alc269_auto_init(struct hda_codec *codec)
10892 struct alc_spec *spec = codec->spec;
10893 alc269_auto_init_multi_out(codec);
10894 alc269_auto_init_hp_out(codec);
10895 alc269_auto_init_analog_input(codec);
10896 if (spec->unsol_event)
10897 alc_sku_automute(codec);
10901 * configuration and preset
10903 static const char *alc269_models[ALC269_MODEL_LAST] = {
10904 [ALC269_BASIC] = "basic",
10907 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10911 static struct alc_config_preset alc269_presets[] = {
10913 .mixers = { alc269_base_mixer },
10914 .init_verbs = { alc269_init_verbs },
10915 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10916 .dac_nids = alc269_dac_nids,
10918 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10919 .channel_mode = alc269_modes,
10920 .input_mux = &alc269_capture_source,
10924 static int patch_alc269(struct hda_codec *codec)
10926 struct alc_spec *spec;
10930 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10934 codec->spec = spec;
10936 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10940 if (board_config < 0) {
10941 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10942 "trying auto-probe from BIOS...\n");
10943 board_config = ALC269_AUTO;
10946 if (board_config == ALC269_AUTO) {
10947 /* automatic parse from the BIOS config */
10948 err = alc269_parse_auto_config(codec);
10954 "hda_codec: Cannot set up configuration "
10955 "from BIOS. Using base mode...\n");
10956 board_config = ALC269_BASIC;
10960 if (board_config != ALC269_AUTO)
10961 setup_preset(spec, &alc269_presets[board_config]);
10963 spec->stream_name_analog = "ALC269 Analog";
10964 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10965 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10967 spec->stream_name_digital = "ALC269 Digital";
10968 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10969 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10971 spec->adc_nids = alc269_adc_nids;
10972 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10973 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10974 spec->num_mixers++;
10976 codec->patch_ops = alc_patch_ops;
10977 if (board_config == ALC269_AUTO)
10978 spec->init_hook = alc269_auto_init;
10979 #ifdef CONFIG_SND_HDA_POWER_SAVE
10980 if (!spec->loopback.amplist)
10981 spec->loopback.amplist = alc269_loopbacks;
10988 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10992 * set the path ways for 2 channel output
10993 * need to set the codec line out and mic 1 pin widgets to inputs
10995 static struct hda_verb alc861_threestack_ch2_init[] = {
10996 /* set pin widget 1Ah (line in) for input */
10997 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10998 /* set pin widget 18h (mic1/2) for input, for mic also enable
11001 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11003 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11005 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11006 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11012 * need to set the codec line out and mic 1 pin widgets to outputs
11014 static struct hda_verb alc861_threestack_ch6_init[] = {
11015 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11016 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11017 /* set pin widget 18h (mic1) for output (CLFE)*/
11018 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11020 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11021 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11023 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11025 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11026 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11031 static struct hda_channel_mode alc861_threestack_modes[2] = {
11032 { 2, alc861_threestack_ch2_init },
11033 { 6, alc861_threestack_ch6_init },
11035 /* Set mic1 as input and unmute the mixer */
11036 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
11037 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11038 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11041 /* Set mic1 as output and mute mixer */
11042 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
11043 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11044 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11048 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
11049 { 2, alc861_uniwill_m31_ch2_init },
11050 { 4, alc861_uniwill_m31_ch4_init },
11053 /* Set mic1 and line-in as input and unmute the mixer */
11054 static struct hda_verb alc861_asus_ch2_init[] = {
11055 /* set pin widget 1Ah (line in) for input */
11056 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11057 /* set pin widget 18h (mic1/2) for input, for mic also enable
11060 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11062 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
11064 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
11065 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
11069 /* Set mic1 nad line-in as output and mute mixer */
11070 static struct hda_verb alc861_asus_ch6_init[] = {
11071 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11072 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11073 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11074 /* set pin widget 18h (mic1) for output (CLFE)*/
11075 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11076 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11077 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
11078 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
11080 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
11082 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
11083 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
11088 static struct hda_channel_mode alc861_asus_modes[2] = {
11089 { 2, alc861_asus_ch2_init },
11090 { 6, alc861_asus_ch6_init },
11095 static struct snd_kcontrol_new alc861_base_mixer[] = {
11096 /* output mixer control */
11097 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11098 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11099 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11100 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11103 /*Input mixer control */
11104 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11105 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11106 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11107 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11108 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11109 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11111 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11115 /* Capture mixer control */
11116 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11117 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11120 .name = "Capture Source",
11122 .info = alc_mux_enum_info,
11123 .get = alc_mux_enum_get,
11124 .put = alc_mux_enum_put,
11129 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
11130 /* output mixer control */
11131 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11132 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11133 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11134 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11135 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11137 /* Input mixer control */
11138 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11139 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11140 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11141 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11142 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11143 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11145 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11149 /* Capture mixer control */
11150 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11151 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11154 .name = "Capture Source",
11156 .info = alc_mux_enum_info,
11157 .get = alc_mux_enum_get,
11158 .put = alc_mux_enum_put,
11161 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11162 .name = "Channel Mode",
11163 .info = alc_ch_mode_info,
11164 .get = alc_ch_mode_get,
11165 .put = alc_ch_mode_put,
11166 .private_value = ARRAY_SIZE(alc861_threestack_modes),
11171 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
11172 /* output mixer control */
11173 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11175 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11177 /*Capture mixer control */
11178 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11179 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11181 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11182 .name = "Capture Source",
11184 .info = alc_mux_enum_info,
11185 .get = alc_mux_enum_get,
11186 .put = alc_mux_enum_put,
11192 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
11193 /* output mixer control */
11194 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11195 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11196 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11197 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11198 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11200 /* Input mixer control */
11201 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11202 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11203 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11204 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11205 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11206 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11208 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11209 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
11212 /* Capture mixer control */
11213 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11214 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11217 .name = "Capture Source",
11219 .info = alc_mux_enum_info,
11220 .get = alc_mux_enum_get,
11221 .put = alc_mux_enum_put,
11224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11225 .name = "Channel Mode",
11226 .info = alc_ch_mode_info,
11227 .get = alc_ch_mode_get,
11228 .put = alc_ch_mode_put,
11229 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
11234 static struct snd_kcontrol_new alc861_asus_mixer[] = {
11235 /* output mixer control */
11236 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11237 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
11238 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
11239 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
11240 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
11242 /* Input mixer control */
11243 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11244 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11245 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11246 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11247 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
11248 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
11249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
11250 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
11251 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
11252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
11254 /* Capture mixer control */
11255 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11256 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11259 .name = "Capture Source",
11261 .info = alc_mux_enum_info,
11262 .get = alc_mux_enum_get,
11263 .put = alc_mux_enum_put,
11266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11267 .name = "Channel Mode",
11268 .info = alc_ch_mode_info,
11269 .get = alc_ch_mode_get,
11270 .put = alc_ch_mode_put,
11271 .private_value = ARRAY_SIZE(alc861_asus_modes),
11276 /* additional mixer */
11277 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
11278 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
11279 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
11280 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
11281 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
11286 * generic initialization of ADC, input mixers and output mixers
11288 static struct hda_verb alc861_base_init_verbs[] = {
11290 * Unmute ADC0 and set the default input to mic-in
11292 /* port-A for surround (rear panel) */
11293 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11294 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
11295 /* port-B for mic-in (rear panel) with vref */
11296 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11297 /* port-C for line-in (rear panel) */
11298 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11299 /* port-D for Front */
11300 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11301 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11302 /* port-E for HP out (front panel) */
11303 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11304 /* route front PCM to HP */
11305 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11306 /* port-F for mic-in (front panel) with vref */
11307 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11308 /* port-G for CLFE (rear panel) */
11309 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11310 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11311 /* port-H for side (rear panel) */
11312 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11313 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
11315 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11316 /* route front mic to ADC1*/
11317 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11320 /* Unmute DAC0~3 & spdif out*/
11321 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11322 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11323 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11324 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11327 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11328 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11329 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11330 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11331 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11333 /* Unmute Stereo Mixer 15 */
11334 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11336 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11339 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11340 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11341 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11342 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11343 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11344 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11345 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11346 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11347 /* hp used DAC 3 (Front) */
11348 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11349 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11354 static struct hda_verb alc861_threestack_init_verbs[] = {
11356 * Unmute ADC0 and set the default input to mic-in
11358 /* port-A for surround (rear panel) */
11359 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11360 /* port-B for mic-in (rear panel) with vref */
11361 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11362 /* port-C for line-in (rear panel) */
11363 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11364 /* port-D for Front */
11365 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11366 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11367 /* port-E for HP out (front panel) */
11368 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
11369 /* route front PCM to HP */
11370 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11371 /* port-F for mic-in (front panel) with vref */
11372 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11373 /* port-G for CLFE (rear panel) */
11374 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11375 /* port-H for side (rear panel) */
11376 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11378 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11379 /* route front mic to ADC1*/
11380 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11382 /* Unmute DAC0~3 & spdif out*/
11383 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11384 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11385 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11386 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11389 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11390 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11391 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11392 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11393 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11395 /* Unmute Stereo Mixer 15 */
11396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11402 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11403 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11407 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11408 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11409 /* hp used DAC 3 (Front) */
11410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11411 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11415 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
11417 * Unmute ADC0 and set the default input to mic-in
11419 /* port-A for surround (rear panel) */
11420 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11421 /* port-B for mic-in (rear panel) with vref */
11422 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11423 /* port-C for line-in (rear panel) */
11424 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11425 /* port-D for Front */
11426 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11427 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11428 /* port-E for HP out (front panel) */
11429 /* this has to be set to VREF80 */
11430 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11431 /* route front PCM to HP */
11432 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11433 /* port-F for mic-in (front panel) with vref */
11434 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11435 /* port-G for CLFE (rear panel) */
11436 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11437 /* port-H for side (rear panel) */
11438 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11440 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11441 /* route front mic to ADC1*/
11442 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11444 /* Unmute DAC0~3 & spdif out*/
11445 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11446 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11447 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11448 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11449 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11451 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11452 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11453 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11454 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11455 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11457 /* Unmute Stereo Mixer 15 */
11458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11460 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11461 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11463 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11464 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11465 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11466 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11467 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11468 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11469 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11470 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11471 /* hp used DAC 3 (Front) */
11472 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11477 static struct hda_verb alc861_asus_init_verbs[] = {
11479 * Unmute ADC0 and set the default input to mic-in
11481 /* port-A for surround (rear panel)
11482 * according to codec#0 this is the HP jack
11484 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
11485 /* route front PCM to HP */
11486 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
11487 /* port-B for mic-in (rear panel) with vref */
11488 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11489 /* port-C for line-in (rear panel) */
11490 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11491 /* port-D for Front */
11492 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11493 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
11494 /* port-E for HP out (front panel) */
11495 /* this has to be set to VREF80 */
11496 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11497 /* route front PCM to HP */
11498 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
11499 /* port-F for mic-in (front panel) with vref */
11500 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
11501 /* port-G for CLFE (rear panel) */
11502 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11503 /* port-H for side (rear panel) */
11504 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
11506 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
11507 /* route front mic to ADC1*/
11508 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11510 /* Unmute DAC0~3 & spdif out*/
11511 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11513 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11514 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11516 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11517 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11518 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11519 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11520 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11522 /* Unmute Stereo Mixer 15 */
11523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11526 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
11528 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11530 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11531 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11532 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11533 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11534 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11535 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11536 /* hp used DAC 3 (Front) */
11537 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11538 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11542 /* additional init verbs for ASUS laptops */
11543 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
11544 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
11545 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
11550 * generic initialization of ADC, input mixers and output mixers
11552 static struct hda_verb alc861_auto_init_verbs[] = {
11554 * Unmute ADC0 and set the default input to mic-in
11556 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11557 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11559 /* Unmute DAC0~3 & spdif out*/
11560 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11562 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11563 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11566 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11567 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11568 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11569 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11570 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11572 /* Unmute Stereo Mixer 15 */
11573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
11578 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11579 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11580 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11581 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11582 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11583 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11584 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11585 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11587 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11588 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11590 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11592 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11593 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11594 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11596 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
11601 static struct hda_verb alc861_toshiba_init_verbs[] = {
11602 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11607 /* toggle speaker-output according to the hp-jack state */
11608 static void alc861_toshiba_automute(struct hda_codec *codec)
11610 unsigned int present;
11612 present = snd_hda_codec_read(codec, 0x0f, 0,
11613 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11614 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
11615 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11616 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
11617 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
11620 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
11623 if ((res >> 26) == ALC880_HP_EVENT)
11624 alc861_toshiba_automute(codec);
11627 /* pcm configuration: identiacal with ALC880 */
11628 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11629 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11630 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11631 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11634 #define ALC861_DIGOUT_NID 0x07
11636 static struct hda_channel_mode alc861_8ch_modes[1] = {
11640 static hda_nid_t alc861_dac_nids[4] = {
11641 /* front, surround, clfe, side */
11642 0x03, 0x06, 0x05, 0x04
11645 static hda_nid_t alc660_dac_nids[3] = {
11646 /* front, clfe, surround */
11650 static hda_nid_t alc861_adc_nids[1] = {
11655 static struct hda_input_mux alc861_capture_source = {
11659 { "Front Mic", 0x3 },
11666 /* fill in the dac_nids table from the parsed pin configuration */
11667 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
11668 const struct auto_pin_cfg *cfg)
11673 spec->multiout.dac_nids = spec->private_dac_nids;
11674 for (i = 0; i < cfg->line_outs; i++) {
11675 nid = cfg->line_out_pins[i];
11677 if (i >= ARRAY_SIZE(alc861_dac_nids))
11679 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
11682 spec->multiout.num_dacs = cfg->line_outs;
11686 /* add playback controls from the parsed DAC table */
11687 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
11688 const struct auto_pin_cfg *cfg)
11691 static const char *chname[4] = {
11692 "Front", "Surround", NULL /*CLFE*/, "Side"
11697 for (i = 0; i < cfg->line_outs; i++) {
11698 nid = spec->multiout.dac_nids[i];
11703 err = add_control(spec, ALC_CTL_BIND_MUTE,
11704 "Center Playback Switch",
11705 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11709 err = add_control(spec, ALC_CTL_BIND_MUTE,
11710 "LFE Playback Switch",
11711 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11716 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
11718 if (nid == alc861_dac_nids[idx])
11720 sprintf(name, "%s Playback Switch", chname[idx]);
11721 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11722 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11731 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
11739 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
11741 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11742 "Headphone Playback Switch",
11743 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11746 spec->multiout.hp_nid = nid;
11751 /* create playback/capture controls for input pins */
11752 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
11753 const struct auto_pin_cfg *cfg)
11755 struct hda_input_mux *imux = &spec->private_imux;
11756 int i, err, idx, idx1;
11758 for (i = 0; i < AUTO_PIN_LAST; i++) {
11759 switch (cfg->input_pins[i]) {
11762 idx = 2; /* Line In */
11766 idx = 2; /* Line In */
11770 idx = 1; /* Mic In */
11774 idx = 1; /* Mic In */
11784 err = new_analog_input(spec, cfg->input_pins[i],
11785 auto_pin_cfg_labels[i], idx, 0x15);
11789 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11790 imux->items[imux->num_items].index = idx1;
11796 static struct snd_kcontrol_new alc861_capture_mixer[] = {
11797 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
11798 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
11801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11802 /* The multiple "Capture Source" controls confuse alsamixer
11803 * So call somewhat different..
11805 /* .name = "Capture Source", */
11806 .name = "Input Source",
11808 .info = alc_mux_enum_info,
11809 .get = alc_mux_enum_get,
11810 .put = alc_mux_enum_put,
11815 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
11817 int pin_type, int dac_idx)
11819 alc_set_pin_output(codec, nid, pin_type);
11822 static void alc861_auto_init_multi_out(struct hda_codec *codec)
11824 struct alc_spec *spec = codec->spec;
11827 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
11828 for (i = 0; i < spec->autocfg.line_outs; i++) {
11829 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11830 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11832 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11833 spec->multiout.dac_nids[i]);
11837 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11839 struct alc_spec *spec = codec->spec;
11842 pin = spec->autocfg.hp_pins[0];
11843 if (pin) /* connect to front */
11844 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11845 spec->multiout.dac_nids[0]);
11846 pin = spec->autocfg.speaker_pins[0];
11848 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
11851 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11853 struct alc_spec *spec = codec->spec;
11856 for (i = 0; i < AUTO_PIN_LAST; i++) {
11857 hda_nid_t nid = spec->autocfg.input_pins[i];
11858 if (nid >= 0x0c && nid <= 0x11) {
11859 snd_hda_codec_write(codec, nid, 0,
11860 AC_VERB_SET_PIN_WIDGET_CONTROL,
11861 i <= AUTO_PIN_FRONT_MIC ?
11862 PIN_VREF80 : PIN_IN);
11867 /* parse the BIOS configuration and set up the alc_spec */
11868 /* return 1 if successful, 0 if the proper config is not found,
11869 * or a negative error code
11871 static int alc861_parse_auto_config(struct hda_codec *codec)
11873 struct alc_spec *spec = codec->spec;
11875 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11877 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11881 if (!spec->autocfg.line_outs)
11882 return 0; /* can't find valid BIOS pin config */
11884 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11887 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11890 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11893 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11897 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11899 if (spec->autocfg.dig_out_pin)
11900 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11902 if (spec->kctl_alloc)
11903 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11905 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11907 spec->num_mux_defs = 1;
11908 spec->input_mux = &spec->private_imux;
11910 spec->adc_nids = alc861_adc_nids;
11911 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11912 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11913 spec->num_mixers++;
11918 /* additional initialization for auto-configuration model */
11919 static void alc861_auto_init(struct hda_codec *codec)
11921 struct alc_spec *spec = codec->spec;
11922 alc861_auto_init_multi_out(codec);
11923 alc861_auto_init_hp_out(codec);
11924 alc861_auto_init_analog_input(codec);
11925 if (spec->unsol_event)
11926 alc_sku_automute(codec);
11929 #ifdef CONFIG_SND_HDA_POWER_SAVE
11930 static struct hda_amp_list alc861_loopbacks[] = {
11931 { 0x15, HDA_INPUT, 0 },
11932 { 0x15, HDA_INPUT, 1 },
11933 { 0x15, HDA_INPUT, 2 },
11934 { 0x15, HDA_INPUT, 3 },
11941 * configuration and preset
11943 static const char *alc861_models[ALC861_MODEL_LAST] = {
11944 [ALC861_3ST] = "3stack",
11945 [ALC660_3ST] = "3stack-660",
11946 [ALC861_3ST_DIG] = "3stack-dig",
11947 [ALC861_6ST_DIG] = "6stack-dig",
11948 [ALC861_UNIWILL_M31] = "uniwill-m31",
11949 [ALC861_TOSHIBA] = "toshiba",
11950 [ALC861_ASUS] = "asus",
11951 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11952 [ALC861_AUTO] = "auto",
11955 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11956 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11957 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11958 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11959 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11960 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11961 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11962 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11963 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11964 * Any other models that need this preset?
11966 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11967 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11968 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11969 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11970 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11971 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11972 /* FIXME: the below seems conflict */
11973 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11974 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11975 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11979 static struct alc_config_preset alc861_presets[] = {
11981 .mixers = { alc861_3ST_mixer },
11982 .init_verbs = { alc861_threestack_init_verbs },
11983 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11984 .dac_nids = alc861_dac_nids,
11985 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11986 .channel_mode = alc861_threestack_modes,
11988 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11989 .adc_nids = alc861_adc_nids,
11990 .input_mux = &alc861_capture_source,
11992 [ALC861_3ST_DIG] = {
11993 .mixers = { alc861_base_mixer },
11994 .init_verbs = { alc861_threestack_init_verbs },
11995 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11996 .dac_nids = alc861_dac_nids,
11997 .dig_out_nid = ALC861_DIGOUT_NID,
11998 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11999 .channel_mode = alc861_threestack_modes,
12001 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12002 .adc_nids = alc861_adc_nids,
12003 .input_mux = &alc861_capture_source,
12005 [ALC861_6ST_DIG] = {
12006 .mixers = { alc861_base_mixer },
12007 .init_verbs = { alc861_base_init_verbs },
12008 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12009 .dac_nids = alc861_dac_nids,
12010 .dig_out_nid = ALC861_DIGOUT_NID,
12011 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
12012 .channel_mode = alc861_8ch_modes,
12013 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12014 .adc_nids = alc861_adc_nids,
12015 .input_mux = &alc861_capture_source,
12018 .mixers = { alc861_3ST_mixer },
12019 .init_verbs = { alc861_threestack_init_verbs },
12020 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
12021 .dac_nids = alc660_dac_nids,
12022 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
12023 .channel_mode = alc861_threestack_modes,
12025 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12026 .adc_nids = alc861_adc_nids,
12027 .input_mux = &alc861_capture_source,
12029 [ALC861_UNIWILL_M31] = {
12030 .mixers = { alc861_uniwill_m31_mixer },
12031 .init_verbs = { alc861_uniwill_m31_init_verbs },
12032 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12033 .dac_nids = alc861_dac_nids,
12034 .dig_out_nid = ALC861_DIGOUT_NID,
12035 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
12036 .channel_mode = alc861_uniwill_m31_modes,
12038 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12039 .adc_nids = alc861_adc_nids,
12040 .input_mux = &alc861_capture_source,
12042 [ALC861_TOSHIBA] = {
12043 .mixers = { alc861_toshiba_mixer },
12044 .init_verbs = { alc861_base_init_verbs,
12045 alc861_toshiba_init_verbs },
12046 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12047 .dac_nids = alc861_dac_nids,
12048 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12049 .channel_mode = alc883_3ST_2ch_modes,
12050 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12051 .adc_nids = alc861_adc_nids,
12052 .input_mux = &alc861_capture_source,
12053 .unsol_event = alc861_toshiba_unsol_event,
12054 .init_hook = alc861_toshiba_automute,
12057 .mixers = { alc861_asus_mixer },
12058 .init_verbs = { alc861_asus_init_verbs },
12059 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12060 .dac_nids = alc861_dac_nids,
12061 .dig_out_nid = ALC861_DIGOUT_NID,
12062 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
12063 .channel_mode = alc861_asus_modes,
12066 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12067 .adc_nids = alc861_adc_nids,
12068 .input_mux = &alc861_capture_source,
12070 [ALC861_ASUS_LAPTOP] = {
12071 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
12072 .init_verbs = { alc861_asus_init_verbs,
12073 alc861_asus_laptop_init_verbs },
12074 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
12075 .dac_nids = alc861_dac_nids,
12076 .dig_out_nid = ALC861_DIGOUT_NID,
12077 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12078 .channel_mode = alc883_3ST_2ch_modes,
12080 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
12081 .adc_nids = alc861_adc_nids,
12082 .input_mux = &alc861_capture_source,
12087 static int patch_alc861(struct hda_codec *codec)
12089 struct alc_spec *spec;
12093 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12097 codec->spec = spec;
12099 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
12103 if (board_config < 0) {
12104 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
12105 "trying auto-probe from BIOS...\n");
12106 board_config = ALC861_AUTO;
12109 if (board_config == ALC861_AUTO) {
12110 /* automatic parse from the BIOS config */
12111 err = alc861_parse_auto_config(codec);
12117 "hda_codec: Cannot set up configuration "
12118 "from BIOS. Using base mode...\n");
12119 board_config = ALC861_3ST_DIG;
12123 if (board_config != ALC861_AUTO)
12124 setup_preset(spec, &alc861_presets[board_config]);
12126 spec->stream_name_analog = "ALC861 Analog";
12127 spec->stream_analog_playback = &alc861_pcm_analog_playback;
12128 spec->stream_analog_capture = &alc861_pcm_analog_capture;
12130 spec->stream_name_digital = "ALC861 Digital";
12131 spec->stream_digital_playback = &alc861_pcm_digital_playback;
12132 spec->stream_digital_capture = &alc861_pcm_digital_capture;
12134 spec->vmaster_nid = 0x03;
12136 codec->patch_ops = alc_patch_ops;
12137 if (board_config == ALC861_AUTO)
12138 spec->init_hook = alc861_auto_init;
12139 #ifdef CONFIG_SND_HDA_POWER_SAVE
12140 if (!spec->loopback.amplist)
12141 spec->loopback.amplist = alc861_loopbacks;
12148 * ALC861-VD support
12152 * In addition, an independent DAC
12154 #define ALC861VD_DIGOUT_NID 0x06
12156 static hda_nid_t alc861vd_dac_nids[4] = {
12157 /* front, surr, clfe, side surr */
12158 0x02, 0x03, 0x04, 0x05
12161 /* dac_nids for ALC660vd are in a different order - according to
12162 * Realtek's driver.
12163 * This should probably tesult in a different mixer for 6stack models
12164 * of ALC660vd codecs, but for now there is only 3stack mixer
12165 * - and it is the same as in 861vd.
12166 * adc_nids in ALC660vd are (is) the same as in 861vd
12168 static hda_nid_t alc660vd_dac_nids[3] = {
12169 /* front, rear, clfe, rear_surr */
12173 static hda_nid_t alc861vd_adc_nids[1] = {
12178 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
12181 /* FIXME: should be a matrix-type input source selection */
12182 static struct hda_input_mux alc861vd_capture_source = {
12186 { "Front Mic", 0x1 },
12192 static struct hda_input_mux alc861vd_dallas_capture_source = {
12195 { "Ext Mic", 0x0 },
12196 { "Int Mic", 0x1 },
12200 static struct hda_input_mux alc861vd_hp_capture_source = {
12203 { "Front Mic", 0x0 },
12204 { "ATAPI Mic", 0x1 },
12208 #define alc861vd_mux_enum_info alc_mux_enum_info
12209 #define alc861vd_mux_enum_get alc_mux_enum_get
12210 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12211 #define alc861vd_mux_enum_put alc882_mux_enum_put
12216 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
12223 static struct hda_verb alc861vd_6stack_ch6_init[] = {
12224 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12225 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12226 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12227 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12234 static struct hda_verb alc861vd_6stack_ch8_init[] = {
12235 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12236 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12237 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12238 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12242 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
12243 { 6, alc861vd_6stack_ch6_init },
12244 { 8, alc861vd_6stack_ch8_init },
12247 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
12249 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12250 .name = "Channel Mode",
12251 .info = alc_ch_mode_info,
12252 .get = alc_ch_mode_get,
12253 .put = alc_ch_mode_put,
12258 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
12259 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12260 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12263 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12264 /* The multiple "Capture Source" controls confuse alsamixer
12265 * So call somewhat different..
12267 /* .name = "Capture Source", */
12268 .name = "Input Source",
12270 .info = alc861vd_mux_enum_info,
12271 .get = alc861vd_mux_enum_get,
12272 .put = alc861vd_mux_enum_put,
12277 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12278 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12280 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
12281 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12282 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12284 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12285 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
12287 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12289 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12291 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12292 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
12294 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
12295 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
12297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12299 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12303 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12304 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12305 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12308 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12310 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12311 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12313 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12314 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12319 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
12320 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12321 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12329 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12333 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12334 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12336 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12337 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12339 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12340 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12345 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
12346 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12347 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12348 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12356 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12357 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12358 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12366 /* Pin assignment: Speaker=0x14, HP = 0x15,
12367 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12369 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
12370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
12372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12373 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12374 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12375 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12376 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12377 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12378 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12379 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12380 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),
12381 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),
12385 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12386 * Front Mic=0x18, ATAPI Mic = 0x19,
12388 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
12389 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12390 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
12391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12392 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
12393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12395 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12396 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12402 * generic initialization of ADC, input mixers and output mixers
12404 static struct hda_verb alc861vd_volume_init_verbs[] = {
12406 * Unmute ADC0 and set the default input to mic-in
12408 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12409 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12411 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12412 * the analog-loopback mixer widget
12414 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12421 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12428 * Set up output mixers (0x02 - 0x05)
12430 /* set vol=0 to output mixers */
12431 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12432 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12433 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12434 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12436 /* set up input amps for analog loopback */
12437 /* Amp Indices: DAC = 0, mixer = 1 */
12438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12440 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12441 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12442 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12444 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12445 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12451 * 3-stack pin configuration:
12452 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12454 static struct hda_verb alc861vd_3stack_init_verbs[] = {
12456 * Set pin mode and muting
12458 /* set front pin widgets 0x14 for output */
12459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12460 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12461 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12463 /* Mic (rear) pin: input vref at 80% */
12464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12466 /* Front Mic pin: input vref at 80% */
12467 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12469 /* Line In pin: input */
12470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12472 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12474 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12475 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12476 /* CD pin widget for input */
12477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12483 * 6-stack pin configuration:
12485 static struct hda_verb alc861vd_6stack_init_verbs[] = {
12487 * Set pin mode and muting
12489 /* set front pin widgets 0x14 for output */
12490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12491 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12492 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12494 /* Rear Pin: output 1 (0x0d) */
12495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12497 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12498 /* CLFE Pin: output 2 (0x0e) */
12499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12500 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12501 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
12502 /* Side Pin: output 3 (0x0f) */
12503 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12504 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12505 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
12507 /* Mic (rear) pin: input vref at 80% */
12508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12510 /* Front Mic pin: input vref at 80% */
12511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12513 /* Line In pin: input */
12514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12516 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12517 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12518 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12520 /* CD pin widget for input */
12521 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12526 static struct hda_verb alc861vd_eapd_verbs[] = {
12527 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12531 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
12532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12535 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12536 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12540 /* toggle speaker-output according to the hp-jack state */
12541 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
12543 unsigned int present;
12544 unsigned char bits;
12546 present = snd_hda_codec_read(codec, 0x1b, 0,
12547 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12548 bits = present ? HDA_AMP_MUTE : 0;
12549 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12550 HDA_AMP_MUTE, bits);
12553 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
12555 unsigned int present;
12556 unsigned char bits;
12558 present = snd_hda_codec_read(codec, 0x18, 0,
12559 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12560 bits = present ? HDA_AMP_MUTE : 0;
12561 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
12562 HDA_AMP_MUTE, bits);
12565 static void alc861vd_lenovo_automute(struct hda_codec *codec)
12567 alc861vd_lenovo_hp_automute(codec);
12568 alc861vd_lenovo_mic_automute(codec);
12571 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
12574 switch (res >> 26) {
12575 case ALC880_HP_EVENT:
12576 alc861vd_lenovo_hp_automute(codec);
12578 case ALC880_MIC_EVENT:
12579 alc861vd_lenovo_mic_automute(codec);
12584 static struct hda_verb alc861vd_dallas_verbs[] = {
12585 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12586 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12587 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12588 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12593 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12595 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12596 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12600 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12603 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12604 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12605 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12606 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12609 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12610 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
12611 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12612 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12613 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12614 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12615 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12622 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12623 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12624 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12629 /* toggle speaker-output according to the hp-jack state */
12630 static void alc861vd_dallas_automute(struct hda_codec *codec)
12632 unsigned int present;
12634 present = snd_hda_codec_read(codec, 0x15, 0,
12635 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12636 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12637 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
12640 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
12642 if ((res >> 26) == ALC880_HP_EVENT)
12643 alc861vd_dallas_automute(codec);
12646 #ifdef CONFIG_SND_HDA_POWER_SAVE
12647 #define alc861vd_loopbacks alc880_loopbacks
12650 /* pcm configuration: identiacal with ALC880 */
12651 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12652 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12653 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12654 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12657 * configuration and preset
12659 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
12660 [ALC660VD_3ST] = "3stack-660",
12661 [ALC660VD_3ST_DIG] = "3stack-660-digout",
12662 [ALC861VD_3ST] = "3stack",
12663 [ALC861VD_3ST_DIG] = "3stack-digout",
12664 [ALC861VD_6ST_DIG] = "6stack-digout",
12665 [ALC861VD_LENOVO] = "lenovo",
12666 [ALC861VD_DALLAS] = "dallas",
12667 [ALC861VD_HP] = "hp",
12668 [ALC861VD_AUTO] = "auto",
12671 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
12672 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
12673 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
12674 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
12675 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
12676 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
12677 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
12678 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
12679 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12680 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
12681 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
12682 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
12683 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
12684 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
12685 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
12686 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
12690 static struct alc_config_preset alc861vd_presets[] = {
12692 .mixers = { alc861vd_3st_mixer },
12693 .init_verbs = { alc861vd_volume_init_verbs,
12694 alc861vd_3stack_init_verbs },
12695 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12696 .dac_nids = alc660vd_dac_nids,
12697 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12698 .channel_mode = alc861vd_3stack_2ch_modes,
12699 .input_mux = &alc861vd_capture_source,
12701 [ALC660VD_3ST_DIG] = {
12702 .mixers = { alc861vd_3st_mixer },
12703 .init_verbs = { alc861vd_volume_init_verbs,
12704 alc861vd_3stack_init_verbs },
12705 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12706 .dac_nids = alc660vd_dac_nids,
12707 .dig_out_nid = ALC861VD_DIGOUT_NID,
12708 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12709 .channel_mode = alc861vd_3stack_2ch_modes,
12710 .input_mux = &alc861vd_capture_source,
12713 .mixers = { alc861vd_3st_mixer },
12714 .init_verbs = { alc861vd_volume_init_verbs,
12715 alc861vd_3stack_init_verbs },
12716 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12717 .dac_nids = alc861vd_dac_nids,
12718 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12719 .channel_mode = alc861vd_3stack_2ch_modes,
12720 .input_mux = &alc861vd_capture_source,
12722 [ALC861VD_3ST_DIG] = {
12723 .mixers = { alc861vd_3st_mixer },
12724 .init_verbs = { alc861vd_volume_init_verbs,
12725 alc861vd_3stack_init_verbs },
12726 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12727 .dac_nids = alc861vd_dac_nids,
12728 .dig_out_nid = ALC861VD_DIGOUT_NID,
12729 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12730 .channel_mode = alc861vd_3stack_2ch_modes,
12731 .input_mux = &alc861vd_capture_source,
12733 [ALC861VD_6ST_DIG] = {
12734 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
12735 .init_verbs = { alc861vd_volume_init_verbs,
12736 alc861vd_6stack_init_verbs },
12737 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12738 .dac_nids = alc861vd_dac_nids,
12739 .dig_out_nid = ALC861VD_DIGOUT_NID,
12740 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
12741 .channel_mode = alc861vd_6stack_modes,
12742 .input_mux = &alc861vd_capture_source,
12744 [ALC861VD_LENOVO] = {
12745 .mixers = { alc861vd_lenovo_mixer },
12746 .init_verbs = { alc861vd_volume_init_verbs,
12747 alc861vd_3stack_init_verbs,
12748 alc861vd_eapd_verbs,
12749 alc861vd_lenovo_unsol_verbs },
12750 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
12751 .dac_nids = alc660vd_dac_nids,
12752 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12753 .channel_mode = alc861vd_3stack_2ch_modes,
12754 .input_mux = &alc861vd_capture_source,
12755 .unsol_event = alc861vd_lenovo_unsol_event,
12756 .init_hook = alc861vd_lenovo_automute,
12758 [ALC861VD_DALLAS] = {
12759 .mixers = { alc861vd_dallas_mixer },
12760 .init_verbs = { alc861vd_dallas_verbs },
12761 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12762 .dac_nids = alc861vd_dac_nids,
12763 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12764 .channel_mode = alc861vd_3stack_2ch_modes,
12765 .input_mux = &alc861vd_dallas_capture_source,
12766 .unsol_event = alc861vd_dallas_unsol_event,
12767 .init_hook = alc861vd_dallas_automute,
12770 .mixers = { alc861vd_hp_mixer },
12771 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
12772 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
12773 .dac_nids = alc861vd_dac_nids,
12774 .dig_out_nid = ALC861VD_DIGOUT_NID,
12775 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
12776 .channel_mode = alc861vd_3stack_2ch_modes,
12777 .input_mux = &alc861vd_hp_capture_source,
12778 .unsol_event = alc861vd_dallas_unsol_event,
12779 .init_hook = alc861vd_dallas_automute,
12784 * BIOS auto configuration
12786 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
12787 hda_nid_t nid, int pin_type, int dac_idx)
12789 alc_set_pin_output(codec, nid, pin_type);
12792 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
12794 struct alc_spec *spec = codec->spec;
12797 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
12798 for (i = 0; i <= HDA_SIDE; i++) {
12799 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12800 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12802 alc861vd_auto_set_output_and_unmute(codec, nid,
12808 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12810 struct alc_spec *spec = codec->spec;
12813 pin = spec->autocfg.hp_pins[0];
12814 if (pin) /* connect to front and use dac 0 */
12815 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12816 pin = spec->autocfg.speaker_pins[0];
12818 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
12821 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12822 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12824 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12826 struct alc_spec *spec = codec->spec;
12829 for (i = 0; i < AUTO_PIN_LAST; i++) {
12830 hda_nid_t nid = spec->autocfg.input_pins[i];
12831 if (alc861vd_is_input_pin(nid)) {
12832 snd_hda_codec_write(codec, nid, 0,
12833 AC_VERB_SET_PIN_WIDGET_CONTROL,
12834 i <= AUTO_PIN_FRONT_MIC ?
12835 PIN_VREF80 : PIN_IN);
12836 if (nid != ALC861VD_PIN_CD_NID)
12837 snd_hda_codec_write(codec, nid, 0,
12838 AC_VERB_SET_AMP_GAIN_MUTE,
12844 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12845 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12847 /* add playback controls from the parsed DAC table */
12848 /* Based on ALC880 version. But ALC861VD has separate,
12849 * different NIDs for mute/unmute switch and volume control */
12850 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12851 const struct auto_pin_cfg *cfg)
12854 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12855 hda_nid_t nid_v, nid_s;
12858 for (i = 0; i < cfg->line_outs; i++) {
12859 if (!spec->multiout.dac_nids[i])
12861 nid_v = alc861vd_idx_to_mixer_vol(
12863 spec->multiout.dac_nids[i]));
12864 nid_s = alc861vd_idx_to_mixer_switch(
12866 spec->multiout.dac_nids[i]));
12870 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12871 "Center Playback Volume",
12872 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12876 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12877 "LFE Playback Volume",
12878 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12882 err = add_control(spec, ALC_CTL_BIND_MUTE,
12883 "Center Playback Switch",
12884 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12888 err = add_control(spec, ALC_CTL_BIND_MUTE,
12889 "LFE Playback Switch",
12890 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12895 sprintf(name, "%s Playback Volume", chname[i]);
12896 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12897 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12901 sprintf(name, "%s Playback Switch", chname[i]);
12902 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12903 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12912 /* add playback controls for speaker and HP outputs */
12913 /* Based on ALC880 version. But ALC861VD has separate,
12914 * different NIDs for mute/unmute switch and volume control */
12915 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12916 hda_nid_t pin, const char *pfx)
12918 hda_nid_t nid_v, nid_s;
12925 if (alc880_is_fixed_pin(pin)) {
12926 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12927 /* specify the DAC as the extra output */
12928 if (!spec->multiout.hp_nid)
12929 spec->multiout.hp_nid = nid_v;
12931 spec->multiout.extra_out_nid[0] = nid_v;
12932 /* control HP volume/switch on the output mixer amp */
12933 nid_v = alc861vd_idx_to_mixer_vol(
12934 alc880_fixed_pin_idx(pin));
12935 nid_s = alc861vd_idx_to_mixer_switch(
12936 alc880_fixed_pin_idx(pin));
12938 sprintf(name, "%s Playback Volume", pfx);
12939 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12940 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12943 sprintf(name, "%s Playback Switch", pfx);
12944 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12945 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12948 } else if (alc880_is_multi_pin(pin)) {
12949 /* set manual connection */
12950 /* we have only a switch on HP-out PIN */
12951 sprintf(name, "%s Playback Switch", pfx);
12952 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12953 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12960 /* parse the BIOS configuration and set up the alc_spec
12961 * return 1 if successful, 0 if the proper config is not found,
12962 * or a negative error code
12963 * Based on ALC880 version - had to change it to override
12964 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12965 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12967 struct alc_spec *spec = codec->spec;
12969 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12971 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12975 if (!spec->autocfg.line_outs)
12976 return 0; /* can't find valid BIOS pin config */
12978 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12981 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12984 err = alc861vd_auto_create_extra_out(spec,
12985 spec->autocfg.speaker_pins[0],
12989 err = alc861vd_auto_create_extra_out(spec,
12990 spec->autocfg.hp_pins[0],
12994 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12998 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13000 if (spec->autocfg.dig_out_pin)
13001 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
13003 if (spec->kctl_alloc)
13004 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13006 spec->init_verbs[spec->num_init_verbs++]
13007 = alc861vd_volume_init_verbs;
13009 spec->num_mux_defs = 1;
13010 spec->input_mux = &spec->private_imux;
13012 err = alc_auto_add_mic_boost(codec);
13019 /* additional initialization for auto-configuration model */
13020 static void alc861vd_auto_init(struct hda_codec *codec)
13022 struct alc_spec *spec = codec->spec;
13023 alc861vd_auto_init_multi_out(codec);
13024 alc861vd_auto_init_hp_out(codec);
13025 alc861vd_auto_init_analog_input(codec);
13026 if (spec->unsol_event)
13027 alc_sku_automute(codec);
13030 static int patch_alc861vd(struct hda_codec *codec)
13032 struct alc_spec *spec;
13033 int err, board_config;
13035 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13039 codec->spec = spec;
13041 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
13045 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
13046 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
13047 "ALC861VD, trying auto-probe from BIOS...\n");
13048 board_config = ALC861VD_AUTO;
13051 if (board_config == ALC861VD_AUTO) {
13052 /* automatic parse from the BIOS config */
13053 err = alc861vd_parse_auto_config(codec);
13059 "hda_codec: Cannot set up configuration "
13060 "from BIOS. Using base mode...\n");
13061 board_config = ALC861VD_3ST;
13065 if (board_config != ALC861VD_AUTO)
13066 setup_preset(spec, &alc861vd_presets[board_config]);
13068 spec->stream_name_analog = "ALC861VD Analog";
13069 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
13070 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
13072 spec->stream_name_digital = "ALC861VD Digital";
13073 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
13074 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
13076 spec->adc_nids = alc861vd_adc_nids;
13077 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
13078 spec->capsrc_nids = alc861vd_capsrc_nids;
13080 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
13081 spec->num_mixers++;
13083 spec->vmaster_nid = 0x02;
13085 codec->patch_ops = alc_patch_ops;
13087 if (board_config == ALC861VD_AUTO)
13088 spec->init_hook = alc861vd_auto_init;
13089 #ifdef CONFIG_SND_HDA_POWER_SAVE
13090 if (!spec->loopback.amplist)
13091 spec->loopback.amplist = alc861vd_loopbacks;
13100 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13101 * configuration. Each pin widget can choose any input DACs and a mixer.
13102 * Each ADC is connected from a mixer of all inputs. This makes possible
13103 * 6-channel independent captures.
13105 * In addition, an independent DAC for the multi-playback (not used in this
13108 #define ALC662_DIGOUT_NID 0x06
13109 #define ALC662_DIGIN_NID 0x0a
13111 static hda_nid_t alc662_dac_nids[4] = {
13112 /* front, rear, clfe, rear_surr */
13116 static hda_nid_t alc662_adc_nids[1] = {
13121 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
13124 /* FIXME: should be a matrix-type input source selection */
13125 static struct hda_input_mux alc662_capture_source = {
13129 { "Front Mic", 0x1 },
13135 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
13143 static struct hda_input_mux alc662_eeepc_capture_source = {
13151 #define alc662_mux_enum_info alc_mux_enum_info
13152 #define alc662_mux_enum_get alc_mux_enum_get
13153 #define alc662_mux_enum_put alc882_mux_enum_put
13158 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
13165 static struct hda_verb alc662_3ST_ch2_init[] = {
13166 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
13167 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
13169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
13176 static struct hda_verb alc662_3ST_ch6_init[] = {
13177 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13178 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13179 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
13180 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13181 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
13182 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
13186 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
13187 { 2, alc662_3ST_ch2_init },
13188 { 6, alc662_3ST_ch6_init },
13194 static struct hda_verb alc662_sixstack_ch6_init[] = {
13195 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13196 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13197 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13204 static struct hda_verb alc662_sixstack_ch8_init[] = {
13205 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13206 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13207 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
13211 static struct hda_channel_mode alc662_5stack_modes[2] = {
13212 { 2, alc662_sixstack_ch6_init },
13213 { 6, alc662_sixstack_ch8_init },
13216 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13217 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13220 static struct snd_kcontrol_new alc662_base_mixer[] = {
13221 /* output mixer control */
13222 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13223 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13225 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13228 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13229 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13232 /*Input mixer control */
13233 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
13234 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
13235 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
13236 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
13237 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
13238 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
13239 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
13240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
13244 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
13245 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13246 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13254 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13255 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13256 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13257 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13261 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
13262 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13263 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
13264 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13265 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
13266 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13267 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13268 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
13269 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
13270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13271 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
13272 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13273 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13274 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13276 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13277 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13278 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13279 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
13280 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
13284 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
13285 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13286 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
13287 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13288 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
13289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13291 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13297 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
13298 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13300 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13301 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13303 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
13304 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13305 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13307 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
13308 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
13309 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
13313 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
13314 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13315 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13317 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
13318 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
13319 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
13320 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
13321 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
13322 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
13323 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
13324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13331 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
13333 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13334 .name = "Channel Mode",
13335 .info = alc_ch_mode_info,
13336 .get = alc_ch_mode_get,
13337 .put = alc_ch_mode_put,
13342 static struct hda_verb alc662_init_verbs[] = {
13343 /* ADC: mute amp left and right */
13344 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13345 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13346 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13359 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13361 /* Front Pin: output 0 (0x0c) */
13362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13365 /* Rear Pin: output 1 (0x0d) */
13366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13369 /* CLFE Pin: output 2 (0x0e) */
13370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13371 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13373 /* Mic (rear) pin: input vref at 80% */
13374 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13376 /* Front Mic pin: input vref at 80% */
13377 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13378 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13379 /* Line In pin: input */
13380 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13382 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13383 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13384 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13385 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
13386 /* CD pin widget for input */
13387 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13389 /* FIXME: use matrix-type input source selection */
13390 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13392 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
13404 static struct hda_verb alc662_sue_init_verbs[] = {
13405 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
13406 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
13410 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
13411 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13412 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13416 /* Set Unsolicited Event*/
13417 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
13418 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13424 * generic initialization of ADC, input mixers and output mixers
13426 static struct hda_verb alc662_auto_init_verbs[] = {
13428 * Unmute ADC and set the default input to mic-in
13430 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
13431 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13435 * Note: PASD motherboards uses the Line In 2 as the input for front
13436 * panel mic (mic 2)
13438 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13446 * Set up output mixers (0x0c - 0x0f)
13448 /* set vol=0 to output mixers */
13449 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13450 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13451 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13453 /* set up input amps for analog loopback */
13454 /* Amp Indices: DAC = 0, mixer = 1 */
13455 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13463 /* FIXME: use matrix-type input source selection */
13464 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13471 /* capture mixer elements */
13472 static struct snd_kcontrol_new alc662_capture_mixer[] = {
13473 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13474 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13477 /* The multiple "Capture Source" controls confuse alsamixer
13478 * So call somewhat different..
13480 /* .name = "Capture Source", */
13481 .name = "Input Source",
13483 .info = alc662_mux_enum_info,
13484 .get = alc662_mux_enum_get,
13485 .put = alc662_mux_enum_put,
13490 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
13492 unsigned int present;
13493 unsigned char bits;
13495 present = snd_hda_codec_read(codec, 0x14, 0,
13496 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13497 bits = present ? HDA_AMP_MUTE : 0;
13498 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13499 HDA_AMP_MUTE, bits);
13502 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
13504 unsigned int present;
13505 unsigned char bits;
13507 present = snd_hda_codec_read(codec, 0x1b, 0,
13508 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13509 bits = present ? HDA_AMP_MUTE : 0;
13510 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13511 HDA_AMP_MUTE, bits);
13512 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
13513 HDA_AMP_MUTE, bits);
13516 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
13519 if ((res >> 26) == ALC880_HP_EVENT)
13520 alc662_lenovo_101e_all_automute(codec);
13521 if ((res >> 26) == ALC880_FRONT_EVENT)
13522 alc662_lenovo_101e_ispeaker_automute(codec);
13525 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
13527 unsigned int present;
13529 present = snd_hda_codec_read(codec, 0x18, 0,
13530 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13531 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13532 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13533 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13534 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13535 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13536 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13537 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13538 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13541 /* unsolicited event for HP jack sensing */
13542 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
13545 if ((res >> 26) == ALC880_HP_EVENT)
13546 alc262_hippo1_automute( codec );
13548 if ((res >> 26) == ALC880_MIC_EVENT)
13549 alc662_eeepc_mic_automute(codec);
13552 static void alc662_eeepc_inithook(struct hda_codec *codec)
13554 alc262_hippo1_automute( codec );
13555 alc662_eeepc_mic_automute(codec);
13558 static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
13561 unsigned int present;
13563 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
13564 present = snd_hda_codec_read(codec, 0x14, 0,
13565 AC_VERB_GET_PIN_SENSE, 0);
13566 present = (present & 0x80000000) != 0;
13568 /* mute internal speaker */
13569 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13570 HDA_AMP_MUTE, HDA_AMP_MUTE);
13572 /* unmute internal speaker if necessary */
13573 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13574 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
13575 HDA_AMP_MUTE, mute);
13579 /* unsolicited event for HP jack sensing */
13580 static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
13583 if ((res >> 26) == ALC880_HP_EVENT)
13584 alc662_eeepc_ep20_automute(codec);
13587 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
13589 alc662_eeepc_ep20_automute(codec);
13592 #ifdef CONFIG_SND_HDA_POWER_SAVE
13593 #define alc662_loopbacks alc880_loopbacks
13597 /* pcm configuration: identiacal with ALC880 */
13598 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13599 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13600 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13601 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13604 * configuration and preset
13606 static const char *alc662_models[ALC662_MODEL_LAST] = {
13607 [ALC662_3ST_2ch_DIG] = "3stack-dig",
13608 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
13609 [ALC662_3ST_6ch] = "3stack-6ch",
13610 [ALC662_5ST_DIG] = "6stack-dig",
13611 [ALC662_LENOVO_101E] = "lenovo-101e",
13612 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
13613 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
13614 [ALC662_AUTO] = "auto",
13617 static struct snd_pci_quirk alc662_cfg_tbl[] = {
13618 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
13619 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
13620 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
13621 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
13625 static struct alc_config_preset alc662_presets[] = {
13626 [ALC662_3ST_2ch_DIG] = {
13627 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
13628 .init_verbs = { alc662_init_verbs },
13629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13630 .dac_nids = alc662_dac_nids,
13631 .dig_out_nid = ALC662_DIGOUT_NID,
13632 .dig_in_nid = ALC662_DIGIN_NID,
13633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13634 .channel_mode = alc662_3ST_2ch_modes,
13635 .input_mux = &alc662_capture_source,
13637 [ALC662_3ST_6ch_DIG] = {
13638 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13639 alc662_capture_mixer },
13640 .init_verbs = { alc662_init_verbs },
13641 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13642 .dac_nids = alc662_dac_nids,
13643 .dig_out_nid = ALC662_DIGOUT_NID,
13644 .dig_in_nid = ALC662_DIGIN_NID,
13645 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13646 .channel_mode = alc662_3ST_6ch_modes,
13648 .input_mux = &alc662_capture_source,
13650 [ALC662_3ST_6ch] = {
13651 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
13652 alc662_capture_mixer },
13653 .init_verbs = { alc662_init_verbs },
13654 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13655 .dac_nids = alc662_dac_nids,
13656 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13657 .channel_mode = alc662_3ST_6ch_modes,
13659 .input_mux = &alc662_capture_source,
13661 [ALC662_5ST_DIG] = {
13662 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
13663 alc662_capture_mixer },
13664 .init_verbs = { alc662_init_verbs },
13665 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13666 .dac_nids = alc662_dac_nids,
13667 .dig_out_nid = ALC662_DIGOUT_NID,
13668 .dig_in_nid = ALC662_DIGIN_NID,
13669 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
13670 .channel_mode = alc662_5stack_modes,
13671 .input_mux = &alc662_capture_source,
13673 [ALC662_LENOVO_101E] = {
13674 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
13675 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
13676 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13677 .dac_nids = alc662_dac_nids,
13678 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13679 .channel_mode = alc662_3ST_2ch_modes,
13680 .input_mux = &alc662_lenovo_101e_capture_source,
13681 .unsol_event = alc662_lenovo_101e_unsol_event,
13682 .init_hook = alc662_lenovo_101e_all_automute,
13684 [ALC662_ASUS_EEEPC_P701] = {
13685 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
13686 .init_verbs = { alc662_init_verbs,
13687 alc662_eeepc_sue_init_verbs },
13688 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13689 .dac_nids = alc662_dac_nids,
13690 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
13691 .channel_mode = alc662_3ST_2ch_modes,
13692 .input_mux = &alc662_eeepc_capture_source,
13693 .unsol_event = alc662_eeepc_unsol_event,
13694 .init_hook = alc662_eeepc_inithook,
13696 [ALC662_ASUS_EEEPC_EP20] = {
13697 .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer,
13698 alc662_chmode_mixer },
13699 .init_verbs = { alc662_init_verbs,
13700 alc662_eeepc_ep20_sue_init_verbs },
13701 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
13702 .dac_nids = alc662_dac_nids,
13703 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
13704 .channel_mode = alc662_3ST_6ch_modes,
13705 .input_mux = &alc662_lenovo_101e_capture_source,
13706 .unsol_event = alc662_eeepc_ep20_unsol_event,
13707 .init_hook = alc662_eeepc_ep20_inithook,
13714 * BIOS auto configuration
13717 /* add playback controls from the parsed DAC table */
13718 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
13719 const struct auto_pin_cfg *cfg)
13722 static const char *chname[4] = {
13723 "Front", "Surround", NULL /*CLFE*/, "Side"
13728 for (i = 0; i < cfg->line_outs; i++) {
13729 if (!spec->multiout.dac_nids[i])
13731 nid = alc880_idx_to_dac(i);
13734 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13735 "Center Playback Volume",
13736 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13740 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13741 "LFE Playback Volume",
13742 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13746 err = add_control(spec, ALC_CTL_BIND_MUTE,
13747 "Center Playback Switch",
13748 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
13752 err = add_control(spec, ALC_CTL_BIND_MUTE,
13753 "LFE Playback Switch",
13754 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
13759 sprintf(name, "%s Playback Volume", chname[i]);
13760 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13761 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13765 sprintf(name, "%s Playback Switch", chname[i]);
13766 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13767 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
13776 /* add playback controls for speaker and HP outputs */
13777 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
13787 if (alc880_is_fixed_pin(pin)) {
13788 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13789 /* printk("DAC nid=%x\n",nid); */
13790 /* specify the DAC as the extra output */
13791 if (!spec->multiout.hp_nid)
13792 spec->multiout.hp_nid = nid;
13794 spec->multiout.extra_out_nid[0] = nid;
13795 /* control HP volume/switch on the output mixer amp */
13796 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
13797 sprintf(name, "%s Playback Volume", pfx);
13798 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
13799 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13802 sprintf(name, "%s Playback Switch", pfx);
13803 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13804 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
13807 } else if (alc880_is_multi_pin(pin)) {
13808 /* set manual connection */
13809 /* we have only a switch on HP-out PIN */
13810 sprintf(name, "%s Playback Switch", pfx);
13811 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
13812 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
13819 /* create playback/capture controls for input pins */
13820 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
13821 const struct auto_pin_cfg *cfg)
13823 struct hda_input_mux *imux = &spec->private_imux;
13826 for (i = 0; i < AUTO_PIN_LAST; i++) {
13827 if (alc880_is_input_pin(cfg->input_pins[i])) {
13828 idx = alc880_input_pin_idx(cfg->input_pins[i]);
13829 err = new_analog_input(spec, cfg->input_pins[i],
13830 auto_pin_cfg_labels[i],
13834 imux->items[imux->num_items].label =
13835 auto_pin_cfg_labels[i];
13836 imux->items[imux->num_items].index =
13837 alc880_input_pin_idx(cfg->input_pins[i]);
13844 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
13845 hda_nid_t nid, int pin_type,
13848 alc_set_pin_output(codec, nid, pin_type);
13849 /* need the manual connection? */
13850 if (alc880_is_multi_pin(nid)) {
13851 struct alc_spec *spec = codec->spec;
13852 int idx = alc880_multi_pin_idx(nid);
13853 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13854 AC_VERB_SET_CONNECT_SEL,
13855 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13859 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13861 struct alc_spec *spec = codec->spec;
13864 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
13865 for (i = 0; i <= HDA_SIDE; i++) {
13866 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13867 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13869 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13874 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13876 struct alc_spec *spec = codec->spec;
13879 pin = spec->autocfg.hp_pins[0];
13880 if (pin) /* connect to front */
13882 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13883 pin = spec->autocfg.speaker_pins[0];
13885 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13888 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13889 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13891 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13893 struct alc_spec *spec = codec->spec;
13896 for (i = 0; i < AUTO_PIN_LAST; i++) {
13897 hda_nid_t nid = spec->autocfg.input_pins[i];
13898 if (alc662_is_input_pin(nid)) {
13899 snd_hda_codec_write(codec, nid, 0,
13900 AC_VERB_SET_PIN_WIDGET_CONTROL,
13901 (i <= AUTO_PIN_FRONT_MIC ?
13902 PIN_VREF80 : PIN_IN));
13903 if (nid != ALC662_PIN_CD_NID)
13904 snd_hda_codec_write(codec, nid, 0,
13905 AC_VERB_SET_AMP_GAIN_MUTE,
13911 static int alc662_parse_auto_config(struct hda_codec *codec)
13913 struct alc_spec *spec = codec->spec;
13915 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13917 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13921 if (!spec->autocfg.line_outs)
13922 return 0; /* can't find valid BIOS pin config */
13924 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13927 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13930 err = alc662_auto_create_extra_out(spec,
13931 spec->autocfg.speaker_pins[0],
13935 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13939 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13943 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13945 if (spec->autocfg.dig_out_pin)
13946 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13948 if (spec->kctl_alloc)
13949 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13951 spec->num_mux_defs = 1;
13952 spec->input_mux = &spec->private_imux;
13954 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13955 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13956 spec->num_mixers++;
13960 /* additional initialization for auto-configuration model */
13961 static void alc662_auto_init(struct hda_codec *codec)
13963 struct alc_spec *spec = codec->spec;
13964 alc662_auto_init_multi_out(codec);
13965 alc662_auto_init_hp_out(codec);
13966 alc662_auto_init_analog_input(codec);
13967 if (spec->unsol_event)
13968 alc_sku_automute(codec);
13971 static int patch_alc662(struct hda_codec *codec)
13973 struct alc_spec *spec;
13974 int err, board_config;
13976 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13980 codec->spec = spec;
13982 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13985 if (board_config < 0) {
13986 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13987 "trying auto-probe from BIOS...\n");
13988 board_config = ALC662_AUTO;
13991 if (board_config == ALC662_AUTO) {
13992 /* automatic parse from the BIOS config */
13993 err = alc662_parse_auto_config(codec);
13999 "hda_codec: Cannot set up configuration "
14000 "from BIOS. Using base mode...\n");
14001 board_config = ALC662_3ST_2ch_DIG;
14005 if (board_config != ALC662_AUTO)
14006 setup_preset(spec, &alc662_presets[board_config]);
14008 spec->stream_name_analog = "ALC662 Analog";
14009 spec->stream_analog_playback = &alc662_pcm_analog_playback;
14010 spec->stream_analog_capture = &alc662_pcm_analog_capture;
14012 spec->stream_name_digital = "ALC662 Digital";
14013 spec->stream_digital_playback = &alc662_pcm_digital_playback;
14014 spec->stream_digital_capture = &alc662_pcm_digital_capture;
14016 spec->adc_nids = alc662_adc_nids;
14017 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
14018 spec->capsrc_nids = alc662_capsrc_nids;
14020 spec->vmaster_nid = 0x02;
14022 codec->patch_ops = alc_patch_ops;
14023 if (board_config == ALC662_AUTO)
14024 spec->init_hook = alc662_auto_init;
14025 #ifdef CONFIG_SND_HDA_POWER_SAVE
14026 if (!spec->loopback.amplist)
14027 spec->loopback.amplist = alc662_loopbacks;
14036 struct hda_codec_preset snd_hda_preset_realtek[] = {
14037 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
14038 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
14039 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
14040 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
14041 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
14042 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
14043 .patch = patch_alc861 },
14044 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
14045 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
14046 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
14047 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
14048 .patch = patch_alc883 },
14049 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
14050 .patch = patch_alc662 },
14051 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
14052 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
14053 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
14054 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
14055 .patch = patch_alc882 }, /* should be patch_alc883() in future */
14056 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
14057 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
14058 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
14059 {} /* terminator */