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 <sound/driver.h>
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include "hda_codec.h"
33 #include "hda_local.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,
101 ALC262_MODEL_LAST /* last tag */
109 #ifdef CONFIG_SND_DEBUG
113 ALC268_MODEL_LAST /* last tag */
120 ALC269_MODEL_LAST /* last tag */
137 /* ALC861-VD models */
158 ALC662_ASUS_EEEPC_P701,
186 ALC883_TARGA_2ch_DIG,
192 ALC883_LENOVO_101E_2ch,
193 ALC883_LENOVO_NB0763,
194 ALC888_LENOVO_MS7195_DIG,
204 #define GPIO_MASK 0x03
207 /* codec parameterization */
208 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
209 unsigned int num_mixers;
211 const struct hda_verb *init_verbs[5]; /* initialization verbs
215 unsigned int num_init_verbs;
217 char *stream_name_analog; /* analog PCM stream */
218 struct hda_pcm_stream *stream_analog_playback;
219 struct hda_pcm_stream *stream_analog_capture;
221 char *stream_name_digital; /* digital PCM stream */
222 struct hda_pcm_stream *stream_digital_playback;
223 struct hda_pcm_stream *stream_digital_capture;
226 struct hda_multi_out multiout; /* playback set-up
227 * max_channels, dacs must be set
228 * dig_out_nid and hp_nid are optional
232 unsigned int num_adc_nids;
234 hda_nid_t dig_in_nid; /* digital-in NID; optional */
237 unsigned int num_mux_defs;
238 const struct hda_input_mux *input_mux;
239 unsigned int cur_mux[3];
242 const struct hda_channel_mode *channel_mode;
243 int num_channel_mode;
246 /* PCM information */
247 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
249 /* dynamic controls, init_verbs and input_mux */
250 struct auto_pin_cfg autocfg;
251 unsigned int num_kctl_alloc, num_kctl_used;
252 struct snd_kcontrol_new *kctl_alloc;
253 struct hda_input_mux private_imux;
254 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
257 void (*init_hook)(struct hda_codec *codec);
258 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
260 /* for pin sensing */
261 unsigned int sense_updated: 1;
262 unsigned int jack_present: 1;
264 #ifdef CONFIG_SND_HDA_POWER_SAVE
265 struct hda_loopback_check loopback;
270 * configuration template - to be copied to the spec instance
272 struct alc_config_preset {
273 struct snd_kcontrol_new *mixers[5]; /* should be identical size
276 const struct hda_verb *init_verbs[5];
277 unsigned int num_dacs;
279 hda_nid_t dig_out_nid; /* optional */
280 hda_nid_t hp_nid; /* optional */
281 unsigned int num_adc_nids;
283 hda_nid_t dig_in_nid;
284 unsigned int num_channel_mode;
285 const struct hda_channel_mode *channel_mode;
287 unsigned int num_mux_defs;
288 const struct hda_input_mux *input_mux;
289 void (*unsol_event)(struct hda_codec *, unsigned int);
290 void (*init_hook)(struct hda_codec *);
291 #ifdef CONFIG_SND_HDA_POWER_SAVE
292 struct hda_amp_list *loopbacks;
300 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
301 struct snd_ctl_elem_info *uinfo)
303 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
304 struct alc_spec *spec = codec->spec;
305 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
306 if (mux_idx >= spec->num_mux_defs)
308 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
311 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
312 struct snd_ctl_elem_value *ucontrol)
314 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
315 struct alc_spec *spec = codec->spec;
316 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
318 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
322 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
323 struct snd_ctl_elem_value *ucontrol)
325 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
326 struct alc_spec *spec = codec->spec;
327 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
328 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
329 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
330 spec->adc_nids[adc_idx],
331 &spec->cur_mux[adc_idx]);
336 * channel mode setting
338 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
339 struct snd_ctl_elem_info *uinfo)
341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
342 struct alc_spec *spec = codec->spec;
343 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
344 spec->num_channel_mode);
347 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_value *ucontrol)
350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
351 struct alc_spec *spec = codec->spec;
352 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
353 spec->num_channel_mode,
354 spec->multiout.max_channels);
357 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
358 struct snd_ctl_elem_value *ucontrol)
360 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
361 struct alc_spec *spec = codec->spec;
362 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
363 spec->num_channel_mode,
364 &spec->multiout.max_channels);
365 if (err >= 0 && spec->need_dac_fix)
366 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
371 * Control the mode of pin widget settings via the mixer. "pc" is used
372 * instead of "%" to avoid consequences of accidently treating the % as
373 * being part of a format specifier. Maximum allowed length of a value is
374 * 63 characters plus NULL terminator.
376 * Note: some retasking pin complexes seem to ignore requests for input
377 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
378 * are requested. Therefore order this list so that this behaviour will not
379 * cause problems when mixer clients move through the enum sequentially.
380 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
383 static char *alc_pin_mode_names[] = {
384 "Mic 50pc bias", "Mic 80pc bias",
385 "Line in", "Line out", "Headphone out",
387 static unsigned char alc_pin_mode_values[] = {
388 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
390 /* The control can present all 5 options, or it can limit the options based
391 * in the pin being assumed to be exclusively an input or an output pin. In
392 * addition, "input" pins may or may not process the mic bias option
393 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
394 * accept requests for bias as of chip versions up to March 2006) and/or
395 * wiring in the computer.
397 #define ALC_PIN_DIR_IN 0x00
398 #define ALC_PIN_DIR_OUT 0x01
399 #define ALC_PIN_DIR_INOUT 0x02
400 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
401 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
403 /* Info about the pin modes supported by the different pin direction modes.
404 * For each direction the minimum and maximum values are given.
406 static signed char alc_pin_mode_dir_info[5][2] = {
407 { 0, 2 }, /* ALC_PIN_DIR_IN */
408 { 3, 4 }, /* ALC_PIN_DIR_OUT */
409 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
410 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
411 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
413 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
414 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
415 #define alc_pin_mode_n_items(_dir) \
416 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
418 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
419 struct snd_ctl_elem_info *uinfo)
421 unsigned int item_num = uinfo->value.enumerated.item;
422 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
424 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
426 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
428 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
429 item_num = alc_pin_mode_min(dir);
430 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
434 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_value *ucontrol)
438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
439 hda_nid_t nid = kcontrol->private_value & 0xffff;
440 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
441 long *valp = ucontrol->value.integer.value;
442 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
443 AC_VERB_GET_PIN_WIDGET_CONTROL,
446 /* Find enumerated value for current pinctl setting */
447 i = alc_pin_mode_min(dir);
448 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
450 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
454 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
455 struct snd_ctl_elem_value *ucontrol)
458 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
459 hda_nid_t nid = kcontrol->private_value & 0xffff;
460 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
461 long val = *ucontrol->value.integer.value;
462 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
463 AC_VERB_GET_PIN_WIDGET_CONTROL,
466 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
467 val = alc_pin_mode_min(dir);
469 change = pinctl != alc_pin_mode_values[val];
471 /* Set pin mode to that requested */
472 snd_hda_codec_write_cache(codec, nid, 0,
473 AC_VERB_SET_PIN_WIDGET_CONTROL,
474 alc_pin_mode_values[val]);
476 /* Also enable the retasking pin's input/output as required
477 * for the requested pin mode. Enum values of 2 or less are
480 * Dynamically switching the input/output buffers probably
481 * reduces noise slightly (particularly on input) so we'll
482 * do it. However, having both input and output buffers
483 * enabled simultaneously doesn't seem to be problematic if
484 * this turns out to be necessary in the future.
487 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
488 HDA_AMP_MUTE, HDA_AMP_MUTE);
489 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
492 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
493 HDA_AMP_MUTE, HDA_AMP_MUTE);
494 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
501 #define ALC_PIN_MODE(xname, nid, dir) \
502 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
503 .info = alc_pin_mode_info, \
504 .get = alc_pin_mode_get, \
505 .put = alc_pin_mode_put, \
506 .private_value = nid | (dir<<16) }
508 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
509 * together using a mask with more than one bit set. This control is
510 * currently used only by the ALC260 test model. At this stage they are not
511 * needed for any "production" models.
513 #ifdef CONFIG_SND_DEBUG
514 #define alc_gpio_data_info snd_ctl_boolean_mono_info
516 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
517 struct snd_ctl_elem_value *ucontrol)
519 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
520 hda_nid_t nid = kcontrol->private_value & 0xffff;
521 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
522 long *valp = ucontrol->value.integer.value;
523 unsigned int val = snd_hda_codec_read(codec, nid, 0,
524 AC_VERB_GET_GPIO_DATA, 0x00);
526 *valp = (val & mask) != 0;
529 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
530 struct snd_ctl_elem_value *ucontrol)
533 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
534 hda_nid_t nid = kcontrol->private_value & 0xffff;
535 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
536 long val = *ucontrol->value.integer.value;
537 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
538 AC_VERB_GET_GPIO_DATA,
541 /* Set/unset the masked GPIO bit(s) as needed */
542 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
547 snd_hda_codec_write_cache(codec, nid, 0,
548 AC_VERB_SET_GPIO_DATA, gpio_data);
552 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
553 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
554 .info = alc_gpio_data_info, \
555 .get = alc_gpio_data_get, \
556 .put = alc_gpio_data_put, \
557 .private_value = nid | (mask<<16) }
558 #endif /* CONFIG_SND_DEBUG */
560 /* A switch control to allow the enabling of the digital IO pins on the
561 * ALC260. This is incredibly simplistic; the intention of this control is
562 * to provide something in the test model allowing digital outputs to be
563 * identified if present. If models are found which can utilise these
564 * outputs a more complete mixer control can be devised for those models if
567 #ifdef CONFIG_SND_DEBUG
568 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
570 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
571 struct snd_ctl_elem_value *ucontrol)
573 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
574 hda_nid_t nid = kcontrol->private_value & 0xffff;
575 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
576 long *valp = ucontrol->value.integer.value;
577 unsigned int val = snd_hda_codec_read(codec, nid, 0,
578 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
580 *valp = (val & mask) != 0;
583 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
584 struct snd_ctl_elem_value *ucontrol)
587 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
588 hda_nid_t nid = kcontrol->private_value & 0xffff;
589 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
590 long val = *ucontrol->value.integer.value;
591 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
592 AC_VERB_GET_DIGI_CONVERT_1,
595 /* Set/unset the masked control bit(s) as needed */
596 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
601 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
606 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
607 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
608 .info = alc_spdif_ctrl_info, \
609 .get = alc_spdif_ctrl_get, \
610 .put = alc_spdif_ctrl_put, \
611 .private_value = nid | (mask<<16) }
612 #endif /* CONFIG_SND_DEBUG */
614 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
615 * Again, this is only used in the ALC26x test models to help identify when
616 * the EAPD line must be asserted for features to work.
618 #ifdef CONFIG_SND_DEBUG
619 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
621 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
622 struct snd_ctl_elem_value *ucontrol)
624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
625 hda_nid_t nid = kcontrol->private_value & 0xffff;
626 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
627 long *valp = ucontrol->value.integer.value;
628 unsigned int val = snd_hda_codec_read(codec, nid, 0,
629 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
631 *valp = (val & mask) != 0;
635 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
636 struct snd_ctl_elem_value *ucontrol)
639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
640 hda_nid_t nid = kcontrol->private_value & 0xffff;
641 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
642 long val = *ucontrol->value.integer.value;
643 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
644 AC_VERB_GET_EAPD_BTLENABLE,
647 /* Set/unset the masked control bit(s) as needed */
648 change = (!val ? 0 : mask) != (ctrl_data & mask);
653 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
659 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
660 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
661 .info = alc_eapd_ctrl_info, \
662 .get = alc_eapd_ctrl_get, \
663 .put = alc_eapd_ctrl_put, \
664 .private_value = nid | (mask<<16) }
665 #endif /* CONFIG_SND_DEBUG */
668 * set up from the preset table
670 static void setup_preset(struct alc_spec *spec,
671 const struct alc_config_preset *preset)
675 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
676 spec->mixers[spec->num_mixers++] = preset->mixers[i];
677 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
679 spec->init_verbs[spec->num_init_verbs++] =
680 preset->init_verbs[i];
682 spec->channel_mode = preset->channel_mode;
683 spec->num_channel_mode = preset->num_channel_mode;
684 spec->need_dac_fix = preset->need_dac_fix;
686 spec->multiout.max_channels = spec->channel_mode[0].channels;
688 spec->multiout.num_dacs = preset->num_dacs;
689 spec->multiout.dac_nids = preset->dac_nids;
690 spec->multiout.dig_out_nid = preset->dig_out_nid;
691 spec->multiout.hp_nid = preset->hp_nid;
693 spec->num_mux_defs = preset->num_mux_defs;
694 if (!spec->num_mux_defs)
695 spec->num_mux_defs = 1;
696 spec->input_mux = preset->input_mux;
698 spec->num_adc_nids = preset->num_adc_nids;
699 spec->adc_nids = preset->adc_nids;
700 spec->dig_in_nid = preset->dig_in_nid;
702 spec->unsol_event = preset->unsol_event;
703 spec->init_hook = preset->init_hook;
704 #ifdef CONFIG_SND_HDA_POWER_SAVE
705 spec->loopback.amplist = preset->loopbacks;
709 /* Enable GPIO mask and set output */
710 static struct hda_verb alc_gpio1_init_verbs[] = {
711 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
712 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
713 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
717 static struct hda_verb alc_gpio2_init_verbs[] = {
718 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
719 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
720 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
724 static struct hda_verb alc_gpio3_init_verbs[] = {
725 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
726 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
727 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
731 static void alc_sku_automute(struct hda_codec *codec)
733 struct alc_spec *spec = codec->spec;
735 unsigned int present;
736 unsigned int hp_nid = spec->autocfg.hp_pins[0];
737 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
739 /* need to execute and sync at first */
740 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
741 present = snd_hda_codec_read(codec, hp_nid, 0,
742 AC_VERB_GET_PIN_SENSE, 0);
743 spec->jack_present = (present & 0x80000000) != 0;
744 if (spec->jack_present) {
745 /* mute internal speaker */
746 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
747 HDA_AMP_MUTE, HDA_AMP_MUTE);
749 /* unmute internal speaker if necessary */
750 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
751 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
756 /* unsolicited event for HP jack sensing */
757 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
759 if (codec->vendor_id == 0x10ec0880)
763 if (res != ALC880_HP_EVENT)
766 alc_sku_automute(codec);
769 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
770 * 31 ~ 16 : Manufacture ID
772 * 7 ~ 0 : Assembly ID
773 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
775 static void alc_subsystem_id(struct hda_codec *codec,
776 unsigned int porta, unsigned int porte,
779 unsigned int ass, tmp, i;
781 struct alc_spec *spec = codec->spec;
783 ass = codec->subsystem_id & 0xffff;
784 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
788 * 31~30 : port conetcivity
791 * 19~16 : Check sum (15:1)
796 if (codec->vendor_id == 0x10ec0260)
798 ass = snd_hda_codec_read(codec, nid, 0,
799 AC_VERB_GET_CONFIG_DEFAULT, 0);
800 if (!(ass & 1) && !(ass & 0x100000))
802 if ((ass >> 30) != 1) /* no physical connection */
807 for (i = 1; i < 16; i++) {
811 if (((ass >> 16) & 0xf) != tmp)
817 * 2 : 0 --> Desktop, 1 --> Laptop
818 * 3~5 : External Amplifier control
821 tmp = (ass & 0x38) >> 3; /* external Amp control */
824 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
827 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
830 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
832 case 5: /* set EAPD output high */
833 switch (codec->vendor_id) {
835 snd_hda_codec_write(codec, 0x0f, 0,
836 AC_VERB_SET_EAPD_BTLENABLE, 2);
837 snd_hda_codec_write(codec, 0x10, 0,
838 AC_VERB_SET_EAPD_BTLENABLE, 2);
846 snd_hda_codec_write(codec, 0x14, 0,
847 AC_VERB_SET_EAPD_BTLENABLE, 2);
848 snd_hda_codec_write(codec, 0x15, 0,
849 AC_VERB_SET_EAPD_BTLENABLE, 2);
852 switch (codec->vendor_id) {
854 snd_hda_codec_write(codec, 0x1a, 0,
855 AC_VERB_SET_COEF_INDEX, 7);
856 tmp = snd_hda_codec_read(codec, 0x1a, 0,
857 AC_VERB_GET_PROC_COEF, 0);
858 snd_hda_codec_write(codec, 0x1a, 0,
859 AC_VERB_SET_COEF_INDEX, 7);
860 snd_hda_codec_write(codec, 0x1a, 0,
861 AC_VERB_SET_PROC_COEF,
870 snd_hda_codec_write(codec, 0x20, 0,
871 AC_VERB_SET_COEF_INDEX, 7);
872 tmp = snd_hda_codec_read(codec, 0x20, 0,
873 AC_VERB_GET_PROC_COEF, 0);
874 snd_hda_codec_write(codec, 0x20, 0,
875 AC_VERB_SET_COEF_INDEX, 7);
876 snd_hda_codec_write(codec, 0x20, 0,
877 AC_VERB_SET_PROC_COEF,
882 snd_hda_codec_write(codec, 0x20, 0,
883 AC_VERB_SET_COEF_INDEX, 7);
884 tmp = snd_hda_codec_read(codec, 0x20, 0,
885 AC_VERB_GET_PROC_COEF, 0);
886 snd_hda_codec_write(codec, 0x20, 0,
887 AC_VERB_SET_COEF_INDEX, 7);
888 snd_hda_codec_write(codec, 0x20, 0,
889 AC_VERB_SET_PROC_COEF,
897 /* is laptop and enable the function "Mute internal speaker
898 * when the external headphone out jack is plugged"
900 if (!(ass & 0x4) || !(ass & 0x8000))
903 * 10~8 : Jack location
904 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
906 * 15 : 1 --> enable the function "Mute internal speaker
907 * when the external headphone out jack is plugged"
909 if (!spec->autocfg.speaker_pins[0]) {
910 if (spec->multiout.dac_nids[0])
911 spec->autocfg.speaker_pins[0] =
912 spec->multiout.dac_nids[0];
917 if (!spec->autocfg.hp_pins[0]) {
918 tmp = (ass >> 11) & 0x3; /* HP to chassis */
920 spec->autocfg.hp_pins[0] = porta;
922 spec->autocfg.hp_pins[0] = porte;
924 spec->autocfg.hp_pins[0] = portd;
929 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
930 AC_VERB_SET_UNSOLICITED_ENABLE,
931 AC_USRSP_EN | ALC880_HP_EVENT);
932 spec->unsol_event = alc_sku_unsol_event;
933 spec->init_hook = alc_sku_automute;
937 * Fix-up pin default configurations
945 static void alc_fix_pincfg(struct hda_codec *codec,
946 const struct snd_pci_quirk *quirk,
947 const struct alc_pincfg **pinfix)
949 const struct alc_pincfg *cfg;
951 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
955 cfg = pinfix[quirk->value];
956 for (; cfg->nid; cfg++) {
959 for (i = 0; i < 4; i++) {
960 snd_hda_codec_write(codec, cfg->nid, 0,
961 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
969 * ALC880 3-stack model
971 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
972 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
973 * F-Mic = 0x1b, HP = 0x19
976 static hda_nid_t alc880_dac_nids[4] = {
977 /* front, rear, clfe, rear_surr */
978 0x02, 0x05, 0x04, 0x03
981 static hda_nid_t alc880_adc_nids[3] = {
986 /* The datasheet says the node 0x07 is connected from inputs,
987 * but it shows zero connection in the real implementation on some devices.
988 * Note: this is a 915GAV bug, fixed on 915GLV
990 static hda_nid_t alc880_adc_nids_alt[2] = {
995 #define ALC880_DIGOUT_NID 0x06
996 #define ALC880_DIGIN_NID 0x0a
998 static struct hda_input_mux alc880_capture_source = {
1002 { "Front Mic", 0x3 },
1008 /* channel source setting (2/6 channel selection for 3-stack) */
1010 static struct hda_verb alc880_threestack_ch2_init[] = {
1011 /* set line-in to input, mute it */
1012 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1013 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1014 /* set mic-in to input vref 80%, mute it */
1015 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1016 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1021 static struct hda_verb alc880_threestack_ch6_init[] = {
1022 /* set line-in to output, unmute it */
1023 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1024 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1025 /* set mic-in to output, unmute it */
1026 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1027 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1031 static struct hda_channel_mode alc880_threestack_modes[2] = {
1032 { 2, alc880_threestack_ch2_init },
1033 { 6, alc880_threestack_ch6_init },
1036 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1038 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1040 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1041 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1042 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1043 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1044 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1045 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1046 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1053 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1054 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1057 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1058 .name = "Channel Mode",
1059 .info = alc_ch_mode_info,
1060 .get = alc_ch_mode_get,
1061 .put = alc_ch_mode_put,
1066 /* capture mixer elements */
1067 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1068 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1069 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1070 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1071 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1072 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1073 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1076 /* The multiple "Capture Source" controls confuse alsamixer
1077 * So call somewhat different..
1078 * FIXME: the controls appear in the "playback" view!
1080 /* .name = "Capture Source", */
1081 .name = "Input Source",
1083 .info = alc_mux_enum_info,
1084 .get = alc_mux_enum_get,
1085 .put = alc_mux_enum_put,
1090 /* capture mixer elements (in case NID 0x07 not available) */
1091 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1092 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1093 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1094 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1095 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1098 /* The multiple "Capture Source" controls confuse alsamixer
1099 * So call somewhat different..
1100 * FIXME: the controls appear in the "playback" view!
1102 /* .name = "Capture Source", */
1103 .name = "Input Source",
1105 .info = alc_mux_enum_info,
1106 .get = alc_mux_enum_get,
1107 .put = alc_mux_enum_put,
1115 * ALC880 5-stack model
1117 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1119 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1120 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1123 /* additional mixers to alc880_three_stack_mixer */
1124 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1125 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1126 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1130 /* channel source setting (6/8 channel selection for 5-stack) */
1132 static struct hda_verb alc880_fivestack_ch6_init[] = {
1133 /* set line-in to input, mute it */
1134 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1135 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1140 static struct hda_verb alc880_fivestack_ch8_init[] = {
1141 /* set line-in to output, unmute it */
1142 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1143 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1147 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1148 { 6, alc880_fivestack_ch6_init },
1149 { 8, alc880_fivestack_ch8_init },
1154 * ALC880 6-stack model
1156 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1157 * Side = 0x05 (0x0f)
1158 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1159 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1162 static hda_nid_t alc880_6st_dac_nids[4] = {
1163 /* front, rear, clfe, rear_surr */
1164 0x02, 0x03, 0x04, 0x05
1167 static struct hda_input_mux alc880_6stack_capture_source = {
1171 { "Front Mic", 0x1 },
1177 /* fixed 8-channels */
1178 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1182 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1188 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1189 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1190 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1191 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1192 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1201 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1202 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1205 .name = "Channel Mode",
1206 .info = alc_ch_mode_info,
1207 .get = alc_ch_mode_get,
1208 .put = alc_ch_mode_put,
1217 * W810 has rear IO for:
1220 * Center/LFE (DAC 04)
1223 * The system also has a pair of internal speakers, and a headphone jack.
1224 * These are both connected to Line2 on the codec, hence to DAC 02.
1226 * There is a variable resistor to control the speaker or headphone
1227 * volume. This is a hardware-only device without a software API.
1229 * Plugging headphones in will disable the internal speakers. This is
1230 * implemented in hardware, not via the driver using jack sense. In
1231 * a similar fashion, plugging into the rear socket marked "front" will
1232 * disable both the speakers and headphones.
1234 * For input, there's a microphone jack, and an "audio in" jack.
1235 * These may not do anything useful with this driver yet, because I
1236 * haven't setup any initialization verbs for these yet...
1239 static hda_nid_t alc880_w810_dac_nids[3] = {
1240 /* front, rear/surround, clfe */
1244 /* fixed 6 channels */
1245 static struct hda_channel_mode alc880_w810_modes[1] = {
1249 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1250 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1252 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1253 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1254 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1255 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1256 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1257 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1258 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1267 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1268 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1272 static hda_nid_t alc880_z71v_dac_nids[1] = {
1275 #define ALC880_Z71V_HP_DAC 0x03
1277 /* fixed 2 channels */
1278 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1282 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1283 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1284 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1285 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1286 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1287 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1288 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1297 * ALC880 F1734 model
1299 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1300 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1303 static hda_nid_t alc880_f1734_dac_nids[1] = {
1306 #define ALC880_F1734_HP_DAC 0x02
1308 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1310 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1311 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1312 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1325 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1326 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1327 * Mic = 0x18, Line = 0x1a
1330 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1331 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1333 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1334 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1335 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1336 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1337 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1338 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1339 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1340 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1341 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1342 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1343 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1350 .name = "Channel Mode",
1351 .info = alc_ch_mode_info,
1352 .get = alc_ch_mode_get,
1353 .put = alc_ch_mode_put,
1360 * ALC880 ASUS W1V model
1362 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1363 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1364 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1367 /* additional mixers to alc880_asus_mixer */
1368 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1369 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1370 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1374 /* additional mixers to alc880_asus_mixer */
1375 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1376 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1377 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1382 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1383 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1384 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1387 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1388 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1389 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1390 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1391 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1394 /* The multiple "Capture Source" controls confuse alsamixer
1395 * So call somewhat different..
1396 * FIXME: the controls appear in the "playback" view!
1398 /* .name = "Capture Source", */
1399 .name = "Input Source",
1401 .info = alc_mux_enum_info,
1402 .get = alc_mux_enum_get,
1403 .put = alc_mux_enum_put,
1409 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1410 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1411 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1412 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1413 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1414 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1415 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1416 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1417 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1420 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1421 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1424 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1425 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1426 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1427 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1429 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1430 .name = "Channel Mode",
1431 .info = alc_ch_mode_info,
1432 .get = alc_ch_mode_get,
1433 .put = alc_ch_mode_put,
1438 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1439 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1440 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1441 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1442 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1445 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1446 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1447 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1448 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1452 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1453 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1454 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1455 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1456 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1463 * build control elements
1465 static int alc_build_controls(struct hda_codec *codec)
1467 struct alc_spec *spec = codec->spec;
1471 for (i = 0; i < spec->num_mixers; i++) {
1472 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1477 if (spec->multiout.dig_out_nid) {
1478 err = snd_hda_create_spdif_out_ctls(codec,
1479 spec->multiout.dig_out_nid);
1483 if (spec->dig_in_nid) {
1484 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1493 * initialize the codec volumes, etc
1497 * generic initialization of ADC, input mixers and output mixers
1499 static struct hda_verb alc880_volume_init_verbs[] = {
1501 * Unmute ADC0-2 and set the default input to mic-in
1503 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1505 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1506 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1507 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1510 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1512 * Note: PASD motherboards uses the Line In 2 as the input for front
1515 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1525 * Set up output mixers (0x0c - 0x0f)
1527 /* set vol=0 to output mixers */
1528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1529 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1531 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1532 /* set up input amps for analog loopback */
1533 /* Amp Indices: DAC = 0, mixer = 1 */
1534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1536 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1538 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1541 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1547 * 3-stack pin configuration:
1548 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1550 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1552 * preset connection lists of input pins
1553 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1555 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1556 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1557 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1560 * Set pin mode and muting
1562 /* set front pin widgets 0x14 for output */
1563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1565 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1566 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1567 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1568 /* Mic2 (as headphone out) for HP output */
1569 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1571 /* Line In pin widget for input */
1572 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1573 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1574 /* Line2 (as front mic) pin widget for input and vref at 80% */
1575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1576 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1577 /* CD pin widget for input */
1578 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1584 * 5-stack pin configuration:
1585 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1586 * line-in/side = 0x1a, f-mic = 0x1b
1588 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1590 * preset connection lists of input pins
1591 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1593 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1594 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1597 * Set pin mode and muting
1599 /* set pin widgets 0x14-0x17 for output */
1600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1603 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1604 /* unmute pins for output (no gain on this amp) */
1605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1607 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1608 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1611 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1613 /* Mic2 (as headphone out) for HP output */
1614 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1616 /* Line In pin widget for input */
1617 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1618 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1619 /* Line2 (as front mic) pin widget for input and vref at 80% */
1620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1621 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1622 /* CD pin widget for input */
1623 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1629 * W810 pin configuration:
1630 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1632 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1633 /* hphone/speaker input selector: front DAC */
1634 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1637 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1640 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1641 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1643 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1644 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1650 * Z71V pin configuration:
1651 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1653 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1660 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1661 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1662 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1668 * 6-stack pin configuration:
1669 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1670 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1672 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1673 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1676 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1677 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1680 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1681 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1682 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1684 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1686 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1688 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1689 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1691 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1698 * Uniwill pin configuration:
1699 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1702 static struct hda_verb alc880_uniwill_init_verbs[] = {
1703 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1705 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1706 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1709 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1710 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1712 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1713 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1715 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1716 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1717 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1718 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1723 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1725 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1726 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1727 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1728 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1730 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1731 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1738 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1740 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1741 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1744 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1747 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1748 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1756 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1757 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1758 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1759 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1760 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1763 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1764 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1769 static struct hda_verb alc880_beep_init_verbs[] = {
1770 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1774 /* toggle speaker-output according to the hp-jack state */
1775 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1777 unsigned int present;
1780 present = snd_hda_codec_read(codec, 0x14, 0,
1781 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1782 bits = present ? HDA_AMP_MUTE : 0;
1783 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1784 HDA_AMP_MUTE, bits);
1785 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1786 HDA_AMP_MUTE, bits);
1789 /* auto-toggle front mic */
1790 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1792 unsigned int present;
1795 present = snd_hda_codec_read(codec, 0x18, 0,
1796 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1797 bits = present ? HDA_AMP_MUTE : 0;
1798 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1801 static void alc880_uniwill_automute(struct hda_codec *codec)
1803 alc880_uniwill_hp_automute(codec);
1804 alc880_uniwill_mic_automute(codec);
1807 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1810 /* Looks like the unsol event is incompatible with the standard
1811 * definition. 4bit tag is placed at 28 bit!
1813 switch (res >> 28) {
1814 case ALC880_HP_EVENT:
1815 alc880_uniwill_hp_automute(codec);
1817 case ALC880_MIC_EVENT:
1818 alc880_uniwill_mic_automute(codec);
1823 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1825 unsigned int present;
1828 present = snd_hda_codec_read(codec, 0x14, 0,
1829 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1830 bits = present ? HDA_AMP_MUTE : 0;
1831 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1834 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1836 unsigned int present;
1838 present = snd_hda_codec_read(codec, 0x21, 0,
1839 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1840 present &= HDA_AMP_VOLMASK;
1841 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1842 HDA_AMP_VOLMASK, present);
1843 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1844 HDA_AMP_VOLMASK, present);
1847 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1850 /* Looks like the unsol event is incompatible with the standard
1851 * definition. 4bit tag is placed at 28 bit!
1853 if ((res >> 28) == ALC880_HP_EVENT)
1854 alc880_uniwill_p53_hp_automute(codec);
1855 if ((res >> 28) == ALC880_DCVOL_EVENT)
1856 alc880_uniwill_p53_dcvol_automute(codec);
1861 * F1734 pin configuration:
1862 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1864 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1865 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1866 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1867 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1868 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1875 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1876 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1877 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1878 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1882 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1883 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1890 * ASUS pin configuration:
1891 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1893 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1894 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1895 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1896 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1897 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1900 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1903 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1905 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1906 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1908 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1910 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1911 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1913 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1914 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1915 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1916 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1921 /* Enable GPIO mask and set output */
1922 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1923 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1925 /* Clevo m520g init */
1926 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1927 /* headphone output */
1928 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1931 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1936 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1937 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1938 /* Mic1 (rear panel) */
1939 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1941 /* Mic2 (front panel) */
1942 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1943 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1947 /* change to EAPD mode */
1948 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1949 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1954 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1955 /* change to EAPD mode */
1956 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1957 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1959 /* Headphone output */
1960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1963 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1965 /* Line In pin widget for input */
1966 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1967 /* CD pin widget for input */
1968 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1969 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1972 /* change to EAPD mode */
1973 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1974 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1980 * LG m1 express dual
1983 * Rear Line-In/Out (blue): 0x14
1984 * Build-in Mic-In: 0x15
1986 * HP-Out (green): 0x1b
1987 * Mic-In/Out (red): 0x19
1991 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1992 static hda_nid_t alc880_lg_dac_nids[3] = {
1996 /* seems analog CD is not working */
1997 static struct hda_input_mux alc880_lg_capture_source = {
2002 { "Internal Mic", 0x6 },
2006 /* 2,4,6 channel modes */
2007 static struct hda_verb alc880_lg_ch2_init[] = {
2008 /* set line-in and mic-in to input */
2009 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2010 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2014 static struct hda_verb alc880_lg_ch4_init[] = {
2015 /* set line-in to out and mic-in to input */
2016 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2017 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2021 static struct hda_verb alc880_lg_ch6_init[] = {
2022 /* set line-in and mic-in to output */
2023 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2024 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2028 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2029 { 2, alc880_lg_ch2_init },
2030 { 4, alc880_lg_ch4_init },
2031 { 6, alc880_lg_ch6_init },
2034 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2035 /* FIXME: it's not really "master" but front channels */
2036 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2037 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
2038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2039 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2048 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2049 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2052 .name = "Channel Mode",
2053 .info = alc_ch_mode_info,
2054 .get = alc_ch_mode_get,
2055 .put = alc_ch_mode_put,
2060 static struct hda_verb alc880_lg_init_verbs[] = {
2061 /* set capture source to mic-in */
2062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2064 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2065 /* mute all amp mixer inputs */
2066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2069 /* line-in to input */
2070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2076 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2077 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2078 /* mic-in to input */
2079 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2083 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2084 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2085 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2087 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2091 /* toggle speaker-output according to the hp-jack state */
2092 static void alc880_lg_automute(struct hda_codec *codec)
2094 unsigned int present;
2097 present = snd_hda_codec_read(codec, 0x1b, 0,
2098 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2099 bits = present ? HDA_AMP_MUTE : 0;
2100 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2101 HDA_AMP_MUTE, bits);
2104 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2106 /* Looks like the unsol event is incompatible with the standard
2107 * definition. 4bit tag is placed at 28 bit!
2109 if ((res >> 28) == 0x01)
2110 alc880_lg_automute(codec);
2119 * Built-in Mic-In: 0x19
2125 static struct hda_input_mux alc880_lg_lw_capture_source = {
2129 { "Internal Mic", 0x1 },
2134 #define alc880_lg_lw_modes alc880_threestack_modes
2136 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2139 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2140 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2141 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2143 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2144 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2149 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2150 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2153 .name = "Channel Mode",
2154 .info = alc_ch_mode_info,
2155 .get = alc_ch_mode_get,
2156 .put = alc_ch_mode_put,
2161 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2162 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2163 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2164 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2166 /* set capture source to mic-in */
2167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2172 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2173 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2175 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2176 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2177 /* mic-in to input */
2178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2181 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2184 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2188 /* toggle speaker-output according to the hp-jack state */
2189 static void alc880_lg_lw_automute(struct hda_codec *codec)
2191 unsigned int present;
2194 present = snd_hda_codec_read(codec, 0x1b, 0,
2195 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2196 bits = present ? HDA_AMP_MUTE : 0;
2197 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2198 HDA_AMP_MUTE, bits);
2201 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2203 /* Looks like the unsol event is incompatible with the standard
2204 * definition. 4bit tag is placed at 28 bit!
2206 if ((res >> 28) == 0x01)
2207 alc880_lg_lw_automute(codec);
2210 #ifdef CONFIG_SND_HDA_POWER_SAVE
2211 static struct hda_amp_list alc880_loopbacks[] = {
2212 { 0x0b, HDA_INPUT, 0 },
2213 { 0x0b, HDA_INPUT, 1 },
2214 { 0x0b, HDA_INPUT, 2 },
2215 { 0x0b, HDA_INPUT, 3 },
2216 { 0x0b, HDA_INPUT, 4 },
2220 static struct hda_amp_list alc880_lg_loopbacks[] = {
2221 { 0x0b, HDA_INPUT, 1 },
2222 { 0x0b, HDA_INPUT, 6 },
2223 { 0x0b, HDA_INPUT, 7 },
2232 static int alc_init(struct hda_codec *codec)
2234 struct alc_spec *spec = codec->spec;
2237 for (i = 0; i < spec->num_init_verbs; i++)
2238 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2240 if (spec->init_hook)
2241 spec->init_hook(codec);
2246 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2248 struct alc_spec *spec = codec->spec;
2250 if (spec->unsol_event)
2251 spec->unsol_event(codec, res);
2254 #ifdef CONFIG_SND_HDA_POWER_SAVE
2255 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2257 struct alc_spec *spec = codec->spec;
2258 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2263 * Analog playback callbacks
2265 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2266 struct hda_codec *codec,
2267 struct snd_pcm_substream *substream)
2269 struct alc_spec *spec = codec->spec;
2270 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2273 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2274 struct hda_codec *codec,
2275 unsigned int stream_tag,
2276 unsigned int format,
2277 struct snd_pcm_substream *substream)
2279 struct alc_spec *spec = codec->spec;
2280 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2281 stream_tag, format, substream);
2284 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2285 struct hda_codec *codec,
2286 struct snd_pcm_substream *substream)
2288 struct alc_spec *spec = codec->spec;
2289 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2295 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2296 struct hda_codec *codec,
2297 struct snd_pcm_substream *substream)
2299 struct alc_spec *spec = codec->spec;
2300 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2303 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2304 struct hda_codec *codec,
2305 unsigned int stream_tag,
2306 unsigned int format,
2307 struct snd_pcm_substream *substream)
2309 struct alc_spec *spec = codec->spec;
2310 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2311 stream_tag, format, substream);
2314 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2315 struct hda_codec *codec,
2316 struct snd_pcm_substream *substream)
2318 struct alc_spec *spec = codec->spec;
2319 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2325 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2326 struct hda_codec *codec,
2327 unsigned int stream_tag,
2328 unsigned int format,
2329 struct snd_pcm_substream *substream)
2331 struct alc_spec *spec = codec->spec;
2333 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2334 stream_tag, 0, format);
2338 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2339 struct hda_codec *codec,
2340 struct snd_pcm_substream *substream)
2342 struct alc_spec *spec = codec->spec;
2344 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2352 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2356 /* NID is set in alc_build_pcms */
2358 .open = alc880_playback_pcm_open,
2359 .prepare = alc880_playback_pcm_prepare,
2360 .cleanup = alc880_playback_pcm_cleanup
2364 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2368 /* NID is set in alc_build_pcms */
2370 .prepare = alc880_capture_pcm_prepare,
2371 .cleanup = alc880_capture_pcm_cleanup
2375 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2379 /* NID is set in alc_build_pcms */
2381 .open = alc880_dig_playback_pcm_open,
2382 .close = alc880_dig_playback_pcm_close,
2383 .prepare = alc880_dig_playback_pcm_prepare
2387 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2391 /* NID is set in alc_build_pcms */
2394 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2395 static struct hda_pcm_stream alc_pcm_null_playback = {
2401 static int alc_build_pcms(struct hda_codec *codec)
2403 struct alc_spec *spec = codec->spec;
2404 struct hda_pcm *info = spec->pcm_rec;
2407 codec->num_pcms = 1;
2408 codec->pcm_info = info;
2410 info->name = spec->stream_name_analog;
2411 if (spec->stream_analog_playback) {
2412 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2413 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2414 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2416 if (spec->stream_analog_capture) {
2417 snd_assert(spec->adc_nids, return -EINVAL);
2418 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2419 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2422 if (spec->channel_mode) {
2423 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2424 for (i = 0; i < spec->num_channel_mode; i++) {
2425 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2426 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2431 /* SPDIF for stream index #1 */
2432 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2433 codec->num_pcms = 2;
2434 info = spec->pcm_rec + 1;
2435 info->name = spec->stream_name_digital;
2436 if (spec->multiout.dig_out_nid &&
2437 spec->stream_digital_playback) {
2438 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2439 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2441 if (spec->dig_in_nid &&
2442 spec->stream_digital_capture) {
2443 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2444 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2448 /* If the use of more than one ADC is requested for the current
2449 * model, configure a second analog capture-only PCM.
2451 /* Additional Analaog capture for index #2 */
2452 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2454 codec->num_pcms = 3;
2455 info = spec->pcm_rec + 2;
2456 info->name = spec->stream_name_analog;
2457 /* No playback stream for second PCM */
2458 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2459 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2460 if (spec->stream_analog_capture) {
2461 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2462 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2469 static void alc_free(struct hda_codec *codec)
2471 struct alc_spec *spec = codec->spec;
2477 if (spec->kctl_alloc) {
2478 for (i = 0; i < spec->num_kctl_used; i++)
2479 kfree(spec->kctl_alloc[i].name);
2480 kfree(spec->kctl_alloc);
2487 static struct hda_codec_ops alc_patch_ops = {
2488 .build_controls = alc_build_controls,
2489 .build_pcms = alc_build_pcms,
2492 .unsol_event = alc_unsol_event,
2493 #ifdef CONFIG_SND_HDA_POWER_SAVE
2494 .check_power_status = alc_check_power_status,
2500 * Test configuration for debugging
2502 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2505 #ifdef CONFIG_SND_DEBUG
2506 static hda_nid_t alc880_test_dac_nids[4] = {
2507 0x02, 0x03, 0x04, 0x05
2510 static struct hda_input_mux alc880_test_capture_source = {
2519 { "Surround", 0x6 },
2523 static struct hda_channel_mode alc880_test_modes[4] = {
2530 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2531 struct snd_ctl_elem_info *uinfo)
2533 static char *texts[] = {
2534 "N/A", "Line Out", "HP Out",
2535 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2537 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2539 uinfo->value.enumerated.items = 8;
2540 if (uinfo->value.enumerated.item >= 8)
2541 uinfo->value.enumerated.item = 7;
2542 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2546 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2547 struct snd_ctl_elem_value *ucontrol)
2549 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2550 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2551 unsigned int pin_ctl, item = 0;
2553 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2554 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2555 if (pin_ctl & AC_PINCTL_OUT_EN) {
2556 if (pin_ctl & AC_PINCTL_HP_EN)
2560 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2561 switch (pin_ctl & AC_PINCTL_VREFEN) {
2562 case AC_PINCTL_VREF_HIZ: item = 3; break;
2563 case AC_PINCTL_VREF_50: item = 4; break;
2564 case AC_PINCTL_VREF_GRD: item = 5; break;
2565 case AC_PINCTL_VREF_80: item = 6; break;
2566 case AC_PINCTL_VREF_100: item = 7; break;
2569 ucontrol->value.enumerated.item[0] = item;
2573 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2574 struct snd_ctl_elem_value *ucontrol)
2576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2577 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2578 static unsigned int ctls[] = {
2579 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2580 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2581 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2582 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2583 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2584 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2586 unsigned int old_ctl, new_ctl;
2588 old_ctl = snd_hda_codec_read(codec, nid, 0,
2589 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2590 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2591 if (old_ctl != new_ctl) {
2593 snd_hda_codec_write_cache(codec, nid, 0,
2594 AC_VERB_SET_PIN_WIDGET_CONTROL,
2596 val = ucontrol->value.enumerated.item[0] >= 3 ?
2598 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2605 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2606 struct snd_ctl_elem_info *uinfo)
2608 static char *texts[] = {
2609 "Front", "Surround", "CLFE", "Side"
2611 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2613 uinfo->value.enumerated.items = 4;
2614 if (uinfo->value.enumerated.item >= 4)
2615 uinfo->value.enumerated.item = 3;
2616 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2620 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2621 struct snd_ctl_elem_value *ucontrol)
2623 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2624 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2627 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2628 ucontrol->value.enumerated.item[0] = sel & 3;
2632 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2633 struct snd_ctl_elem_value *ucontrol)
2635 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2636 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2639 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2640 if (ucontrol->value.enumerated.item[0] != sel) {
2641 sel = ucontrol->value.enumerated.item[0] & 3;
2642 snd_hda_codec_write_cache(codec, nid, 0,
2643 AC_VERB_SET_CONNECT_SEL, sel);
2649 #define PIN_CTL_TEST(xname,nid) { \
2650 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2652 .info = alc_test_pin_ctl_info, \
2653 .get = alc_test_pin_ctl_get, \
2654 .put = alc_test_pin_ctl_put, \
2655 .private_value = nid \
2658 #define PIN_SRC_TEST(xname,nid) { \
2659 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2661 .info = alc_test_pin_src_info, \
2662 .get = alc_test_pin_src_get, \
2663 .put = alc_test_pin_src_put, \
2664 .private_value = nid \
2667 static struct snd_kcontrol_new alc880_test_mixer[] = {
2668 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2669 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2670 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2671 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2672 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2673 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2674 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2675 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2676 PIN_CTL_TEST("Front Pin Mode", 0x14),
2677 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2678 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2679 PIN_CTL_TEST("Side Pin Mode", 0x17),
2680 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2681 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2682 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2683 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2684 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2685 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2686 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2687 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2688 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2689 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2690 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2691 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2692 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2693 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2694 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2695 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2696 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2697 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2699 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2700 .name = "Channel Mode",
2701 .info = alc_ch_mode_info,
2702 .get = alc_ch_mode_get,
2703 .put = alc_ch_mode_put,
2708 static struct hda_verb alc880_test_init_verbs[] = {
2709 /* Unmute inputs of 0x0c - 0x0f */
2710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2716 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2718 /* Vol output for 0x0c-0x0f */
2719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2720 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2721 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2722 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2723 /* Set output pins 0x14-0x17 */
2724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2725 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2726 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 /* Unmute output pins 0x14-0x17 */
2729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 /* Set input pins 0x18-0x1c */
2734 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2735 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2736 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2738 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2739 /* Mute input pins 0x18-0x1b */
2740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2746 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2748 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2750 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2751 /* Analog input/passthru */
2752 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2753 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2754 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2764 static const char *alc880_models[ALC880_MODEL_LAST] = {
2765 [ALC880_3ST] = "3stack",
2766 [ALC880_TCL_S700] = "tcl",
2767 [ALC880_3ST_DIG] = "3stack-digout",
2768 [ALC880_CLEVO] = "clevo",
2769 [ALC880_5ST] = "5stack",
2770 [ALC880_5ST_DIG] = "5stack-digout",
2771 [ALC880_W810] = "w810",
2772 [ALC880_Z71V] = "z71v",
2773 [ALC880_6ST] = "6stack",
2774 [ALC880_6ST_DIG] = "6stack-digout",
2775 [ALC880_ASUS] = "asus",
2776 [ALC880_ASUS_W1V] = "asus-w1v",
2777 [ALC880_ASUS_DIG] = "asus-dig",
2778 [ALC880_ASUS_DIG2] = "asus-dig2",
2779 [ALC880_UNIWILL_DIG] = "uniwill",
2780 [ALC880_UNIWILL_P53] = "uniwill-p53",
2781 [ALC880_FUJITSU] = "fujitsu",
2782 [ALC880_F1734] = "F1734",
2784 [ALC880_LG_LW] = "lg-lw",
2785 #ifdef CONFIG_SND_DEBUG
2786 [ALC880_TEST] = "test",
2788 [ALC880_AUTO] = "auto",
2791 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2792 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2793 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2794 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2795 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2796 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2797 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2798 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2799 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2800 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2801 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2802 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2803 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2804 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2805 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2806 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2807 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2808 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2809 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2810 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2811 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2812 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2813 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2814 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2815 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2816 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2817 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */
2818 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2819 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2820 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2821 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2822 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2823 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2824 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2825 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2826 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2827 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2828 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2829 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2830 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2831 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2832 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2833 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2834 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2835 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2836 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2837 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2838 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2839 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2840 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2841 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2842 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2843 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2844 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2845 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2846 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
2847 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2848 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2849 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2850 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2851 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2852 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2853 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2854 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2855 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2856 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2857 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2858 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */
2859 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2860 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2865 * ALC880 codec presets
2867 static struct alc_config_preset alc880_presets[] = {
2869 .mixers = { alc880_three_stack_mixer },
2870 .init_verbs = { alc880_volume_init_verbs,
2871 alc880_pin_3stack_init_verbs },
2872 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2873 .dac_nids = alc880_dac_nids,
2874 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2875 .channel_mode = alc880_threestack_modes,
2877 .input_mux = &alc880_capture_source,
2879 [ALC880_3ST_DIG] = {
2880 .mixers = { alc880_three_stack_mixer },
2881 .init_verbs = { alc880_volume_init_verbs,
2882 alc880_pin_3stack_init_verbs },
2883 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2884 .dac_nids = alc880_dac_nids,
2885 .dig_out_nid = ALC880_DIGOUT_NID,
2886 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2887 .channel_mode = alc880_threestack_modes,
2889 .input_mux = &alc880_capture_source,
2891 [ALC880_TCL_S700] = {
2892 .mixers = { alc880_tcl_s700_mixer },
2893 .init_verbs = { alc880_volume_init_verbs,
2894 alc880_pin_tcl_S700_init_verbs,
2895 alc880_gpio2_init_verbs },
2896 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2897 .dac_nids = alc880_dac_nids,
2899 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2900 .channel_mode = alc880_2_jack_modes,
2901 .input_mux = &alc880_capture_source,
2904 .mixers = { alc880_three_stack_mixer,
2905 alc880_five_stack_mixer},
2906 .init_verbs = { alc880_volume_init_verbs,
2907 alc880_pin_5stack_init_verbs },
2908 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2909 .dac_nids = alc880_dac_nids,
2910 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2911 .channel_mode = alc880_fivestack_modes,
2912 .input_mux = &alc880_capture_source,
2914 [ALC880_5ST_DIG] = {
2915 .mixers = { alc880_three_stack_mixer,
2916 alc880_five_stack_mixer },
2917 .init_verbs = { alc880_volume_init_verbs,
2918 alc880_pin_5stack_init_verbs },
2919 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2920 .dac_nids = alc880_dac_nids,
2921 .dig_out_nid = ALC880_DIGOUT_NID,
2922 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2923 .channel_mode = alc880_fivestack_modes,
2924 .input_mux = &alc880_capture_source,
2927 .mixers = { alc880_six_stack_mixer },
2928 .init_verbs = { alc880_volume_init_verbs,
2929 alc880_pin_6stack_init_verbs },
2930 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2931 .dac_nids = alc880_6st_dac_nids,
2932 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2933 .channel_mode = alc880_sixstack_modes,
2934 .input_mux = &alc880_6stack_capture_source,
2936 [ALC880_6ST_DIG] = {
2937 .mixers = { alc880_six_stack_mixer },
2938 .init_verbs = { alc880_volume_init_verbs,
2939 alc880_pin_6stack_init_verbs },
2940 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2941 .dac_nids = alc880_6st_dac_nids,
2942 .dig_out_nid = ALC880_DIGOUT_NID,
2943 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2944 .channel_mode = alc880_sixstack_modes,
2945 .input_mux = &alc880_6stack_capture_source,
2948 .mixers = { alc880_w810_base_mixer },
2949 .init_verbs = { alc880_volume_init_verbs,
2950 alc880_pin_w810_init_verbs,
2951 alc880_gpio2_init_verbs },
2952 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2953 .dac_nids = alc880_w810_dac_nids,
2954 .dig_out_nid = ALC880_DIGOUT_NID,
2955 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2956 .channel_mode = alc880_w810_modes,
2957 .input_mux = &alc880_capture_source,
2960 .mixers = { alc880_z71v_mixer },
2961 .init_verbs = { alc880_volume_init_verbs,
2962 alc880_pin_z71v_init_verbs },
2963 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2964 .dac_nids = alc880_z71v_dac_nids,
2965 .dig_out_nid = ALC880_DIGOUT_NID,
2967 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2968 .channel_mode = alc880_2_jack_modes,
2969 .input_mux = &alc880_capture_source,
2972 .mixers = { alc880_f1734_mixer },
2973 .init_verbs = { alc880_volume_init_verbs,
2974 alc880_pin_f1734_init_verbs },
2975 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2976 .dac_nids = alc880_f1734_dac_nids,
2978 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2979 .channel_mode = alc880_2_jack_modes,
2980 .input_mux = &alc880_capture_source,
2983 .mixers = { alc880_asus_mixer },
2984 .init_verbs = { alc880_volume_init_verbs,
2985 alc880_pin_asus_init_verbs,
2986 alc880_gpio1_init_verbs },
2987 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2988 .dac_nids = alc880_asus_dac_nids,
2989 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2990 .channel_mode = alc880_asus_modes,
2992 .input_mux = &alc880_capture_source,
2994 [ALC880_ASUS_DIG] = {
2995 .mixers = { alc880_asus_mixer },
2996 .init_verbs = { alc880_volume_init_verbs,
2997 alc880_pin_asus_init_verbs,
2998 alc880_gpio1_init_verbs },
2999 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3000 .dac_nids = alc880_asus_dac_nids,
3001 .dig_out_nid = ALC880_DIGOUT_NID,
3002 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3003 .channel_mode = alc880_asus_modes,
3005 .input_mux = &alc880_capture_source,
3007 [ALC880_ASUS_DIG2] = {
3008 .mixers = { alc880_asus_mixer },
3009 .init_verbs = { alc880_volume_init_verbs,
3010 alc880_pin_asus_init_verbs,
3011 alc880_gpio2_init_verbs }, /* use GPIO2 */
3012 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3013 .dac_nids = alc880_asus_dac_nids,
3014 .dig_out_nid = ALC880_DIGOUT_NID,
3015 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3016 .channel_mode = alc880_asus_modes,
3018 .input_mux = &alc880_capture_source,
3020 [ALC880_ASUS_W1V] = {
3021 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3022 .init_verbs = { alc880_volume_init_verbs,
3023 alc880_pin_asus_init_verbs,
3024 alc880_gpio1_init_verbs },
3025 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3026 .dac_nids = alc880_asus_dac_nids,
3027 .dig_out_nid = ALC880_DIGOUT_NID,
3028 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3029 .channel_mode = alc880_asus_modes,
3031 .input_mux = &alc880_capture_source,
3033 [ALC880_UNIWILL_DIG] = {
3034 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
3035 .init_verbs = { alc880_volume_init_verbs,
3036 alc880_pin_asus_init_verbs },
3037 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3038 .dac_nids = alc880_asus_dac_nids,
3039 .dig_out_nid = ALC880_DIGOUT_NID,
3040 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3041 .channel_mode = alc880_asus_modes,
3043 .input_mux = &alc880_capture_source,
3045 [ALC880_UNIWILL] = {
3046 .mixers = { alc880_uniwill_mixer },
3047 .init_verbs = { alc880_volume_init_verbs,
3048 alc880_uniwill_init_verbs },
3049 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3050 .dac_nids = alc880_asus_dac_nids,
3051 .dig_out_nid = ALC880_DIGOUT_NID,
3052 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3053 .channel_mode = alc880_threestack_modes,
3055 .input_mux = &alc880_capture_source,
3056 .unsol_event = alc880_uniwill_unsol_event,
3057 .init_hook = alc880_uniwill_automute,
3059 [ALC880_UNIWILL_P53] = {
3060 .mixers = { alc880_uniwill_p53_mixer },
3061 .init_verbs = { alc880_volume_init_verbs,
3062 alc880_uniwill_p53_init_verbs },
3063 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3064 .dac_nids = alc880_asus_dac_nids,
3065 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3066 .channel_mode = alc880_threestack_modes,
3067 .input_mux = &alc880_capture_source,
3068 .unsol_event = alc880_uniwill_p53_unsol_event,
3069 .init_hook = alc880_uniwill_p53_hp_automute,
3071 [ALC880_FUJITSU] = {
3072 .mixers = { alc880_fujitsu_mixer,
3073 alc880_pcbeep_mixer, },
3074 .init_verbs = { alc880_volume_init_verbs,
3075 alc880_uniwill_p53_init_verbs,
3076 alc880_beep_init_verbs },
3077 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3078 .dac_nids = alc880_dac_nids,
3079 .dig_out_nid = ALC880_DIGOUT_NID,
3080 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3081 .channel_mode = alc880_2_jack_modes,
3082 .input_mux = &alc880_capture_source,
3083 .unsol_event = alc880_uniwill_p53_unsol_event,
3084 .init_hook = alc880_uniwill_p53_hp_automute,
3087 .mixers = { alc880_three_stack_mixer },
3088 .init_verbs = { alc880_volume_init_verbs,
3089 alc880_pin_clevo_init_verbs },
3090 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3091 .dac_nids = alc880_dac_nids,
3093 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3094 .channel_mode = alc880_threestack_modes,
3096 .input_mux = &alc880_capture_source,
3099 .mixers = { alc880_lg_mixer },
3100 .init_verbs = { alc880_volume_init_verbs,
3101 alc880_lg_init_verbs },
3102 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3103 .dac_nids = alc880_lg_dac_nids,
3104 .dig_out_nid = ALC880_DIGOUT_NID,
3105 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3106 .channel_mode = alc880_lg_ch_modes,
3108 .input_mux = &alc880_lg_capture_source,
3109 .unsol_event = alc880_lg_unsol_event,
3110 .init_hook = alc880_lg_automute,
3111 #ifdef CONFIG_SND_HDA_POWER_SAVE
3112 .loopbacks = alc880_lg_loopbacks,
3116 .mixers = { alc880_lg_lw_mixer },
3117 .init_verbs = { alc880_volume_init_verbs,
3118 alc880_lg_lw_init_verbs },
3119 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3120 .dac_nids = alc880_dac_nids,
3121 .dig_out_nid = ALC880_DIGOUT_NID,
3122 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3123 .channel_mode = alc880_lg_lw_modes,
3124 .input_mux = &alc880_lg_lw_capture_source,
3125 .unsol_event = alc880_lg_lw_unsol_event,
3126 .init_hook = alc880_lg_lw_automute,
3128 #ifdef CONFIG_SND_DEBUG
3130 .mixers = { alc880_test_mixer },
3131 .init_verbs = { alc880_test_init_verbs },
3132 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3133 .dac_nids = alc880_test_dac_nids,
3134 .dig_out_nid = ALC880_DIGOUT_NID,
3135 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3136 .channel_mode = alc880_test_modes,
3137 .input_mux = &alc880_test_capture_source,
3143 * Automatic parse of I/O pins from the BIOS configuration
3146 #define NUM_CONTROL_ALLOC 32
3147 #define NUM_VERB_ALLOC 32
3151 ALC_CTL_WIDGET_MUTE,
3154 static struct snd_kcontrol_new alc880_control_templates[] = {
3155 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3156 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3157 HDA_BIND_MUTE(NULL, 0, 0, 0),
3160 /* add dynamic controls */
3161 static int add_control(struct alc_spec *spec, int type, const char *name,
3164 struct snd_kcontrol_new *knew;
3166 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3167 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3169 /* array + terminator */
3170 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3173 if (spec->kctl_alloc) {
3174 memcpy(knew, spec->kctl_alloc,
3175 sizeof(*knew) * spec->num_kctl_alloc);
3176 kfree(spec->kctl_alloc);
3178 spec->kctl_alloc = knew;
3179 spec->num_kctl_alloc = num;
3182 knew = &spec->kctl_alloc[spec->num_kctl_used];
3183 *knew = alc880_control_templates[type];
3184 knew->name = kstrdup(name, GFP_KERNEL);
3187 knew->private_value = val;
3188 spec->num_kctl_used++;
3192 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3193 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3194 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3195 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3196 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3197 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3198 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3199 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3200 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3201 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3202 #define ALC880_PIN_CD_NID 0x1c
3204 /* fill in the dac_nids table from the parsed pin configuration */
3205 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3206 const struct auto_pin_cfg *cfg)
3212 memset(assigned, 0, sizeof(assigned));
3213 spec->multiout.dac_nids = spec->private_dac_nids;
3215 /* check the pins hardwired to audio widget */
3216 for (i = 0; i < cfg->line_outs; i++) {
3217 nid = cfg->line_out_pins[i];
3218 if (alc880_is_fixed_pin(nid)) {
3219 int idx = alc880_fixed_pin_idx(nid);
3220 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3224 /* left pins can be connect to any audio widget */
3225 for (i = 0; i < cfg->line_outs; i++) {
3226 nid = cfg->line_out_pins[i];
3227 if (alc880_is_fixed_pin(nid))
3229 /* search for an empty channel */
3230 for (j = 0; j < cfg->line_outs; j++) {
3232 spec->multiout.dac_nids[i] =
3233 alc880_idx_to_dac(j);
3239 spec->multiout.num_dacs = cfg->line_outs;
3243 /* add playback controls from the parsed DAC table */
3244 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3245 const struct auto_pin_cfg *cfg)
3248 static const char *chname[4] = {
3249 "Front", "Surround", NULL /*CLFE*/, "Side"
3254 for (i = 0; i < cfg->line_outs; i++) {
3255 if (!spec->multiout.dac_nids[i])
3257 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3260 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3261 "Center Playback Volume",
3262 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3266 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3267 "LFE Playback Volume",
3268 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3272 err = add_control(spec, ALC_CTL_BIND_MUTE,
3273 "Center Playback Switch",
3274 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3278 err = add_control(spec, ALC_CTL_BIND_MUTE,
3279 "LFE Playback Switch",
3280 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3285 sprintf(name, "%s Playback Volume", chname[i]);
3286 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3287 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3291 sprintf(name, "%s Playback Switch", chname[i]);
3292 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3293 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3302 /* add playback controls for speaker and HP outputs */
3303 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3313 if (alc880_is_fixed_pin(pin)) {
3314 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3315 /* specify the DAC as the extra output */
3316 if (!spec->multiout.hp_nid)
3317 spec->multiout.hp_nid = nid;
3319 spec->multiout.extra_out_nid[0] = nid;
3320 /* control HP volume/switch on the output mixer amp */
3321 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3322 sprintf(name, "%s Playback Volume", pfx);
3323 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3324 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3327 sprintf(name, "%s Playback Switch", pfx);
3328 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3329 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3332 } else if (alc880_is_multi_pin(pin)) {
3333 /* set manual connection */
3334 /* we have only a switch on HP-out PIN */
3335 sprintf(name, "%s Playback Switch", pfx);
3336 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3337 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3344 /* create input playback/capture controls for the given pin */
3345 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3346 const char *ctlname,
3347 int idx, hda_nid_t mix_nid)
3352 sprintf(name, "%s Playback Volume", ctlname);
3353 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3354 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3357 sprintf(name, "%s Playback Switch", ctlname);
3358 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3359 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3365 /* create playback/capture controls for input pins */
3366 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3367 const struct auto_pin_cfg *cfg)
3369 struct hda_input_mux *imux = &spec->private_imux;
3372 for (i = 0; i < AUTO_PIN_LAST; i++) {
3373 if (alc880_is_input_pin(cfg->input_pins[i])) {
3374 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3375 err = new_analog_input(spec, cfg->input_pins[i],
3376 auto_pin_cfg_labels[i],
3380 imux->items[imux->num_items].label =
3381 auto_pin_cfg_labels[i];
3382 imux->items[imux->num_items].index =
3383 alc880_input_pin_idx(cfg->input_pins[i]);
3390 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3391 hda_nid_t nid, int pin_type,
3395 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3397 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3399 /* need the manual connection? */
3400 if (alc880_is_multi_pin(nid)) {
3401 struct alc_spec *spec = codec->spec;
3402 int idx = alc880_multi_pin_idx(nid);
3403 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3404 AC_VERB_SET_CONNECT_SEL,
3405 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3409 static int get_pin_type(int line_out_type)
3411 if (line_out_type == AUTO_PIN_HP_OUT)
3417 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3419 struct alc_spec *spec = codec->spec;
3422 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3423 for (i = 0; i < spec->autocfg.line_outs; i++) {
3424 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3425 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3426 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3430 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3432 struct alc_spec *spec = codec->spec;
3435 pin = spec->autocfg.speaker_pins[0];
3436 if (pin) /* connect to front */
3437 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3438 pin = spec->autocfg.hp_pins[0];
3439 if (pin) /* connect to front */
3440 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3443 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3445 struct alc_spec *spec = codec->spec;
3448 for (i = 0; i < AUTO_PIN_LAST; i++) {
3449 hda_nid_t nid = spec->autocfg.input_pins[i];
3450 if (alc880_is_input_pin(nid)) {
3451 snd_hda_codec_write(codec, nid, 0,
3452 AC_VERB_SET_PIN_WIDGET_CONTROL,
3453 i <= AUTO_PIN_FRONT_MIC ?
3454 PIN_VREF80 : PIN_IN);
3455 if (nid != ALC880_PIN_CD_NID)
3456 snd_hda_codec_write(codec, nid, 0,
3457 AC_VERB_SET_AMP_GAIN_MUTE,
3463 /* parse the BIOS configuration and set up the alc_spec */
3464 /* return 1 if successful, 0 if the proper config is not found,
3465 * or a negative error code
3467 static int alc880_parse_auto_config(struct hda_codec *codec)
3469 struct alc_spec *spec = codec->spec;
3471 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3473 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3477 if (!spec->autocfg.line_outs)
3478 return 0; /* can't find valid BIOS pin config */
3480 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3483 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3486 err = alc880_auto_create_extra_out(spec,
3487 spec->autocfg.speaker_pins[0],
3491 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3495 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3499 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3501 if (spec->autocfg.dig_out_pin)
3502 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3503 if (spec->autocfg.dig_in_pin)
3504 spec->dig_in_nid = ALC880_DIGIN_NID;
3506 if (spec->kctl_alloc)
3507 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3509 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3511 spec->num_mux_defs = 1;
3512 spec->input_mux = &spec->private_imux;
3517 /* additional initialization for auto-configuration model */
3518 static void alc880_auto_init(struct hda_codec *codec)
3520 alc880_auto_init_multi_out(codec);
3521 alc880_auto_init_extra_out(codec);
3522 alc880_auto_init_analog_input(codec);
3526 * OK, here we have finally the patch for ALC880
3529 static int patch_alc880(struct hda_codec *codec)
3531 struct alc_spec *spec;
3535 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3541 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3544 if (board_config < 0) {
3545 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3546 "trying auto-probe from BIOS...\n");
3547 board_config = ALC880_AUTO;
3550 if (board_config == ALC880_AUTO) {
3551 /* automatic parse from the BIOS config */
3552 err = alc880_parse_auto_config(codec);
3558 "hda_codec: Cannot set up configuration "
3559 "from BIOS. Using 3-stack mode...\n");
3560 board_config = ALC880_3ST;
3564 if (board_config != ALC880_AUTO)
3565 setup_preset(spec, &alc880_presets[board_config]);
3567 spec->stream_name_analog = "ALC880 Analog";
3568 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3569 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3571 spec->stream_name_digital = "ALC880 Digital";
3572 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3573 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3575 if (!spec->adc_nids && spec->input_mux) {
3576 /* check whether NID 0x07 is valid */
3577 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3579 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3580 if (wcap != AC_WID_AUD_IN) {
3581 spec->adc_nids = alc880_adc_nids_alt;
3582 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3583 spec->mixers[spec->num_mixers] =
3584 alc880_capture_alt_mixer;
3587 spec->adc_nids = alc880_adc_nids;
3588 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3589 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3594 codec->patch_ops = alc_patch_ops;
3595 if (board_config == ALC880_AUTO)
3596 spec->init_hook = alc880_auto_init;
3597 #ifdef CONFIG_SND_HDA_POWER_SAVE
3598 if (!spec->loopback.amplist)
3599 spec->loopback.amplist = alc880_loopbacks;
3610 static hda_nid_t alc260_dac_nids[1] = {
3615 static hda_nid_t alc260_adc_nids[1] = {
3620 static hda_nid_t alc260_adc_nids_alt[1] = {
3625 static hda_nid_t alc260_hp_adc_nids[2] = {
3630 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3631 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3633 static hda_nid_t alc260_dual_adc_nids[2] = {
3638 #define ALC260_DIGOUT_NID 0x03
3639 #define ALC260_DIGIN_NID 0x06
3641 static struct hda_input_mux alc260_capture_source = {
3645 { "Front Mic", 0x1 },
3651 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3652 * headphone jack and the internal CD lines since these are the only pins at
3653 * which audio can appear. For flexibility, also allow the option of
3654 * recording the mixer output on the second ADC (ADC0 doesn't have a
3655 * connection to the mixer output).
3657 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3661 { "Mic/Line", 0x0 },
3663 { "Headphone", 0x2 },
3669 { "Mic/Line", 0x0 },
3671 { "Headphone", 0x2 },
3678 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3679 * the Fujitsu S702x, but jacks are marked differently.
3681 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3688 { "Headphone", 0x5 },
3697 { "Headphone", 0x6 },
3703 * This is just place-holder, so there's something for alc_build_pcms to look
3704 * at when it calculates the maximum number of channels. ALC260 has no mixer
3705 * element which allows changing the channel mode, so the verb list is
3708 static struct hda_channel_mode alc260_modes[1] = {
3713 /* Mixer combinations
3715 * basic: base_output + input + pc_beep + capture
3716 * HP: base_output + input + capture_alt
3717 * HP_3013: hp_3013 + input + capture
3718 * fujitsu: fujitsu + capture
3719 * acer: acer + capture
3722 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3723 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3724 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3726 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3727 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3728 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3732 static struct snd_kcontrol_new alc260_input_mixer[] = {
3733 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3734 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3735 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3736 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3738 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3739 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3744 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3745 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3746 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3750 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3751 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3752 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3753 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3754 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3755 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3757 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3758 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3762 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3763 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3765 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3766 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3767 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3768 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3769 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3770 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3771 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3772 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3773 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3774 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3775 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3776 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3777 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3781 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3782 * versions of the ALC260 don't act on requests to enable mic bias from NID
3783 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3784 * datasheet doesn't mention this restriction. At this stage it's not clear
3785 * whether this behaviour is intentional or is a hardware bug in chip
3786 * revisions available in early 2006. Therefore for now allow the
3787 * "Headphone Jack Mode" control to span all choices, but if it turns out
3788 * that the lack of mic bias for this NID is intentional we could change the
3789 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3791 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3792 * don't appear to make the mic bias available from the "line" jack, even
3793 * though the NID used for this jack (0x14) can supply it. The theory is
3794 * that perhaps Acer have included blocking capacitors between the ALC260
3795 * and the output jack. If this turns out to be the case for all such
3796 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3797 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3799 * The C20x Tablet series have a mono internal speaker which is controlled
3800 * via the chip's Mono sum widget and pin complex, so include the necessary
3801 * controls for such models. On models without a "mono speaker" the control
3802 * won't do anything.
3804 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3805 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3806 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3807 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3808 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3810 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3812 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3813 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3815 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3816 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3817 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3818 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3819 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3820 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3821 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3825 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3826 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3828 static struct snd_kcontrol_new alc260_will_mixer[] = {
3829 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3830 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3832 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3833 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3834 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3835 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3836 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3837 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3838 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3839 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3840 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3844 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3845 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3847 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3848 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3849 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3851 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3852 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3853 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3854 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3855 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3856 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3857 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3861 /* capture mixer elements */
3862 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3863 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3864 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3865 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3866 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3868 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3869 /* The multiple "Capture Source" controls confuse alsamixer
3870 * So call somewhat different..
3871 * FIXME: the controls appear in the "playback" view!
3873 /* .name = "Capture Source", */
3874 .name = "Input Source",
3876 .info = alc_mux_enum_info,
3877 .get = alc_mux_enum_get,
3878 .put = alc_mux_enum_put,
3883 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3884 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3885 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3888 /* The multiple "Capture Source" controls confuse alsamixer
3889 * So call somewhat different..
3890 * FIXME: the controls appear in the "playback" view!
3892 /* .name = "Capture Source", */
3893 .name = "Input Source",
3895 .info = alc_mux_enum_info,
3896 .get = alc_mux_enum_get,
3897 .put = alc_mux_enum_put,
3903 * initialization verbs
3905 static struct hda_verb alc260_init_verbs[] = {
3906 /* Line In pin widget for input */
3907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3908 /* CD pin widget for input */
3909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3910 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3911 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3912 /* Mic2 (front panel) pin widget for input and vref at 80% */
3913 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3914 /* LINE-2 is used for line-out in rear */
3915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3916 /* select line-out */
3917 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3919 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3921 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3923 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3924 /* mute capture amp left and right */
3925 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3926 /* set connection select to line in (default select for this ADC) */
3927 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3928 /* mute capture amp left and right */
3929 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3930 /* set connection select to line in (default select for this ADC) */
3931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3932 /* set vol=0 Line-Out mixer amp left and right */
3933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3934 /* unmute pin widget amp left and right (no gain on this amp) */
3935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3936 /* set vol=0 HP mixer amp left and right */
3937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3938 /* unmute pin widget amp left and right (no gain on this amp) */
3939 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3940 /* set vol=0 Mono mixer amp left and right */
3941 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3942 /* unmute pin widget amp left and right (no gain on this amp) */
3943 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3944 /* unmute LINE-2 out pin */
3945 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3946 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3949 /* mute analog inputs */
3950 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3955 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3956 /* mute Front out path */
3957 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3958 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3959 /* mute Headphone out path */
3960 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3961 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3962 /* mute Mono out path */
3963 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3964 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3968 #if 0 /* should be identical with alc260_init_verbs? */
3969 static struct hda_verb alc260_hp_init_verbs[] = {
3970 /* Headphone and output */
3971 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3973 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3974 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3975 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3976 /* Mic2 (front panel) pin widget for input and vref at 80% */
3977 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3978 /* Line In pin widget for input */
3979 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3980 /* Line-2 pin widget for output */
3981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3982 /* CD pin widget for input */
3983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3984 /* unmute amp left and right */
3985 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3986 /* set connection select to line in (default select for this ADC) */
3987 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3988 /* unmute Line-Out mixer amp left and right (volume = 0) */
3989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3990 /* mute pin widget amp left and right (no gain on this amp) */
3991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3992 /* unmute HP mixer amp left and right (volume = 0) */
3993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3994 /* mute pin widget amp left and right (no gain on this amp) */
3995 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3996 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3999 /* mute analog inputs */
4000 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4001 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4005 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4006 /* Unmute Front out path */
4007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4009 /* Unmute Headphone out path */
4010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4012 /* Unmute Mono out path */
4013 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4014 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4019 static struct hda_verb alc260_hp_3013_init_verbs[] = {
4020 /* Line out and output */
4021 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4023 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
4024 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4025 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4026 /* Mic2 (front panel) pin widget for input and vref at 80% */
4027 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
4028 /* Line In pin widget for input */
4029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4030 /* Headphone pin widget for output */
4031 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
4032 /* CD pin widget for input */
4033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
4034 /* unmute amp left and right */
4035 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
4036 /* set connection select to line in (default select for this ADC) */
4037 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
4038 /* unmute Line-Out mixer amp left and right (volume = 0) */
4039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4040 /* mute pin widget amp left and right (no gain on this amp) */
4041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4042 /* unmute HP mixer amp left and right (volume = 0) */
4043 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
4044 /* mute pin widget amp left and right (no gain on this amp) */
4045 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4046 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4049 /* mute analog inputs */
4050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4055 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4056 /* Unmute Front out path */
4057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4059 /* Unmute Headphone out path */
4060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4062 /* Unmute Mono out path */
4063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4064 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4068 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4069 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4070 * audio = 0x16, internal speaker = 0x10.
4072 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4073 /* Disable all GPIOs */
4074 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4075 /* Internal speaker is connected to headphone pin */
4076 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4077 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4079 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4080 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4081 /* Ensure all other unused pins are disabled and muted. */
4082 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4084 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4085 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4086 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4087 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4091 /* Disable digital (SPDIF) pins */
4092 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4093 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4095 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4096 * when acting as an output.
4098 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4100 /* Start with output sum widgets muted and their output gains at min */
4101 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4104 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4107 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4108 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4109 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4111 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4112 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4113 /* Unmute Line1 pin widget output buffer since it starts as an output.
4114 * If the pin mode is changed by the user the pin mode control will
4115 * take care of enabling the pin's input/output buffers as needed.
4116 * Therefore there's no need to enable the input buffer at this
4119 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4120 /* Unmute input buffer of pin widget used for Line-in (no equiv
4123 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4125 /* Mute capture amp left and right */
4126 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4127 /* Set ADC connection select to match default mixer setting - line
4130 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4132 /* Do the same for the second ADC: mute capture input amp and
4133 * set ADC connection to line in (on mic1 pin)
4135 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4136 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4138 /* Mute all inputs to mixer widget (even unconnected ones) */
4139 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4141 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4142 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4143 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4144 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4151 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4152 * similar laptops (adapted from Fujitsu init verbs).
4154 static struct hda_verb alc260_acer_init_verbs[] = {
4155 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4156 * the headphone jack. Turn this on and rely on the standard mute
4157 * methods whenever the user wants to turn these outputs off.
4159 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4160 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4161 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4162 /* Internal speaker/Headphone jack is connected to Line-out pin */
4163 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4164 /* Internal microphone/Mic jack is connected to Mic1 pin */
4165 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4166 /* Line In jack is connected to Line1 pin */
4167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4168 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4169 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4170 /* Ensure all other unused pins are disabled and muted. */
4171 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4172 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4173 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4174 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4177 /* Disable digital (SPDIF) pins */
4178 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4179 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4181 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4182 * bus when acting as outputs.
4184 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4185 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4187 /* Start with output sum widgets muted and their output gains at min */
4188 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4190 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4191 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4192 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4193 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4194 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4195 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4198 /* Unmute Line-out pin widget amp left and right
4199 * (no equiv mixer ctrl)
4201 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4202 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4203 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4204 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4205 * inputs. If the pin mode is changed by the user the pin mode control
4206 * will take care of enabling the pin's input/output buffers as needed.
4207 * Therefore there's no need to enable the input buffer at this
4210 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4211 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4213 /* Mute capture amp left and right */
4214 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4215 /* Set ADC connection select to match default mixer setting - mic
4218 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4220 /* Do similar with the second ADC: mute capture input amp and
4221 * set ADC connection to mic to match ALSA's default state.
4223 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4224 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4226 /* Mute all inputs to mixer widget (even unconnected ones) */
4227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4231 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4239 static struct hda_verb alc260_will_verbs[] = {
4240 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4241 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4242 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4243 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4244 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4245 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4249 static struct hda_verb alc260_replacer_672v_verbs[] = {
4250 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4251 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4252 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4254 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4255 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4256 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4258 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4262 /* toggle speaker-output according to the hp-jack state */
4263 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4265 unsigned int present;
4267 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4268 present = snd_hda_codec_read(codec, 0x0f, 0,
4269 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4271 snd_hda_codec_write_cache(codec, 0x01, 0,
4272 AC_VERB_SET_GPIO_DATA, 1);
4273 snd_hda_codec_write_cache(codec, 0x0f, 0,
4274 AC_VERB_SET_PIN_WIDGET_CONTROL,
4277 snd_hda_codec_write_cache(codec, 0x01, 0,
4278 AC_VERB_SET_GPIO_DATA, 0);
4279 snd_hda_codec_write_cache(codec, 0x0f, 0,
4280 AC_VERB_SET_PIN_WIDGET_CONTROL,
4285 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4288 if ((res >> 26) == ALC880_HP_EVENT)
4289 alc260_replacer_672v_automute(codec);
4292 /* Test configuration for debugging, modelled after the ALC880 test
4295 #ifdef CONFIG_SND_DEBUG
4296 static hda_nid_t alc260_test_dac_nids[1] = {
4299 static hda_nid_t alc260_test_adc_nids[2] = {
4302 /* For testing the ALC260, each input MUX needs its own definition since
4303 * the signal assignments are different. This assumes that the first ADC
4306 static struct hda_input_mux alc260_test_capture_sources[2] = {
4310 { "MIC1 pin", 0x0 },
4311 { "MIC2 pin", 0x1 },
4312 { "LINE1 pin", 0x2 },
4313 { "LINE2 pin", 0x3 },
4315 { "LINE-OUT pin", 0x5 },
4316 { "HP-OUT pin", 0x6 },
4322 { "MIC1 pin", 0x0 },
4323 { "MIC2 pin", 0x1 },
4324 { "LINE1 pin", 0x2 },
4325 { "LINE2 pin", 0x3 },
4328 { "LINE-OUT pin", 0x6 },
4329 { "HP-OUT pin", 0x7 },
4333 static struct snd_kcontrol_new alc260_test_mixer[] = {
4334 /* Output driver widgets */
4335 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4336 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4337 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4338 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4339 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4340 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4342 /* Modes for retasking pin widgets
4343 * Note: the ALC260 doesn't seem to act on requests to enable mic
4344 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4345 * mention this restriction. At this stage it's not clear whether
4346 * this behaviour is intentional or is a hardware bug in chip
4347 * revisions available at least up until early 2006. Therefore for
4348 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4349 * choices, but if it turns out that the lack of mic bias for these
4350 * NIDs is intentional we could change their modes from
4351 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4353 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4354 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4355 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4356 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4357 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4358 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4360 /* Loopback mixer controls */
4361 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4362 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4363 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4364 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4365 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4366 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4367 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4368 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4369 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4370 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4371 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4372 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4373 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4374 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4375 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4376 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4378 /* Controls for GPIO pins, assuming they are configured as outputs */
4379 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4380 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4381 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4382 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4384 /* Switches to allow the digital IO pins to be enabled. The datasheet
4385 * is ambigious as to which NID is which; testing on laptops which
4386 * make this output available should provide clarification.
4388 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4389 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4391 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4392 * this output to turn on an external amplifier.
4394 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4395 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4399 static struct hda_verb alc260_test_init_verbs[] = {
4400 /* Enable all GPIOs as outputs with an initial value of 0 */
4401 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4402 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4403 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4405 /* Enable retasking pins as output, initially without power amp */
4406 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4407 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4408 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4410 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4411 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4413 /* Disable digital (SPDIF) pins initially, but users can enable
4414 * them via a mixer switch. In the case of SPDIF-out, this initverb
4415 * payload also sets the generation to 0, output to be in "consumer"
4416 * PCM format, copyright asserted, no pre-emphasis and no validity
4419 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4420 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4422 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4423 * OUT1 sum bus when acting as an output.
4425 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4426 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4427 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4428 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4430 /* Start with output sum widgets muted and their output gains at min */
4431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4437 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4438 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4439 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4441 /* Unmute retasking pin widget output buffers since the default
4442 * state appears to be output. As the pin mode is changed by the
4443 * user the pin mode control will take care of enabling the pin's
4444 * input/output buffers as needed.
4446 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4447 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4450 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4451 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4452 /* Also unmute the mono-out pin widget */
4453 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4455 /* Mute capture amp left and right */
4456 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4457 /* Set ADC connection select to match default mixer setting (mic1
4460 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4462 /* Do the same for the second ADC: mute capture input amp and
4463 * set ADC connection to mic1 pin
4465 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4466 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4468 /* Mute all inputs to mixer widget (even unconnected ones) */
4469 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4470 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4482 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4488 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4494 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4495 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4498 * for BIOS auto-configuration
4501 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4505 unsigned long vol_val, sw_val;
4509 if (nid >= 0x0f && nid < 0x11) {
4510 nid_vol = nid - 0x7;
4511 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4512 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4513 } else if (nid == 0x11) {
4514 nid_vol = nid - 0x7;
4515 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4516 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4517 } else if (nid >= 0x12 && nid <= 0x15) {
4519 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4520 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4524 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4525 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4528 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4529 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4535 /* add playback controls from the parsed DAC table */
4536 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4537 const struct auto_pin_cfg *cfg)
4542 spec->multiout.num_dacs = 1;
4543 spec->multiout.dac_nids = spec->private_dac_nids;
4544 spec->multiout.dac_nids[0] = 0x02;
4546 nid = cfg->line_out_pins[0];
4548 err = alc260_add_playback_controls(spec, nid, "Front");
4553 nid = cfg->speaker_pins[0];
4555 err = alc260_add_playback_controls(spec, nid, "Speaker");
4560 nid = cfg->hp_pins[0];
4562 err = alc260_add_playback_controls(spec, nid, "Headphone");
4569 /* create playback/capture controls for input pins */
4570 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4571 const struct auto_pin_cfg *cfg)
4573 struct hda_input_mux *imux = &spec->private_imux;
4576 for (i = 0; i < AUTO_PIN_LAST; i++) {
4577 if (cfg->input_pins[i] >= 0x12) {
4578 idx = cfg->input_pins[i] - 0x12;
4579 err = new_analog_input(spec, cfg->input_pins[i],
4580 auto_pin_cfg_labels[i], idx,
4584 imux->items[imux->num_items].label =
4585 auto_pin_cfg_labels[i];
4586 imux->items[imux->num_items].index = idx;
4589 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4590 idx = cfg->input_pins[i] - 0x09;
4591 err = new_analog_input(spec, cfg->input_pins[i],
4592 auto_pin_cfg_labels[i], idx,
4596 imux->items[imux->num_items].label =
4597 auto_pin_cfg_labels[i];
4598 imux->items[imux->num_items].index = idx;
4605 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4606 hda_nid_t nid, int pin_type,
4610 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4612 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4614 /* need the manual connection? */
4616 int idx = nid - 0x12;
4617 snd_hda_codec_write(codec, idx + 0x0b, 0,
4618 AC_VERB_SET_CONNECT_SEL, sel_idx);
4622 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4624 struct alc_spec *spec = codec->spec;
4627 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4628 nid = spec->autocfg.line_out_pins[0];
4630 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4631 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4634 nid = spec->autocfg.speaker_pins[0];
4636 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4638 nid = spec->autocfg.hp_pins[0];
4640 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4643 #define ALC260_PIN_CD_NID 0x16
4644 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4646 struct alc_spec *spec = codec->spec;
4649 for (i = 0; i < AUTO_PIN_LAST; i++) {
4650 hda_nid_t nid = spec->autocfg.input_pins[i];
4652 snd_hda_codec_write(codec, nid, 0,
4653 AC_VERB_SET_PIN_WIDGET_CONTROL,
4654 i <= AUTO_PIN_FRONT_MIC ?
4655 PIN_VREF80 : PIN_IN);
4656 if (nid != ALC260_PIN_CD_NID)
4657 snd_hda_codec_write(codec, nid, 0,
4658 AC_VERB_SET_AMP_GAIN_MUTE,
4665 * generic initialization of ADC, input mixers and output mixers
4667 static struct hda_verb alc260_volume_init_verbs[] = {
4669 * Unmute ADC0-1 and set the default input to mic-in
4671 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4672 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4673 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4674 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4676 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4678 * Note: PASD motherboards uses the Line In 2 as the input for
4679 * front panel mic (mic 2)
4681 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4682 /* mute analog inputs */
4683 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4690 * Set up output mixers (0x08 - 0x0a)
4692 /* set vol=0 to output mixers */
4693 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4694 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4695 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4696 /* set up input amps for analog loopback */
4697 /* Amp Indices: DAC = 0, mixer = 1 */
4698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4702 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4708 static int alc260_parse_auto_config(struct hda_codec *codec)
4710 struct alc_spec *spec = codec->spec;
4713 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4715 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4719 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4722 if (!spec->kctl_alloc)
4723 return 0; /* can't find valid BIOS pin config */
4724 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4728 spec->multiout.max_channels = 2;
4730 if (spec->autocfg.dig_out_pin)
4731 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4732 if (spec->kctl_alloc)
4733 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4735 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4737 spec->num_mux_defs = 1;
4738 spec->input_mux = &spec->private_imux;
4740 /* check whether NID 0x04 is valid */
4741 wcap = get_wcaps(codec, 0x04);
4742 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4743 if (wcap != AC_WID_AUD_IN) {
4744 spec->adc_nids = alc260_adc_nids_alt;
4745 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4746 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4748 spec->adc_nids = alc260_adc_nids;
4749 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4750 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4757 /* additional initialization for auto-configuration model */
4758 static void alc260_auto_init(struct hda_codec *codec)
4760 alc260_auto_init_multi_out(codec);
4761 alc260_auto_init_analog_input(codec);
4764 #ifdef CONFIG_SND_HDA_POWER_SAVE
4765 static struct hda_amp_list alc260_loopbacks[] = {
4766 { 0x07, HDA_INPUT, 0 },
4767 { 0x07, HDA_INPUT, 1 },
4768 { 0x07, HDA_INPUT, 2 },
4769 { 0x07, HDA_INPUT, 3 },
4770 { 0x07, HDA_INPUT, 4 },
4776 * ALC260 configurations
4778 static const char *alc260_models[ALC260_MODEL_LAST] = {
4779 [ALC260_BASIC] = "basic",
4781 [ALC260_HP_3013] = "hp-3013",
4782 [ALC260_FUJITSU_S702X] = "fujitsu",
4783 [ALC260_ACER] = "acer",
4784 [ALC260_WILL] = "will",
4785 [ALC260_REPLACER_672V] = "replacer",
4786 #ifdef CONFIG_SND_DEBUG
4787 [ALC260_TEST] = "test",
4789 [ALC260_AUTO] = "auto",
4792 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4793 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4794 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4795 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4796 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4797 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4798 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4799 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4800 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4801 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4802 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4803 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4804 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4805 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4806 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4807 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4808 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4809 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4810 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4814 static struct alc_config_preset alc260_presets[] = {
4816 .mixers = { alc260_base_output_mixer,
4818 alc260_pc_beep_mixer,
4819 alc260_capture_mixer },
4820 .init_verbs = { alc260_init_verbs },
4821 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4822 .dac_nids = alc260_dac_nids,
4823 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4824 .adc_nids = alc260_adc_nids,
4825 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4826 .channel_mode = alc260_modes,
4827 .input_mux = &alc260_capture_source,
4830 .mixers = { alc260_base_output_mixer,
4832 alc260_capture_alt_mixer },
4833 .init_verbs = { alc260_init_verbs },
4834 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4835 .dac_nids = alc260_dac_nids,
4836 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4837 .adc_nids = alc260_hp_adc_nids,
4838 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4839 .channel_mode = alc260_modes,
4840 .input_mux = &alc260_capture_source,
4842 [ALC260_HP_3013] = {
4843 .mixers = { alc260_hp_3013_mixer,
4845 alc260_capture_alt_mixer },
4846 .init_verbs = { alc260_hp_3013_init_verbs },
4847 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4848 .dac_nids = alc260_dac_nids,
4849 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4850 .adc_nids = alc260_hp_adc_nids,
4851 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4852 .channel_mode = alc260_modes,
4853 .input_mux = &alc260_capture_source,
4855 [ALC260_FUJITSU_S702X] = {
4856 .mixers = { alc260_fujitsu_mixer,
4857 alc260_capture_mixer },
4858 .init_verbs = { alc260_fujitsu_init_verbs },
4859 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4860 .dac_nids = alc260_dac_nids,
4861 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4862 .adc_nids = alc260_dual_adc_nids,
4863 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4864 .channel_mode = alc260_modes,
4865 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4866 .input_mux = alc260_fujitsu_capture_sources,
4869 .mixers = { alc260_acer_mixer,
4870 alc260_capture_mixer },
4871 .init_verbs = { alc260_acer_init_verbs },
4872 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4873 .dac_nids = alc260_dac_nids,
4874 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4875 .adc_nids = alc260_dual_adc_nids,
4876 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4877 .channel_mode = alc260_modes,
4878 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4879 .input_mux = alc260_acer_capture_sources,
4882 .mixers = { alc260_will_mixer,
4883 alc260_capture_mixer },
4884 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4885 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4886 .dac_nids = alc260_dac_nids,
4887 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4888 .adc_nids = alc260_adc_nids,
4889 .dig_out_nid = ALC260_DIGOUT_NID,
4890 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4891 .channel_mode = alc260_modes,
4892 .input_mux = &alc260_capture_source,
4894 [ALC260_REPLACER_672V] = {
4895 .mixers = { alc260_replacer_672v_mixer,
4896 alc260_capture_mixer },
4897 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4898 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4899 .dac_nids = alc260_dac_nids,
4900 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4901 .adc_nids = alc260_adc_nids,
4902 .dig_out_nid = ALC260_DIGOUT_NID,
4903 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4904 .channel_mode = alc260_modes,
4905 .input_mux = &alc260_capture_source,
4906 .unsol_event = alc260_replacer_672v_unsol_event,
4907 .init_hook = alc260_replacer_672v_automute,
4909 #ifdef CONFIG_SND_DEBUG
4911 .mixers = { alc260_test_mixer,
4912 alc260_capture_mixer },
4913 .init_verbs = { alc260_test_init_verbs },
4914 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4915 .dac_nids = alc260_test_dac_nids,
4916 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4917 .adc_nids = alc260_test_adc_nids,
4918 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4919 .channel_mode = alc260_modes,
4920 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4921 .input_mux = alc260_test_capture_sources,
4926 static int patch_alc260(struct hda_codec *codec)
4928 struct alc_spec *spec;
4929 int err, board_config;
4931 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4937 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4940 if (board_config < 0) {
4941 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4942 "trying auto-probe from BIOS...\n");
4943 board_config = ALC260_AUTO;
4946 if (board_config == ALC260_AUTO) {
4947 /* automatic parse from the BIOS config */
4948 err = alc260_parse_auto_config(codec);
4954 "hda_codec: Cannot set up configuration "
4955 "from BIOS. Using base mode...\n");
4956 board_config = ALC260_BASIC;
4960 if (board_config != ALC260_AUTO)
4961 setup_preset(spec, &alc260_presets[board_config]);
4963 spec->stream_name_analog = "ALC260 Analog";
4964 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4965 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4967 spec->stream_name_digital = "ALC260 Digital";
4968 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4969 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4971 codec->patch_ops = alc_patch_ops;
4972 if (board_config == ALC260_AUTO)
4973 spec->init_hook = alc260_auto_init;
4974 #ifdef CONFIG_SND_HDA_POWER_SAVE
4975 if (!spec->loopback.amplist)
4976 spec->loopback.amplist = alc260_loopbacks;
4986 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4987 * configuration. Each pin widget can choose any input DACs and a mixer.
4988 * Each ADC is connected from a mixer of all inputs. This makes possible
4989 * 6-channel independent captures.
4991 * In addition, an independent DAC for the multi-playback (not used in this
4994 #define ALC882_DIGOUT_NID 0x06
4995 #define ALC882_DIGIN_NID 0x0a
4997 static struct hda_channel_mode alc882_ch_modes[1] = {
5001 static hda_nid_t alc882_dac_nids[4] = {
5002 /* front, rear, clfe, rear_surr */
5003 0x02, 0x03, 0x04, 0x05
5006 /* identical with ALC880 */
5007 #define alc882_adc_nids alc880_adc_nids
5008 #define alc882_adc_nids_alt alc880_adc_nids_alt
5011 /* FIXME: should be a matrix-type input source selection */
5013 static struct hda_input_mux alc882_capture_source = {
5017 { "Front Mic", 0x1 },
5022 #define alc882_mux_enum_info alc_mux_enum_info
5023 #define alc882_mux_enum_get alc_mux_enum_get
5025 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5026 struct snd_ctl_elem_value *ucontrol)
5028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5029 struct alc_spec *spec = codec->spec;
5030 const struct hda_input_mux *imux = spec->input_mux;
5031 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5032 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5033 hda_nid_t nid = capture_mixers[adc_idx];
5034 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5035 unsigned int i, idx;
5037 idx = ucontrol->value.enumerated.item[0];
5038 if (idx >= imux->num_items)
5039 idx = imux->num_items - 1;
5040 if (*cur_val == idx)
5042 for (i = 0; i < imux->num_items; i++) {
5043 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5044 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5045 imux->items[i].index,
5055 static struct hda_verb alc882_3ST_ch2_init[] = {
5056 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5057 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5058 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5059 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5066 static struct hda_verb alc882_3ST_ch6_init[] = {
5067 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5068 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5069 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5071 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5072 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5076 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5077 { 2, alc882_3ST_ch2_init },
5078 { 6, alc882_3ST_ch6_init },
5084 static struct hda_verb alc882_sixstack_ch6_init[] = {
5085 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5086 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5087 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5088 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5095 static struct hda_verb alc882_sixstack_ch8_init[] = {
5096 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5097 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5098 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5099 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5103 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5104 { 6, alc882_sixstack_ch6_init },
5105 { 8, alc882_sixstack_ch8_init },
5109 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5115 static struct hda_verb alc885_mbp_ch2_init[] = {
5116 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5117 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5118 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5125 static struct hda_verb alc885_mbp_ch6_init[] = {
5126 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5127 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5129 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5130 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5134 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5135 { 2, alc885_mbp_ch2_init },
5136 { 6, alc885_mbp_ch6_init },
5140 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5141 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5143 static struct snd_kcontrol_new alc882_base_mixer[] = {
5144 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5145 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5146 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5147 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5148 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5149 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5150 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5151 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5152 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5153 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5160 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5163 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5164 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5165 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5166 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5170 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5171 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT),
5172 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT),
5173 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT),
5174 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT),
5175 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT),
5176 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT),
5177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5178 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5179 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT),
5180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5183 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5184 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5185 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5193 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5194 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5198 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5204 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5205 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5208 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5209 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5210 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5211 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5215 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5216 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5218 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5220 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5222 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5223 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5224 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5225 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5226 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5227 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5228 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5235 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5237 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5239 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5240 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5241 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5242 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5244 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5246 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5247 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5251 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5254 .name = "Channel Mode",
5255 .info = alc_ch_mode_info,
5256 .get = alc_ch_mode_get,
5257 .put = alc_ch_mode_put,
5262 static struct hda_verb alc882_init_verbs[] = {
5263 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5268 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5269 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5276 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5277 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5278 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5280 /* Front Pin: output 0 (0x0c) */
5281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5283 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5284 /* Rear Pin: output 1 (0x0d) */
5285 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5288 /* CLFE Pin: output 2 (0x0e) */
5289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5291 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5292 /* Side Pin: output 3 (0x0f) */
5293 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5294 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5295 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5296 /* Mic (rear) pin: input vref at 80% */
5297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5299 /* Front Mic pin: input vref at 80% */
5300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5301 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5302 /* Line In pin: input */
5303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5304 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5305 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5306 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5307 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5308 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5309 /* CD pin widget for input */
5310 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5312 /* FIXME: use matrix-type input source selection */
5313 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5314 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5322 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5329 /* ADC1: mute amp left and right */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5331 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5332 /* ADC2: mute amp left and right */
5333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5334 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5335 /* ADC3: mute amp left and right */
5336 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5337 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5342 static struct hda_verb alc882_eapd_verbs[] = {
5343 /* change to EAPD mode */
5344 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5345 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5350 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5351 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5352 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5353 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5356 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5357 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5361 static struct hda_verb alc882_macpro_init_verbs[] = {
5362 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5365 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5366 /* Front Pin: output 0 (0x0c) */
5367 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5369 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5370 /* Front Mic pin: input vref at 80% */
5371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5373 /* Speaker: output */
5374 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5376 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5377 /* Headphone output (output 0 - 0x0c) */
5378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5380 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5382 /* FIXME: use matrix-type input source selection */
5383 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5384 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5399 /* ADC1: mute amp left and right */
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5401 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5402 /* ADC2: mute amp left and right */
5403 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5404 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5405 /* ADC3: mute amp left and right */
5406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5412 /* Macbook Pro rev3 */
5413 static struct hda_verb alc885_mbp3_init_verbs[] = {
5414 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5422 /* Front Pin: output 0 (0x0c) */
5423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5425 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5426 /* HP Pin: output 0 (0x0d) */
5427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5430 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5431 /* Mic (rear) pin: input vref at 80% */
5432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5433 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5434 /* Front Mic pin: input vref at 80% */
5435 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5436 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5437 /* Line In pin: use output 1 when in LineOut mode */
5438 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5439 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5440 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5442 /* FIXME: use matrix-type input source selection */
5443 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5444 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5450 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5451 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5459 /* ADC1: mute amp left and right */
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5461 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5462 /* ADC2: mute amp left and right */
5463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5464 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5465 /* ADC3: mute amp left and right */
5466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5467 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5472 /* iMac 24 mixer. */
5473 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5474 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5475 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5479 /* iMac 24 init verbs. */
5480 static struct hda_verb alc885_imac24_init_verbs[] = {
5481 /* Internal speakers: output 0 (0x0c) */
5482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5484 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5485 /* Internal speakers: output 0 (0x0c) */
5486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5488 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5489 /* Headphone: output 0 (0x0c) */
5490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5491 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5492 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5493 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5494 /* Front Mic: input vref at 80% */
5495 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5496 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5500 /* Toggle speaker-output according to the hp-jack state */
5501 static void alc885_imac24_automute(struct hda_codec *codec)
5503 unsigned int present;
5505 present = snd_hda_codec_read(codec, 0x14, 0,
5506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5507 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5508 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5509 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5510 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5513 /* Processes unsolicited events. */
5514 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5517 /* Headphone insertion or removal. */
5518 if ((res >> 26) == ALC880_HP_EVENT)
5519 alc885_imac24_automute(codec);
5522 static void alc885_mbp3_automute(struct hda_codec *codec)
5524 unsigned int present;
5526 present = snd_hda_codec_read(codec, 0x15, 0,
5527 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5528 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5529 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5530 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5531 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5534 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5537 /* Headphone insertion or removal. */
5538 if ((res >> 26) == ALC880_HP_EVENT)
5539 alc885_mbp3_automute(codec);
5543 static struct hda_verb alc882_targa_verbs[] = {
5544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5550 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5551 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5552 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5554 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5555 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5556 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5557 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5561 /* toggle speaker-output according to the hp-jack state */
5562 static void alc882_targa_automute(struct hda_codec *codec)
5564 unsigned int present;
5566 present = snd_hda_codec_read(codec, 0x14, 0,
5567 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5568 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5569 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5570 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5574 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5576 /* Looks like the unsol event is incompatible with the standard
5577 * definition. 4bit tag is placed at 26 bit!
5579 if (((res >> 26) == ALC880_HP_EVENT)) {
5580 alc882_targa_automute(codec);
5584 static struct hda_verb alc882_asus_a7j_verbs[] = {
5585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5592 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5594 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5596 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5597 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5598 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5602 static struct hda_verb alc882_asus_a7m_verbs[] = {
5603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5608 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5610 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5612 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5614 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5615 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5616 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5620 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5622 unsigned int gpiostate, gpiomask, gpiodir;
5624 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5625 AC_VERB_GET_GPIO_DATA, 0);
5628 gpiostate |= (1 << pin);
5630 gpiostate &= ~(1 << pin);
5632 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5633 AC_VERB_GET_GPIO_MASK, 0);
5634 gpiomask |= (1 << pin);
5636 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5637 AC_VERB_GET_GPIO_DIRECTION, 0);
5638 gpiodir |= (1 << pin);
5641 snd_hda_codec_write(codec, codec->afg, 0,
5642 AC_VERB_SET_GPIO_MASK, gpiomask);
5643 snd_hda_codec_write(codec, codec->afg, 0,
5644 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5648 snd_hda_codec_write(codec, codec->afg, 0,
5649 AC_VERB_SET_GPIO_DATA, gpiostate);
5652 /* set up GPIO at initialization */
5653 static void alc885_macpro_init_hook(struct hda_codec *codec)
5655 alc882_gpio_mute(codec, 0, 0);
5656 alc882_gpio_mute(codec, 1, 0);
5659 /* set up GPIO and update auto-muting at initialization */
5660 static void alc885_imac24_init_hook(struct hda_codec *codec)
5662 alc885_macpro_init_hook(codec);
5663 alc885_imac24_automute(codec);
5667 * generic initialization of ADC, input mixers and output mixers
5669 static struct hda_verb alc882_auto_init_verbs[] = {
5671 * Unmute ADC0-2 and set the default input to mic-in
5673 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5674 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5675 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5676 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5677 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5680 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5682 * Note: PASD motherboards uses the Line In 2 as the input for
5683 * front panel mic (mic 2)
5685 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5693 * Set up output mixers (0x0c - 0x0f)
5695 /* set vol=0 to output mixers */
5696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5699 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5700 /* set up input amps for analog loopback */
5701 /* Amp Indices: DAC = 0, mixer = 1 */
5702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5704 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5707 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5708 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5709 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5710 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5711 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5713 /* FIXME: use matrix-type input source selection */
5714 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5715 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5721 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5726 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5734 /* capture mixer elements */
5735 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5736 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5737 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5738 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5739 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5742 /* The multiple "Capture Source" controls confuse alsamixer
5743 * So call somewhat different..
5744 * FIXME: the controls appear in the "playback" view!
5746 /* .name = "Capture Source", */
5747 .name = "Input Source",
5749 .info = alc882_mux_enum_info,
5750 .get = alc882_mux_enum_get,
5751 .put = alc882_mux_enum_put,
5756 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5757 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5758 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5759 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5760 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5761 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5762 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5764 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5765 /* The multiple "Capture Source" controls confuse alsamixer
5766 * So call somewhat different..
5767 * FIXME: the controls appear in the "playback" view!
5769 /* .name = "Capture Source", */
5770 .name = "Input Source",
5772 .info = alc882_mux_enum_info,
5773 .get = alc882_mux_enum_get,
5774 .put = alc882_mux_enum_put,
5779 #ifdef CONFIG_SND_HDA_POWER_SAVE
5780 #define alc882_loopbacks alc880_loopbacks
5783 /* pcm configuration: identiacal with ALC880 */
5784 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5785 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5786 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5787 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5790 * configuration and preset
5792 static const char *alc882_models[ALC882_MODEL_LAST] = {
5793 [ALC882_3ST_DIG] = "3stack-dig",
5794 [ALC882_6ST_DIG] = "6stack-dig",
5795 [ALC882_ARIMA] = "arima",
5796 [ALC882_W2JC] = "w2jc",
5797 [ALC882_TARGA] = "targa",
5798 [ALC882_ASUS_A7J] = "asus-a7j",
5799 [ALC882_ASUS_A7M] = "asus-a7m",
5800 [ALC885_MACPRO] = "macpro",
5801 [ALC885_MBP3] = "mbp3",
5802 [ALC885_IMAC24] = "imac24",
5803 [ALC882_AUTO] = "auto",
5806 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5807 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5808 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5809 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5810 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5811 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5812 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5813 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5814 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5815 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5816 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5817 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5821 static struct alc_config_preset alc882_presets[] = {
5822 [ALC882_3ST_DIG] = {
5823 .mixers = { alc882_base_mixer },
5824 .init_verbs = { alc882_init_verbs },
5825 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5826 .dac_nids = alc882_dac_nids,
5827 .dig_out_nid = ALC882_DIGOUT_NID,
5828 .dig_in_nid = ALC882_DIGIN_NID,
5829 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5830 .channel_mode = alc882_ch_modes,
5832 .input_mux = &alc882_capture_source,
5834 [ALC882_6ST_DIG] = {
5835 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5836 .init_verbs = { alc882_init_verbs },
5837 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5838 .dac_nids = alc882_dac_nids,
5839 .dig_out_nid = ALC882_DIGOUT_NID,
5840 .dig_in_nid = ALC882_DIGIN_NID,
5841 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5842 .channel_mode = alc882_sixstack_modes,
5843 .input_mux = &alc882_capture_source,
5846 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5847 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5848 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5849 .dac_nids = alc882_dac_nids,
5850 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5851 .channel_mode = alc882_sixstack_modes,
5852 .input_mux = &alc882_capture_source,
5855 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5856 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5857 alc880_gpio1_init_verbs },
5858 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5859 .dac_nids = alc882_dac_nids,
5860 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5861 .channel_mode = alc880_threestack_modes,
5863 .input_mux = &alc882_capture_source,
5864 .dig_out_nid = ALC882_DIGOUT_NID,
5867 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5868 .init_verbs = { alc885_mbp3_init_verbs,
5869 alc880_gpio1_init_verbs },
5870 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5871 .dac_nids = alc882_dac_nids,
5872 .channel_mode = alc885_mbp_6ch_modes,
5873 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5874 .input_mux = &alc882_capture_source,
5875 .dig_out_nid = ALC882_DIGOUT_NID,
5876 .dig_in_nid = ALC882_DIGIN_NID,
5877 .unsol_event = alc885_mbp3_unsol_event,
5878 .init_hook = alc885_mbp3_automute,
5881 .mixers = { alc882_macpro_mixer },
5882 .init_verbs = { alc882_macpro_init_verbs },
5883 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5884 .dac_nids = alc882_dac_nids,
5885 .dig_out_nid = ALC882_DIGOUT_NID,
5886 .dig_in_nid = ALC882_DIGIN_NID,
5887 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5888 .channel_mode = alc882_ch_modes,
5889 .input_mux = &alc882_capture_source,
5890 .init_hook = alc885_macpro_init_hook,
5893 .mixers = { alc885_imac24_mixer },
5894 .init_verbs = { alc885_imac24_init_verbs },
5895 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5896 .dac_nids = alc882_dac_nids,
5897 .dig_out_nid = ALC882_DIGOUT_NID,
5898 .dig_in_nid = ALC882_DIGIN_NID,
5899 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5900 .channel_mode = alc882_ch_modes,
5901 .input_mux = &alc882_capture_source,
5902 .unsol_event = alc885_imac24_unsol_event,
5903 .init_hook = alc885_imac24_init_hook,
5906 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5907 alc882_capture_mixer },
5908 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5909 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5910 .dac_nids = alc882_dac_nids,
5911 .dig_out_nid = ALC882_DIGOUT_NID,
5912 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5913 .adc_nids = alc882_adc_nids,
5914 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5915 .channel_mode = alc882_3ST_6ch_modes,
5917 .input_mux = &alc882_capture_source,
5918 .unsol_event = alc882_targa_unsol_event,
5919 .init_hook = alc882_targa_automute,
5921 [ALC882_ASUS_A7J] = {
5922 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5923 alc882_capture_mixer },
5924 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5925 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5926 .dac_nids = alc882_dac_nids,
5927 .dig_out_nid = ALC882_DIGOUT_NID,
5928 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5929 .adc_nids = alc882_adc_nids,
5930 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5931 .channel_mode = alc882_3ST_6ch_modes,
5933 .input_mux = &alc882_capture_source,
5935 [ALC882_ASUS_A7M] = {
5936 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
5937 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5938 alc880_gpio1_init_verbs,
5939 alc882_asus_a7m_verbs },
5940 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5941 .dac_nids = alc882_dac_nids,
5942 .dig_out_nid = ALC882_DIGOUT_NID,
5943 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5944 .channel_mode = alc880_threestack_modes,
5946 .input_mux = &alc882_capture_source,
5955 PINFIX_ABIT_AW9D_MAX
5958 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5959 { 0x15, 0x01080104 }, /* side */
5960 { 0x16, 0x01011012 }, /* rear */
5961 { 0x17, 0x01016011 }, /* clfe */
5965 static const struct alc_pincfg *alc882_pin_fixes[] = {
5966 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5969 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5970 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5975 * BIOS auto configuration
5977 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5978 hda_nid_t nid, int pin_type,
5982 struct alc_spec *spec = codec->spec;
5985 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5988 idx = spec->multiout.dac_nids[dac_idx] - 2;
5990 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5992 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5994 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5998 static void alc882_auto_init_multi_out(struct hda_codec *codec)
6000 struct alc_spec *spec = codec->spec;
6003 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6004 for (i = 0; i <= HDA_SIDE; i++) {
6005 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6006 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6008 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
6013 static void alc882_auto_init_hp_out(struct hda_codec *codec)
6015 struct alc_spec *spec = codec->spec;
6018 pin = spec->autocfg.hp_pins[0];
6019 if (pin) /* connect to front */
6021 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6024 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6025 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6027 static void alc882_auto_init_analog_input(struct hda_codec *codec)
6029 struct alc_spec *spec = codec->spec;
6032 for (i = 0; i < AUTO_PIN_LAST; i++) {
6033 hda_nid_t nid = spec->autocfg.input_pins[i];
6034 if (alc882_is_input_pin(nid)) {
6035 snd_hda_codec_write(codec, nid, 0,
6036 AC_VERB_SET_PIN_WIDGET_CONTROL,
6037 i <= AUTO_PIN_FRONT_MIC ?
6038 PIN_VREF80 : PIN_IN);
6039 if (nid != ALC882_PIN_CD_NID)
6040 snd_hda_codec_write(codec, nid, 0,
6041 AC_VERB_SET_AMP_GAIN_MUTE,
6047 /* add mic boosts if needed */
6048 static int alc_auto_add_mic_boost(struct hda_codec *codec)
6050 struct alc_spec *spec = codec->spec;
6054 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6056 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6058 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6062 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6064 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6066 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6073 /* almost identical with ALC880 parser... */
6074 static int alc882_parse_auto_config(struct hda_codec *codec)
6076 struct alc_spec *spec = codec->spec;
6077 int err = alc880_parse_auto_config(codec);
6082 return 0; /* no config found */
6084 err = alc_auto_add_mic_boost(codec);
6088 /* hack - override the init verbs */
6089 spec->init_verbs[0] = alc882_auto_init_verbs;
6091 return 1; /* config found */
6094 /* additional initialization for auto-configuration model */
6095 static void alc882_auto_init(struct hda_codec *codec)
6097 alc882_auto_init_multi_out(codec);
6098 alc882_auto_init_hp_out(codec);
6099 alc882_auto_init_analog_input(codec);
6102 static int patch_alc882(struct hda_codec *codec)
6104 struct alc_spec *spec;
6105 int err, board_config;
6107 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6113 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6117 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6118 /* Pick up systems that don't supply PCI SSID */
6119 switch (codec->subsystem_id) {
6120 case 0x106b0c00: /* Mac Pro */
6121 board_config = ALC885_MACPRO;
6123 case 0x106b1000: /* iMac 24 */
6124 board_config = ALC885_IMAC24;
6126 case 0x106b2c00: /* Macbook Pro rev3 */
6127 board_config = ALC885_MBP3;
6130 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6131 "trying auto-probe from BIOS...\n");
6132 board_config = ALC882_AUTO;
6136 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6138 if (board_config == ALC882_AUTO) {
6139 /* automatic parse from the BIOS config */
6140 err = alc882_parse_auto_config(codec);
6146 "hda_codec: Cannot set up configuration "
6147 "from BIOS. Using base mode...\n");
6148 board_config = ALC882_3ST_DIG;
6152 if (board_config != ALC882_AUTO)
6153 setup_preset(spec, &alc882_presets[board_config]);
6155 spec->stream_name_analog = "ALC882 Analog";
6156 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6157 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6159 spec->stream_name_digital = "ALC882 Digital";
6160 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6161 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6163 if (!spec->adc_nids && spec->input_mux) {
6164 /* check whether NID 0x07 is valid */
6165 unsigned int wcap = get_wcaps(codec, 0x07);
6167 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6168 if (wcap != AC_WID_AUD_IN) {
6169 spec->adc_nids = alc882_adc_nids_alt;
6170 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6171 spec->mixers[spec->num_mixers] =
6172 alc882_capture_alt_mixer;
6175 spec->adc_nids = alc882_adc_nids;
6176 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6177 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6182 codec->patch_ops = alc_patch_ops;
6183 if (board_config == ALC882_AUTO)
6184 spec->init_hook = alc882_auto_init;
6185 #ifdef CONFIG_SND_HDA_POWER_SAVE
6186 if (!spec->loopback.amplist)
6187 spec->loopback.amplist = alc882_loopbacks;
6196 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6197 * configuration. Each pin widget can choose any input DACs and a mixer.
6198 * Each ADC is connected from a mixer of all inputs. This makes possible
6199 * 6-channel independent captures.
6201 * In addition, an independent DAC for the multi-playback (not used in this
6204 #define ALC883_DIGOUT_NID 0x06
6205 #define ALC883_DIGIN_NID 0x0a
6207 static hda_nid_t alc883_dac_nids[4] = {
6208 /* front, rear, clfe, rear_surr */
6209 0x02, 0x04, 0x03, 0x05
6212 static hda_nid_t alc883_adc_nids[2] = {
6218 /* FIXME: should be a matrix-type input source selection */
6220 static struct hda_input_mux alc883_capture_source = {
6224 { "Front Mic", 0x1 },
6230 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6238 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6248 #define alc883_mux_enum_info alc_mux_enum_info
6249 #define alc883_mux_enum_get alc_mux_enum_get
6251 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6252 struct snd_ctl_elem_value *ucontrol)
6254 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6255 struct alc_spec *spec = codec->spec;
6256 const struct hda_input_mux *imux = spec->input_mux;
6257 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6258 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6259 hda_nid_t nid = capture_mixers[adc_idx];
6260 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6261 unsigned int i, idx;
6263 idx = ucontrol->value.enumerated.item[0];
6264 if (idx >= imux->num_items)
6265 idx = imux->num_items - 1;
6266 if (*cur_val == idx)
6268 for (i = 0; i < imux->num_items; i++) {
6269 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6270 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6271 imux->items[i].index,
6281 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6288 static struct hda_verb alc883_3ST_ch2_init[] = {
6289 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6290 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6291 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6292 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6299 static struct hda_verb alc883_3ST_ch4_init[] = {
6300 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6301 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6302 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6303 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6304 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6311 static struct hda_verb alc883_3ST_ch6_init[] = {
6312 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6313 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6314 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6315 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6316 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6317 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6321 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6322 { 2, alc883_3ST_ch2_init },
6323 { 4, alc883_3ST_ch4_init },
6324 { 6, alc883_3ST_ch6_init },
6330 static struct hda_verb alc883_sixstack_ch6_init[] = {
6331 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6332 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6333 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6334 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6341 static struct hda_verb alc883_sixstack_ch8_init[] = {
6342 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6343 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6344 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6345 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6349 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6350 { 6, alc883_sixstack_ch6_init },
6351 { 8, alc883_sixstack_ch8_init },
6354 static struct hda_verb alc883_medion_eapd_verbs[] = {
6355 /* eanable EAPD on medion laptop */
6356 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6357 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6361 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6362 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6365 static struct snd_kcontrol_new alc883_base_mixer[] = {
6366 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6367 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6368 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6369 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6370 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6371 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6372 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6373 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6374 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6375 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6376 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6379 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6380 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6382 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6384 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6385 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6386 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6387 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6388 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6389 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6390 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6391 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6392 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6394 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6395 /* .name = "Capture Source", */
6396 .name = "Input Source",
6398 .info = alc883_mux_enum_info,
6399 .get = alc883_mux_enum_get,
6400 .put = alc883_mux_enum_put,
6405 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6407 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6408 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6409 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6410 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6411 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6416 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6417 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6418 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6419 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6420 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6421 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6422 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6425 /* .name = "Capture Source", */
6426 .name = "Input Source",
6428 .info = alc883_mux_enum_info,
6429 .get = alc883_mux_enum_get,
6430 .put = alc883_mux_enum_put,
6435 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6437 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6447 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6448 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6449 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6450 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6451 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6452 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6453 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6454 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6457 /* .name = "Capture Source", */
6458 .name = "Input Source",
6460 .info = alc883_mux_enum_info,
6461 .get = alc883_mux_enum_get,
6462 .put = alc883_mux_enum_put,
6467 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6468 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6472 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6473 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6474 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6475 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6476 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6477 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6478 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6479 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6480 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6481 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6482 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6483 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6484 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6485 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6487 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6488 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6489 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6490 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6491 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6492 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6494 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6495 /* .name = "Capture Source", */
6496 .name = "Input Source",
6498 .info = alc883_mux_enum_info,
6499 .get = alc883_mux_enum_get,
6500 .put = alc883_mux_enum_put,
6505 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6506 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6507 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6508 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6509 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6510 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6511 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6512 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6513 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6515 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6516 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6517 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6518 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6520 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6522 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6523 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6525 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6526 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6527 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6528 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6532 /* .name = "Capture Source", */
6533 .name = "Input Source",
6535 .info = alc883_mux_enum_info,
6536 .get = alc883_mux_enum_get,
6537 .put = alc883_mux_enum_put,
6542 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6545 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6546 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6547 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6548 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6549 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6550 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6551 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6552 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6553 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6557 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6558 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6559 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6560 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6561 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6562 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6564 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6565 /* .name = "Capture Source", */
6566 .name = "Input Source",
6568 .info = alc883_mux_enum_info,
6569 .get = alc883_mux_enum_get,
6570 .put = alc883_mux_enum_put,
6575 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6578 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6579 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6580 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6584 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6585 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6586 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6587 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6589 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6590 /* .name = "Capture Source", */
6591 .name = "Input Source",
6593 .info = alc883_mux_enum_info,
6594 .get = alc883_mux_enum_get,
6595 .put = alc883_mux_enum_put,
6600 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6601 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6602 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6603 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6604 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6605 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6609 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6610 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6613 /* .name = "Capture Source", */
6614 .name = "Input Source",
6616 .info = alc883_mux_enum_info,
6617 .get = alc883_mux_enum_get,
6618 .put = alc883_mux_enum_put,
6623 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6624 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6625 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6631 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6632 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6633 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6634 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6635 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6636 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6639 /* .name = "Capture Source", */
6640 .name = "Input Source",
6642 .info = alc883_mux_enum_info,
6643 .get = alc883_mux_enum_get,
6644 .put = alc883_mux_enum_put,
6649 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6650 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6652 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6659 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6660 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6661 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6662 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6665 /* .name = "Capture Source", */
6666 .name = "Input Source",
6668 .info = alc883_mux_enum_info,
6669 .get = alc883_mux_enum_get,
6670 .put = alc883_mux_enum_put,
6675 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6676 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6677 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6678 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6679 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6680 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6681 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6682 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6683 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6684 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6685 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6686 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6687 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6688 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6689 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6690 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6692 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6695 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6696 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6697 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6698 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6699 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6700 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6701 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6702 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6705 /* .name = "Capture Source", */
6706 .name = "Input Source",
6708 .info = alc883_mux_enum_info,
6709 .get = alc883_mux_enum_get,
6710 .put = alc883_mux_enum_put,
6715 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6716 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6718 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6719 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6720 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6721 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6722 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6723 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6724 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6725 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6726 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6727 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6728 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6730 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6732 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6733 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6734 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6735 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6736 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6737 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6738 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6739 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6740 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6743 /* .name = "Capture Source", */
6744 .name = "Input Source",
6746 .info = alc883_mux_enum_info,
6747 .get = alc883_mux_enum_get,
6748 .put = alc883_mux_enum_put,
6753 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6754 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6762 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6763 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6764 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6765 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6767 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6768 /* .name = "Capture Source", */
6769 .name = "Input Source",
6771 .info = alc883_mux_enum_info,
6772 .get = alc883_mux_enum_get,
6773 .put = alc883_mux_enum_put,
6778 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6781 .name = "Channel Mode",
6782 .info = alc_ch_mode_info,
6783 .get = alc_ch_mode_get,
6784 .put = alc_ch_mode_put,
6789 static struct hda_verb alc883_init_verbs[] = {
6790 /* ADC1: mute amp left and right */
6791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6792 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6793 /* ADC2: mute amp left and right */
6794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6795 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6796 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6801 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6807 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6809 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6810 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6813 /* mute analog input loopbacks */
6814 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6817 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6818 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6820 /* Front Pin: output 0 (0x0c) */
6821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6822 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6823 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6824 /* Rear Pin: output 1 (0x0d) */
6825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6827 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6828 /* CLFE Pin: output 2 (0x0e) */
6829 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6830 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6831 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6832 /* Side Pin: output 3 (0x0f) */
6833 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6834 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6835 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6836 /* Mic (rear) pin: input vref at 80% */
6837 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6839 /* Front Mic pin: input vref at 80% */
6840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6842 /* Line In pin: input */
6843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6845 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6846 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6847 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6848 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6849 /* CD pin widget for input */
6850 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6852 /* FIXME: use matrix-type input source selection */
6853 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6857 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6863 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6867 /* toggle speaker-output according to the hp-jack state */
6868 static void alc883_mitac_hp_automute(struct hda_codec *codec)
6870 unsigned int present;
6872 present = snd_hda_codec_read(codec, 0x15, 0,
6873 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6874 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6875 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6876 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
6877 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6880 /* auto-toggle front mic */
6882 static void alc883_mitac_mic_automute(struct hda_codec *codec)
6884 unsigned int present;
6887 present = snd_hda_codec_read(codec, 0x18, 0,
6888 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6889 bits = present ? HDA_AMP_MUTE : 0;
6890 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
6894 static void alc883_mitac_automute(struct hda_codec *codec)
6896 alc883_mitac_hp_automute(codec);
6897 /* alc883_mitac_mic_automute(codec); */
6900 static void alc883_mitac_unsol_event(struct hda_codec *codec,
6903 switch (res >> 26) {
6904 case ALC880_HP_EVENT:
6905 alc883_mitac_hp_automute(codec);
6907 case ALC880_MIC_EVENT:
6908 /* alc883_mitac_mic_automute(codec); */
6913 static struct hda_verb alc883_mitac_verbs[] = {
6915 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6918 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
6919 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6921 /* enable unsolicited event */
6922 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6923 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
6928 static struct hda_verb alc883_tagra_verbs[] = {
6929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6933 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6935 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6936 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6937 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6939 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6940 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6941 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6942 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6947 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6948 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6950 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6954 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6955 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6957 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6962 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6963 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6966 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6967 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6971 static struct hda_verb alc883_haier_w66_verbs[] = {
6972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6975 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6977 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6978 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6979 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6984 static struct hda_verb alc888_6st_hp_verbs[] = {
6985 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6987 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6988 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6992 static struct hda_verb alc888_3st_hp_verbs[] = {
6993 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6994 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6995 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6999 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7000 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7001 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7002 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7003 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7007 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7008 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7009 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7010 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7011 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7015 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
7016 { 2, alc888_3st_hp_2ch_init },
7017 { 6, alc888_3st_hp_6ch_init },
7020 /* toggle front-jack and RCA according to the hp-jack state */
7021 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7023 unsigned int present;
7025 present = snd_hda_codec_read(codec, 0x1b, 0,
7026 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7027 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7028 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7029 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7030 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7033 /* toggle RCA according to the front-jack state */
7034 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7036 unsigned int present;
7038 present = snd_hda_codec_read(codec, 0x14, 0,
7039 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7040 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7041 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7044 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7047 if ((res >> 26) == ALC880_HP_EVENT)
7048 alc888_lenovo_ms7195_front_automute(codec);
7049 if ((res >> 26) == ALC880_FRONT_EVENT)
7050 alc888_lenovo_ms7195_rca_automute(codec);
7053 static struct hda_verb alc883_medion_md2_verbs[] = {
7054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7059 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7063 /* toggle speaker-output according to the hp-jack state */
7064 static void alc883_medion_md2_automute(struct hda_codec *codec)
7066 unsigned int present;
7068 present = snd_hda_codec_read(codec, 0x14, 0,
7069 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7070 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7071 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7074 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7077 if ((res >> 26) == ALC880_HP_EVENT)
7078 alc883_medion_md2_automute(codec);
7081 /* toggle speaker-output according to the hp-jack state */
7082 static void alc883_tagra_automute(struct hda_codec *codec)
7084 unsigned int present;
7087 present = snd_hda_codec_read(codec, 0x14, 0,
7088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7089 bits = present ? HDA_AMP_MUTE : 0;
7090 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7091 HDA_AMP_MUTE, bits);
7092 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7096 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7098 if ((res >> 26) == ALC880_HP_EVENT)
7099 alc883_tagra_automute(codec);
7102 static void alc883_haier_w66_automute(struct hda_codec *codec)
7104 unsigned int present;
7107 present = snd_hda_codec_read(codec, 0x1b, 0,
7108 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7109 bits = present ? 0x80 : 0;
7110 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7114 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7117 if ((res >> 26) == ALC880_HP_EVENT)
7118 alc883_haier_w66_automute(codec);
7121 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7123 unsigned int present;
7126 present = snd_hda_codec_read(codec, 0x14, 0,
7127 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7128 bits = present ? HDA_AMP_MUTE : 0;
7129 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7130 HDA_AMP_MUTE, bits);
7133 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7135 unsigned int present;
7138 present = snd_hda_codec_read(codec, 0x1b, 0,
7139 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7140 bits = present ? HDA_AMP_MUTE : 0;
7141 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7142 HDA_AMP_MUTE, bits);
7143 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7144 HDA_AMP_MUTE, bits);
7147 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7150 if ((res >> 26) == ALC880_HP_EVENT)
7151 alc883_lenovo_101e_all_automute(codec);
7152 if ((res >> 26) == ALC880_FRONT_EVENT)
7153 alc883_lenovo_101e_ispeaker_automute(codec);
7156 /* toggle speaker-output according to the hp-jack state */
7157 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7159 unsigned int present;
7161 present = snd_hda_codec_read(codec, 0x14, 0,
7162 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7163 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7164 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7165 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7166 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7169 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7172 if ((res >> 26) == ALC880_HP_EVENT)
7173 alc883_acer_aspire_automute(codec);
7176 static struct hda_verb alc883_acer_eapd_verbs[] = {
7177 /* HP Pin: output 0 (0x0c) */
7178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7181 /* Front Pin: output 0 (0x0c) */
7182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7183 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7185 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7186 /* eanable EAPD on medion laptop */
7187 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7188 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7189 /* enable unsolicited event */
7190 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7195 * generic initialization of ADC, input mixers and output mixers
7197 static struct hda_verb alc883_auto_init_verbs[] = {
7199 * Unmute ADC0-2 and set the default input to mic-in
7201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7203 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7204 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7206 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7208 * Note: PASD motherboards uses the Line In 2 as the input for
7209 * front panel mic (mic 2)
7211 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7212 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7213 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7219 * Set up output mixers (0x0c - 0x0f)
7221 /* set vol=0 to output mixers */
7222 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7223 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7224 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7226 /* set up input amps for analog loopback */
7227 /* Amp Indices: DAC = 0, mixer = 1 */
7228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7232 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7233 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7234 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7235 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7236 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7237 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7239 /* FIXME: use matrix-type input source selection */
7240 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7245 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7251 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7257 /* capture mixer elements */
7258 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7259 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7260 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7261 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7262 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7265 /* The multiple "Capture Source" controls confuse alsamixer
7266 * So call somewhat different..
7267 * FIXME: the controls appear in the "playback" view!
7269 /* .name = "Capture Source", */
7270 .name = "Input Source",
7272 .info = alc882_mux_enum_info,
7273 .get = alc882_mux_enum_get,
7274 .put = alc882_mux_enum_put,
7279 #ifdef CONFIG_SND_HDA_POWER_SAVE
7280 #define alc883_loopbacks alc880_loopbacks
7283 /* pcm configuration: identiacal with ALC880 */
7284 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7285 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7286 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7287 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7290 * configuration and preset
7292 static const char *alc883_models[ALC883_MODEL_LAST] = {
7293 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7294 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7295 [ALC883_3ST_6ch] = "3stack-6ch",
7296 [ALC883_6ST_DIG] = "6stack-dig",
7297 [ALC883_TARGA_DIG] = "targa-dig",
7298 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7299 [ALC883_ACER] = "acer",
7300 [ALC883_ACER_ASPIRE] = "acer-aspire",
7301 [ALC883_MEDION] = "medion",
7302 [ALC883_MEDION_MD2] = "medion-md2",
7303 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7304 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7305 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7306 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7307 [ALC883_HAIER_W66] = "haier-w66",
7308 [ALC888_6ST_HP] = "6stack-hp",
7309 [ALC888_3ST_HP] = "3stack-hp",
7310 [ALC883_MITAC] = "mitac",
7311 [ALC883_AUTO] = "auto",
7314 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7315 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7316 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7317 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7318 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7319 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
7320 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7321 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7322 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7323 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7324 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7325 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7326 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7327 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7328 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7329 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7330 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7331 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7332 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7333 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7334 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7335 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7336 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7337 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7338 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7339 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7340 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7341 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7342 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7343 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7344 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7345 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7346 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7347 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7348 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7349 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7350 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7351 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7352 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7353 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7354 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7355 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7356 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7357 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7358 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7359 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7363 static struct alc_config_preset alc883_presets[] = {
7364 [ALC883_3ST_2ch_DIG] = {
7365 .mixers = { alc883_3ST_2ch_mixer },
7366 .init_verbs = { alc883_init_verbs },
7367 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7368 .dac_nids = alc883_dac_nids,
7369 .dig_out_nid = ALC883_DIGOUT_NID,
7370 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7371 .adc_nids = alc883_adc_nids,
7372 .dig_in_nid = ALC883_DIGIN_NID,
7373 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7374 .channel_mode = alc883_3ST_2ch_modes,
7375 .input_mux = &alc883_capture_source,
7377 [ALC883_3ST_6ch_DIG] = {
7378 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7379 .init_verbs = { alc883_init_verbs },
7380 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7381 .dac_nids = alc883_dac_nids,
7382 .dig_out_nid = ALC883_DIGOUT_NID,
7383 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7384 .adc_nids = alc883_adc_nids,
7385 .dig_in_nid = ALC883_DIGIN_NID,
7386 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7387 .channel_mode = alc883_3ST_6ch_modes,
7389 .input_mux = &alc883_capture_source,
7391 [ALC883_3ST_6ch] = {
7392 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7393 .init_verbs = { alc883_init_verbs },
7394 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7395 .dac_nids = alc883_dac_nids,
7396 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7397 .adc_nids = alc883_adc_nids,
7398 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7399 .channel_mode = alc883_3ST_6ch_modes,
7401 .input_mux = &alc883_capture_source,
7403 [ALC883_6ST_DIG] = {
7404 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7405 .init_verbs = { alc883_init_verbs },
7406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7407 .dac_nids = alc883_dac_nids,
7408 .dig_out_nid = ALC883_DIGOUT_NID,
7409 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7410 .adc_nids = alc883_adc_nids,
7411 .dig_in_nid = ALC883_DIGIN_NID,
7412 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7413 .channel_mode = alc883_sixstack_modes,
7414 .input_mux = &alc883_capture_source,
7416 [ALC883_TARGA_DIG] = {
7417 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7418 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7419 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7420 .dac_nids = alc883_dac_nids,
7421 .dig_out_nid = ALC883_DIGOUT_NID,
7422 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7423 .adc_nids = alc883_adc_nids,
7424 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7425 .channel_mode = alc883_3ST_6ch_modes,
7427 .input_mux = &alc883_capture_source,
7428 .unsol_event = alc883_tagra_unsol_event,
7429 .init_hook = alc883_tagra_automute,
7431 [ALC883_TARGA_2ch_DIG] = {
7432 .mixers = { alc883_tagra_2ch_mixer},
7433 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7434 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7435 .dac_nids = alc883_dac_nids,
7436 .dig_out_nid = ALC883_DIGOUT_NID,
7437 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7438 .adc_nids = alc883_adc_nids,
7439 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7440 .channel_mode = alc883_3ST_2ch_modes,
7441 .input_mux = &alc883_capture_source,
7442 .unsol_event = alc883_tagra_unsol_event,
7443 .init_hook = alc883_tagra_automute,
7446 .mixers = { alc883_base_mixer },
7447 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7448 * and the headphone jack. Turn this on and rely on the
7449 * standard mute methods whenever the user wants to turn
7450 * these outputs off.
7452 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7453 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7454 .dac_nids = alc883_dac_nids,
7455 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7456 .adc_nids = alc883_adc_nids,
7457 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7458 .channel_mode = alc883_3ST_2ch_modes,
7459 .input_mux = &alc883_capture_source,
7461 [ALC883_ACER_ASPIRE] = {
7462 .mixers = { alc883_acer_aspire_mixer },
7463 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7464 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7465 .dac_nids = alc883_dac_nids,
7466 .dig_out_nid = ALC883_DIGOUT_NID,
7467 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7468 .adc_nids = alc883_adc_nids,
7469 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7470 .channel_mode = alc883_3ST_2ch_modes,
7471 .input_mux = &alc883_capture_source,
7472 .unsol_event = alc883_acer_aspire_unsol_event,
7473 .init_hook = alc883_acer_aspire_automute,
7476 .mixers = { alc883_fivestack_mixer,
7477 alc883_chmode_mixer },
7478 .init_verbs = { alc883_init_verbs,
7479 alc883_medion_eapd_verbs },
7480 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7481 .dac_nids = alc883_dac_nids,
7482 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7483 .adc_nids = alc883_adc_nids,
7484 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7485 .channel_mode = alc883_sixstack_modes,
7486 .input_mux = &alc883_capture_source,
7488 [ALC883_MEDION_MD2] = {
7489 .mixers = { alc883_medion_md2_mixer},
7490 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7491 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7492 .dac_nids = alc883_dac_nids,
7493 .dig_out_nid = ALC883_DIGOUT_NID,
7494 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7495 .adc_nids = alc883_adc_nids,
7496 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7497 .channel_mode = alc883_3ST_2ch_modes,
7498 .input_mux = &alc883_capture_source,
7499 .unsol_event = alc883_medion_md2_unsol_event,
7500 .init_hook = alc883_medion_md2_automute,
7502 [ALC883_LAPTOP_EAPD] = {
7503 .mixers = { alc883_base_mixer },
7504 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7506 .dac_nids = alc883_dac_nids,
7507 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7508 .adc_nids = alc883_adc_nids,
7509 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7510 .channel_mode = alc883_3ST_2ch_modes,
7511 .input_mux = &alc883_capture_source,
7513 [ALC883_LENOVO_101E_2ch] = {
7514 .mixers = { alc883_lenovo_101e_2ch_mixer},
7515 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7516 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7517 .dac_nids = alc883_dac_nids,
7518 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7519 .adc_nids = alc883_adc_nids,
7520 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7521 .channel_mode = alc883_3ST_2ch_modes,
7522 .input_mux = &alc883_lenovo_101e_capture_source,
7523 .unsol_event = alc883_lenovo_101e_unsol_event,
7524 .init_hook = alc883_lenovo_101e_all_automute,
7526 [ALC883_LENOVO_NB0763] = {
7527 .mixers = { alc883_lenovo_nb0763_mixer },
7528 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7529 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7530 .dac_nids = alc883_dac_nids,
7531 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7532 .adc_nids = alc883_adc_nids,
7533 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7534 .channel_mode = alc883_3ST_2ch_modes,
7536 .input_mux = &alc883_lenovo_nb0763_capture_source,
7537 .unsol_event = alc883_medion_md2_unsol_event,
7538 .init_hook = alc883_medion_md2_automute,
7540 [ALC888_LENOVO_MS7195_DIG] = {
7541 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7542 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7543 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7544 .dac_nids = alc883_dac_nids,
7545 .dig_out_nid = ALC883_DIGOUT_NID,
7546 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7547 .adc_nids = alc883_adc_nids,
7548 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7549 .channel_mode = alc883_3ST_6ch_modes,
7551 .input_mux = &alc883_capture_source,
7552 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7553 .init_hook = alc888_lenovo_ms7195_front_automute,
7555 [ALC883_HAIER_W66] = {
7556 .mixers = { alc883_tagra_2ch_mixer},
7557 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7559 .dac_nids = alc883_dac_nids,
7560 .dig_out_nid = ALC883_DIGOUT_NID,
7561 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7562 .adc_nids = alc883_adc_nids,
7563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7564 .channel_mode = alc883_3ST_2ch_modes,
7565 .input_mux = &alc883_capture_source,
7566 .unsol_event = alc883_haier_w66_unsol_event,
7567 .init_hook = alc883_haier_w66_automute,
7570 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7571 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7573 .dac_nids = alc883_dac_nids,
7574 .dig_out_nid = ALC883_DIGOUT_NID,
7575 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7576 .adc_nids = alc883_adc_nids,
7577 .dig_in_nid = ALC883_DIGIN_NID,
7578 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7579 .channel_mode = alc883_sixstack_modes,
7580 .input_mux = &alc883_capture_source,
7583 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7584 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7586 .dac_nids = alc883_dac_nids,
7587 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7588 .adc_nids = alc883_adc_nids,
7589 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7590 .channel_mode = alc888_3st_hp_modes,
7592 .input_mux = &alc883_capture_source,
7595 .mixers = { alc883_mitac_mixer },
7596 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7597 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7598 .dac_nids = alc883_dac_nids,
7599 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7600 .adc_nids = alc883_adc_nids,
7601 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7602 .channel_mode = alc883_3ST_2ch_modes,
7603 .input_mux = &alc883_capture_source,
7604 .unsol_event = alc883_mitac_unsol_event,
7605 .init_hook = alc883_mitac_automute,
7611 * BIOS auto configuration
7613 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7614 hda_nid_t nid, int pin_type,
7618 struct alc_spec *spec = codec->spec;
7621 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7624 idx = spec->multiout.dac_nids[dac_idx] - 2;
7626 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7628 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7630 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7634 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7636 struct alc_spec *spec = codec->spec;
7639 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7640 for (i = 0; i <= HDA_SIDE; i++) {
7641 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7642 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7644 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7649 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7651 struct alc_spec *spec = codec->spec;
7654 pin = spec->autocfg.hp_pins[0];
7655 if (pin) /* connect to front */
7657 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7660 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7661 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7663 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7665 struct alc_spec *spec = codec->spec;
7668 for (i = 0; i < AUTO_PIN_LAST; i++) {
7669 hda_nid_t nid = spec->autocfg.input_pins[i];
7670 if (alc883_is_input_pin(nid)) {
7671 snd_hda_codec_write(codec, nid, 0,
7672 AC_VERB_SET_PIN_WIDGET_CONTROL,
7673 (i <= AUTO_PIN_FRONT_MIC ?
7674 PIN_VREF80 : PIN_IN));
7675 if (nid != ALC883_PIN_CD_NID)
7676 snd_hda_codec_write(codec, nid, 0,
7677 AC_VERB_SET_AMP_GAIN_MUTE,
7683 /* almost identical with ALC880 parser... */
7684 static int alc883_parse_auto_config(struct hda_codec *codec)
7686 struct alc_spec *spec = codec->spec;
7687 int err = alc880_parse_auto_config(codec);
7692 return 0; /* no config found */
7694 err = alc_auto_add_mic_boost(codec);
7698 /* hack - override the init verbs */
7699 spec->init_verbs[0] = alc883_auto_init_verbs;
7700 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7703 return 1; /* config found */
7706 /* additional initialization for auto-configuration model */
7707 static void alc883_auto_init(struct hda_codec *codec)
7709 alc883_auto_init_multi_out(codec);
7710 alc883_auto_init_hp_out(codec);
7711 alc883_auto_init_analog_input(codec);
7714 static int patch_alc883(struct hda_codec *codec)
7716 struct alc_spec *spec;
7717 int err, board_config;
7719 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7725 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7728 if (board_config < 0) {
7729 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7730 "trying auto-probe from BIOS...\n");
7731 board_config = ALC883_AUTO;
7734 if (board_config == ALC883_AUTO) {
7735 /* automatic parse from the BIOS config */
7736 err = alc883_parse_auto_config(codec);
7742 "hda_codec: Cannot set up configuration "
7743 "from BIOS. Using base mode...\n");
7744 board_config = ALC883_3ST_2ch_DIG;
7748 if (board_config != ALC883_AUTO)
7749 setup_preset(spec, &alc883_presets[board_config]);
7751 spec->stream_name_analog = "ALC883 Analog";
7752 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7753 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7755 spec->stream_name_digital = "ALC883 Digital";
7756 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7757 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7759 if (!spec->adc_nids && spec->input_mux) {
7760 spec->adc_nids = alc883_adc_nids;
7761 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7764 codec->patch_ops = alc_patch_ops;
7765 if (board_config == ALC883_AUTO)
7766 spec->init_hook = alc883_auto_init;
7767 #ifdef CONFIG_SND_HDA_POWER_SAVE
7768 if (!spec->loopback.amplist)
7769 spec->loopback.amplist = alc883_loopbacks;
7779 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7780 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7782 #define alc262_dac_nids alc260_dac_nids
7783 #define alc262_adc_nids alc882_adc_nids
7784 #define alc262_adc_nids_alt alc882_adc_nids_alt
7786 #define alc262_modes alc260_modes
7787 #define alc262_capture_source alc882_capture_source
7789 static struct snd_kcontrol_new alc262_base_mixer[] = {
7790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7791 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7802 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7803 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7804 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7805 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7806 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7807 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7811 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7812 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7813 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7814 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7815 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7820 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7821 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7822 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7823 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7824 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7825 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7826 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7831 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7832 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7833 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7834 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7835 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7836 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7843 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7844 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7845 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7848 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7849 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7850 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7851 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7855 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7856 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7857 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7860 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7861 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7863 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7866 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7867 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7868 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7869 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7870 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7874 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7875 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7876 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7877 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7881 static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = {
7882 .ops = &snd_hda_bind_vol,
7884 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7885 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7890 static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = {
7891 .ops = &snd_hda_bind_sw,
7893 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7894 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7899 /* mute/unmute internal speaker according to the hp jack and mute state */
7900 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
7902 struct alc_spec *spec = codec->spec;
7905 if (force || !spec->sense_updated) {
7906 unsigned int present;
7907 present = snd_hda_codec_read(codec, 0x15, 0,
7908 AC_VERB_GET_PIN_SENSE, 0);
7909 spec->jack_present = (present & 0x80000000) != 0;
7910 spec->sense_updated = 1;
7912 if (spec->jack_present)
7913 mute = (0x7080 | ((0)<<8)); /* mute internal speaker */
7914 else /* unmute internal speaker if necessary */
7915 mute = (0x7000 | ((0)<<8));
7916 snd_hda_codec_write(codec, 0x0c, 0,
7917 AC_VERB_SET_AMP_GAIN_MUTE, mute );
7920 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
7923 if ((res >> 26) != ALC880_HP_EVENT)
7925 alc262_hp_t5735_automute(codec, 1);
7928 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
7930 alc262_hp_t5735_automute(codec, 1);
7933 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
7934 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol),
7935 HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw),
7936 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7938 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7939 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7940 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7944 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7948 static struct hda_verb alc262_hp_t5735_verbs[] = {
7949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7950 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7952 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7956 /* bind hp and internal speaker mute (with plug check) */
7957 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
7958 struct snd_ctl_elem_value *ucontrol)
7960 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7961 long *valp = ucontrol->value.integer.value;
7964 /* change hp mute */
7965 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7967 valp[0] ? 0 : HDA_AMP_MUTE);
7968 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7970 valp[1] ? 0 : HDA_AMP_MUTE);
7972 /* change speaker according to HP jack state */
7973 struct alc_spec *spec = codec->spec;
7975 if (spec->jack_present)
7976 mute = HDA_AMP_MUTE;
7978 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
7980 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7981 HDA_AMP_MUTE, mute);
7986 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7987 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7990 .name = "Master Playback Switch",
7991 .info = snd_hda_mixer_amp_switch_info,
7992 .get = snd_hda_mixer_amp_switch_get,
7993 .put = alc262_sony_master_sw_put,
7994 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7996 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7997 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7998 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7999 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8003 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
8004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8005 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8006 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8009 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8010 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8014 #define alc262_capture_mixer alc882_capture_mixer
8015 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8018 * generic initialization of ADC, input mixers and output mixers
8020 static struct hda_verb alc262_init_verbs[] = {
8022 * Unmute ADC0-2 and set the default input to mic-in
8024 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8026 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8028 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8029 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8031 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8033 * Note: PASD motherboards uses the Line In 2 as the input for
8034 * front panel mic (mic 2)
8036 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8044 * Set up output mixers (0x0c - 0x0e)
8046 /* set vol=0 to output mixers */
8047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8050 /* set up input amps for analog loopback */
8051 /* Amp Indices: DAC = 0, mixer = 1 */
8052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8062 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8063 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8064 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8068 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8072 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8075 /* FIXME: use matrix-type input source selection */
8076 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8077 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8083 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8085 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8086 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8096 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8102 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8104 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8105 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8107 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8108 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8112 static struct hda_verb alc262_sony_unsol_verbs[] = {
8113 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8115 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8117 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 /* mute/unmute internal speaker according to the hp jack and mute state */
8122 static void alc262_hippo_automute(struct hda_codec *codec)
8124 struct alc_spec *spec = codec->spec;
8126 unsigned int present;
8128 /* need to execute and sync at first */
8129 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8130 present = snd_hda_codec_read(codec, 0x15, 0,
8131 AC_VERB_GET_PIN_SENSE, 0);
8132 spec->jack_present = (present & 0x80000000) != 0;
8133 if (spec->jack_present) {
8134 /* mute internal speaker */
8135 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8136 HDA_AMP_MUTE, HDA_AMP_MUTE);
8138 /* unmute internal speaker if necessary */
8139 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8140 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8141 HDA_AMP_MUTE, mute);
8145 /* unsolicited event for HP jack sensing */
8146 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8149 if ((res >> 26) != ALC880_HP_EVENT)
8151 alc262_hippo_automute(codec);
8154 static void alc262_hippo1_automute(struct hda_codec *codec)
8157 unsigned int present;
8159 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8160 present = snd_hda_codec_read(codec, 0x1b, 0,
8161 AC_VERB_GET_PIN_SENSE, 0);
8162 present = (present & 0x80000000) != 0;
8164 /* mute internal speaker */
8165 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8166 HDA_AMP_MUTE, HDA_AMP_MUTE);
8168 /* unmute internal speaker if necessary */
8169 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8170 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8171 HDA_AMP_MUTE, mute);
8175 /* unsolicited event for HP jack sensing */
8176 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8179 if ((res >> 26) != ALC880_HP_EVENT)
8181 alc262_hippo1_automute(codec);
8186 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8189 #define ALC_HP_EVENT 0x37
8191 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8192 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8193 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8197 static struct hda_input_mux alc262_fujitsu_capture_source = {
8206 static struct hda_input_mux alc262_HP_capture_source = {
8210 { "Front Mic", 0x1 },
8217 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8221 { "Front Mic", 0x2 },
8227 /* mute/unmute internal speaker according to the hp jack and mute state */
8228 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8230 struct alc_spec *spec = codec->spec;
8233 if (force || !spec->sense_updated) {
8234 unsigned int present;
8235 /* need to execute and sync at first */
8236 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8237 present = snd_hda_codec_read(codec, 0x14, 0,
8238 AC_VERB_GET_PIN_SENSE, 0);
8239 spec->jack_present = (present & 0x80000000) != 0;
8240 spec->sense_updated = 1;
8242 if (spec->jack_present) {
8243 /* mute internal speaker */
8244 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8245 HDA_AMP_MUTE, HDA_AMP_MUTE);
8247 /* unmute internal speaker if necessary */
8248 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8249 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8250 HDA_AMP_MUTE, mute);
8254 /* unsolicited event for HP jack sensing */
8255 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8258 if ((res >> 26) != ALC_HP_EVENT)
8260 alc262_fujitsu_automute(codec, 1);
8263 /* bind volumes of both NID 0x0c and 0x0d */
8264 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8265 .ops = &snd_hda_bind_vol,
8267 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8268 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8273 /* bind hp and internal speaker mute (with plug check) */
8274 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8275 struct snd_ctl_elem_value *ucontrol)
8277 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8278 long *valp = ucontrol->value.integer.value;
8281 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8283 valp[0] ? 0 : HDA_AMP_MUTE);
8284 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8286 valp[1] ? 0 : HDA_AMP_MUTE);
8288 alc262_fujitsu_automute(codec, 0);
8292 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8293 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8296 .name = "Master Playback Switch",
8297 .info = snd_hda_mixer_amp_switch_info,
8298 .get = snd_hda_mixer_amp_switch_get,
8299 .put = alc262_fujitsu_master_sw_put,
8300 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8308 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8309 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8313 /* additional init verbs for Benq laptops */
8314 static struct hda_verb alc262_EAPD_verbs[] = {
8315 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8316 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8320 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8321 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8322 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8324 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8325 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8329 /* Samsung Q1 Ultra Vista model setup */
8330 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8340 static struct hda_verb alc262_ultra_verbs[] = {
8341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8343 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8344 /* Mic is on Node 0x19 */
8345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8346 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8348 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8350 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8355 static struct hda_input_mux alc262_ultra_capture_source = {
8362 /* mute/unmute internal speaker according to the hp jack and mute state */
8363 static void alc262_ultra_automute(struct hda_codec *codec)
8365 struct alc_spec *spec = codec->spec;
8367 unsigned int present;
8369 /* need to execute and sync at first */
8370 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8371 present = snd_hda_codec_read(codec, 0x15, 0,
8372 AC_VERB_GET_PIN_SENSE, 0);
8373 spec->jack_present = (present & 0x80000000) != 0;
8374 if (spec->jack_present) {
8375 /* mute internal speaker */
8376 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8377 HDA_AMP_MUTE, HDA_AMP_MUTE);
8379 /* unmute internal speaker if necessary */
8380 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8381 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8382 HDA_AMP_MUTE, mute);
8386 /* unsolicited event for HP jack sensing */
8387 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8390 if ((res >> 26) != ALC880_HP_EVENT)
8392 alc262_ultra_automute(codec);
8395 /* add playback controls from the parsed DAC table */
8396 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8397 const struct auto_pin_cfg *cfg)
8402 spec->multiout.num_dacs = 1; /* only use one dac */
8403 spec->multiout.dac_nids = spec->private_dac_nids;
8404 spec->multiout.dac_nids[0] = 2;
8406 nid = cfg->line_out_pins[0];
8408 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8409 "Front Playback Volume",
8410 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8413 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8414 "Front Playback Switch",
8415 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8420 nid = cfg->speaker_pins[0];
8423 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8424 "Speaker Playback Volume",
8425 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8429 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8430 "Speaker Playback Switch",
8431 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8436 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8437 "Speaker Playback Switch",
8438 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8444 nid = cfg->hp_pins[0];
8446 /* spec->multiout.hp_nid = 2; */
8448 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8449 "Headphone Playback Volume",
8450 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8454 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8455 "Headphone Playback Switch",
8456 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8461 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8462 "Headphone Playback Switch",
8463 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8472 /* identical with ALC880 */
8473 #define alc262_auto_create_analog_input_ctls \
8474 alc880_auto_create_analog_input_ctls
8477 * generic initialization of ADC, input mixers and output mixers
8479 static struct hda_verb alc262_volume_init_verbs[] = {
8481 * Unmute ADC0-2 and set the default input to mic-in
8483 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8485 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8487 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8490 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8492 * Note: PASD motherboards uses the Line In 2 as the input for
8493 * front panel mic (mic 2)
8495 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8499 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8503 * Set up output mixers (0x0c - 0x0f)
8505 /* set vol=0 to output mixers */
8506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8507 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8510 /* set up input amps for analog loopback */
8511 /* Amp Indices: DAC = 0, mixer = 1 */
8512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8519 /* FIXME: use matrix-type input source selection */
8520 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8521 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8527 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8540 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8542 * Unmute ADC0-2 and set the default input to mic-in
8544 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8546 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8547 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8548 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8549 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8551 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8553 * Note: PASD motherboards uses the Line In 2 as the input for
8554 * front panel mic (mic 2)
8556 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8561 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8562 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8563 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8566 * Set up output mixers (0x0c - 0x0e)
8568 /* set vol=0 to output mixers */
8569 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8570 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8571 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8573 /* set up input amps for analog loopback */
8574 /* Amp Indices: DAC = 0, mixer = 1 */
8575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8577 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8579 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8580 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8582 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8586 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8589 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8594 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8596 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8599 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8600 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8601 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8602 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8603 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8606 /* FIXME: use matrix-type input source selection */
8607 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8608 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8609 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8610 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8615 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8627 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8629 * Unmute ADC0-2 and set the default input to mic-in
8631 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8633 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8634 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8635 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8636 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8638 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8640 * Note: PASD motherboards uses the Line In 2 as the input for front
8643 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8653 * Set up output mixers (0x0c - 0x0e)
8655 /* set vol=0 to output mixers */
8656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8660 /* set up input amps for analog loopback */
8661 /* Amp Indices: DAC = 0, mixer = 1 */
8662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8670 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8671 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8673 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8674 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8675 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8676 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8679 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8681 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8682 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8684 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8685 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8686 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8688 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8689 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8691 /* FIXME: use matrix-type input source selection */
8692 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8693 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8699 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8707 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8712 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8715 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8721 #ifdef CONFIG_SND_HDA_POWER_SAVE
8722 #define alc262_loopbacks alc880_loopbacks
8725 /* pcm configuration: identiacal with ALC880 */
8726 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8727 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8728 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8729 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8732 * BIOS auto configuration
8734 static int alc262_parse_auto_config(struct hda_codec *codec)
8736 struct alc_spec *spec = codec->spec;
8738 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8740 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8744 if (!spec->autocfg.line_outs)
8745 return 0; /* can't find valid BIOS pin config */
8746 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8749 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8753 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8755 if (spec->autocfg.dig_out_pin)
8756 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8757 if (spec->autocfg.dig_in_pin)
8758 spec->dig_in_nid = ALC262_DIGIN_NID;
8760 if (spec->kctl_alloc)
8761 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8763 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8764 spec->num_mux_defs = 1;
8765 spec->input_mux = &spec->private_imux;
8767 err = alc_auto_add_mic_boost(codec);
8774 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8775 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8776 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8779 /* init callback for auto-configuration model -- overriding the default init */
8780 static void alc262_auto_init(struct hda_codec *codec)
8782 alc262_auto_init_multi_out(codec);
8783 alc262_auto_init_hp_out(codec);
8784 alc262_auto_init_analog_input(codec);
8788 * configuration and preset
8790 static const char *alc262_models[ALC262_MODEL_LAST] = {
8791 [ALC262_BASIC] = "basic",
8792 [ALC262_HIPPO] = "hippo",
8793 [ALC262_HIPPO_1] = "hippo_1",
8794 [ALC262_FUJITSU] = "fujitsu",
8795 [ALC262_HP_BPC] = "hp-bpc",
8796 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8797 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
8798 [ALC262_BENQ_ED8] = "benq",
8799 [ALC262_BENQ_T31] = "benq-t31",
8800 [ALC262_SONY_ASSAMD] = "sony-assamd",
8801 [ALC262_ULTRA] = "ultra",
8802 [ALC262_AUTO] = "auto",
8805 static struct snd_pci_quirk alc262_cfg_tbl[] = {
8806 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
8807 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
8808 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
8809 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
8810 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
8811 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
8812 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
8813 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
8814 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
8815 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
8816 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
8817 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
8818 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
8819 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
8820 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
8821 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
8822 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
8823 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
8824 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
8825 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
8826 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
8827 ALC262_HP_TC_T5735),
8828 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8829 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
8830 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8831 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8832 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
8833 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
8834 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
8835 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
8836 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
8837 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
8841 static struct alc_config_preset alc262_presets[] = {
8843 .mixers = { alc262_base_mixer },
8844 .init_verbs = { alc262_init_verbs },
8845 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8846 .dac_nids = alc262_dac_nids,
8848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8849 .channel_mode = alc262_modes,
8850 .input_mux = &alc262_capture_source,
8853 .mixers = { alc262_base_mixer },
8854 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8856 .dac_nids = alc262_dac_nids,
8858 .dig_out_nid = ALC262_DIGOUT_NID,
8859 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8860 .channel_mode = alc262_modes,
8861 .input_mux = &alc262_capture_source,
8862 .unsol_event = alc262_hippo_unsol_event,
8863 .init_hook = alc262_hippo_automute,
8865 [ALC262_HIPPO_1] = {
8866 .mixers = { alc262_hippo1_mixer },
8867 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8868 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8869 .dac_nids = alc262_dac_nids,
8871 .dig_out_nid = ALC262_DIGOUT_NID,
8872 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8873 .channel_mode = alc262_modes,
8874 .input_mux = &alc262_capture_source,
8875 .unsol_event = alc262_hippo1_unsol_event,
8876 .init_hook = alc262_hippo1_automute,
8878 [ALC262_FUJITSU] = {
8879 .mixers = { alc262_fujitsu_mixer },
8880 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
8881 alc262_fujitsu_unsol_verbs },
8882 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8883 .dac_nids = alc262_dac_nids,
8885 .dig_out_nid = ALC262_DIGOUT_NID,
8886 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8887 .channel_mode = alc262_modes,
8888 .input_mux = &alc262_fujitsu_capture_source,
8889 .unsol_event = alc262_fujitsu_unsol_event,
8892 .mixers = { alc262_HP_BPC_mixer },
8893 .init_verbs = { alc262_HP_BPC_init_verbs },
8894 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8895 .dac_nids = alc262_dac_nids,
8897 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8898 .channel_mode = alc262_modes,
8899 .input_mux = &alc262_HP_capture_source,
8901 [ALC262_HP_BPC_D7000_WF] = {
8902 .mixers = { alc262_HP_BPC_WildWest_mixer },
8903 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8904 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8905 .dac_nids = alc262_dac_nids,
8907 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8908 .channel_mode = alc262_modes,
8909 .input_mux = &alc262_HP_D7000_capture_source,
8911 [ALC262_HP_BPC_D7000_WL] = {
8912 .mixers = { alc262_HP_BPC_WildWest_mixer,
8913 alc262_HP_BPC_WildWest_option_mixer },
8914 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8915 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8916 .dac_nids = alc262_dac_nids,
8918 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8919 .channel_mode = alc262_modes,
8920 .input_mux = &alc262_HP_D7000_capture_source,
8922 [ALC262_HP_TC_T5735] = {
8923 .mixers = { alc262_hp_t5735_mixer },
8924 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
8925 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8926 .dac_nids = alc262_dac_nids,
8928 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8929 .channel_mode = alc262_modes,
8930 .input_mux = &alc262_capture_source,
8931 .unsol_event = alc262_hp_t5735_unsol_event,
8932 .init_hook = alc262_hp_t5735_init_hook,
8934 [ALC262_BENQ_ED8] = {
8935 .mixers = { alc262_base_mixer },
8936 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
8937 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8938 .dac_nids = alc262_dac_nids,
8940 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8941 .channel_mode = alc262_modes,
8942 .input_mux = &alc262_capture_source,
8944 [ALC262_SONY_ASSAMD] = {
8945 .mixers = { alc262_sony_mixer },
8946 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
8947 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8948 .dac_nids = alc262_dac_nids,
8950 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8951 .channel_mode = alc262_modes,
8952 .input_mux = &alc262_capture_source,
8953 .unsol_event = alc262_hippo_unsol_event,
8954 .init_hook = alc262_hippo_automute,
8956 [ALC262_BENQ_T31] = {
8957 .mixers = { alc262_benq_t31_mixer },
8958 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
8959 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8960 .dac_nids = alc262_dac_nids,
8962 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8963 .channel_mode = alc262_modes,
8964 .input_mux = &alc262_capture_source,
8965 .unsol_event = alc262_hippo_unsol_event,
8966 .init_hook = alc262_hippo_automute,
8969 .mixers = { alc262_ultra_mixer },
8970 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
8971 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8972 .dac_nids = alc262_dac_nids,
8974 .dig_out_nid = ALC262_DIGOUT_NID,
8975 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8976 .channel_mode = alc262_modes,
8977 .input_mux = &alc262_ultra_capture_source,
8978 .unsol_event = alc262_ultra_unsol_event,
8979 .init_hook = alc262_ultra_automute,
8983 static int patch_alc262(struct hda_codec *codec)
8985 struct alc_spec *spec;
8989 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8995 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9000 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9001 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
9002 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
9003 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
9007 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
9011 if (board_config < 0) {
9012 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
9013 "trying auto-probe from BIOS...\n");
9014 board_config = ALC262_AUTO;
9017 if (board_config == ALC262_AUTO) {
9018 /* automatic parse from the BIOS config */
9019 err = alc262_parse_auto_config(codec);
9025 "hda_codec: Cannot set up configuration "
9026 "from BIOS. Using base mode...\n");
9027 board_config = ALC262_BASIC;
9031 if (board_config != ALC262_AUTO)
9032 setup_preset(spec, &alc262_presets[board_config]);
9034 spec->stream_name_analog = "ALC262 Analog";
9035 spec->stream_analog_playback = &alc262_pcm_analog_playback;
9036 spec->stream_analog_capture = &alc262_pcm_analog_capture;
9038 spec->stream_name_digital = "ALC262 Digital";
9039 spec->stream_digital_playback = &alc262_pcm_digital_playback;
9040 spec->stream_digital_capture = &alc262_pcm_digital_capture;
9042 if (!spec->adc_nids && spec->input_mux) {
9043 /* check whether NID 0x07 is valid */
9044 unsigned int wcap = get_wcaps(codec, 0x07);
9047 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9048 if (wcap != AC_WID_AUD_IN) {
9049 spec->adc_nids = alc262_adc_nids_alt;
9050 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
9051 spec->mixers[spec->num_mixers] =
9052 alc262_capture_alt_mixer;
9055 spec->adc_nids = alc262_adc_nids;
9056 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9057 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9062 codec->patch_ops = alc_patch_ops;
9063 if (board_config == ALC262_AUTO)
9064 spec->init_hook = alc262_auto_init;
9065 #ifdef CONFIG_SND_HDA_POWER_SAVE
9066 if (!spec->loopback.amplist)
9067 spec->loopback.amplist = alc262_loopbacks;
9074 * ALC268 channel source setting (2 channel)
9076 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9077 #define alc268_modes alc260_modes
9079 static hda_nid_t alc268_dac_nids[2] = {
9084 static hda_nid_t alc268_adc_nids[2] = {
9089 static hda_nid_t alc268_adc_nids_alt[1] = {
9094 static struct snd_kcontrol_new alc268_base_mixer[] = {
9095 /* output mixer control */
9096 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9097 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9102 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9106 static struct hda_verb alc268_eapd_verbs[] = {
9107 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9108 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9112 /* Toshiba specific */
9113 #define alc268_toshiba_automute alc262_hippo_automute
9115 static struct hda_verb alc268_toshiba_verbs[] = {
9116 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9121 /* bind volumes of both NID 0x02 and 0x03 */
9122 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9123 .ops = &snd_hda_bind_vol,
9125 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9126 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9131 /* mute/unmute internal speaker according to the hp jack and mute state */
9132 static void alc268_acer_automute(struct hda_codec *codec, int force)
9134 struct alc_spec *spec = codec->spec;
9137 if (force || !spec->sense_updated) {
9138 unsigned int present;
9139 present = snd_hda_codec_read(codec, 0x14, 0,
9140 AC_VERB_GET_PIN_SENSE, 0);
9141 spec->jack_present = (present & 0x80000000) != 0;
9142 spec->sense_updated = 1;
9144 if (spec->jack_present)
9145 mute = HDA_AMP_MUTE; /* mute internal speaker */
9146 else /* unmute internal speaker if necessary */
9147 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9148 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9149 HDA_AMP_MUTE, mute);
9153 /* bind hp and internal speaker mute (with plug check) */
9154 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9155 struct snd_ctl_elem_value *ucontrol)
9157 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9158 long *valp = ucontrol->value.integer.value;
9161 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9163 valp[0] ? 0 : HDA_AMP_MUTE);
9164 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9166 valp[1] ? 0 : HDA_AMP_MUTE);
9168 alc268_acer_automute(codec, 0);
9172 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9173 /* output mixer control */
9174 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9176 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9177 .name = "Master Playback Switch",
9178 .info = snd_hda_mixer_amp_switch_info,
9179 .get = snd_hda_mixer_amp_switch_get,
9180 .put = alc268_acer_master_sw_put,
9181 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9183 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9184 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9185 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9189 static struct hda_verb alc268_acer_verbs[] = {
9190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9197 /* unsolicited event for HP jack sensing */
9198 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9201 if ((res >> 26) != ALC880_HP_EVENT)
9203 alc268_toshiba_automute(codec);
9206 static void alc268_acer_unsol_event(struct hda_codec *codec,
9209 if ((res >> 26) != ALC880_HP_EVENT)
9211 alc268_acer_automute(codec, 1);
9214 static void alc268_acer_init_hook(struct hda_codec *codec)
9216 alc268_acer_automute(codec, 1);
9220 * generic initialization of ADC, input mixers and output mixers
9222 static struct hda_verb alc268_base_init_verbs[] = {
9223 /* Unmute DAC0-1 and set vol = 0 */
9224 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9225 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9226 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9227 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9228 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9229 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9232 * Set up output mixers (0x0c - 0x0e)
9234 /* set vol=0 to output mixers */
9235 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9238 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9240 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9241 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9244 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9245 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9246 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9247 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9248 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9249 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9250 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9254 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9255 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9256 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9257 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9258 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9259 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9261 /* Unmute Selector 23h,24h and set the default input to mic-in */
9263 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
9264 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9265 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
9266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9272 * generic initialization of ADC, input mixers and output mixers
9274 static struct hda_verb alc268_volume_init_verbs[] = {
9275 /* set output DAC */
9276 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9277 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9278 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9279 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9281 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9282 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9284 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9285 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9287 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9291 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9296 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9298 /* set PCBEEP vol = 0 */
9299 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9304 #define alc268_mux_enum_info alc_mux_enum_info
9305 #define alc268_mux_enum_get alc_mux_enum_get
9307 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9308 struct snd_ctl_elem_value *ucontrol)
9310 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9311 struct alc_spec *spec = codec->spec;
9313 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9314 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9315 hda_nid_t nid = capture_mixers[adc_idx];
9317 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
9319 &spec->cur_mux[adc_idx]);
9322 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9323 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9324 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9327 /* The multiple "Capture Source" controls confuse alsamixer
9328 * So call somewhat different..
9329 * FIXME: the controls appear in the "playback" view!
9331 /* .name = "Capture Source", */
9332 .name = "Input Source",
9334 .info = alc268_mux_enum_info,
9335 .get = alc268_mux_enum_get,
9336 .put = alc268_mux_enum_put,
9341 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9342 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9343 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9344 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9345 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9348 /* The multiple "Capture Source" controls confuse alsamixer
9349 * So call somewhat different..
9350 * FIXME: the controls appear in the "playback" view!
9352 /* .name = "Capture Source", */
9353 .name = "Input Source",
9355 .info = alc268_mux_enum_info,
9356 .get = alc268_mux_enum_get,
9357 .put = alc268_mux_enum_put,
9362 static struct hda_input_mux alc268_capture_source = {
9366 { "Front Mic", 0x1 },
9372 #ifdef CONFIG_SND_DEBUG
9373 static struct snd_kcontrol_new alc268_test_mixer[] = {
9374 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9375 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9376 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9379 /* Volume widgets */
9380 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9381 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9382 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9383 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
9384 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
9385 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
9386 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
9387 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
9388 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
9389 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
9390 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
9391 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
9392 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
9393 HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),
9394 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9395 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
9396 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
9397 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
9399 /* Modes for retasking pin widgets */
9400 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
9401 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
9402 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
9403 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
9405 /* Controls for GPIO pins, assuming they are configured as outputs */
9406 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
9407 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
9408 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
9409 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
9411 /* Switches to allow the digital SPDIF output pin to be enabled.
9412 * The ALC268 does not have an SPDIF input.
9414 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
9416 /* A switch allowing EAPD to be enabled. Some laptops seem to use
9417 * this output to turn on an external amplifier.
9419 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
9420 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
9426 /* create input playback/capture controls for the given pin */
9427 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9428 const char *ctlname, int idx)
9433 sprintf(name, "%s Playback Volume", ctlname);
9435 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9436 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9440 } else if (nid == 0x15) {
9441 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9442 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9448 sprintf(name, "%s Playback Switch", ctlname);
9449 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9450 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9456 /* add playback controls from the parsed DAC table */
9457 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9458 const struct auto_pin_cfg *cfg)
9463 spec->multiout.num_dacs = 2; /* only use one dac */
9464 spec->multiout.dac_nids = spec->private_dac_nids;
9465 spec->multiout.dac_nids[0] = 2;
9466 spec->multiout.dac_nids[1] = 3;
9468 nid = cfg->line_out_pins[0];
9470 alc268_new_analog_output(spec, nid, "Front", 0);
9472 nid = cfg->speaker_pins[0];
9474 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9475 "Speaker Playback Volume",
9476 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9480 nid = cfg->hp_pins[0];
9482 alc268_new_analog_output(spec, nid, "Headphone", 0);
9484 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9486 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9487 "Mono Playback Switch",
9488 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9495 /* create playback/capture controls for input pins */
9496 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9497 const struct auto_pin_cfg *cfg)
9499 struct hda_input_mux *imux = &spec->private_imux;
9502 for (i = 0; i < AUTO_PIN_LAST; i++) {
9503 switch(cfg->input_pins[i]) {
9505 idx1 = 0; /* Mic 1 */
9508 idx1 = 1; /* Mic 2 */
9511 idx1 = 2; /* Line In */
9519 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9520 imux->items[imux->num_items].index = idx1;
9526 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9528 struct alc_spec *spec = codec->spec;
9529 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9530 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9531 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9532 unsigned int dac_vol1, dac_vol2;
9535 snd_hda_codec_write(codec, speaker_nid, 0,
9536 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9537 snd_hda_codec_write(codec, 0x0f, 0,
9538 AC_VERB_SET_AMP_GAIN_MUTE,
9540 snd_hda_codec_write(codec, 0x10, 0,
9541 AC_VERB_SET_AMP_GAIN_MUTE,
9544 snd_hda_codec_write(codec, 0x0f, 0,
9545 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9546 snd_hda_codec_write(codec, 0x10, 0,
9547 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9550 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9551 if (line_nid == 0x14)
9552 dac_vol2 = AMP_OUT_ZERO;
9553 else if (line_nid == 0x15)
9554 dac_vol1 = AMP_OUT_ZERO;
9556 dac_vol2 = AMP_OUT_ZERO;
9557 else if (hp_nid == 0x15)
9558 dac_vol1 = AMP_OUT_ZERO;
9559 if (line_nid != 0x16 || hp_nid != 0x16 ||
9560 spec->autocfg.line_out_pins[1] != 0x16 ||
9561 spec->autocfg.line_out_pins[2] != 0x16)
9562 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9564 snd_hda_codec_write(codec, 0x02, 0,
9565 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9566 snd_hda_codec_write(codec, 0x03, 0,
9567 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9570 /* pcm configuration: identiacal with ALC880 */
9571 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9572 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9573 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9576 * BIOS auto configuration
9578 static int alc268_parse_auto_config(struct hda_codec *codec)
9580 struct alc_spec *spec = codec->spec;
9582 static hda_nid_t alc268_ignore[] = { 0 };
9584 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9588 if (!spec->autocfg.line_outs)
9589 return 0; /* can't find valid BIOS pin config */
9591 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9594 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9598 spec->multiout.max_channels = 2;
9600 /* digital only support output */
9601 if (spec->autocfg.dig_out_pin)
9602 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9604 if (spec->kctl_alloc)
9605 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9607 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9608 spec->num_mux_defs = 1;
9609 spec->input_mux = &spec->private_imux;
9611 err = alc_auto_add_mic_boost(codec);
9618 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9619 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9620 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9622 /* init callback for auto-configuration model -- overriding the default init */
9623 static void alc268_auto_init(struct hda_codec *codec)
9625 alc268_auto_init_multi_out(codec);
9626 alc268_auto_init_hp_out(codec);
9627 alc268_auto_init_mono_speaker_out(codec);
9628 alc268_auto_init_analog_input(codec);
9632 * configuration and preset
9634 static const char *alc268_models[ALC268_MODEL_LAST] = {
9635 [ALC268_3ST] = "3stack",
9636 [ALC268_TOSHIBA] = "toshiba",
9637 [ALC268_ACER] = "acer",
9638 #ifdef CONFIG_SND_DEBUG
9639 [ALC268_TEST] = "test",
9641 [ALC268_AUTO] = "auto",
9644 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9645 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9646 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9647 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9648 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9649 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9650 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9651 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9655 static struct alc_config_preset alc268_presets[] = {
9657 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9658 .init_verbs = { alc268_base_init_verbs },
9659 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9660 .dac_nids = alc268_dac_nids,
9661 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9662 .adc_nids = alc268_adc_nids_alt,
9664 .dig_out_nid = ALC268_DIGOUT_NID,
9665 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9666 .channel_mode = alc268_modes,
9667 .input_mux = &alc268_capture_source,
9669 [ALC268_TOSHIBA] = {
9670 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9671 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9672 alc268_toshiba_verbs },
9673 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9674 .dac_nids = alc268_dac_nids,
9675 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9676 .adc_nids = alc268_adc_nids_alt,
9678 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9679 .channel_mode = alc268_modes,
9680 .input_mux = &alc268_capture_source,
9681 .unsol_event = alc268_toshiba_unsol_event,
9682 .init_hook = alc268_toshiba_automute,
9685 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9686 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9687 alc268_acer_verbs },
9688 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9689 .dac_nids = alc268_dac_nids,
9690 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9691 .adc_nids = alc268_adc_nids_alt,
9693 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9694 .channel_mode = alc268_modes,
9695 .input_mux = &alc268_capture_source,
9696 .unsol_event = alc268_acer_unsol_event,
9697 .init_hook = alc268_acer_init_hook,
9699 #ifdef CONFIG_SND_DEBUG
9701 .mixers = { alc268_test_mixer, alc268_capture_mixer },
9702 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9703 alc268_volume_init_verbs },
9704 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9705 .dac_nids = alc268_dac_nids,
9706 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9707 .adc_nids = alc268_adc_nids_alt,
9709 .dig_out_nid = ALC268_DIGOUT_NID,
9710 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9711 .channel_mode = alc268_modes,
9712 .input_mux = &alc268_capture_source,
9717 static int patch_alc268(struct hda_codec *codec)
9719 struct alc_spec *spec;
9723 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
9729 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
9733 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
9734 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
9735 "trying auto-probe from BIOS...\n");
9736 board_config = ALC268_AUTO;
9739 if (board_config == ALC268_AUTO) {
9740 /* automatic parse from the BIOS config */
9741 err = alc268_parse_auto_config(codec);
9747 "hda_codec: Cannot set up configuration "
9748 "from BIOS. Using base mode...\n");
9749 board_config = ALC268_3ST;
9753 if (board_config != ALC268_AUTO)
9754 setup_preset(spec, &alc268_presets[board_config]);
9756 spec->stream_name_analog = "ALC268 Analog";
9757 spec->stream_analog_playback = &alc268_pcm_analog_playback;
9758 spec->stream_analog_capture = &alc268_pcm_analog_capture;
9760 spec->stream_name_digital = "ALC268 Digital";
9761 spec->stream_digital_playback = &alc268_pcm_digital_playback;
9763 if (board_config == ALC268_AUTO) {
9764 if (!spec->adc_nids && spec->input_mux) {
9765 /* check whether NID 0x07 is valid */
9766 unsigned int wcap = get_wcaps(codec, 0x07);
9769 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9770 if (wcap != AC_WID_AUD_IN) {
9771 spec->adc_nids = alc268_adc_nids_alt;
9772 spec->num_adc_nids =
9773 ARRAY_SIZE(alc268_adc_nids_alt);
9774 spec->mixers[spec->num_mixers] =
9775 alc268_capture_alt_mixer;
9778 spec->adc_nids = alc268_adc_nids;
9779 spec->num_adc_nids =
9780 ARRAY_SIZE(alc268_adc_nids);
9781 spec->mixers[spec->num_mixers] =
9782 alc268_capture_mixer;
9787 codec->patch_ops = alc_patch_ops;
9788 if (board_config == ALC268_AUTO)
9789 spec->init_hook = alc268_auto_init;
9795 * ALC269 channel source setting (2 channel)
9797 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
9799 #define alc269_dac_nids alc260_dac_nids
9801 static hda_nid_t alc269_adc_nids[1] = {
9806 #define alc269_modes alc260_modes
9807 #define alc269_capture_source alc880_lg_lw_capture_source
9809 static struct snd_kcontrol_new alc269_base_mixer[] = {
9810 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9811 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9812 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9813 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9821 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9825 /* capture mixer elements */
9826 static struct snd_kcontrol_new alc269_capture_mixer[] = {
9827 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9828 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9831 /* The multiple "Capture Source" controls confuse alsamixer
9832 * So call somewhat different..
9833 * FIXME: the controls appear in the "playback" view!
9835 /* .name = "Capture Source", */
9836 .name = "Input Source",
9838 .info = alc_mux_enum_info,
9839 .get = alc_mux_enum_get,
9840 .put = alc_mux_enum_put,
9846 * generic initialization of ADC, input mixers and output mixers
9848 static struct hda_verb alc269_init_verbs[] = {
9850 * Unmute ADC0 and set the default input to mic-in
9852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9854 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
9855 * analog-loopback mixer widget
9856 * Note: PASD motherboards uses the Line In 2 as the input for
9857 * front panel mic (mic 2)
9859 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9860 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9861 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9862 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9863 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9867 * Set up output mixers (0x0c - 0x0e)
9869 /* set vol=0 to output mixers */
9870 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9871 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9873 /* set up input amps for analog loopback */
9874 /* Amp Indices: DAC = 0, mixer = 1 */
9875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9884 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9885 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9886 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9887 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9890 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9892 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9893 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9896 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9898 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9899 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9901 /* FIXME: use matrix-type input source selection */
9902 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
9903 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9910 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9911 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9915 /* add playback controls from the parsed DAC table */
9916 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
9917 const struct auto_pin_cfg *cfg)
9922 spec->multiout.num_dacs = 1; /* only use one dac */
9923 spec->multiout.dac_nids = spec->private_dac_nids;
9924 spec->multiout.dac_nids[0] = 2;
9926 nid = cfg->line_out_pins[0];
9928 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9929 "Front Playback Volume",
9930 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
9933 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9934 "Front Playback Switch",
9935 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9940 nid = cfg->speaker_pins[0];
9942 if (!cfg->line_out_pins[0]) {
9943 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9944 "Speaker Playback Volume",
9945 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9951 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9952 "Speaker Playback Switch",
9953 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9958 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9959 "Speaker Playback Switch",
9960 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9966 nid = cfg->hp_pins[0];
9968 /* spec->multiout.hp_nid = 2; */
9969 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
9970 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9971 "Headphone Playback Volume",
9972 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9978 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9979 "Headphone Playback Switch",
9980 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9985 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9986 "Headphone Playback Switch",
9987 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9996 #define alc269_auto_create_analog_input_ctls \
9997 alc880_auto_create_analog_input_ctls
9999 #ifdef CONFIG_SND_HDA_POWER_SAVE
10000 #define alc269_loopbacks alc880_loopbacks
10003 /* pcm configuration: identiacal with ALC880 */
10004 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10005 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10006 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10007 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10010 * BIOS auto configuration
10012 static int alc269_parse_auto_config(struct hda_codec *codec)
10014 struct alc_spec *spec = codec->spec;
10016 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
10018 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10023 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
10026 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
10030 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10032 if (spec->autocfg.dig_out_pin)
10033 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
10035 if (spec->kctl_alloc)
10036 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10038 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
10039 spec->num_mux_defs = 1;
10040 spec->input_mux = &spec->private_imux;
10042 err = alc_auto_add_mic_boost(codec);
10049 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10050 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10051 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10054 /* init callback for auto-configuration model -- overriding the default init */
10055 static void alc269_auto_init(struct hda_codec *codec)
10057 alc269_auto_init_multi_out(codec);
10058 alc269_auto_init_hp_out(codec);
10059 alc269_auto_init_analog_input(codec);
10063 * configuration and preset
10065 static const char *alc269_models[ALC269_MODEL_LAST] = {
10066 [ALC269_BASIC] = "basic",
10069 static struct snd_pci_quirk alc269_cfg_tbl[] = {
10073 static struct alc_config_preset alc269_presets[] = {
10075 .mixers = { alc269_base_mixer },
10076 .init_verbs = { alc269_init_verbs },
10077 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
10078 .dac_nids = alc269_dac_nids,
10080 .num_channel_mode = ARRAY_SIZE(alc269_modes),
10081 .channel_mode = alc269_modes,
10082 .input_mux = &alc269_capture_source,
10086 static int patch_alc269(struct hda_codec *codec)
10088 struct alc_spec *spec;
10092 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10096 codec->spec = spec;
10098 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
10102 if (board_config < 0) {
10103 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10104 "trying auto-probe from BIOS...\n");
10105 board_config = ALC269_AUTO;
10108 if (board_config == ALC269_AUTO) {
10109 /* automatic parse from the BIOS config */
10110 err = alc269_parse_auto_config(codec);
10116 "hda_codec: Cannot set up configuration "
10117 "from BIOS. Using base mode...\n");
10118 board_config = ALC269_BASIC;
10122 if (board_config != ALC269_AUTO)
10123 setup_preset(spec, &alc269_presets[board_config]);
10125 spec->stream_name_analog = "ALC269 Analog";
10126 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10127 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10129 spec->stream_name_digital = "ALC269 Digital";
10130 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10131 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10133 spec->adc_nids = alc269_adc_nids;
10134 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10135 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10136 spec->num_mixers++;
10138 codec->patch_ops = alc_patch_ops;
10139 if (board_config == ALC269_AUTO)
10140 spec->init_hook = alc269_auto_init;
10141 #ifdef CONFIG_SND_HDA_POWER_SAVE
10142 if (!spec->loopback.amplist)
10143 spec->loopback.amplist = alc269_loopbacks;
10150 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10154 * set the path ways for 2 channel output
10155 * need to set the codec line out and mic 1 pin widgets to inputs
10157 static struct hda_verb alc861_threestack_ch2_init[] = {
10158 /* set pin widget 1Ah (line in) for input */
10159 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10160 /* set pin widget 18h (mic1/2) for input, for mic also enable
10163 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10165 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10167 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10168 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10174 * need to set the codec line out and mic 1 pin widgets to outputs
10176 static struct hda_verb alc861_threestack_ch6_init[] = {
10177 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10178 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10179 /* set pin widget 18h (mic1) for output (CLFE)*/
10180 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10182 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10183 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10185 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10187 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10188 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10193 static struct hda_channel_mode alc861_threestack_modes[2] = {
10194 { 2, alc861_threestack_ch2_init },
10195 { 6, alc861_threestack_ch6_init },
10197 /* Set mic1 as input and unmute the mixer */
10198 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10199 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10200 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10203 /* Set mic1 as output and mute mixer */
10204 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10205 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10206 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10210 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10211 { 2, alc861_uniwill_m31_ch2_init },
10212 { 4, alc861_uniwill_m31_ch4_init },
10215 /* Set mic1 and line-in as input and unmute the mixer */
10216 static struct hda_verb alc861_asus_ch2_init[] = {
10217 /* set pin widget 1Ah (line in) for input */
10218 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10219 /* set pin widget 18h (mic1/2) for input, for mic also enable
10222 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10224 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10226 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10227 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10231 /* Set mic1 nad line-in as output and mute mixer */
10232 static struct hda_verb alc861_asus_ch6_init[] = {
10233 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10234 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10235 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10236 /* set pin widget 18h (mic1) for output (CLFE)*/
10237 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10238 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10239 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10240 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10242 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10244 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10245 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10250 static struct hda_channel_mode alc861_asus_modes[2] = {
10251 { 2, alc861_asus_ch2_init },
10252 { 6, alc861_asus_ch6_init },
10257 static struct snd_kcontrol_new alc861_base_mixer[] = {
10258 /* output mixer control */
10259 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10260 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10261 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10262 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10263 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10265 /*Input mixer control */
10266 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10267 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10268 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10269 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10270 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10271 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10273 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10277 /* Capture mixer control */
10278 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10279 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10282 .name = "Capture Source",
10284 .info = alc_mux_enum_info,
10285 .get = alc_mux_enum_get,
10286 .put = alc_mux_enum_put,
10291 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10292 /* output mixer control */
10293 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10294 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10295 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10296 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10297 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10299 /* Input mixer control */
10300 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10301 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10302 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10303 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10304 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10305 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10307 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10308 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10309 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10311 /* Capture mixer control */
10312 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10313 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10315 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10316 .name = "Capture Source",
10318 .info = alc_mux_enum_info,
10319 .get = alc_mux_enum_get,
10320 .put = alc_mux_enum_put,
10323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10324 .name = "Channel Mode",
10325 .info = alc_ch_mode_info,
10326 .get = alc_ch_mode_get,
10327 .put = alc_ch_mode_put,
10328 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10333 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10334 /* output mixer control */
10335 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10337 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10339 /*Capture mixer control */
10340 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10341 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10343 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10344 .name = "Capture Source",
10346 .info = alc_mux_enum_info,
10347 .get = alc_mux_enum_get,
10348 .put = alc_mux_enum_put,
10354 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10355 /* output mixer control */
10356 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10357 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10358 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10359 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10360 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10362 /* Input mixer control */
10363 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10364 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10365 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10366 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10367 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10368 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10369 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10370 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10374 /* Capture mixer control */
10375 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10376 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10378 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10379 .name = "Capture Source",
10381 .info = alc_mux_enum_info,
10382 .get = alc_mux_enum_get,
10383 .put = alc_mux_enum_put,
10386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10387 .name = "Channel Mode",
10388 .info = alc_ch_mode_info,
10389 .get = alc_ch_mode_get,
10390 .put = alc_ch_mode_put,
10391 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10396 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10397 /* output mixer control */
10398 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10399 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10400 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10401 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10402 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10404 /* Input mixer control */
10405 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10406 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10407 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10408 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10409 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10410 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10412 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10413 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10414 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10416 /* Capture mixer control */
10417 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10418 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10420 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10421 .name = "Capture Source",
10423 .info = alc_mux_enum_info,
10424 .get = alc_mux_enum_get,
10425 .put = alc_mux_enum_put,
10428 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10429 .name = "Channel Mode",
10430 .info = alc_ch_mode_info,
10431 .get = alc_ch_mode_get,
10432 .put = alc_ch_mode_put,
10433 .private_value = ARRAY_SIZE(alc861_asus_modes),
10438 /* additional mixer */
10439 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10440 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10441 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10442 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10443 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10448 * generic initialization of ADC, input mixers and output mixers
10450 static struct hda_verb alc861_base_init_verbs[] = {
10452 * Unmute ADC0 and set the default input to mic-in
10454 /* port-A for surround (rear panel) */
10455 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10456 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10457 /* port-B for mic-in (rear panel) with vref */
10458 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10459 /* port-C for line-in (rear panel) */
10460 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10461 /* port-D for Front */
10462 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10463 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10464 /* port-E for HP out (front panel) */
10465 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10466 /* route front PCM to HP */
10467 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10468 /* port-F for mic-in (front panel) with vref */
10469 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10470 /* port-G for CLFE (rear panel) */
10471 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10472 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10473 /* port-H for side (rear panel) */
10474 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10475 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10477 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10478 /* route front mic to ADC1*/
10479 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10480 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10482 /* Unmute DAC0~3 & spdif out*/
10483 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10484 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10485 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10486 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10489 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10490 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10491 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10492 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10493 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10495 /* Unmute Stereo Mixer 15 */
10496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10499 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10501 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10502 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10503 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10504 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10506 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10507 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10508 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10509 /* hp used DAC 3 (Front) */
10510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10516 static struct hda_verb alc861_threestack_init_verbs[] = {
10518 * Unmute ADC0 and set the default input to mic-in
10520 /* port-A for surround (rear panel) */
10521 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10522 /* port-B for mic-in (rear panel) with vref */
10523 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10524 /* port-C for line-in (rear panel) */
10525 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10526 /* port-D for Front */
10527 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10528 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10529 /* port-E for HP out (front panel) */
10530 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10531 /* route front PCM to HP */
10532 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10533 /* port-F for mic-in (front panel) with vref */
10534 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10535 /* port-G for CLFE (rear panel) */
10536 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10537 /* port-H for side (rear panel) */
10538 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10540 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10541 /* route front mic to ADC1*/
10542 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10543 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10544 /* Unmute DAC0~3 & spdif out*/
10545 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10546 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10547 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10548 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10551 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10552 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10553 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10554 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10555 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10557 /* Unmute Stereo Mixer 15 */
10558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10561 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10563 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10564 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10565 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10566 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10567 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10568 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10569 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10571 /* hp used DAC 3 (Front) */
10572 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10573 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10577 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10579 * Unmute ADC0 and set the default input to mic-in
10581 /* port-A for surround (rear panel) */
10582 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10583 /* port-B for mic-in (rear panel) with vref */
10584 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10585 /* port-C for line-in (rear panel) */
10586 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10587 /* port-D for Front */
10588 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10589 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10590 /* port-E for HP out (front panel) */
10591 /* this has to be set to VREF80 */
10592 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10593 /* route front PCM to HP */
10594 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10595 /* port-F for mic-in (front panel) with vref */
10596 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10597 /* port-G for CLFE (rear panel) */
10598 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10599 /* port-H for side (rear panel) */
10600 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10602 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10603 /* route front mic to ADC1*/
10604 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10605 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10606 /* Unmute DAC0~3 & spdif out*/
10607 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10608 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10609 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10610 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10613 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10614 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10615 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10616 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10617 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10619 /* Unmute Stereo Mixer 15 */
10620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10621 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10623 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10625 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10626 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10627 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10628 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10630 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10632 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10633 /* hp used DAC 3 (Front) */
10634 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10639 static struct hda_verb alc861_asus_init_verbs[] = {
10641 * Unmute ADC0 and set the default input to mic-in
10643 /* port-A for surround (rear panel)
10644 * according to codec#0 this is the HP jack
10646 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10647 /* route front PCM to HP */
10648 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10649 /* port-B for mic-in (rear panel) with vref */
10650 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10651 /* port-C for line-in (rear panel) */
10652 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10653 /* port-D for Front */
10654 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10655 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10656 /* port-E for HP out (front panel) */
10657 /* this has to be set to VREF80 */
10658 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10659 /* route front PCM to HP */
10660 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10661 /* port-F for mic-in (front panel) with vref */
10662 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10663 /* port-G for CLFE (rear panel) */
10664 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10665 /* port-H for side (rear panel) */
10666 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10668 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10669 /* route front mic to ADC1*/
10670 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10671 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10672 /* Unmute DAC0~3 & spdif out*/
10673 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10674 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10675 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10676 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10677 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10678 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10679 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10680 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10681 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10684 /* Unmute Stereo Mixer 15 */
10685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10686 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10687 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10690 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10692 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10694 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10695 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10698 /* hp used DAC 3 (Front) */
10699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10704 /* additional init verbs for ASUS laptops */
10705 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
10706 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
10707 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
10712 * generic initialization of ADC, input mixers and output mixers
10714 static struct hda_verb alc861_auto_init_verbs[] = {
10716 * Unmute ADC0 and set the default input to mic-in
10718 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10719 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10721 /* Unmute DAC0~3 & spdif out*/
10722 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10723 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10725 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10728 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10729 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10730 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10731 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10732 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10734 /* Unmute Stereo Mixer 15 */
10735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
10740 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10741 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10742 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10744 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10746 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10749 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10751 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10753 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10754 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10755 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10758 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
10763 static struct hda_verb alc861_toshiba_init_verbs[] = {
10764 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10769 /* toggle speaker-output according to the hp-jack state */
10770 static void alc861_toshiba_automute(struct hda_codec *codec)
10772 unsigned int present;
10774 present = snd_hda_codec_read(codec, 0x0f, 0,
10775 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10776 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
10777 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10778 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
10779 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
10782 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
10785 if ((res >> 26) == ALC880_HP_EVENT)
10786 alc861_toshiba_automute(codec);
10789 /* pcm configuration: identiacal with ALC880 */
10790 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10791 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10792 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10793 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10796 #define ALC861_DIGOUT_NID 0x07
10798 static struct hda_channel_mode alc861_8ch_modes[1] = {
10802 static hda_nid_t alc861_dac_nids[4] = {
10803 /* front, surround, clfe, side */
10804 0x03, 0x06, 0x05, 0x04
10807 static hda_nid_t alc660_dac_nids[3] = {
10808 /* front, clfe, surround */
10812 static hda_nid_t alc861_adc_nids[1] = {
10817 static struct hda_input_mux alc861_capture_source = {
10821 { "Front Mic", 0x3 },
10828 /* fill in the dac_nids table from the parsed pin configuration */
10829 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
10830 const struct auto_pin_cfg *cfg)
10835 spec->multiout.dac_nids = spec->private_dac_nids;
10836 for (i = 0; i < cfg->line_outs; i++) {
10837 nid = cfg->line_out_pins[i];
10839 if (i >= ARRAY_SIZE(alc861_dac_nids))
10841 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
10844 spec->multiout.num_dacs = cfg->line_outs;
10848 /* add playback controls from the parsed DAC table */
10849 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
10850 const struct auto_pin_cfg *cfg)
10853 static const char *chname[4] = {
10854 "Front", "Surround", NULL /*CLFE*/, "Side"
10859 for (i = 0; i < cfg->line_outs; i++) {
10860 nid = spec->multiout.dac_nids[i];
10865 err = add_control(spec, ALC_CTL_BIND_MUTE,
10866 "Center Playback Switch",
10867 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
10871 err = add_control(spec, ALC_CTL_BIND_MUTE,
10872 "LFE Playback Switch",
10873 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10878 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
10880 if (nid == alc861_dac_nids[idx])
10882 sprintf(name, "%s Playback Switch", chname[idx]);
10883 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10884 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10893 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
10901 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
10903 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10904 "Headphone Playback Switch",
10905 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10908 spec->multiout.hp_nid = nid;
10913 /* create playback/capture controls for input pins */
10914 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
10915 const struct auto_pin_cfg *cfg)
10917 struct hda_input_mux *imux = &spec->private_imux;
10918 int i, err, idx, idx1;
10920 for (i = 0; i < AUTO_PIN_LAST; i++) {
10921 switch (cfg->input_pins[i]) {
10924 idx = 2; /* Line In */
10928 idx = 2; /* Line In */
10932 idx = 1; /* Mic In */
10936 idx = 1; /* Mic In */
10946 err = new_analog_input(spec, cfg->input_pins[i],
10947 auto_pin_cfg_labels[i], idx, 0x15);
10951 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10952 imux->items[imux->num_items].index = idx1;
10958 static struct snd_kcontrol_new alc861_capture_mixer[] = {
10959 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10960 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10964 /* The multiple "Capture Source" controls confuse alsamixer
10965 * So call somewhat different..
10966 *FIXME: the controls appear in the "playback" view!
10968 /* .name = "Capture Source", */
10969 .name = "Input Source",
10971 .info = alc_mux_enum_info,
10972 .get = alc_mux_enum_get,
10973 .put = alc_mux_enum_put,
10978 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
10980 int pin_type, int dac_idx)
10982 /* set as output */
10984 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10986 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
10991 static void alc861_auto_init_multi_out(struct hda_codec *codec)
10993 struct alc_spec *spec = codec->spec;
10996 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
10997 for (i = 0; i < spec->autocfg.line_outs; i++) {
10998 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10999 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11001 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
11002 spec->multiout.dac_nids[i]);
11006 static void alc861_auto_init_hp_out(struct hda_codec *codec)
11008 struct alc_spec *spec = codec->spec;
11011 pin = spec->autocfg.hp_pins[0];
11012 if (pin) /* connect to front */
11013 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
11014 spec->multiout.dac_nids[0]);
11017 static void alc861_auto_init_analog_input(struct hda_codec *codec)
11019 struct alc_spec *spec = codec->spec;
11022 for (i = 0; i < AUTO_PIN_LAST; i++) {
11023 hda_nid_t nid = spec->autocfg.input_pins[i];
11024 if (nid >= 0x0c && nid <= 0x11) {
11025 snd_hda_codec_write(codec, nid, 0,
11026 AC_VERB_SET_PIN_WIDGET_CONTROL,
11027 i <= AUTO_PIN_FRONT_MIC ?
11028 PIN_VREF80 : PIN_IN);
11033 /* parse the BIOS configuration and set up the alc_spec */
11034 /* return 1 if successful, 0 if the proper config is not found,
11035 * or a negative error code
11037 static int alc861_parse_auto_config(struct hda_codec *codec)
11039 struct alc_spec *spec = codec->spec;
11041 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11043 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11047 if (!spec->autocfg.line_outs)
11048 return 0; /* can't find valid BIOS pin config */
11050 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
11053 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
11056 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
11059 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
11063 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11065 if (spec->autocfg.dig_out_pin)
11066 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
11068 if (spec->kctl_alloc)
11069 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11071 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
11073 spec->num_mux_defs = 1;
11074 spec->input_mux = &spec->private_imux;
11076 spec->adc_nids = alc861_adc_nids;
11077 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
11078 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
11079 spec->num_mixers++;
11084 /* additional initialization for auto-configuration model */
11085 static void alc861_auto_init(struct hda_codec *codec)
11087 alc861_auto_init_multi_out(codec);
11088 alc861_auto_init_hp_out(codec);
11089 alc861_auto_init_analog_input(codec);
11092 #ifdef CONFIG_SND_HDA_POWER_SAVE
11093 static struct hda_amp_list alc861_loopbacks[] = {
11094 { 0x15, HDA_INPUT, 0 },
11095 { 0x15, HDA_INPUT, 1 },
11096 { 0x15, HDA_INPUT, 2 },
11097 { 0x15, HDA_INPUT, 3 },
11104 * configuration and preset
11106 static const char *alc861_models[ALC861_MODEL_LAST] = {
11107 [ALC861_3ST] = "3stack",
11108 [ALC660_3ST] = "3stack-660",
11109 [ALC861_3ST_DIG] = "3stack-dig",
11110 [ALC861_6ST_DIG] = "6stack-dig",
11111 [ALC861_UNIWILL_M31] = "uniwill-m31",
11112 [ALC861_TOSHIBA] = "toshiba",
11113 [ALC861_ASUS] = "asus",
11114 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11115 [ALC861_AUTO] = "auto",
11118 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11119 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11120 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11121 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11122 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11123 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11124 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11125 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11126 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11127 * Any other models that need this preset?
11129 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11130 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11131 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11132 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11133 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11134 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11135 /* FIXME: the below seems conflict */
11136 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11137 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11138 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11142 static struct alc_config_preset alc861_presets[] = {
11144 .mixers = { alc861_3ST_mixer },
11145 .init_verbs = { alc861_threestack_init_verbs },
11146 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11147 .dac_nids = alc861_dac_nids,
11148 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11149 .channel_mode = alc861_threestack_modes,
11151 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11152 .adc_nids = alc861_adc_nids,
11153 .input_mux = &alc861_capture_source,
11155 [ALC861_3ST_DIG] = {
11156 .mixers = { alc861_base_mixer },
11157 .init_verbs = { alc861_threestack_init_verbs },
11158 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11159 .dac_nids = alc861_dac_nids,
11160 .dig_out_nid = ALC861_DIGOUT_NID,
11161 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11162 .channel_mode = alc861_threestack_modes,
11164 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11165 .adc_nids = alc861_adc_nids,
11166 .input_mux = &alc861_capture_source,
11168 [ALC861_6ST_DIG] = {
11169 .mixers = { alc861_base_mixer },
11170 .init_verbs = { alc861_base_init_verbs },
11171 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11172 .dac_nids = alc861_dac_nids,
11173 .dig_out_nid = ALC861_DIGOUT_NID,
11174 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11175 .channel_mode = alc861_8ch_modes,
11176 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11177 .adc_nids = alc861_adc_nids,
11178 .input_mux = &alc861_capture_source,
11181 .mixers = { alc861_3ST_mixer },
11182 .init_verbs = { alc861_threestack_init_verbs },
11183 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11184 .dac_nids = alc660_dac_nids,
11185 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11186 .channel_mode = alc861_threestack_modes,
11188 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11189 .adc_nids = alc861_adc_nids,
11190 .input_mux = &alc861_capture_source,
11192 [ALC861_UNIWILL_M31] = {
11193 .mixers = { alc861_uniwill_m31_mixer },
11194 .init_verbs = { alc861_uniwill_m31_init_verbs },
11195 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11196 .dac_nids = alc861_dac_nids,
11197 .dig_out_nid = ALC861_DIGOUT_NID,
11198 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11199 .channel_mode = alc861_uniwill_m31_modes,
11201 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11202 .adc_nids = alc861_adc_nids,
11203 .input_mux = &alc861_capture_source,
11205 [ALC861_TOSHIBA] = {
11206 .mixers = { alc861_toshiba_mixer },
11207 .init_verbs = { alc861_base_init_verbs,
11208 alc861_toshiba_init_verbs },
11209 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11210 .dac_nids = alc861_dac_nids,
11211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11212 .channel_mode = alc883_3ST_2ch_modes,
11213 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11214 .adc_nids = alc861_adc_nids,
11215 .input_mux = &alc861_capture_source,
11216 .unsol_event = alc861_toshiba_unsol_event,
11217 .init_hook = alc861_toshiba_automute,
11220 .mixers = { alc861_asus_mixer },
11221 .init_verbs = { alc861_asus_init_verbs },
11222 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11223 .dac_nids = alc861_dac_nids,
11224 .dig_out_nid = ALC861_DIGOUT_NID,
11225 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11226 .channel_mode = alc861_asus_modes,
11229 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11230 .adc_nids = alc861_adc_nids,
11231 .input_mux = &alc861_capture_source,
11233 [ALC861_ASUS_LAPTOP] = {
11234 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11235 .init_verbs = { alc861_asus_init_verbs,
11236 alc861_asus_laptop_init_verbs },
11237 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11238 .dac_nids = alc861_dac_nids,
11239 .dig_out_nid = ALC861_DIGOUT_NID,
11240 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11241 .channel_mode = alc883_3ST_2ch_modes,
11243 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11244 .adc_nids = alc861_adc_nids,
11245 .input_mux = &alc861_capture_source,
11250 static int patch_alc861(struct hda_codec *codec)
11252 struct alc_spec *spec;
11256 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11260 codec->spec = spec;
11262 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11266 if (board_config < 0) {
11267 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11268 "trying auto-probe from BIOS...\n");
11269 board_config = ALC861_AUTO;
11272 if (board_config == ALC861_AUTO) {
11273 /* automatic parse from the BIOS config */
11274 err = alc861_parse_auto_config(codec);
11280 "hda_codec: Cannot set up configuration "
11281 "from BIOS. Using base mode...\n");
11282 board_config = ALC861_3ST_DIG;
11286 if (board_config != ALC861_AUTO)
11287 setup_preset(spec, &alc861_presets[board_config]);
11289 spec->stream_name_analog = "ALC861 Analog";
11290 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11291 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11293 spec->stream_name_digital = "ALC861 Digital";
11294 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11295 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11297 codec->patch_ops = alc_patch_ops;
11298 if (board_config == ALC861_AUTO)
11299 spec->init_hook = alc861_auto_init;
11300 #ifdef CONFIG_SND_HDA_POWER_SAVE
11301 if (!spec->loopback.amplist)
11302 spec->loopback.amplist = alc861_loopbacks;
11309 * ALC861-VD support
11313 * In addition, an independent DAC
11315 #define ALC861VD_DIGOUT_NID 0x06
11317 static hda_nid_t alc861vd_dac_nids[4] = {
11318 /* front, surr, clfe, side surr */
11319 0x02, 0x03, 0x04, 0x05
11322 /* dac_nids for ALC660vd are in a different order - according to
11323 * Realtek's driver.
11324 * This should probably tesult in a different mixer for 6stack models
11325 * of ALC660vd codecs, but for now there is only 3stack mixer
11326 * - and it is the same as in 861vd.
11327 * adc_nids in ALC660vd are (is) the same as in 861vd
11329 static hda_nid_t alc660vd_dac_nids[3] = {
11330 /* front, rear, clfe, rear_surr */
11334 static hda_nid_t alc861vd_adc_nids[1] = {
11340 /* FIXME: should be a matrix-type input source selection */
11341 static struct hda_input_mux alc861vd_capture_source = {
11345 { "Front Mic", 0x1 },
11351 static struct hda_input_mux alc861vd_dallas_capture_source = {
11354 { "Front Mic", 0x0 },
11355 { "ATAPI Mic", 0x1 },
11356 { "Line In", 0x5 },
11360 static struct hda_input_mux alc861vd_hp_capture_source = {
11363 { "Front Mic", 0x0 },
11364 { "ATAPI Mic", 0x1 },
11368 #define alc861vd_mux_enum_info alc_mux_enum_info
11369 #define alc861vd_mux_enum_get alc_mux_enum_get
11371 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11372 struct snd_ctl_elem_value *ucontrol)
11374 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11375 struct alc_spec *spec = codec->spec;
11376 const struct hda_input_mux *imux = spec->input_mux;
11377 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11378 static hda_nid_t capture_mixers[1] = { 0x22 };
11379 hda_nid_t nid = capture_mixers[adc_idx];
11380 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11381 unsigned int i, idx;
11383 idx = ucontrol->value.enumerated.item[0];
11384 if (idx >= imux->num_items)
11385 idx = imux->num_items - 1;
11386 if (*cur_val == idx)
11388 for (i = 0; i < imux->num_items; i++) {
11389 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11390 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11391 imux->items[i].index,
11401 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11408 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11409 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11410 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11411 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11412 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11419 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11420 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11421 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11422 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11423 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11427 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11428 { 6, alc861vd_6stack_ch6_init },
11429 { 8, alc861vd_6stack_ch8_init },
11432 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11434 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11435 .name = "Channel Mode",
11436 .info = alc_ch_mode_info,
11437 .get = alc_ch_mode_get,
11438 .put = alc_ch_mode_put,
11443 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11444 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11445 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11449 /* The multiple "Capture Source" controls confuse alsamixer
11450 * So call somewhat different..
11451 *FIXME: the controls appear in the "playback" view!
11453 /* .name = "Capture Source", */
11454 .name = "Input Source",
11456 .info = alc861vd_mux_enum_info,
11457 .get = alc861vd_mux_enum_get,
11458 .put = alc861vd_mux_enum_put,
11463 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11464 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11466 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11467 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11468 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11470 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11473 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11475 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11477 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11478 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11480 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11481 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11483 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11489 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11490 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11491 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11496 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11497 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11499 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11500 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11505 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11506 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11507 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11515 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11516 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11517 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11519 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11520 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11525 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11526 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11531 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11532 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11533 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11534 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11542 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11543 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11544 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11552 /* Pin assignment: Front=0x14, HP = 0x15,
11553 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11555 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11556 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11557 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11558 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11559 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11560 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11561 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11562 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11563 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11569 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11570 * Front Mic=0x18, ATAPI Mic = 0x19,
11572 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11573 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11574 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11575 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11576 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11577 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11578 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11579 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11580 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11586 * generic initialization of ADC, input mixers and output mixers
11588 static struct hda_verb alc861vd_volume_init_verbs[] = {
11590 * Unmute ADC0 and set the default input to mic-in
11592 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11593 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11595 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11596 * the analog-loopback mixer widget
11598 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11605 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11612 * Set up output mixers (0x02 - 0x05)
11614 /* set vol=0 to output mixers */
11615 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11616 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11617 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11618 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11620 /* set up input amps for analog loopback */
11621 /* Amp Indices: DAC = 0, mixer = 1 */
11622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11635 * 3-stack pin configuration:
11636 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11638 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11640 * Set pin mode and muting
11642 /* set front pin widgets 0x14 for output */
11643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11645 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11647 /* Mic (rear) pin: input vref at 80% */
11648 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11650 /* Front Mic pin: input vref at 80% */
11651 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11652 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11653 /* Line In pin: input */
11654 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11655 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11656 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11659 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11660 /* CD pin widget for input */
11661 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11667 * 6-stack pin configuration:
11669 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11671 * Set pin mode and muting
11673 /* set front pin widgets 0x14 for output */
11674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11676 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11678 /* Rear Pin: output 1 (0x0d) */
11679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11682 /* CLFE Pin: output 2 (0x0e) */
11683 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11685 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11686 /* Side Pin: output 3 (0x0f) */
11687 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11688 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11689 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11691 /* Mic (rear) pin: input vref at 80% */
11692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11694 /* Front Mic pin: input vref at 80% */
11695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11697 /* Line In pin: input */
11698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11700 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11703 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11704 /* CD pin widget for input */
11705 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11710 static struct hda_verb alc861vd_eapd_verbs[] = {
11711 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11715 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
11716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11717 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11718 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11720 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11724 /* toggle speaker-output according to the hp-jack state */
11725 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
11727 unsigned int present;
11728 unsigned char bits;
11730 present = snd_hda_codec_read(codec, 0x1b, 0,
11731 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11732 bits = present ? HDA_AMP_MUTE : 0;
11733 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11734 HDA_AMP_MUTE, bits);
11737 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
11739 unsigned int present;
11740 unsigned char bits;
11742 present = snd_hda_codec_read(codec, 0x18, 0,
11743 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11744 bits = present ? HDA_AMP_MUTE : 0;
11745 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
11746 HDA_AMP_MUTE, bits);
11749 static void alc861vd_lenovo_automute(struct hda_codec *codec)
11751 alc861vd_lenovo_hp_automute(codec);
11752 alc861vd_lenovo_mic_automute(codec);
11755 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
11758 switch (res >> 26) {
11759 case ALC880_HP_EVENT:
11760 alc861vd_lenovo_hp_automute(codec);
11762 case ALC880_MIC_EVENT:
11763 alc861vd_lenovo_mic_automute(codec);
11768 static struct hda_verb alc861vd_dallas_verbs[] = {
11769 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11770 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11771 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11772 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11774 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11775 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11776 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11777 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11778 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11780 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11781 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11788 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11790 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11793 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11794 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11795 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11796 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11799 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11802 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11803 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11804 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11807 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11813 /* toggle speaker-output according to the hp-jack state */
11814 static void alc861vd_dallas_automute(struct hda_codec *codec)
11816 unsigned int present;
11818 present = snd_hda_codec_read(codec, 0x15, 0,
11819 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11820 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11821 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11824 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
11826 if ((res >> 26) == ALC880_HP_EVENT)
11827 alc861vd_dallas_automute(codec);
11830 #ifdef CONFIG_SND_HDA_POWER_SAVE
11831 #define alc861vd_loopbacks alc880_loopbacks
11834 /* pcm configuration: identiacal with ALC880 */
11835 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11836 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11837 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11838 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11841 * configuration and preset
11843 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
11844 [ALC660VD_3ST] = "3stack-660",
11845 [ALC660VD_3ST_DIG] = "3stack-660-digout",
11846 [ALC861VD_3ST] = "3stack",
11847 [ALC861VD_3ST_DIG] = "3stack-digout",
11848 [ALC861VD_6ST_DIG] = "6stack-digout",
11849 [ALC861VD_LENOVO] = "lenovo",
11850 [ALC861VD_DALLAS] = "dallas",
11851 [ALC861VD_HP] = "hp",
11852 [ALC861VD_AUTO] = "auto",
11855 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
11856 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
11857 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
11858 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
11859 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
11860 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
11861 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
11862 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
11863 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11864 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
11865 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
11866 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
11867 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
11868 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
11869 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
11873 static struct alc_config_preset alc861vd_presets[] = {
11875 .mixers = { alc861vd_3st_mixer },
11876 .init_verbs = { alc861vd_volume_init_verbs,
11877 alc861vd_3stack_init_verbs },
11878 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11879 .dac_nids = alc660vd_dac_nids,
11880 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11881 .adc_nids = alc861vd_adc_nids,
11882 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11883 .channel_mode = alc861vd_3stack_2ch_modes,
11884 .input_mux = &alc861vd_capture_source,
11886 [ALC660VD_3ST_DIG] = {
11887 .mixers = { alc861vd_3st_mixer },
11888 .init_verbs = { alc861vd_volume_init_verbs,
11889 alc861vd_3stack_init_verbs },
11890 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11891 .dac_nids = alc660vd_dac_nids,
11892 .dig_out_nid = ALC861VD_DIGOUT_NID,
11893 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11894 .adc_nids = alc861vd_adc_nids,
11895 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11896 .channel_mode = alc861vd_3stack_2ch_modes,
11897 .input_mux = &alc861vd_capture_source,
11900 .mixers = { alc861vd_3st_mixer },
11901 .init_verbs = { alc861vd_volume_init_verbs,
11902 alc861vd_3stack_init_verbs },
11903 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11904 .dac_nids = alc861vd_dac_nids,
11905 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11906 .channel_mode = alc861vd_3stack_2ch_modes,
11907 .input_mux = &alc861vd_capture_source,
11909 [ALC861VD_3ST_DIG] = {
11910 .mixers = { alc861vd_3st_mixer },
11911 .init_verbs = { alc861vd_volume_init_verbs,
11912 alc861vd_3stack_init_verbs },
11913 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11914 .dac_nids = alc861vd_dac_nids,
11915 .dig_out_nid = ALC861VD_DIGOUT_NID,
11916 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11917 .channel_mode = alc861vd_3stack_2ch_modes,
11918 .input_mux = &alc861vd_capture_source,
11920 [ALC861VD_6ST_DIG] = {
11921 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
11922 .init_verbs = { alc861vd_volume_init_verbs,
11923 alc861vd_6stack_init_verbs },
11924 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11925 .dac_nids = alc861vd_dac_nids,
11926 .dig_out_nid = ALC861VD_DIGOUT_NID,
11927 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
11928 .channel_mode = alc861vd_6stack_modes,
11929 .input_mux = &alc861vd_capture_source,
11931 [ALC861VD_LENOVO] = {
11932 .mixers = { alc861vd_lenovo_mixer },
11933 .init_verbs = { alc861vd_volume_init_verbs,
11934 alc861vd_3stack_init_verbs,
11935 alc861vd_eapd_verbs,
11936 alc861vd_lenovo_unsol_verbs },
11937 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11938 .dac_nids = alc660vd_dac_nids,
11939 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11940 .adc_nids = alc861vd_adc_nids,
11941 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11942 .channel_mode = alc861vd_3stack_2ch_modes,
11943 .input_mux = &alc861vd_capture_source,
11944 .unsol_event = alc861vd_lenovo_unsol_event,
11945 .init_hook = alc861vd_lenovo_automute,
11947 [ALC861VD_DALLAS] = {
11948 .mixers = { alc861vd_dallas_mixer },
11949 .init_verbs = { alc861vd_dallas_verbs },
11950 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11951 .dac_nids = alc861vd_dac_nids,
11952 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11953 .adc_nids = alc861vd_adc_nids,
11954 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11955 .channel_mode = alc861vd_3stack_2ch_modes,
11956 .input_mux = &alc861vd_dallas_capture_source,
11957 .unsol_event = alc861vd_dallas_unsol_event,
11958 .init_hook = alc861vd_dallas_automute,
11961 .mixers = { alc861vd_hp_mixer },
11962 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
11963 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11964 .dac_nids = alc861vd_dac_nids,
11965 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11966 .dig_out_nid = ALC861VD_DIGOUT_NID,
11967 .adc_nids = alc861vd_adc_nids,
11968 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11969 .channel_mode = alc861vd_3stack_2ch_modes,
11970 .input_mux = &alc861vd_hp_capture_source,
11971 .unsol_event = alc861vd_dallas_unsol_event,
11972 .init_hook = alc861vd_dallas_automute,
11977 * BIOS auto configuration
11979 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
11980 hda_nid_t nid, int pin_type, int dac_idx)
11982 /* set as output */
11983 snd_hda_codec_write(codec, nid, 0,
11984 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11985 snd_hda_codec_write(codec, nid, 0,
11986 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11989 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
11991 struct alc_spec *spec = codec->spec;
11994 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
11995 for (i = 0; i <= HDA_SIDE; i++) {
11996 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11997 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11999 alc861vd_auto_set_output_and_unmute(codec, nid,
12005 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
12007 struct alc_spec *spec = codec->spec;
12010 pin = spec->autocfg.hp_pins[0];
12011 if (pin) /* connect to front and use dac 0 */
12012 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12015 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12016 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12018 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
12020 struct alc_spec *spec = codec->spec;
12023 for (i = 0; i < AUTO_PIN_LAST; i++) {
12024 hda_nid_t nid = spec->autocfg.input_pins[i];
12025 if (alc861vd_is_input_pin(nid)) {
12026 snd_hda_codec_write(codec, nid, 0,
12027 AC_VERB_SET_PIN_WIDGET_CONTROL,
12028 i <= AUTO_PIN_FRONT_MIC ?
12029 PIN_VREF80 : PIN_IN);
12030 if (nid != ALC861VD_PIN_CD_NID)
12031 snd_hda_codec_write(codec, nid, 0,
12032 AC_VERB_SET_AMP_GAIN_MUTE,
12038 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12039 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12041 /* add playback controls from the parsed DAC table */
12042 /* Based on ALC880 version. But ALC861VD has separate,
12043 * different NIDs for mute/unmute switch and volume control */
12044 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
12045 const struct auto_pin_cfg *cfg)
12048 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
12049 hda_nid_t nid_v, nid_s;
12052 for (i = 0; i < cfg->line_outs; i++) {
12053 if (!spec->multiout.dac_nids[i])
12055 nid_v = alc861vd_idx_to_mixer_vol(
12057 spec->multiout.dac_nids[i]));
12058 nid_s = alc861vd_idx_to_mixer_switch(
12060 spec->multiout.dac_nids[i]));
12064 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12065 "Center Playback Volume",
12066 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
12070 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12071 "LFE Playback Volume",
12072 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
12076 err = add_control(spec, ALC_CTL_BIND_MUTE,
12077 "Center Playback Switch",
12078 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
12082 err = add_control(spec, ALC_CTL_BIND_MUTE,
12083 "LFE Playback Switch",
12084 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
12089 sprintf(name, "%s Playback Volume", chname[i]);
12090 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12091 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
12095 sprintf(name, "%s Playback Switch", chname[i]);
12096 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12097 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12106 /* add playback controls for speaker and HP outputs */
12107 /* Based on ALC880 version. But ALC861VD has separate,
12108 * different NIDs for mute/unmute switch and volume control */
12109 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12110 hda_nid_t pin, const char *pfx)
12112 hda_nid_t nid_v, nid_s;
12119 if (alc880_is_fixed_pin(pin)) {
12120 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12121 /* specify the DAC as the extra output */
12122 if (!spec->multiout.hp_nid)
12123 spec->multiout.hp_nid = nid_v;
12125 spec->multiout.extra_out_nid[0] = nid_v;
12126 /* control HP volume/switch on the output mixer amp */
12127 nid_v = alc861vd_idx_to_mixer_vol(
12128 alc880_fixed_pin_idx(pin));
12129 nid_s = alc861vd_idx_to_mixer_switch(
12130 alc880_fixed_pin_idx(pin));
12132 sprintf(name, "%s Playback Volume", pfx);
12133 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12134 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12137 sprintf(name, "%s Playback Switch", pfx);
12138 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12139 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12142 } else if (alc880_is_multi_pin(pin)) {
12143 /* set manual connection */
12144 /* we have only a switch on HP-out PIN */
12145 sprintf(name, "%s Playback Switch", pfx);
12146 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12147 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12154 /* parse the BIOS configuration and set up the alc_spec
12155 * return 1 if successful, 0 if the proper config is not found,
12156 * or a negative error code
12157 * Based on ALC880 version - had to change it to override
12158 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12159 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12161 struct alc_spec *spec = codec->spec;
12163 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12165 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12169 if (!spec->autocfg.line_outs)
12170 return 0; /* can't find valid BIOS pin config */
12172 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12175 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12178 err = alc861vd_auto_create_extra_out(spec,
12179 spec->autocfg.speaker_pins[0],
12183 err = alc861vd_auto_create_extra_out(spec,
12184 spec->autocfg.hp_pins[0],
12188 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12192 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12194 if (spec->autocfg.dig_out_pin)
12195 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12197 if (spec->kctl_alloc)
12198 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12200 spec->init_verbs[spec->num_init_verbs++]
12201 = alc861vd_volume_init_verbs;
12203 spec->num_mux_defs = 1;
12204 spec->input_mux = &spec->private_imux;
12206 err = alc_auto_add_mic_boost(codec);
12213 /* additional initialization for auto-configuration model */
12214 static void alc861vd_auto_init(struct hda_codec *codec)
12216 alc861vd_auto_init_multi_out(codec);
12217 alc861vd_auto_init_hp_out(codec);
12218 alc861vd_auto_init_analog_input(codec);
12221 static int patch_alc861vd(struct hda_codec *codec)
12223 struct alc_spec *spec;
12224 int err, board_config;
12226 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12230 codec->spec = spec;
12232 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12236 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12237 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12238 "ALC861VD, trying auto-probe from BIOS...\n");
12239 board_config = ALC861VD_AUTO;
12242 if (board_config == ALC861VD_AUTO) {
12243 /* automatic parse from the BIOS config */
12244 err = alc861vd_parse_auto_config(codec);
12250 "hda_codec: Cannot set up configuration "
12251 "from BIOS. Using base mode...\n");
12252 board_config = ALC861VD_3ST;
12256 if (board_config != ALC861VD_AUTO)
12257 setup_preset(spec, &alc861vd_presets[board_config]);
12259 spec->stream_name_analog = "ALC861VD Analog";
12260 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12261 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12263 spec->stream_name_digital = "ALC861VD Digital";
12264 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12265 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12267 spec->adc_nids = alc861vd_adc_nids;
12268 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12270 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12271 spec->num_mixers++;
12273 codec->patch_ops = alc_patch_ops;
12275 if (board_config == ALC861VD_AUTO)
12276 spec->init_hook = alc861vd_auto_init;
12277 #ifdef CONFIG_SND_HDA_POWER_SAVE
12278 if (!spec->loopback.amplist)
12279 spec->loopback.amplist = alc861vd_loopbacks;
12288 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12289 * configuration. Each pin widget can choose any input DACs and a mixer.
12290 * Each ADC is connected from a mixer of all inputs. This makes possible
12291 * 6-channel independent captures.
12293 * In addition, an independent DAC for the multi-playback (not used in this
12296 #define ALC662_DIGOUT_NID 0x06
12297 #define ALC662_DIGIN_NID 0x0a
12299 static hda_nid_t alc662_dac_nids[4] = {
12300 /* front, rear, clfe, rear_surr */
12304 static hda_nid_t alc662_adc_nids[1] = {
12309 /* FIXME: should be a matrix-type input source selection */
12311 static struct hda_input_mux alc662_capture_source = {
12315 { "Front Mic", 0x1 },
12321 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12329 static struct hda_input_mux alc662_eeepc_capture_source = {
12337 #define alc662_mux_enum_info alc_mux_enum_info
12338 #define alc662_mux_enum_get alc_mux_enum_get
12340 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12341 struct snd_ctl_elem_value *ucontrol)
12343 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12344 struct alc_spec *spec = codec->spec;
12345 const struct hda_input_mux *imux = spec->input_mux;
12346 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12347 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12348 hda_nid_t nid = capture_mixers[adc_idx];
12349 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12350 unsigned int i, idx;
12352 idx = ucontrol->value.enumerated.item[0];
12353 if (idx >= imux->num_items)
12354 idx = imux->num_items - 1;
12355 if (*cur_val == idx)
12357 for (i = 0; i < imux->num_items; i++) {
12358 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12359 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12360 imux->items[i].index,
12369 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12376 static struct hda_verb alc662_3ST_ch2_init[] = {
12377 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12378 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12379 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12380 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12387 static struct hda_verb alc662_3ST_ch6_init[] = {
12388 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12389 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12390 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12391 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12392 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12393 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12397 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12398 { 2, alc662_3ST_ch2_init },
12399 { 6, alc662_3ST_ch6_init },
12405 static struct hda_verb alc662_sixstack_ch6_init[] = {
12406 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12407 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12408 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12415 static struct hda_verb alc662_sixstack_ch8_init[] = {
12416 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12417 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12418 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12422 static struct hda_channel_mode alc662_5stack_modes[2] = {
12423 { 2, alc662_sixstack_ch6_init },
12424 { 6, alc662_sixstack_ch8_init },
12427 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12428 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12431 static struct snd_kcontrol_new alc662_base_mixer[] = {
12432 /* output mixer control */
12433 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12435 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12436 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12437 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12438 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12439 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12440 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12443 /*Input mixer control */
12444 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12445 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12446 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12447 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12448 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12449 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12451 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12455 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12456 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12457 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12459 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12460 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12465 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12467 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12468 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12472 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12473 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12474 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12475 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12476 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12477 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12478 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12479 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12480 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12481 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12483 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12484 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12485 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12488 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12490 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12491 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12495 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12496 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12497 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12498 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12499 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
12500 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12501 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12502 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12508 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12509 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12511 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12512 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12514 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12515 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12516 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12518 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12519 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12520 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12524 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12526 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12527 .name = "Channel Mode",
12528 .info = alc_ch_mode_info,
12529 .get = alc_ch_mode_get,
12530 .put = alc_ch_mode_put,
12535 static struct hda_verb alc662_init_verbs[] = {
12536 /* ADC: mute amp left and right */
12537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12538 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12539 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12549 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12551 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12552 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12554 /* Front Pin: output 0 (0x0c) */
12555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12558 /* Rear Pin: output 1 (0x0d) */
12559 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12562 /* CLFE Pin: output 2 (0x0e) */
12563 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12564 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12566 /* Mic (rear) pin: input vref at 80% */
12567 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12568 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12569 /* Front Mic pin: input vref at 80% */
12570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12571 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12572 /* Line In pin: input */
12573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12574 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12575 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12576 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12577 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12578 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12579 /* CD pin widget for input */
12580 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12582 /* FIXME: use matrix-type input source selection */
12583 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12597 static struct hda_verb alc662_sue_init_verbs[] = {
12598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12599 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12603 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12604 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12605 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12610 * generic initialization of ADC, input mixers and output mixers
12612 static struct hda_verb alc662_auto_init_verbs[] = {
12614 * Unmute ADC and set the default input to mic-in
12616 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12619 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12621 * Note: PASD motherboards uses the Line In 2 as the input for front
12622 * panel mic (mic 2)
12624 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12632 * Set up output mixers (0x0c - 0x0f)
12634 /* set vol=0 to output mixers */
12635 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12636 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12637 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12639 /* set up input amps for analog loopback */
12640 /* Amp Indices: DAC = 0, mixer = 1 */
12641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12649 /* FIXME: use matrix-type input source selection */
12650 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12657 /* capture mixer elements */
12658 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12659 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12660 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12663 /* The multiple "Capture Source" controls confuse alsamixer
12664 * So call somewhat different..
12665 * FIXME: the controls appear in the "playback" view!
12667 /* .name = "Capture Source", */
12668 .name = "Input Source",
12670 .info = alc662_mux_enum_info,
12671 .get = alc662_mux_enum_get,
12672 .put = alc662_mux_enum_put,
12677 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
12679 unsigned int present;
12680 unsigned char bits;
12682 present = snd_hda_codec_read(codec, 0x14, 0,
12683 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12684 bits = present ? HDA_AMP_MUTE : 0;
12685 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12686 HDA_AMP_MUTE, bits);
12689 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
12691 unsigned int present;
12692 unsigned char bits;
12694 present = snd_hda_codec_read(codec, 0x1b, 0,
12695 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12696 bits = present ? HDA_AMP_MUTE : 0;
12697 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12698 HDA_AMP_MUTE, bits);
12699 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12700 HDA_AMP_MUTE, bits);
12703 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
12706 if ((res >> 26) == ALC880_HP_EVENT)
12707 alc662_lenovo_101e_all_automute(codec);
12708 if ((res >> 26) == ALC880_FRONT_EVENT)
12709 alc662_lenovo_101e_ispeaker_automute(codec);
12712 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
12714 unsigned int present;
12716 present = snd_hda_codec_read(codec, 0x18, 0,
12717 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12718 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12719 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12720 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12721 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12722 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12723 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12724 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12725 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12728 /* unsolicited event for HP jack sensing */
12729 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
12732 if ((res >> 26) == ALC880_HP_EVENT)
12733 alc262_hippo1_automute( codec );
12735 if ((res >> 26) == ALC880_MIC_EVENT)
12736 alc662_eeepc_mic_automute(codec);
12739 static void alc662_eeepc_inithook(struct hda_codec *codec)
12741 alc262_hippo1_automute( codec );
12742 alc662_eeepc_mic_automute(codec);
12745 #ifdef CONFIG_SND_HDA_POWER_SAVE
12746 #define alc662_loopbacks alc880_loopbacks
12750 /* pcm configuration: identiacal with ALC880 */
12751 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12752 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12753 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12754 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12757 * configuration and preset
12759 static const char *alc662_models[ALC662_MODEL_LAST] = {
12760 [ALC662_3ST_2ch_DIG] = "3stack-dig",
12761 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
12762 [ALC662_3ST_6ch] = "3stack-6ch",
12763 [ALC662_5ST_DIG] = "6stack-dig",
12764 [ALC662_LENOVO_101E] = "lenovo-101e",
12765 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
12766 [ALC662_AUTO] = "auto",
12769 static struct snd_pci_quirk alc662_cfg_tbl[] = {
12770 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
12771 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
12775 static struct alc_config_preset alc662_presets[] = {
12776 [ALC662_3ST_2ch_DIG] = {
12777 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
12778 .init_verbs = { alc662_init_verbs },
12779 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12780 .dac_nids = alc662_dac_nids,
12781 .dig_out_nid = ALC662_DIGOUT_NID,
12782 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12783 .adc_nids = alc662_adc_nids,
12784 .dig_in_nid = ALC662_DIGIN_NID,
12785 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12786 .channel_mode = alc662_3ST_2ch_modes,
12787 .input_mux = &alc662_capture_source,
12789 [ALC662_3ST_6ch_DIG] = {
12790 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12791 alc662_capture_mixer },
12792 .init_verbs = { alc662_init_verbs },
12793 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12794 .dac_nids = alc662_dac_nids,
12795 .dig_out_nid = ALC662_DIGOUT_NID,
12796 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12797 .adc_nids = alc662_adc_nids,
12798 .dig_in_nid = ALC662_DIGIN_NID,
12799 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12800 .channel_mode = alc662_3ST_6ch_modes,
12802 .input_mux = &alc662_capture_source,
12804 [ALC662_3ST_6ch] = {
12805 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12806 alc662_capture_mixer },
12807 .init_verbs = { alc662_init_verbs },
12808 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12809 .dac_nids = alc662_dac_nids,
12810 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12811 .adc_nids = alc662_adc_nids,
12812 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12813 .channel_mode = alc662_3ST_6ch_modes,
12815 .input_mux = &alc662_capture_source,
12817 [ALC662_5ST_DIG] = {
12818 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
12819 alc662_capture_mixer },
12820 .init_verbs = { alc662_init_verbs },
12821 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12822 .dac_nids = alc662_dac_nids,
12823 .dig_out_nid = ALC662_DIGOUT_NID,
12824 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12825 .adc_nids = alc662_adc_nids,
12826 .dig_in_nid = ALC662_DIGIN_NID,
12827 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
12828 .channel_mode = alc662_5stack_modes,
12829 .input_mux = &alc662_capture_source,
12831 [ALC662_LENOVO_101E] = {
12832 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
12833 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
12834 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12835 .dac_nids = alc662_dac_nids,
12836 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12837 .adc_nids = alc662_adc_nids,
12838 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12839 .channel_mode = alc662_3ST_2ch_modes,
12840 .input_mux = &alc662_lenovo_101e_capture_source,
12841 .unsol_event = alc662_lenovo_101e_unsol_event,
12842 .init_hook = alc662_lenovo_101e_all_automute,
12844 [ALC662_ASUS_EEEPC_P701] = {
12845 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
12846 .init_verbs = { alc662_init_verbs,
12847 alc662_eeepc_sue_init_verbs },
12848 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12849 .dac_nids = alc662_dac_nids,
12850 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12851 .adc_nids = alc662_adc_nids,
12852 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12853 .channel_mode = alc662_3ST_2ch_modes,
12854 .input_mux = &alc662_eeepc_capture_source,
12855 .unsol_event = alc662_eeepc_unsol_event,
12856 .init_hook = alc662_eeepc_inithook,
12863 * BIOS auto configuration
12866 /* add playback controls from the parsed DAC table */
12867 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
12868 const struct auto_pin_cfg *cfg)
12871 static const char *chname[4] = {
12872 "Front", "Surround", NULL /*CLFE*/, "Side"
12877 for (i = 0; i < cfg->line_outs; i++) {
12878 if (!spec->multiout.dac_nids[i])
12880 nid = alc880_idx_to_dac(i);
12883 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12884 "Center Playback Volume",
12885 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12889 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12890 "LFE Playback Volume",
12891 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12895 err = add_control(spec, ALC_CTL_BIND_MUTE,
12896 "Center Playback Switch",
12897 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
12901 err = add_control(spec, ALC_CTL_BIND_MUTE,
12902 "LFE Playback Switch",
12903 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
12908 sprintf(name, "%s Playback Volume", chname[i]);
12909 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12910 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12914 sprintf(name, "%s Playback Switch", chname[i]);
12915 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12916 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
12925 /* add playback controls for speaker and HP outputs */
12926 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
12936 if (alc880_is_fixed_pin(pin)) {
12937 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12938 /* printk("DAC nid=%x\n",nid); */
12939 /* specify the DAC as the extra output */
12940 if (!spec->multiout.hp_nid)
12941 spec->multiout.hp_nid = nid;
12943 spec->multiout.extra_out_nid[0] = nid;
12944 /* control HP volume/switch on the output mixer amp */
12945 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12946 sprintf(name, "%s Playback Volume", pfx);
12947 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12948 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12951 sprintf(name, "%s Playback Switch", pfx);
12952 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12953 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
12956 } else if (alc880_is_multi_pin(pin)) {
12957 /* set manual connection */
12958 /* we have only a switch on HP-out PIN */
12959 sprintf(name, "%s Playback Switch", pfx);
12960 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12961 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12968 /* create playback/capture controls for input pins */
12969 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
12970 const struct auto_pin_cfg *cfg)
12972 struct hda_input_mux *imux = &spec->private_imux;
12975 for (i = 0; i < AUTO_PIN_LAST; i++) {
12976 if (alc880_is_input_pin(cfg->input_pins[i])) {
12977 idx = alc880_input_pin_idx(cfg->input_pins[i]);
12978 err = new_analog_input(spec, cfg->input_pins[i],
12979 auto_pin_cfg_labels[i],
12983 imux->items[imux->num_items].label =
12984 auto_pin_cfg_labels[i];
12985 imux->items[imux->num_items].index =
12986 alc880_input_pin_idx(cfg->input_pins[i]);
12993 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
12994 hda_nid_t nid, int pin_type,
12997 /* set as output */
12998 snd_hda_codec_write(codec, nid, 0,
12999 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
13000 snd_hda_codec_write(codec, nid, 0,
13001 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
13002 /* need the manual connection? */
13003 if (alc880_is_multi_pin(nid)) {
13004 struct alc_spec *spec = codec->spec;
13005 int idx = alc880_multi_pin_idx(nid);
13006 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
13007 AC_VERB_SET_CONNECT_SEL,
13008 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
13012 static void alc662_auto_init_multi_out(struct hda_codec *codec)
13014 struct alc_spec *spec = codec->spec;
13017 for (i = 0; i <= HDA_SIDE; i++) {
13018 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13019 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13021 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
13026 static void alc662_auto_init_hp_out(struct hda_codec *codec)
13028 struct alc_spec *spec = codec->spec;
13031 pin = spec->autocfg.hp_pins[0];
13032 if (pin) /* connect to front */
13034 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
13037 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13038 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13040 static void alc662_auto_init_analog_input(struct hda_codec *codec)
13042 struct alc_spec *spec = codec->spec;
13045 for (i = 0; i < AUTO_PIN_LAST; i++) {
13046 hda_nid_t nid = spec->autocfg.input_pins[i];
13047 if (alc662_is_input_pin(nid)) {
13048 snd_hda_codec_write(codec, nid, 0,
13049 AC_VERB_SET_PIN_WIDGET_CONTROL,
13050 (i <= AUTO_PIN_FRONT_MIC ?
13051 PIN_VREF80 : PIN_IN));
13052 if (nid != ALC662_PIN_CD_NID)
13053 snd_hda_codec_write(codec, nid, 0,
13054 AC_VERB_SET_AMP_GAIN_MUTE,
13060 static int alc662_parse_auto_config(struct hda_codec *codec)
13062 struct alc_spec *spec = codec->spec;
13064 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13066 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13070 if (!spec->autocfg.line_outs)
13071 return 0; /* can't find valid BIOS pin config */
13073 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13076 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13079 err = alc662_auto_create_extra_out(spec,
13080 spec->autocfg.speaker_pins[0],
13084 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13088 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13092 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13094 if (spec->autocfg.dig_out_pin)
13095 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13097 if (spec->kctl_alloc)
13098 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13100 spec->num_mux_defs = 1;
13101 spec->input_mux = &spec->private_imux;
13103 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13104 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13105 spec->num_mixers++;
13109 /* additional initialization for auto-configuration model */
13110 static void alc662_auto_init(struct hda_codec *codec)
13112 alc662_auto_init_multi_out(codec);
13113 alc662_auto_init_hp_out(codec);
13114 alc662_auto_init_analog_input(codec);
13117 static int patch_alc662(struct hda_codec *codec)
13119 struct alc_spec *spec;
13120 int err, board_config;
13122 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13126 codec->spec = spec;
13128 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13131 if (board_config < 0) {
13132 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13133 "trying auto-probe from BIOS...\n");
13134 board_config = ALC662_AUTO;
13137 if (board_config == ALC662_AUTO) {
13138 /* automatic parse from the BIOS config */
13139 err = alc662_parse_auto_config(codec);
13145 "hda_codec: Cannot set up configuration "
13146 "from BIOS. Using base mode...\n");
13147 board_config = ALC662_3ST_2ch_DIG;
13151 if (board_config != ALC662_AUTO)
13152 setup_preset(spec, &alc662_presets[board_config]);
13154 spec->stream_name_analog = "ALC662 Analog";
13155 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13156 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13158 spec->stream_name_digital = "ALC662 Digital";
13159 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13160 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13162 if (!spec->adc_nids && spec->input_mux) {
13163 spec->adc_nids = alc662_adc_nids;
13164 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13167 codec->patch_ops = alc_patch_ops;
13168 if (board_config == ALC662_AUTO)
13169 spec->init_hook = alc662_auto_init;
13170 #ifdef CONFIG_SND_HDA_POWER_SAVE
13171 if (!spec->loopback.amplist)
13172 spec->loopback.amplist = alc662_loopbacks;
13181 struct hda_codec_preset snd_hda_preset_realtek[] = {
13182 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13183 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13184 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13185 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13186 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13187 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13188 .patch = patch_alc861 },
13189 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13190 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13191 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13192 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13193 .patch = patch_alc883 },
13194 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13195 .patch = patch_alc662 },
13196 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13197 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13198 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13199 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13200 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13201 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13202 {} /* terminator */