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 */
110 ALC268_MODEL_LAST /* last tag */
117 ALC269_MODEL_LAST /* last tag */
134 /* ALC861-VD models */
155 ALC662_ASUS_EEEPC_P701,
183 ALC883_TARGA_2ch_DIG,
189 ALC883_LENOVO_101E_2ch,
190 ALC883_LENOVO_NB0763,
191 ALC888_LENOVO_MS7195_DIG,
201 #define GPIO_MASK 0x03
204 /* codec parameterization */
205 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
206 unsigned int num_mixers;
208 const struct hda_verb *init_verbs[5]; /* initialization verbs
212 unsigned int num_init_verbs;
214 char *stream_name_analog; /* analog PCM stream */
215 struct hda_pcm_stream *stream_analog_playback;
216 struct hda_pcm_stream *stream_analog_capture;
218 char *stream_name_digital; /* digital PCM stream */
219 struct hda_pcm_stream *stream_digital_playback;
220 struct hda_pcm_stream *stream_digital_capture;
223 struct hda_multi_out multiout; /* playback set-up
224 * max_channels, dacs must be set
225 * dig_out_nid and hp_nid are optional
229 unsigned int num_adc_nids;
231 hda_nid_t dig_in_nid; /* digital-in NID; optional */
234 unsigned int num_mux_defs;
235 const struct hda_input_mux *input_mux;
236 unsigned int cur_mux[3];
239 const struct hda_channel_mode *channel_mode;
240 int num_channel_mode;
243 /* PCM information */
244 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
246 /* dynamic controls, init_verbs and input_mux */
247 struct auto_pin_cfg autocfg;
248 unsigned int num_kctl_alloc, num_kctl_used;
249 struct snd_kcontrol_new *kctl_alloc;
250 struct hda_input_mux private_imux;
251 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
254 void (*init_hook)(struct hda_codec *codec);
255 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
257 /* for pin sensing */
258 unsigned int sense_updated: 1;
259 unsigned int jack_present: 1;
261 #ifdef CONFIG_SND_HDA_POWER_SAVE
262 struct hda_loopback_check loopback;
267 * configuration template - to be copied to the spec instance
269 struct alc_config_preset {
270 struct snd_kcontrol_new *mixers[5]; /* should be identical size
273 const struct hda_verb *init_verbs[5];
274 unsigned int num_dacs;
276 hda_nid_t dig_out_nid; /* optional */
277 hda_nid_t hp_nid; /* optional */
278 unsigned int num_adc_nids;
280 hda_nid_t dig_in_nid;
281 unsigned int num_channel_mode;
282 const struct hda_channel_mode *channel_mode;
284 unsigned int num_mux_defs;
285 const struct hda_input_mux *input_mux;
286 void (*unsol_event)(struct hda_codec *, unsigned int);
287 void (*init_hook)(struct hda_codec *);
288 #ifdef CONFIG_SND_HDA_POWER_SAVE
289 struct hda_amp_list *loopbacks;
297 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
298 struct snd_ctl_elem_info *uinfo)
300 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
301 struct alc_spec *spec = codec->spec;
302 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
303 if (mux_idx >= spec->num_mux_defs)
305 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
308 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
309 struct snd_ctl_elem_value *ucontrol)
311 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
312 struct alc_spec *spec = codec->spec;
313 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
315 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
319 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
320 struct snd_ctl_elem_value *ucontrol)
322 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
323 struct alc_spec *spec = codec->spec;
324 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
325 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
326 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
327 spec->adc_nids[adc_idx],
328 &spec->cur_mux[adc_idx]);
333 * channel mode setting
335 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
336 struct snd_ctl_elem_info *uinfo)
338 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
339 struct alc_spec *spec = codec->spec;
340 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
341 spec->num_channel_mode);
344 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
345 struct snd_ctl_elem_value *ucontrol)
347 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
348 struct alc_spec *spec = codec->spec;
349 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
350 spec->num_channel_mode,
351 spec->multiout.max_channels);
354 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
355 struct snd_ctl_elem_value *ucontrol)
357 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
358 struct alc_spec *spec = codec->spec;
359 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
360 spec->num_channel_mode,
361 &spec->multiout.max_channels);
362 if (err >= 0 && spec->need_dac_fix)
363 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
368 * Control the mode of pin widget settings via the mixer. "pc" is used
369 * instead of "%" to avoid consequences of accidently treating the % as
370 * being part of a format specifier. Maximum allowed length of a value is
371 * 63 characters plus NULL terminator.
373 * Note: some retasking pin complexes seem to ignore requests for input
374 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
375 * are requested. Therefore order this list so that this behaviour will not
376 * cause problems when mixer clients move through the enum sequentially.
377 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
380 static char *alc_pin_mode_names[] = {
381 "Mic 50pc bias", "Mic 80pc bias",
382 "Line in", "Line out", "Headphone out",
384 static unsigned char alc_pin_mode_values[] = {
385 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
387 /* The control can present all 5 options, or it can limit the options based
388 * in the pin being assumed to be exclusively an input or an output pin. In
389 * addition, "input" pins may or may not process the mic bias option
390 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
391 * accept requests for bias as of chip versions up to March 2006) and/or
392 * wiring in the computer.
394 #define ALC_PIN_DIR_IN 0x00
395 #define ALC_PIN_DIR_OUT 0x01
396 #define ALC_PIN_DIR_INOUT 0x02
397 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
398 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
400 /* Info about the pin modes supported by the different pin direction modes.
401 * For each direction the minimum and maximum values are given.
403 static signed char alc_pin_mode_dir_info[5][2] = {
404 { 0, 2 }, /* ALC_PIN_DIR_IN */
405 { 3, 4 }, /* ALC_PIN_DIR_OUT */
406 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
407 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
408 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
410 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
411 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
412 #define alc_pin_mode_n_items(_dir) \
413 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
415 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
416 struct snd_ctl_elem_info *uinfo)
418 unsigned int item_num = uinfo->value.enumerated.item;
419 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
421 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
423 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
425 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
426 item_num = alc_pin_mode_min(dir);
427 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
431 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
432 struct snd_ctl_elem_value *ucontrol)
435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
436 hda_nid_t nid = kcontrol->private_value & 0xffff;
437 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
438 long *valp = ucontrol->value.integer.value;
439 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
440 AC_VERB_GET_PIN_WIDGET_CONTROL,
443 /* Find enumerated value for current pinctl setting */
444 i = alc_pin_mode_min(dir);
445 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
447 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
451 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
452 struct snd_ctl_elem_value *ucontrol)
455 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
456 hda_nid_t nid = kcontrol->private_value & 0xffff;
457 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
458 long val = *ucontrol->value.integer.value;
459 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
460 AC_VERB_GET_PIN_WIDGET_CONTROL,
463 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
464 val = alc_pin_mode_min(dir);
466 change = pinctl != alc_pin_mode_values[val];
468 /* Set pin mode to that requested */
469 snd_hda_codec_write_cache(codec, nid, 0,
470 AC_VERB_SET_PIN_WIDGET_CONTROL,
471 alc_pin_mode_values[val]);
473 /* Also enable the retasking pin's input/output as required
474 * for the requested pin mode. Enum values of 2 or less are
477 * Dynamically switching the input/output buffers probably
478 * reduces noise slightly (particularly on input) so we'll
479 * do it. However, having both input and output buffers
480 * enabled simultaneously doesn't seem to be problematic if
481 * this turns out to be necessary in the future.
484 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
485 HDA_AMP_MUTE, HDA_AMP_MUTE);
486 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
489 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
490 HDA_AMP_MUTE, HDA_AMP_MUTE);
491 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
498 #define ALC_PIN_MODE(xname, nid, dir) \
499 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
500 .info = alc_pin_mode_info, \
501 .get = alc_pin_mode_get, \
502 .put = alc_pin_mode_put, \
503 .private_value = nid | (dir<<16) }
505 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
506 * together using a mask with more than one bit set. This control is
507 * currently used only by the ALC260 test model. At this stage they are not
508 * needed for any "production" models.
510 #ifdef CONFIG_SND_DEBUG
511 #define alc_gpio_data_info snd_ctl_boolean_mono_info
513 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
514 struct snd_ctl_elem_value *ucontrol)
516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
517 hda_nid_t nid = kcontrol->private_value & 0xffff;
518 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
519 long *valp = ucontrol->value.integer.value;
520 unsigned int val = snd_hda_codec_read(codec, nid, 0,
521 AC_VERB_GET_GPIO_DATA, 0x00);
523 *valp = (val & mask) != 0;
526 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
527 struct snd_ctl_elem_value *ucontrol)
530 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
531 hda_nid_t nid = kcontrol->private_value & 0xffff;
532 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
533 long val = *ucontrol->value.integer.value;
534 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
535 AC_VERB_GET_GPIO_DATA,
538 /* Set/unset the masked GPIO bit(s) as needed */
539 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
544 snd_hda_codec_write_cache(codec, nid, 0,
545 AC_VERB_SET_GPIO_DATA, gpio_data);
549 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
550 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
551 .info = alc_gpio_data_info, \
552 .get = alc_gpio_data_get, \
553 .put = alc_gpio_data_put, \
554 .private_value = nid | (mask<<16) }
555 #endif /* CONFIG_SND_DEBUG */
557 /* A switch control to allow the enabling of the digital IO pins on the
558 * ALC260. This is incredibly simplistic; the intention of this control is
559 * to provide something in the test model allowing digital outputs to be
560 * identified if present. If models are found which can utilise these
561 * outputs a more complete mixer control can be devised for those models if
564 #ifdef CONFIG_SND_DEBUG
565 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
567 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
570 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
571 hda_nid_t nid = kcontrol->private_value & 0xffff;
572 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
573 long *valp = ucontrol->value.integer.value;
574 unsigned int val = snd_hda_codec_read(codec, nid, 0,
575 AC_VERB_GET_DIGI_CONVERT, 0x00);
577 *valp = (val & mask) != 0;
580 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
581 struct snd_ctl_elem_value *ucontrol)
584 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
585 hda_nid_t nid = kcontrol->private_value & 0xffff;
586 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
587 long val = *ucontrol->value.integer.value;
588 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
589 AC_VERB_GET_DIGI_CONVERT,
592 /* Set/unset the masked control bit(s) as needed */
593 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
598 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
603 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
604 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
605 .info = alc_spdif_ctrl_info, \
606 .get = alc_spdif_ctrl_get, \
607 .put = alc_spdif_ctrl_put, \
608 .private_value = nid | (mask<<16) }
609 #endif /* CONFIG_SND_DEBUG */
612 * set up from the preset table
614 static void setup_preset(struct alc_spec *spec,
615 const struct alc_config_preset *preset)
619 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
620 spec->mixers[spec->num_mixers++] = preset->mixers[i];
621 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
623 spec->init_verbs[spec->num_init_verbs++] =
624 preset->init_verbs[i];
626 spec->channel_mode = preset->channel_mode;
627 spec->num_channel_mode = preset->num_channel_mode;
628 spec->need_dac_fix = preset->need_dac_fix;
630 spec->multiout.max_channels = spec->channel_mode[0].channels;
632 spec->multiout.num_dacs = preset->num_dacs;
633 spec->multiout.dac_nids = preset->dac_nids;
634 spec->multiout.dig_out_nid = preset->dig_out_nid;
635 spec->multiout.hp_nid = preset->hp_nid;
637 spec->num_mux_defs = preset->num_mux_defs;
638 if (!spec->num_mux_defs)
639 spec->num_mux_defs = 1;
640 spec->input_mux = preset->input_mux;
642 spec->num_adc_nids = preset->num_adc_nids;
643 spec->adc_nids = preset->adc_nids;
644 spec->dig_in_nid = preset->dig_in_nid;
646 spec->unsol_event = preset->unsol_event;
647 spec->init_hook = preset->init_hook;
648 #ifdef CONFIG_SND_HDA_POWER_SAVE
649 spec->loopback.amplist = preset->loopbacks;
653 /* Enable GPIO mask and set output */
654 static struct hda_verb alc_gpio1_init_verbs[] = {
655 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
656 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
657 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
661 static struct hda_verb alc_gpio2_init_verbs[] = {
662 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
663 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
664 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
668 static struct hda_verb alc_gpio3_init_verbs[] = {
669 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
670 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
671 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
675 static void alc_sku_automute(struct hda_codec *codec)
677 struct alc_spec *spec = codec->spec;
679 unsigned int present;
680 unsigned int hp_nid = spec->autocfg.hp_pins[0];
681 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
683 /* need to execute and sync at first */
684 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
685 present = snd_hda_codec_read(codec, hp_nid, 0,
686 AC_VERB_GET_PIN_SENSE, 0);
687 spec->jack_present = (present & 0x80000000) != 0;
688 if (spec->jack_present) {
689 /* mute internal speaker */
690 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
691 HDA_AMP_MUTE, HDA_AMP_MUTE);
693 /* unmute internal speaker if necessary */
694 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
695 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
700 /* unsolicited event for HP jack sensing */
701 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
703 if (codec->vendor_id == 0x10ec0880)
707 if (res != ALC880_HP_EVENT)
710 alc_sku_automute(codec);
713 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
714 * 31 ~ 16 : Manufacture ID
716 * 7 ~ 0 : Assembly ID
717 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
719 static void alc_subsystem_id(struct hda_codec *codec,
720 unsigned int porta, unsigned int porte,
723 unsigned int ass, tmp, i;
725 struct alc_spec *spec = codec->spec;
727 ass = codec->subsystem_id & 0xffff;
728 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
732 * 31~30 : port conetcivity
735 * 19~16 : Check sum (15:1)
740 if (codec->vendor_id == 0x10ec0260)
742 ass = snd_hda_codec_read(codec, nid, 0,
743 AC_VERB_GET_CONFIG_DEFAULT, 0);
744 if (!(ass & 1) && !(ass & 0x100000))
746 if ((ass >> 30) != 1) /* no physical connection */
751 for (i = 1; i < 16; i++) {
755 if (((ass >> 16) & 0xf) != tmp)
761 * 2 : 0 --> Desktop, 1 --> Laptop
762 * 3~5 : External Amplifier control
765 tmp = (ass & 0x38) >> 3; /* external Amp control */
768 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
771 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
774 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
776 case 5: /* set EAPD output high */
777 switch (codec->vendor_id) {
779 snd_hda_codec_write(codec, 0x0f, 0,
780 AC_VERB_SET_EAPD_BTLENABLE, 2);
781 snd_hda_codec_write(codec, 0x10, 0,
782 AC_VERB_SET_EAPD_BTLENABLE, 2);
790 snd_hda_codec_write(codec, 0x14, 0,
791 AC_VERB_SET_EAPD_BTLENABLE, 2);
792 snd_hda_codec_write(codec, 0x15, 0,
793 AC_VERB_SET_EAPD_BTLENABLE, 2);
796 switch (codec->vendor_id) {
798 snd_hda_codec_write(codec, 0x1a, 0,
799 AC_VERB_SET_COEF_INDEX, 7);
800 tmp = snd_hda_codec_read(codec, 0x1a, 0,
801 AC_VERB_GET_PROC_COEF, 0);
802 snd_hda_codec_write(codec, 0x1a, 0,
803 AC_VERB_SET_COEF_INDEX, 7);
804 snd_hda_codec_write(codec, 0x1a, 0,
805 AC_VERB_SET_PROC_COEF,
814 snd_hda_codec_write(codec, 0x20, 0,
815 AC_VERB_SET_COEF_INDEX, 7);
816 tmp = snd_hda_codec_read(codec, 0x20, 0,
817 AC_VERB_GET_PROC_COEF, 0);
818 snd_hda_codec_write(codec, 0x20, 0,
819 AC_VERB_SET_COEF_INDEX, 7);
820 snd_hda_codec_write(codec, 0x20, 0,
821 AC_VERB_SET_PROC_COEF,
826 snd_hda_codec_write(codec, 0x20, 0,
827 AC_VERB_SET_COEF_INDEX, 7);
828 tmp = snd_hda_codec_read(codec, 0x20, 0,
829 AC_VERB_GET_PROC_COEF, 0);
830 snd_hda_codec_write(codec, 0x20, 0,
831 AC_VERB_SET_COEF_INDEX, 7);
832 snd_hda_codec_write(codec, 0x20, 0,
833 AC_VERB_SET_PROC_COEF,
841 /* is laptop and enable the function "Mute internal speaker
842 * when the external headphone out jack is plugged"
844 if (!(ass & 0x4) || !(ass & 0x8000))
847 * 10~8 : Jack location
848 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
850 * 15 : 1 --> enable the function "Mute internal speaker
851 * when the external headphone out jack is plugged"
853 if (!spec->autocfg.speaker_pins[0]) {
854 if (spec->multiout.dac_nids[0])
855 spec->autocfg.speaker_pins[0] =
856 spec->multiout.dac_nids[0];
861 if (!spec->autocfg.hp_pins[0]) {
862 tmp = (ass >> 11) & 0x3; /* HP to chassis */
864 spec->autocfg.hp_pins[0] = porta;
866 spec->autocfg.hp_pins[0] = porte;
868 spec->autocfg.hp_pins[0] = portd;
873 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
874 AC_VERB_SET_UNSOLICITED_ENABLE,
875 AC_USRSP_EN | ALC880_HP_EVENT);
876 spec->unsol_event = alc_sku_unsol_event;
877 spec->init_hook = alc_sku_automute;
881 * Fix-up pin default configurations
889 static void alc_fix_pincfg(struct hda_codec *codec,
890 const struct snd_pci_quirk *quirk,
891 const struct alc_pincfg **pinfix)
893 const struct alc_pincfg *cfg;
895 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
899 cfg = pinfix[quirk->value];
900 for (; cfg->nid; cfg++) {
903 for (i = 0; i < 4; i++) {
904 snd_hda_codec_write(codec, cfg->nid, 0,
905 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
913 * ALC880 3-stack model
915 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
916 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
917 * F-Mic = 0x1b, HP = 0x19
920 static hda_nid_t alc880_dac_nids[4] = {
921 /* front, rear, clfe, rear_surr */
922 0x02, 0x05, 0x04, 0x03
925 static hda_nid_t alc880_adc_nids[3] = {
930 /* The datasheet says the node 0x07 is connected from inputs,
931 * but it shows zero connection in the real implementation on some devices.
932 * Note: this is a 915GAV bug, fixed on 915GLV
934 static hda_nid_t alc880_adc_nids_alt[2] = {
939 #define ALC880_DIGOUT_NID 0x06
940 #define ALC880_DIGIN_NID 0x0a
942 static struct hda_input_mux alc880_capture_source = {
946 { "Front Mic", 0x3 },
952 /* channel source setting (2/6 channel selection for 3-stack) */
954 static struct hda_verb alc880_threestack_ch2_init[] = {
955 /* set line-in to input, mute it */
956 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
957 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
958 /* set mic-in to input vref 80%, mute it */
959 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
960 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
965 static struct hda_verb alc880_threestack_ch6_init[] = {
966 /* set line-in to output, unmute it */
967 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
968 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
969 /* set mic-in to output, unmute it */
970 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
971 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
975 static struct hda_channel_mode alc880_threestack_modes[2] = {
976 { 2, alc880_threestack_ch2_init },
977 { 6, alc880_threestack_ch6_init },
980 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
983 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
984 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
985 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
986 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
987 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
988 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
989 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
990 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
997 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
998 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1002 .name = "Channel Mode",
1003 .info = alc_ch_mode_info,
1004 .get = alc_ch_mode_get,
1005 .put = alc_ch_mode_put,
1010 /* capture mixer elements */
1011 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1012 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1013 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1014 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1015 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1016 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1017 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1020 /* The multiple "Capture Source" controls confuse alsamixer
1021 * So call somewhat different..
1022 * FIXME: the controls appear in the "playback" view!
1024 /* .name = "Capture Source", */
1025 .name = "Input Source",
1027 .info = alc_mux_enum_info,
1028 .get = alc_mux_enum_get,
1029 .put = alc_mux_enum_put,
1034 /* capture mixer elements (in case NID 0x07 not available) */
1035 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1036 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1037 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1038 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1039 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1042 /* The multiple "Capture Source" controls confuse alsamixer
1043 * So call somewhat different..
1044 * FIXME: the controls appear in the "playback" view!
1046 /* .name = "Capture Source", */
1047 .name = "Input Source",
1049 .info = alc_mux_enum_info,
1050 .get = alc_mux_enum_get,
1051 .put = alc_mux_enum_put,
1059 * ALC880 5-stack model
1061 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1063 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1064 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1067 /* additional mixers to alc880_three_stack_mixer */
1068 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1069 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1070 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1074 /* channel source setting (6/8 channel selection for 5-stack) */
1076 static struct hda_verb alc880_fivestack_ch6_init[] = {
1077 /* set line-in to input, mute it */
1078 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1079 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1084 static struct hda_verb alc880_fivestack_ch8_init[] = {
1085 /* set line-in to output, unmute it */
1086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1091 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1092 { 6, alc880_fivestack_ch6_init },
1093 { 8, alc880_fivestack_ch8_init },
1098 * ALC880 6-stack model
1100 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1101 * Side = 0x05 (0x0f)
1102 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1103 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1106 static hda_nid_t alc880_6st_dac_nids[4] = {
1107 /* front, rear, clfe, rear_surr */
1108 0x02, 0x03, 0x04, 0x05
1111 static struct hda_input_mux alc880_6stack_capture_source = {
1115 { "Front Mic", 0x1 },
1121 /* fixed 8-channels */
1122 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1126 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1129 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1130 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1131 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1133 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1134 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1135 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1136 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1137 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1138 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1145 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1146 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1148 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1149 .name = "Channel Mode",
1150 .info = alc_ch_mode_info,
1151 .get = alc_ch_mode_get,
1152 .put = alc_ch_mode_put,
1161 * W810 has rear IO for:
1164 * Center/LFE (DAC 04)
1167 * The system also has a pair of internal speakers, and a headphone jack.
1168 * These are both connected to Line2 on the codec, hence to DAC 02.
1170 * There is a variable resistor to control the speaker or headphone
1171 * volume. This is a hardware-only device without a software API.
1173 * Plugging headphones in will disable the internal speakers. This is
1174 * implemented in hardware, not via the driver using jack sense. In
1175 * a similar fashion, plugging into the rear socket marked "front" will
1176 * disable both the speakers and headphones.
1178 * For input, there's a microphone jack, and an "audio in" jack.
1179 * These may not do anything useful with this driver yet, because I
1180 * haven't setup any initialization verbs for these yet...
1183 static hda_nid_t alc880_w810_dac_nids[3] = {
1184 /* front, rear/surround, clfe */
1188 /* fixed 6 channels */
1189 static struct hda_channel_mode alc880_w810_modes[1] = {
1193 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1194 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1195 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1196 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1197 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1198 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1199 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1200 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1201 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1202 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1211 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1212 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1216 static hda_nid_t alc880_z71v_dac_nids[1] = {
1219 #define ALC880_Z71V_HP_DAC 0x03
1221 /* fixed 2 channels */
1222 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1226 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1230 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1241 * ALC880 F1734 model
1243 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1244 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1247 static hda_nid_t alc880_f1734_dac_nids[1] = {
1250 #define ALC880_F1734_HP_DAC 0x02
1252 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1254 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1255 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1256 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1269 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1270 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1271 * Mic = 0x18, Line = 0x1a
1274 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1275 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1277 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1279 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1280 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1281 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1282 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1283 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1284 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1285 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1286 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1287 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1293 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1294 .name = "Channel Mode",
1295 .info = alc_ch_mode_info,
1296 .get = alc_ch_mode_get,
1297 .put = alc_ch_mode_put,
1304 * ALC880 ASUS W1V model
1306 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1307 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1308 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1311 /* additional mixers to alc880_asus_mixer */
1312 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1313 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1314 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1318 /* additional mixers to alc880_asus_mixer */
1319 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1320 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1321 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1326 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1327 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1328 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1330 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1331 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1332 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1333 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1334 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1335 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1337 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1338 /* The multiple "Capture Source" controls confuse alsamixer
1339 * So call somewhat different..
1340 * FIXME: the controls appear in the "playback" view!
1342 /* .name = "Capture Source", */
1343 .name = "Input Source",
1345 .info = alc_mux_enum_info,
1346 .get = alc_mux_enum_get,
1347 .put = alc_mux_enum_put,
1353 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1354 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1355 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1356 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1357 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1358 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1359 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1360 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1361 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1364 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1365 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1368 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1369 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1370 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1371 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1374 .name = "Channel Mode",
1375 .info = alc_ch_mode_info,
1376 .get = alc_ch_mode_get,
1377 .put = alc_ch_mode_put,
1382 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1389 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1390 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1391 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1392 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1396 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1397 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1398 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1399 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1400 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1407 * build control elements
1409 static int alc_build_controls(struct hda_codec *codec)
1411 struct alc_spec *spec = codec->spec;
1415 for (i = 0; i < spec->num_mixers; i++) {
1416 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1421 if (spec->multiout.dig_out_nid) {
1422 err = snd_hda_create_spdif_out_ctls(codec,
1423 spec->multiout.dig_out_nid);
1427 if (spec->dig_in_nid) {
1428 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1437 * initialize the codec volumes, etc
1441 * generic initialization of ADC, input mixers and output mixers
1443 static struct hda_verb alc880_volume_init_verbs[] = {
1445 * Unmute ADC0-2 and set the default input to mic-in
1447 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1448 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1449 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1451 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1454 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1456 * Note: PASD motherboards uses the Line In 2 as the input for front
1459 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1469 * Set up output mixers (0x0c - 0x0f)
1471 /* set vol=0 to output mixers */
1472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1476 /* set up input amps for analog loopback */
1477 /* Amp Indices: DAC = 0, mixer = 1 */
1478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1479 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1483 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1491 * 3-stack pin configuration:
1492 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1494 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1496 * preset connection lists of input pins
1497 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1499 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1500 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1501 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1504 * Set pin mode and muting
1506 /* set front pin widgets 0x14 for output */
1507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1511 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1512 /* Mic2 (as headphone out) for HP output */
1513 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1514 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1515 /* Line In pin widget for input */
1516 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1517 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1518 /* Line2 (as front mic) pin widget for input and vref at 80% */
1519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1521 /* CD pin widget for input */
1522 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1528 * 5-stack pin configuration:
1529 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1530 * line-in/side = 0x1a, f-mic = 0x1b
1532 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1534 * preset connection lists of input pins
1535 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1537 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1538 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1541 * Set pin mode and muting
1543 /* set pin widgets 0x14-0x17 for output */
1544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1547 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1548 /* unmute pins for output (no gain on this amp) */
1549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1550 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1551 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1552 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1554 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1557 /* Mic2 (as headphone out) for HP output */
1558 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1559 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1560 /* Line In pin widget for input */
1561 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1562 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1563 /* Line2 (as front mic) pin widget for input and vref at 80% */
1564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1565 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1566 /* CD pin widget for input */
1567 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1573 * W810 pin configuration:
1574 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1576 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1577 /* hphone/speaker input selector: front DAC */
1578 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1581 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1585 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1588 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1594 * Z71V pin configuration:
1595 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1597 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1598 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1599 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1604 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1605 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1612 * 6-stack pin configuration:
1613 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1614 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1616 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1617 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1620 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1623 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1625 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1630 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1631 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1633 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1635 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1636 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1642 * Uniwill pin configuration:
1643 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1646 static struct hda_verb alc880_uniwill_init_verbs[] = {
1647 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1650 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1656 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1667 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1670 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1671 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1672 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1674 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1675 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1682 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1684 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1685 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1691 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1692 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1696 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1697 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1700 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1701 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1702 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1704 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1707 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1708 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1713 static struct hda_verb alc880_beep_init_verbs[] = {
1714 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1718 /* toggle speaker-output according to the hp-jack state */
1719 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1721 unsigned int present;
1724 present = snd_hda_codec_read(codec, 0x14, 0,
1725 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1726 bits = present ? HDA_AMP_MUTE : 0;
1727 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1728 HDA_AMP_MUTE, bits);
1729 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1730 HDA_AMP_MUTE, bits);
1733 /* auto-toggle front mic */
1734 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1736 unsigned int present;
1739 present = snd_hda_codec_read(codec, 0x18, 0,
1740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1741 bits = present ? HDA_AMP_MUTE : 0;
1742 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1745 static void alc880_uniwill_automute(struct hda_codec *codec)
1747 alc880_uniwill_hp_automute(codec);
1748 alc880_uniwill_mic_automute(codec);
1751 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1754 /* Looks like the unsol event is incompatible with the standard
1755 * definition. 4bit tag is placed at 28 bit!
1757 switch (res >> 28) {
1758 case ALC880_HP_EVENT:
1759 alc880_uniwill_hp_automute(codec);
1761 case ALC880_MIC_EVENT:
1762 alc880_uniwill_mic_automute(codec);
1767 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1769 unsigned int present;
1772 present = snd_hda_codec_read(codec, 0x14, 0,
1773 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1774 bits = present ? HDA_AMP_MUTE : 0;
1775 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1778 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1780 unsigned int present;
1782 present = snd_hda_codec_read(codec, 0x21, 0,
1783 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1784 present &= HDA_AMP_VOLMASK;
1785 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1786 HDA_AMP_VOLMASK, present);
1787 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1788 HDA_AMP_VOLMASK, present);
1791 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1794 /* Looks like the unsol event is incompatible with the standard
1795 * definition. 4bit tag is placed at 28 bit!
1797 if ((res >> 28) == ALC880_HP_EVENT)
1798 alc880_uniwill_p53_hp_automute(codec);
1799 if ((res >> 28) == ALC880_DCVOL_EVENT)
1800 alc880_uniwill_p53_dcvol_automute(codec);
1805 * F1734 pin configuration:
1806 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1808 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1809 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1810 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1811 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1812 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1815 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1817 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1834 * ASUS pin configuration:
1835 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1837 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1838 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1839 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1840 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1841 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1843 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1844 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1845 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1849 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1853 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1854 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1855 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1858 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1859 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1865 /* Enable GPIO mask and set output */
1866 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1867 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1869 /* Clevo m520g init */
1870 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1871 /* headphone output */
1872 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1877 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1878 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1880 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1881 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1882 /* Mic1 (rear panel) */
1883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1885 /* Mic2 (front panel) */
1886 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1889 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1891 /* change to EAPD mode */
1892 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1893 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1898 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1899 /* change to EAPD mode */
1900 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1901 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1903 /* Headphone output */
1904 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1907 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1909 /* Line In pin widget for input */
1910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1911 /* CD pin widget for input */
1912 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1913 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1914 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1916 /* change to EAPD mode */
1917 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1918 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1924 * LG m1 express dual
1927 * Rear Line-In/Out (blue): 0x14
1928 * Build-in Mic-In: 0x15
1930 * HP-Out (green): 0x1b
1931 * Mic-In/Out (red): 0x19
1935 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1936 static hda_nid_t alc880_lg_dac_nids[3] = {
1940 /* seems analog CD is not working */
1941 static struct hda_input_mux alc880_lg_capture_source = {
1946 { "Internal Mic", 0x6 },
1950 /* 2,4,6 channel modes */
1951 static struct hda_verb alc880_lg_ch2_init[] = {
1952 /* set line-in and mic-in to input */
1953 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1954 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1958 static struct hda_verb alc880_lg_ch4_init[] = {
1959 /* set line-in to out and mic-in to input */
1960 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1961 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1965 static struct hda_verb alc880_lg_ch6_init[] = {
1966 /* set line-in and mic-in to output */
1967 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1968 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1972 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
1973 { 2, alc880_lg_ch2_init },
1974 { 4, alc880_lg_ch4_init },
1975 { 6, alc880_lg_ch6_init },
1978 static struct snd_kcontrol_new alc880_lg_mixer[] = {
1979 /* FIXME: it's not really "master" but front channels */
1980 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1981 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
1982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1983 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
1984 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
1985 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
1986 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
1987 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
1988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
1991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
1992 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
1993 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1996 .name = "Channel Mode",
1997 .info = alc_ch_mode_info,
1998 .get = alc_ch_mode_get,
1999 .put = alc_ch_mode_put,
2004 static struct hda_verb alc880_lg_init_verbs[] = {
2005 /* set capture source to mic-in */
2006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2008 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2009 /* mute all amp mixer inputs */
2010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2013 /* line-in to input */
2014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2020 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2021 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2022 /* mic-in to input */
2023 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2025 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2027 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2031 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2035 /* toggle speaker-output according to the hp-jack state */
2036 static void alc880_lg_automute(struct hda_codec *codec)
2038 unsigned int present;
2041 present = snd_hda_codec_read(codec, 0x1b, 0,
2042 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2043 bits = present ? HDA_AMP_MUTE : 0;
2044 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2045 HDA_AMP_MUTE, bits);
2048 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2050 /* Looks like the unsol event is incompatible with the standard
2051 * definition. 4bit tag is placed at 28 bit!
2053 if ((res >> 28) == 0x01)
2054 alc880_lg_automute(codec);
2063 * Built-in Mic-In: 0x19
2069 static struct hda_input_mux alc880_lg_lw_capture_source = {
2073 { "Internal Mic", 0x1 },
2078 #define alc880_lg_lw_modes alc880_threestack_modes
2080 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2081 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2082 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2083 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2084 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2085 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2086 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2087 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2088 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2089 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2090 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2093 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2094 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2097 .name = "Channel Mode",
2098 .info = alc_ch_mode_info,
2099 .get = alc_ch_mode_get,
2100 .put = alc_ch_mode_put,
2105 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2106 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2107 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2108 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2110 /* set capture source to mic-in */
2111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2113 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2116 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2117 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2120 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2121 /* mic-in to input */
2122 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2123 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2132 /* toggle speaker-output according to the hp-jack state */
2133 static void alc880_lg_lw_automute(struct hda_codec *codec)
2135 unsigned int present;
2138 present = snd_hda_codec_read(codec, 0x1b, 0,
2139 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2140 bits = present ? HDA_AMP_MUTE : 0;
2141 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2142 HDA_AMP_MUTE, bits);
2145 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2147 /* Looks like the unsol event is incompatible with the standard
2148 * definition. 4bit tag is placed at 28 bit!
2150 if ((res >> 28) == 0x01)
2151 alc880_lg_lw_automute(codec);
2154 #ifdef CONFIG_SND_HDA_POWER_SAVE
2155 static struct hda_amp_list alc880_loopbacks[] = {
2156 { 0x0b, HDA_INPUT, 0 },
2157 { 0x0b, HDA_INPUT, 1 },
2158 { 0x0b, HDA_INPUT, 2 },
2159 { 0x0b, HDA_INPUT, 3 },
2160 { 0x0b, HDA_INPUT, 4 },
2164 static struct hda_amp_list alc880_lg_loopbacks[] = {
2165 { 0x0b, HDA_INPUT, 1 },
2166 { 0x0b, HDA_INPUT, 6 },
2167 { 0x0b, HDA_INPUT, 7 },
2176 static int alc_init(struct hda_codec *codec)
2178 struct alc_spec *spec = codec->spec;
2181 for (i = 0; i < spec->num_init_verbs; i++)
2182 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2184 if (spec->init_hook)
2185 spec->init_hook(codec);
2190 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2192 struct alc_spec *spec = codec->spec;
2194 if (spec->unsol_event)
2195 spec->unsol_event(codec, res);
2198 #ifdef CONFIG_SND_HDA_POWER_SAVE
2199 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2201 struct alc_spec *spec = codec->spec;
2202 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2207 * Analog playback callbacks
2209 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2210 struct hda_codec *codec,
2211 struct snd_pcm_substream *substream)
2213 struct alc_spec *spec = codec->spec;
2214 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2217 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2218 struct hda_codec *codec,
2219 unsigned int stream_tag,
2220 unsigned int format,
2221 struct snd_pcm_substream *substream)
2223 struct alc_spec *spec = codec->spec;
2224 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2225 stream_tag, format, substream);
2228 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2229 struct hda_codec *codec,
2230 struct snd_pcm_substream *substream)
2232 struct alc_spec *spec = codec->spec;
2233 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2239 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2240 struct hda_codec *codec,
2241 struct snd_pcm_substream *substream)
2243 struct alc_spec *spec = codec->spec;
2244 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2247 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2248 struct hda_codec *codec,
2249 unsigned int stream_tag,
2250 unsigned int format,
2251 struct snd_pcm_substream *substream)
2253 struct alc_spec *spec = codec->spec;
2254 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2255 stream_tag, format, substream);
2258 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2259 struct hda_codec *codec,
2260 struct snd_pcm_substream *substream)
2262 struct alc_spec *spec = codec->spec;
2263 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2269 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2270 struct hda_codec *codec,
2271 unsigned int stream_tag,
2272 unsigned int format,
2273 struct snd_pcm_substream *substream)
2275 struct alc_spec *spec = codec->spec;
2277 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2278 stream_tag, 0, format);
2282 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2283 struct hda_codec *codec,
2284 struct snd_pcm_substream *substream)
2286 struct alc_spec *spec = codec->spec;
2288 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2296 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2300 /* NID is set in alc_build_pcms */
2302 .open = alc880_playback_pcm_open,
2303 .prepare = alc880_playback_pcm_prepare,
2304 .cleanup = alc880_playback_pcm_cleanup
2308 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2312 /* NID is set in alc_build_pcms */
2314 .prepare = alc880_capture_pcm_prepare,
2315 .cleanup = alc880_capture_pcm_cleanup
2319 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2323 /* NID is set in alc_build_pcms */
2325 .open = alc880_dig_playback_pcm_open,
2326 .close = alc880_dig_playback_pcm_close,
2327 .prepare = alc880_dig_playback_pcm_prepare
2331 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2335 /* NID is set in alc_build_pcms */
2338 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2339 static struct hda_pcm_stream alc_pcm_null_playback = {
2345 static int alc_build_pcms(struct hda_codec *codec)
2347 struct alc_spec *spec = codec->spec;
2348 struct hda_pcm *info = spec->pcm_rec;
2351 codec->num_pcms = 1;
2352 codec->pcm_info = info;
2354 info->name = spec->stream_name_analog;
2355 if (spec->stream_analog_playback) {
2356 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2357 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2358 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2360 if (spec->stream_analog_capture) {
2361 snd_assert(spec->adc_nids, return -EINVAL);
2362 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2363 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2366 if (spec->channel_mode) {
2367 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2368 for (i = 0; i < spec->num_channel_mode; i++) {
2369 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2370 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2375 /* SPDIF for stream index #1 */
2376 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2377 codec->num_pcms = 2;
2378 info = spec->pcm_rec + 1;
2379 info->name = spec->stream_name_digital;
2380 if (spec->multiout.dig_out_nid &&
2381 spec->stream_digital_playback) {
2382 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2383 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2385 if (spec->dig_in_nid &&
2386 spec->stream_digital_capture) {
2387 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2388 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2392 /* If the use of more than one ADC is requested for the current
2393 * model, configure a second analog capture-only PCM.
2395 /* Additional Analaog capture for index #2 */
2396 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2398 codec->num_pcms = 3;
2399 info = spec->pcm_rec + 2;
2400 info->name = spec->stream_name_analog;
2401 /* No playback stream for second PCM */
2402 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2403 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2404 if (spec->stream_analog_capture) {
2405 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2406 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2413 static void alc_free(struct hda_codec *codec)
2415 struct alc_spec *spec = codec->spec;
2421 if (spec->kctl_alloc) {
2422 for (i = 0; i < spec->num_kctl_used; i++)
2423 kfree(spec->kctl_alloc[i].name);
2424 kfree(spec->kctl_alloc);
2431 static struct hda_codec_ops alc_patch_ops = {
2432 .build_controls = alc_build_controls,
2433 .build_pcms = alc_build_pcms,
2436 .unsol_event = alc_unsol_event,
2437 #ifdef CONFIG_SND_HDA_POWER_SAVE
2438 .check_power_status = alc_check_power_status,
2444 * Test configuration for debugging
2446 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2449 #ifdef CONFIG_SND_DEBUG
2450 static hda_nid_t alc880_test_dac_nids[4] = {
2451 0x02, 0x03, 0x04, 0x05
2454 static struct hda_input_mux alc880_test_capture_source = {
2463 { "Surround", 0x6 },
2467 static struct hda_channel_mode alc880_test_modes[4] = {
2474 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2475 struct snd_ctl_elem_info *uinfo)
2477 static char *texts[] = {
2478 "N/A", "Line Out", "HP Out",
2479 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2481 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2483 uinfo->value.enumerated.items = 8;
2484 if (uinfo->value.enumerated.item >= 8)
2485 uinfo->value.enumerated.item = 7;
2486 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2490 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2491 struct snd_ctl_elem_value *ucontrol)
2493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2494 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2495 unsigned int pin_ctl, item = 0;
2497 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2498 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2499 if (pin_ctl & AC_PINCTL_OUT_EN) {
2500 if (pin_ctl & AC_PINCTL_HP_EN)
2504 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2505 switch (pin_ctl & AC_PINCTL_VREFEN) {
2506 case AC_PINCTL_VREF_HIZ: item = 3; break;
2507 case AC_PINCTL_VREF_50: item = 4; break;
2508 case AC_PINCTL_VREF_GRD: item = 5; break;
2509 case AC_PINCTL_VREF_80: item = 6; break;
2510 case AC_PINCTL_VREF_100: item = 7; break;
2513 ucontrol->value.enumerated.item[0] = item;
2517 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2518 struct snd_ctl_elem_value *ucontrol)
2520 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2521 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2522 static unsigned int ctls[] = {
2523 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2524 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2525 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2526 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2527 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2528 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2530 unsigned int old_ctl, new_ctl;
2532 old_ctl = snd_hda_codec_read(codec, nid, 0,
2533 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2534 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2535 if (old_ctl != new_ctl) {
2537 snd_hda_codec_write_cache(codec, nid, 0,
2538 AC_VERB_SET_PIN_WIDGET_CONTROL,
2540 val = ucontrol->value.enumerated.item[0] >= 3 ?
2542 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2549 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2550 struct snd_ctl_elem_info *uinfo)
2552 static char *texts[] = {
2553 "Front", "Surround", "CLFE", "Side"
2555 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2557 uinfo->value.enumerated.items = 4;
2558 if (uinfo->value.enumerated.item >= 4)
2559 uinfo->value.enumerated.item = 3;
2560 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2564 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2565 struct snd_ctl_elem_value *ucontrol)
2567 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2568 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2571 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2572 ucontrol->value.enumerated.item[0] = sel & 3;
2576 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2577 struct snd_ctl_elem_value *ucontrol)
2579 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2580 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2583 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2584 if (ucontrol->value.enumerated.item[0] != sel) {
2585 sel = ucontrol->value.enumerated.item[0] & 3;
2586 snd_hda_codec_write_cache(codec, nid, 0,
2587 AC_VERB_SET_CONNECT_SEL, sel);
2593 #define PIN_CTL_TEST(xname,nid) { \
2594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2596 .info = alc_test_pin_ctl_info, \
2597 .get = alc_test_pin_ctl_get, \
2598 .put = alc_test_pin_ctl_put, \
2599 .private_value = nid \
2602 #define PIN_SRC_TEST(xname,nid) { \
2603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2605 .info = alc_test_pin_src_info, \
2606 .get = alc_test_pin_src_get, \
2607 .put = alc_test_pin_src_put, \
2608 .private_value = nid \
2611 static struct snd_kcontrol_new alc880_test_mixer[] = {
2612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2613 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2614 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2615 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2616 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2617 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2618 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2619 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2620 PIN_CTL_TEST("Front Pin Mode", 0x14),
2621 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2622 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2623 PIN_CTL_TEST("Side Pin Mode", 0x17),
2624 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2625 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2626 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2627 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2628 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2629 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2630 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2631 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2632 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2633 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2634 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2635 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2636 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2637 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2638 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2639 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2640 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2641 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2643 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2644 .name = "Channel Mode",
2645 .info = alc_ch_mode_info,
2646 .get = alc_ch_mode_get,
2647 .put = alc_ch_mode_put,
2652 static struct hda_verb alc880_test_init_verbs[] = {
2653 /* Unmute inputs of 0x0c - 0x0f */
2654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2659 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2661 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2662 /* Vol output for 0x0c-0x0f */
2663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2667 /* Set output pins 0x14-0x17 */
2668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2671 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2672 /* Unmute output pins 0x14-0x17 */
2673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2676 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 /* Set input pins 0x18-0x1c */
2678 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2679 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2682 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2683 /* Mute input pins 0x18-0x1b */
2684 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2685 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2690 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2691 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2692 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2693 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2694 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2695 /* Analog input/passthru */
2696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2708 static const char *alc880_models[ALC880_MODEL_LAST] = {
2709 [ALC880_3ST] = "3stack",
2710 [ALC880_TCL_S700] = "tcl",
2711 [ALC880_3ST_DIG] = "3stack-digout",
2712 [ALC880_CLEVO] = "clevo",
2713 [ALC880_5ST] = "5stack",
2714 [ALC880_5ST_DIG] = "5stack-digout",
2715 [ALC880_W810] = "w810",
2716 [ALC880_Z71V] = "z71v",
2717 [ALC880_6ST] = "6stack",
2718 [ALC880_6ST_DIG] = "6stack-digout",
2719 [ALC880_ASUS] = "asus",
2720 [ALC880_ASUS_W1V] = "asus-w1v",
2721 [ALC880_ASUS_DIG] = "asus-dig",
2722 [ALC880_ASUS_DIG2] = "asus-dig2",
2723 [ALC880_UNIWILL_DIG] = "uniwill",
2724 [ALC880_UNIWILL_P53] = "uniwill-p53",
2725 [ALC880_FUJITSU] = "fujitsu",
2726 [ALC880_F1734] = "F1734",
2728 [ALC880_LG_LW] = "lg-lw",
2729 #ifdef CONFIG_SND_DEBUG
2730 [ALC880_TEST] = "test",
2732 [ALC880_AUTO] = "auto",
2735 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2736 /* Broken BIOS configuration */
2737 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2738 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2740 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2741 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2742 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2743 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2744 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2745 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2746 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2747 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2748 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2750 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2751 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2753 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2754 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2755 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2756 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2757 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2758 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2759 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2760 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2761 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2762 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2763 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2764 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2765 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2766 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2767 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2769 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2770 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2771 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2772 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2773 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2774 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2775 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2776 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2777 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2778 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2779 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2780 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2781 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2782 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2783 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2784 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2785 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2786 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2788 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2789 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2790 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2791 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2793 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2794 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2795 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2796 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2798 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2799 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2800 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2801 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2803 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2804 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2805 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2806 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2807 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2808 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2809 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2810 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2811 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2812 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2813 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2819 * ALC880 codec presets
2821 static struct alc_config_preset alc880_presets[] = {
2823 .mixers = { alc880_three_stack_mixer },
2824 .init_verbs = { alc880_volume_init_verbs,
2825 alc880_pin_3stack_init_verbs },
2826 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2827 .dac_nids = alc880_dac_nids,
2828 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2829 .channel_mode = alc880_threestack_modes,
2831 .input_mux = &alc880_capture_source,
2833 [ALC880_3ST_DIG] = {
2834 .mixers = { alc880_three_stack_mixer },
2835 .init_verbs = { alc880_volume_init_verbs,
2836 alc880_pin_3stack_init_verbs },
2837 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2838 .dac_nids = alc880_dac_nids,
2839 .dig_out_nid = ALC880_DIGOUT_NID,
2840 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2841 .channel_mode = alc880_threestack_modes,
2843 .input_mux = &alc880_capture_source,
2845 [ALC880_TCL_S700] = {
2846 .mixers = { alc880_tcl_s700_mixer },
2847 .init_verbs = { alc880_volume_init_verbs,
2848 alc880_pin_tcl_S700_init_verbs,
2849 alc880_gpio2_init_verbs },
2850 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2851 .dac_nids = alc880_dac_nids,
2853 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2854 .channel_mode = alc880_2_jack_modes,
2855 .input_mux = &alc880_capture_source,
2858 .mixers = { alc880_three_stack_mixer,
2859 alc880_five_stack_mixer},
2860 .init_verbs = { alc880_volume_init_verbs,
2861 alc880_pin_5stack_init_verbs },
2862 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2863 .dac_nids = alc880_dac_nids,
2864 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2865 .channel_mode = alc880_fivestack_modes,
2866 .input_mux = &alc880_capture_source,
2868 [ALC880_5ST_DIG] = {
2869 .mixers = { alc880_three_stack_mixer,
2870 alc880_five_stack_mixer },
2871 .init_verbs = { alc880_volume_init_verbs,
2872 alc880_pin_5stack_init_verbs },
2873 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2874 .dac_nids = alc880_dac_nids,
2875 .dig_out_nid = ALC880_DIGOUT_NID,
2876 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2877 .channel_mode = alc880_fivestack_modes,
2878 .input_mux = &alc880_capture_source,
2881 .mixers = { alc880_six_stack_mixer },
2882 .init_verbs = { alc880_volume_init_verbs,
2883 alc880_pin_6stack_init_verbs },
2884 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2885 .dac_nids = alc880_6st_dac_nids,
2886 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2887 .channel_mode = alc880_sixstack_modes,
2888 .input_mux = &alc880_6stack_capture_source,
2890 [ALC880_6ST_DIG] = {
2891 .mixers = { alc880_six_stack_mixer },
2892 .init_verbs = { alc880_volume_init_verbs,
2893 alc880_pin_6stack_init_verbs },
2894 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2895 .dac_nids = alc880_6st_dac_nids,
2896 .dig_out_nid = ALC880_DIGOUT_NID,
2897 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2898 .channel_mode = alc880_sixstack_modes,
2899 .input_mux = &alc880_6stack_capture_source,
2902 .mixers = { alc880_w810_base_mixer },
2903 .init_verbs = { alc880_volume_init_verbs,
2904 alc880_pin_w810_init_verbs,
2905 alc880_gpio2_init_verbs },
2906 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2907 .dac_nids = alc880_w810_dac_nids,
2908 .dig_out_nid = ALC880_DIGOUT_NID,
2909 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2910 .channel_mode = alc880_w810_modes,
2911 .input_mux = &alc880_capture_source,
2914 .mixers = { alc880_z71v_mixer },
2915 .init_verbs = { alc880_volume_init_verbs,
2916 alc880_pin_z71v_init_verbs },
2917 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2918 .dac_nids = alc880_z71v_dac_nids,
2919 .dig_out_nid = ALC880_DIGOUT_NID,
2921 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2922 .channel_mode = alc880_2_jack_modes,
2923 .input_mux = &alc880_capture_source,
2926 .mixers = { alc880_f1734_mixer },
2927 .init_verbs = { alc880_volume_init_verbs,
2928 alc880_pin_f1734_init_verbs },
2929 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2930 .dac_nids = alc880_f1734_dac_nids,
2932 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2933 .channel_mode = alc880_2_jack_modes,
2934 .input_mux = &alc880_capture_source,
2937 .mixers = { alc880_asus_mixer },
2938 .init_verbs = { alc880_volume_init_verbs,
2939 alc880_pin_asus_init_verbs,
2940 alc880_gpio1_init_verbs },
2941 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2942 .dac_nids = alc880_asus_dac_nids,
2943 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2944 .channel_mode = alc880_asus_modes,
2946 .input_mux = &alc880_capture_source,
2948 [ALC880_ASUS_DIG] = {
2949 .mixers = { alc880_asus_mixer },
2950 .init_verbs = { alc880_volume_init_verbs,
2951 alc880_pin_asus_init_verbs,
2952 alc880_gpio1_init_verbs },
2953 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2954 .dac_nids = alc880_asus_dac_nids,
2955 .dig_out_nid = ALC880_DIGOUT_NID,
2956 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2957 .channel_mode = alc880_asus_modes,
2959 .input_mux = &alc880_capture_source,
2961 [ALC880_ASUS_DIG2] = {
2962 .mixers = { alc880_asus_mixer },
2963 .init_verbs = { alc880_volume_init_verbs,
2964 alc880_pin_asus_init_verbs,
2965 alc880_gpio2_init_verbs }, /* use GPIO2 */
2966 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2967 .dac_nids = alc880_asus_dac_nids,
2968 .dig_out_nid = ALC880_DIGOUT_NID,
2969 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2970 .channel_mode = alc880_asus_modes,
2972 .input_mux = &alc880_capture_source,
2974 [ALC880_ASUS_W1V] = {
2975 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2976 .init_verbs = { alc880_volume_init_verbs,
2977 alc880_pin_asus_init_verbs,
2978 alc880_gpio1_init_verbs },
2979 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2980 .dac_nids = alc880_asus_dac_nids,
2981 .dig_out_nid = ALC880_DIGOUT_NID,
2982 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2983 .channel_mode = alc880_asus_modes,
2985 .input_mux = &alc880_capture_source,
2987 [ALC880_UNIWILL_DIG] = {
2988 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2989 .init_verbs = { alc880_volume_init_verbs,
2990 alc880_pin_asus_init_verbs },
2991 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2992 .dac_nids = alc880_asus_dac_nids,
2993 .dig_out_nid = ALC880_DIGOUT_NID,
2994 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2995 .channel_mode = alc880_asus_modes,
2997 .input_mux = &alc880_capture_source,
2999 [ALC880_UNIWILL] = {
3000 .mixers = { alc880_uniwill_mixer },
3001 .init_verbs = { alc880_volume_init_verbs,
3002 alc880_uniwill_init_verbs },
3003 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3004 .dac_nids = alc880_asus_dac_nids,
3005 .dig_out_nid = ALC880_DIGOUT_NID,
3006 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3007 .channel_mode = alc880_threestack_modes,
3009 .input_mux = &alc880_capture_source,
3010 .unsol_event = alc880_uniwill_unsol_event,
3011 .init_hook = alc880_uniwill_automute,
3013 [ALC880_UNIWILL_P53] = {
3014 .mixers = { alc880_uniwill_p53_mixer },
3015 .init_verbs = { alc880_volume_init_verbs,
3016 alc880_uniwill_p53_init_verbs },
3017 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3018 .dac_nids = alc880_asus_dac_nids,
3019 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3020 .channel_mode = alc880_threestack_modes,
3021 .input_mux = &alc880_capture_source,
3022 .unsol_event = alc880_uniwill_p53_unsol_event,
3023 .init_hook = alc880_uniwill_p53_hp_automute,
3025 [ALC880_FUJITSU] = {
3026 .mixers = { alc880_fujitsu_mixer,
3027 alc880_pcbeep_mixer, },
3028 .init_verbs = { alc880_volume_init_verbs,
3029 alc880_uniwill_p53_init_verbs,
3030 alc880_beep_init_verbs },
3031 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3032 .dac_nids = alc880_dac_nids,
3033 .dig_out_nid = ALC880_DIGOUT_NID,
3034 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3035 .channel_mode = alc880_2_jack_modes,
3036 .input_mux = &alc880_capture_source,
3037 .unsol_event = alc880_uniwill_p53_unsol_event,
3038 .init_hook = alc880_uniwill_p53_hp_automute,
3041 .mixers = { alc880_three_stack_mixer },
3042 .init_verbs = { alc880_volume_init_verbs,
3043 alc880_pin_clevo_init_verbs },
3044 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3045 .dac_nids = alc880_dac_nids,
3047 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3048 .channel_mode = alc880_threestack_modes,
3050 .input_mux = &alc880_capture_source,
3053 .mixers = { alc880_lg_mixer },
3054 .init_verbs = { alc880_volume_init_verbs,
3055 alc880_lg_init_verbs },
3056 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3057 .dac_nids = alc880_lg_dac_nids,
3058 .dig_out_nid = ALC880_DIGOUT_NID,
3059 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3060 .channel_mode = alc880_lg_ch_modes,
3062 .input_mux = &alc880_lg_capture_source,
3063 .unsol_event = alc880_lg_unsol_event,
3064 .init_hook = alc880_lg_automute,
3065 #ifdef CONFIG_SND_HDA_POWER_SAVE
3066 .loopbacks = alc880_lg_loopbacks,
3070 .mixers = { alc880_lg_lw_mixer },
3071 .init_verbs = { alc880_volume_init_verbs,
3072 alc880_lg_lw_init_verbs },
3073 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3074 .dac_nids = alc880_dac_nids,
3075 .dig_out_nid = ALC880_DIGOUT_NID,
3076 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3077 .channel_mode = alc880_lg_lw_modes,
3078 .input_mux = &alc880_lg_lw_capture_source,
3079 .unsol_event = alc880_lg_lw_unsol_event,
3080 .init_hook = alc880_lg_lw_automute,
3082 #ifdef CONFIG_SND_DEBUG
3084 .mixers = { alc880_test_mixer },
3085 .init_verbs = { alc880_test_init_verbs },
3086 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3087 .dac_nids = alc880_test_dac_nids,
3088 .dig_out_nid = ALC880_DIGOUT_NID,
3089 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3090 .channel_mode = alc880_test_modes,
3091 .input_mux = &alc880_test_capture_source,
3097 * Automatic parse of I/O pins from the BIOS configuration
3100 #define NUM_CONTROL_ALLOC 32
3101 #define NUM_VERB_ALLOC 32
3105 ALC_CTL_WIDGET_MUTE,
3108 static struct snd_kcontrol_new alc880_control_templates[] = {
3109 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3110 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3111 HDA_BIND_MUTE(NULL, 0, 0, 0),
3114 /* add dynamic controls */
3115 static int add_control(struct alc_spec *spec, int type, const char *name,
3118 struct snd_kcontrol_new *knew;
3120 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3121 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3123 /* array + terminator */
3124 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3127 if (spec->kctl_alloc) {
3128 memcpy(knew, spec->kctl_alloc,
3129 sizeof(*knew) * spec->num_kctl_alloc);
3130 kfree(spec->kctl_alloc);
3132 spec->kctl_alloc = knew;
3133 spec->num_kctl_alloc = num;
3136 knew = &spec->kctl_alloc[spec->num_kctl_used];
3137 *knew = alc880_control_templates[type];
3138 knew->name = kstrdup(name, GFP_KERNEL);
3141 knew->private_value = val;
3142 spec->num_kctl_used++;
3146 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3147 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3148 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3149 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3150 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3151 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3152 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3153 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3154 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3155 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3156 #define ALC880_PIN_CD_NID 0x1c
3158 /* fill in the dac_nids table from the parsed pin configuration */
3159 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3160 const struct auto_pin_cfg *cfg)
3166 memset(assigned, 0, sizeof(assigned));
3167 spec->multiout.dac_nids = spec->private_dac_nids;
3169 /* check the pins hardwired to audio widget */
3170 for (i = 0; i < cfg->line_outs; i++) {
3171 nid = cfg->line_out_pins[i];
3172 if (alc880_is_fixed_pin(nid)) {
3173 int idx = alc880_fixed_pin_idx(nid);
3174 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3178 /* left pins can be connect to any audio widget */
3179 for (i = 0; i < cfg->line_outs; i++) {
3180 nid = cfg->line_out_pins[i];
3181 if (alc880_is_fixed_pin(nid))
3183 /* search for an empty channel */
3184 for (j = 0; j < cfg->line_outs; j++) {
3186 spec->multiout.dac_nids[i] =
3187 alc880_idx_to_dac(j);
3193 spec->multiout.num_dacs = cfg->line_outs;
3197 /* add playback controls from the parsed DAC table */
3198 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3199 const struct auto_pin_cfg *cfg)
3202 static const char *chname[4] = {
3203 "Front", "Surround", NULL /*CLFE*/, "Side"
3208 for (i = 0; i < cfg->line_outs; i++) {
3209 if (!spec->multiout.dac_nids[i])
3211 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3214 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3215 "Center Playback Volume",
3216 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3220 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3221 "LFE Playback Volume",
3222 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3226 err = add_control(spec, ALC_CTL_BIND_MUTE,
3227 "Center Playback Switch",
3228 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3232 err = add_control(spec, ALC_CTL_BIND_MUTE,
3233 "LFE Playback Switch",
3234 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3239 sprintf(name, "%s Playback Volume", chname[i]);
3240 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3241 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3245 sprintf(name, "%s Playback Switch", chname[i]);
3246 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3247 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3256 /* add playback controls for speaker and HP outputs */
3257 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3267 if (alc880_is_fixed_pin(pin)) {
3268 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3269 /* specify the DAC as the extra output */
3270 if (!spec->multiout.hp_nid)
3271 spec->multiout.hp_nid = nid;
3273 spec->multiout.extra_out_nid[0] = nid;
3274 /* control HP volume/switch on the output mixer amp */
3275 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3276 sprintf(name, "%s Playback Volume", pfx);
3277 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3278 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3281 sprintf(name, "%s Playback Switch", pfx);
3282 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3283 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3286 } else if (alc880_is_multi_pin(pin)) {
3287 /* set manual connection */
3288 /* we have only a switch on HP-out PIN */
3289 sprintf(name, "%s Playback Switch", pfx);
3290 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3291 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3298 /* create input playback/capture controls for the given pin */
3299 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3300 const char *ctlname,
3301 int idx, hda_nid_t mix_nid)
3306 sprintf(name, "%s Playback Volume", ctlname);
3307 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3308 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3311 sprintf(name, "%s Playback Switch", ctlname);
3312 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3313 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3319 /* create playback/capture controls for input pins */
3320 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3321 const struct auto_pin_cfg *cfg)
3323 struct hda_input_mux *imux = &spec->private_imux;
3326 for (i = 0; i < AUTO_PIN_LAST; i++) {
3327 if (alc880_is_input_pin(cfg->input_pins[i])) {
3328 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3329 err = new_analog_input(spec, cfg->input_pins[i],
3330 auto_pin_cfg_labels[i],
3334 imux->items[imux->num_items].label =
3335 auto_pin_cfg_labels[i];
3336 imux->items[imux->num_items].index =
3337 alc880_input_pin_idx(cfg->input_pins[i]);
3344 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3345 hda_nid_t nid, int pin_type,
3349 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3353 /* need the manual connection? */
3354 if (alc880_is_multi_pin(nid)) {
3355 struct alc_spec *spec = codec->spec;
3356 int idx = alc880_multi_pin_idx(nid);
3357 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3358 AC_VERB_SET_CONNECT_SEL,
3359 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3363 static int get_pin_type(int line_out_type)
3365 if (line_out_type == AUTO_PIN_HP_OUT)
3371 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3373 struct alc_spec *spec = codec->spec;
3376 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3377 for (i = 0; i < spec->autocfg.line_outs; i++) {
3378 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3379 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3380 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3384 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3386 struct alc_spec *spec = codec->spec;
3389 pin = spec->autocfg.speaker_pins[0];
3390 if (pin) /* connect to front */
3391 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3392 pin = spec->autocfg.hp_pins[0];
3393 if (pin) /* connect to front */
3394 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3397 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3399 struct alc_spec *spec = codec->spec;
3402 for (i = 0; i < AUTO_PIN_LAST; i++) {
3403 hda_nid_t nid = spec->autocfg.input_pins[i];
3404 if (alc880_is_input_pin(nid)) {
3405 snd_hda_codec_write(codec, nid, 0,
3406 AC_VERB_SET_PIN_WIDGET_CONTROL,
3407 i <= AUTO_PIN_FRONT_MIC ?
3408 PIN_VREF80 : PIN_IN);
3409 if (nid != ALC880_PIN_CD_NID)
3410 snd_hda_codec_write(codec, nid, 0,
3411 AC_VERB_SET_AMP_GAIN_MUTE,
3417 /* parse the BIOS configuration and set up the alc_spec */
3418 /* return 1 if successful, 0 if the proper config is not found,
3419 * or a negative error code
3421 static int alc880_parse_auto_config(struct hda_codec *codec)
3423 struct alc_spec *spec = codec->spec;
3425 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3427 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3431 if (!spec->autocfg.line_outs)
3432 return 0; /* can't find valid BIOS pin config */
3434 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3437 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3440 err = alc880_auto_create_extra_out(spec,
3441 spec->autocfg.speaker_pins[0],
3445 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3449 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3453 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3455 if (spec->autocfg.dig_out_pin)
3456 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3457 if (spec->autocfg.dig_in_pin)
3458 spec->dig_in_nid = ALC880_DIGIN_NID;
3460 if (spec->kctl_alloc)
3461 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3463 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3465 spec->num_mux_defs = 1;
3466 spec->input_mux = &spec->private_imux;
3471 /* additional initialization for auto-configuration model */
3472 static void alc880_auto_init(struct hda_codec *codec)
3474 alc880_auto_init_multi_out(codec);
3475 alc880_auto_init_extra_out(codec);
3476 alc880_auto_init_analog_input(codec);
3480 * OK, here we have finally the patch for ALC880
3483 static int patch_alc880(struct hda_codec *codec)
3485 struct alc_spec *spec;
3489 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3495 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3498 if (board_config < 0) {
3499 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3500 "trying auto-probe from BIOS...\n");
3501 board_config = ALC880_AUTO;
3504 if (board_config == ALC880_AUTO) {
3505 /* automatic parse from the BIOS config */
3506 err = alc880_parse_auto_config(codec);
3512 "hda_codec: Cannot set up configuration "
3513 "from BIOS. Using 3-stack mode...\n");
3514 board_config = ALC880_3ST;
3518 if (board_config != ALC880_AUTO)
3519 setup_preset(spec, &alc880_presets[board_config]);
3521 spec->stream_name_analog = "ALC880 Analog";
3522 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3523 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3525 spec->stream_name_digital = "ALC880 Digital";
3526 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3527 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3529 if (!spec->adc_nids && spec->input_mux) {
3530 /* check whether NID 0x07 is valid */
3531 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3533 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3534 if (wcap != AC_WID_AUD_IN) {
3535 spec->adc_nids = alc880_adc_nids_alt;
3536 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3537 spec->mixers[spec->num_mixers] =
3538 alc880_capture_alt_mixer;
3541 spec->adc_nids = alc880_adc_nids;
3542 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3543 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3548 codec->patch_ops = alc_patch_ops;
3549 if (board_config == ALC880_AUTO)
3550 spec->init_hook = alc880_auto_init;
3551 #ifdef CONFIG_SND_HDA_POWER_SAVE
3552 if (!spec->loopback.amplist)
3553 spec->loopback.amplist = alc880_loopbacks;
3564 static hda_nid_t alc260_dac_nids[1] = {
3569 static hda_nid_t alc260_adc_nids[1] = {
3574 static hda_nid_t alc260_adc_nids_alt[1] = {
3579 static hda_nid_t alc260_hp_adc_nids[2] = {
3584 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3585 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3587 static hda_nid_t alc260_dual_adc_nids[2] = {
3592 #define ALC260_DIGOUT_NID 0x03
3593 #define ALC260_DIGIN_NID 0x06
3595 static struct hda_input_mux alc260_capture_source = {
3599 { "Front Mic", 0x1 },
3605 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3606 * headphone jack and the internal CD lines since these are the only pins at
3607 * which audio can appear. For flexibility, also allow the option of
3608 * recording the mixer output on the second ADC (ADC0 doesn't have a
3609 * connection to the mixer output).
3611 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3615 { "Mic/Line", 0x0 },
3617 { "Headphone", 0x2 },
3623 { "Mic/Line", 0x0 },
3625 { "Headphone", 0x2 },
3632 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3633 * the Fujitsu S702x, but jacks are marked differently.
3635 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3642 { "Headphone", 0x5 },
3651 { "Headphone", 0x6 },
3657 * This is just place-holder, so there's something for alc_build_pcms to look
3658 * at when it calculates the maximum number of channels. ALC260 has no mixer
3659 * element which allows changing the channel mode, so the verb list is
3662 static struct hda_channel_mode alc260_modes[1] = {
3667 /* Mixer combinations
3669 * basic: base_output + input + pc_beep + capture
3670 * HP: base_output + input + capture_alt
3671 * HP_3013: hp_3013 + input + capture
3672 * fujitsu: fujitsu + capture
3673 * acer: acer + capture
3676 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3677 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3678 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3679 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3680 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3681 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3682 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3686 static struct snd_kcontrol_new alc260_input_mixer[] = {
3687 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3688 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3689 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3690 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3692 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3693 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3694 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3698 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3699 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3700 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3704 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3705 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3706 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3707 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3708 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3709 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3711 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3712 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3716 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3717 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3719 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3720 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3721 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3722 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3723 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3724 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3725 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3726 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3727 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3728 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3729 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3730 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3731 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3735 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3736 * versions of the ALC260 don't act on requests to enable mic bias from NID
3737 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3738 * datasheet doesn't mention this restriction. At this stage it's not clear
3739 * whether this behaviour is intentional or is a hardware bug in chip
3740 * revisions available in early 2006. Therefore for now allow the
3741 * "Headphone Jack Mode" control to span all choices, but if it turns out
3742 * that the lack of mic bias for this NID is intentional we could change the
3743 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3745 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3746 * don't appear to make the mic bias available from the "line" jack, even
3747 * though the NID used for this jack (0x14) can supply it. The theory is
3748 * that perhaps Acer have included blocking capacitors between the ALC260
3749 * and the output jack. If this turns out to be the case for all such
3750 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3751 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3753 * The C20x Tablet series have a mono internal speaker which is controlled
3754 * via the chip's Mono sum widget and pin complex, so include the necessary
3755 * controls for such models. On models without a "mono speaker" the control
3756 * won't do anything.
3758 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3759 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3760 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3761 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3762 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3764 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3766 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3767 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3769 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3770 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3771 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3772 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3773 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3774 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3775 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3779 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3780 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3782 static struct snd_kcontrol_new alc260_will_mixer[] = {
3783 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3784 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3785 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3786 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3787 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3788 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3789 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3790 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3791 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3792 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3793 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3794 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3798 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3799 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3801 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3802 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3803 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3805 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3806 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3807 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3808 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3809 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3810 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3811 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3815 /* capture mixer elements */
3816 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3817 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3818 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3819 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3820 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3822 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3823 /* The multiple "Capture Source" controls confuse alsamixer
3824 * So call somewhat different..
3825 * FIXME: the controls appear in the "playback" view!
3827 /* .name = "Capture Source", */
3828 .name = "Input Source",
3830 .info = alc_mux_enum_info,
3831 .get = alc_mux_enum_get,
3832 .put = alc_mux_enum_put,
3837 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3838 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3839 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3842 /* The multiple "Capture Source" controls confuse alsamixer
3843 * So call somewhat different..
3844 * FIXME: the controls appear in the "playback" view!
3846 /* .name = "Capture Source", */
3847 .name = "Input Source",
3849 .info = alc_mux_enum_info,
3850 .get = alc_mux_enum_get,
3851 .put = alc_mux_enum_put,
3857 * initialization verbs
3859 static struct hda_verb alc260_init_verbs[] = {
3860 /* Line In pin widget for input */
3861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3862 /* CD pin widget for input */
3863 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3864 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3865 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3866 /* Mic2 (front panel) pin widget for input and vref at 80% */
3867 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3868 /* LINE-2 is used for line-out in rear */
3869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3870 /* select line-out */
3871 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3873 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3875 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3877 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3878 /* mute capture amp left and right */
3879 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3880 /* set connection select to line in (default select for this ADC) */
3881 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3882 /* mute capture amp left and right */
3883 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3884 /* set connection select to line in (default select for this ADC) */
3885 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3886 /* set vol=0 Line-Out mixer amp left and right */
3887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3888 /* unmute pin widget amp left and right (no gain on this amp) */
3889 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3890 /* set vol=0 HP mixer amp left and right */
3891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3892 /* unmute pin widget amp left and right (no gain on this amp) */
3893 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3894 /* set vol=0 Mono mixer amp left and right */
3895 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3896 /* unmute pin widget amp left and right (no gain on this amp) */
3897 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3898 /* unmute LINE-2 out pin */
3899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3900 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3903 /* mute analog inputs */
3904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3909 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3910 /* mute Front out path */
3911 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3913 /* mute Headphone out path */
3914 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3916 /* mute Mono out path */
3917 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3918 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3922 #if 0 /* should be identical with alc260_init_verbs? */
3923 static struct hda_verb alc260_hp_init_verbs[] = {
3924 /* Headphone and output */
3925 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3927 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3928 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3929 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3930 /* Mic2 (front panel) pin widget for input and vref at 80% */
3931 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3932 /* Line In pin widget for input */
3933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3934 /* Line-2 pin widget for output */
3935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3936 /* CD pin widget for input */
3937 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3938 /* unmute amp left and right */
3939 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3940 /* set connection select to line in (default select for this ADC) */
3941 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3942 /* unmute Line-Out mixer amp left and right (volume = 0) */
3943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3944 /* mute pin widget amp left and right (no gain on this amp) */
3945 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3946 /* unmute HP mixer amp left and right (volume = 0) */
3947 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3948 /* mute pin widget amp left and right (no gain on this amp) */
3949 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3950 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3953 /* mute analog inputs */
3954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3959 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3960 /* Unmute Front out path */
3961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3962 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3963 /* Unmute Headphone out path */
3964 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3965 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3966 /* Unmute Mono out path */
3967 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3968 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3973 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3974 /* Line out and output */
3975 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3977 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3978 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3979 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3980 /* Mic2 (front panel) pin widget for input and vref at 80% */
3981 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3982 /* Line In pin widget for input */
3983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3984 /* Headphone pin widget for output */
3985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3986 /* CD pin widget for input */
3987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3988 /* unmute amp left and right */
3989 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3990 /* set connection select to line in (default select for this ADC) */
3991 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3992 /* unmute Line-Out mixer amp left and right (volume = 0) */
3993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3994 /* mute pin widget amp left and right (no gain on this amp) */
3995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3996 /* unmute HP mixer amp left and right (volume = 0) */
3997 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3998 /* mute pin widget amp left and right (no gain on this amp) */
3999 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
4000 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4003 /* mute analog inputs */
4004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4009 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4010 /* Unmute Front out path */
4011 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4013 /* Unmute Headphone out path */
4014 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4016 /* Unmute Mono out path */
4017 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4018 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4022 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4023 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4024 * audio = 0x16, internal speaker = 0x10.
4026 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4027 /* Disable all GPIOs */
4028 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4029 /* Internal speaker is connected to headphone pin */
4030 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4031 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4033 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4034 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4035 /* Ensure all other unused pins are disabled and muted. */
4036 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4038 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4039 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4040 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4041 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4043 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4045 /* Disable digital (SPDIF) pins */
4046 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4047 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4049 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4050 * when acting as an output.
4052 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4054 /* Start with output sum widgets muted and their output gains at min */
4055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4061 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4065 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4066 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4067 /* Unmute Line1 pin widget output buffer since it starts as an output.
4068 * If the pin mode is changed by the user the pin mode control will
4069 * take care of enabling the pin's input/output buffers as needed.
4070 * Therefore there's no need to enable the input buffer at this
4073 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4074 /* Unmute input buffer of pin widget used for Line-in (no equiv
4077 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4079 /* Mute capture amp left and right */
4080 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4081 /* Set ADC connection select to match default mixer setting - line
4084 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4086 /* Do the same for the second ADC: mute capture input amp and
4087 * set ADC connection to line in (on mic1 pin)
4089 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4090 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4092 /* Mute all inputs to mixer widget (even unconnected ones) */
4093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4105 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4106 * similar laptops (adapted from Fujitsu init verbs).
4108 static struct hda_verb alc260_acer_init_verbs[] = {
4109 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4110 * the headphone jack. Turn this on and rely on the standard mute
4111 * methods whenever the user wants to turn these outputs off.
4113 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4114 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4115 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4116 /* Internal speaker/Headphone jack is connected to Line-out pin */
4117 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4118 /* Internal microphone/Mic jack is connected to Mic1 pin */
4119 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4120 /* Line In jack is connected to Line1 pin */
4121 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4122 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4123 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4124 /* Ensure all other unused pins are disabled and muted. */
4125 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4126 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4127 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4128 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4131 /* Disable digital (SPDIF) pins */
4132 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4133 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4135 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4136 * bus when acting as outputs.
4138 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4139 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4141 /* Start with output sum widgets muted and their output gains at min */
4142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4146 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4149 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4150 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4152 /* Unmute Line-out pin widget amp left and right
4153 * (no equiv mixer ctrl)
4155 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4156 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4157 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4158 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4159 * inputs. If the pin mode is changed by the user the pin mode control
4160 * will take care of enabling the pin's input/output buffers as needed.
4161 * Therefore there's no need to enable the input buffer at this
4164 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4165 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4167 /* Mute capture amp left and right */
4168 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4169 /* Set ADC connection select to match default mixer setting - mic
4172 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4174 /* Do similar with the second ADC: mute capture input amp and
4175 * set ADC connection to mic to match ALSA's default state.
4177 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4178 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4180 /* Mute all inputs to mixer widget (even unconnected ones) */
4181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4193 static struct hda_verb alc260_will_verbs[] = {
4194 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4195 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4196 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4197 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4198 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4199 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4203 static struct hda_verb alc260_replacer_672v_verbs[] = {
4204 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4205 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4206 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4208 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4209 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4210 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4212 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4216 /* toggle speaker-output according to the hp-jack state */
4217 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4219 unsigned int present;
4221 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4222 present = snd_hda_codec_read(codec, 0x0f, 0,
4223 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4225 snd_hda_codec_write_cache(codec, 0x01, 0,
4226 AC_VERB_SET_GPIO_DATA, 1);
4227 snd_hda_codec_write_cache(codec, 0x0f, 0,
4228 AC_VERB_SET_PIN_WIDGET_CONTROL,
4231 snd_hda_codec_write_cache(codec, 0x01, 0,
4232 AC_VERB_SET_GPIO_DATA, 0);
4233 snd_hda_codec_write_cache(codec, 0x0f, 0,
4234 AC_VERB_SET_PIN_WIDGET_CONTROL,
4239 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4242 if ((res >> 26) == ALC880_HP_EVENT)
4243 alc260_replacer_672v_automute(codec);
4246 /* Test configuration for debugging, modelled after the ALC880 test
4249 #ifdef CONFIG_SND_DEBUG
4250 static hda_nid_t alc260_test_dac_nids[1] = {
4253 static hda_nid_t alc260_test_adc_nids[2] = {
4256 /* For testing the ALC260, each input MUX needs its own definition since
4257 * the signal assignments are different. This assumes that the first ADC
4260 static struct hda_input_mux alc260_test_capture_sources[2] = {
4264 { "MIC1 pin", 0x0 },
4265 { "MIC2 pin", 0x1 },
4266 { "LINE1 pin", 0x2 },
4267 { "LINE2 pin", 0x3 },
4269 { "LINE-OUT pin", 0x5 },
4270 { "HP-OUT pin", 0x6 },
4276 { "MIC1 pin", 0x0 },
4277 { "MIC2 pin", 0x1 },
4278 { "LINE1 pin", 0x2 },
4279 { "LINE2 pin", 0x3 },
4282 { "LINE-OUT pin", 0x6 },
4283 { "HP-OUT pin", 0x7 },
4287 static struct snd_kcontrol_new alc260_test_mixer[] = {
4288 /* Output driver widgets */
4289 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4290 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4291 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4292 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4293 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4294 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4296 /* Modes for retasking pin widgets
4297 * Note: the ALC260 doesn't seem to act on requests to enable mic
4298 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4299 * mention this restriction. At this stage it's not clear whether
4300 * this behaviour is intentional or is a hardware bug in chip
4301 * revisions available at least up until early 2006. Therefore for
4302 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4303 * choices, but if it turns out that the lack of mic bias for these
4304 * NIDs is intentional we could change their modes from
4305 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4307 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4308 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4309 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4310 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4311 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4312 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4314 /* Loopback mixer controls */
4315 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4316 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4317 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4318 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4319 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4320 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4321 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4322 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4323 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4324 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4325 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4326 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4327 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4328 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4329 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4330 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4332 /* Controls for GPIO pins, assuming they are configured as outputs */
4333 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4334 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4335 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4336 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4338 /* Switches to allow the digital IO pins to be enabled. The datasheet
4339 * is ambigious as to which NID is which; testing on laptops which
4340 * make this output available should provide clarification.
4342 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4343 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4347 static struct hda_verb alc260_test_init_verbs[] = {
4348 /* Enable all GPIOs as outputs with an initial value of 0 */
4349 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4350 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4351 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4353 /* Enable retasking pins as output, initially without power amp */
4354 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4355 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4358 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4359 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4361 /* Disable digital (SPDIF) pins initially, but users can enable
4362 * them via a mixer switch. In the case of SPDIF-out, this initverb
4363 * payload also sets the generation to 0, output to be in "consumer"
4364 * PCM format, copyright asserted, no pre-emphasis and no validity
4367 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4368 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4370 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4371 * OUT1 sum bus when acting as an output.
4373 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4374 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4375 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4376 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4378 /* Start with output sum widgets muted and their output gains at min */
4379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4385 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4387 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4389 /* Unmute retasking pin widget output buffers since the default
4390 * state appears to be output. As the pin mode is changed by the
4391 * user the pin mode control will take care of enabling the pin's
4392 * input/output buffers as needed.
4394 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4398 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4399 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4400 /* Also unmute the mono-out pin widget */
4401 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4403 /* Mute capture amp left and right */
4404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4405 /* Set ADC connection select to match default mixer setting (mic1
4408 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4410 /* Do the same for the second ADC: mute capture input amp and
4411 * set ADC connection to mic1 pin
4413 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4414 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4416 /* Mute all inputs to mixer widget (even unconnected ones) */
4417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4430 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4436 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4442 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4443 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4446 * for BIOS auto-configuration
4449 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4453 unsigned long vol_val, sw_val;
4457 if (nid >= 0x0f && nid < 0x11) {
4458 nid_vol = nid - 0x7;
4459 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4460 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4461 } else if (nid == 0x11) {
4462 nid_vol = nid - 0x7;
4463 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4464 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4465 } else if (nid >= 0x12 && nid <= 0x15) {
4467 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4468 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4472 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4473 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4476 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4477 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4483 /* add playback controls from the parsed DAC table */
4484 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4485 const struct auto_pin_cfg *cfg)
4490 spec->multiout.num_dacs = 1;
4491 spec->multiout.dac_nids = spec->private_dac_nids;
4492 spec->multiout.dac_nids[0] = 0x02;
4494 nid = cfg->line_out_pins[0];
4496 err = alc260_add_playback_controls(spec, nid, "Front");
4501 nid = cfg->speaker_pins[0];
4503 err = alc260_add_playback_controls(spec, nid, "Speaker");
4508 nid = cfg->hp_pins[0];
4510 err = alc260_add_playback_controls(spec, nid, "Headphone");
4517 /* create playback/capture controls for input pins */
4518 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4519 const struct auto_pin_cfg *cfg)
4521 struct hda_input_mux *imux = &spec->private_imux;
4524 for (i = 0; i < AUTO_PIN_LAST; i++) {
4525 if (cfg->input_pins[i] >= 0x12) {
4526 idx = cfg->input_pins[i] - 0x12;
4527 err = new_analog_input(spec, cfg->input_pins[i],
4528 auto_pin_cfg_labels[i], idx,
4532 imux->items[imux->num_items].label =
4533 auto_pin_cfg_labels[i];
4534 imux->items[imux->num_items].index = idx;
4537 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4538 idx = cfg->input_pins[i] - 0x09;
4539 err = new_analog_input(spec, cfg->input_pins[i],
4540 auto_pin_cfg_labels[i], idx,
4544 imux->items[imux->num_items].label =
4545 auto_pin_cfg_labels[i];
4546 imux->items[imux->num_items].index = idx;
4553 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4554 hda_nid_t nid, int pin_type,
4558 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4560 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4562 /* need the manual connection? */
4564 int idx = nid - 0x12;
4565 snd_hda_codec_write(codec, idx + 0x0b, 0,
4566 AC_VERB_SET_CONNECT_SEL, sel_idx);
4570 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4572 struct alc_spec *spec = codec->spec;
4575 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4576 nid = spec->autocfg.line_out_pins[0];
4578 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4579 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4582 nid = spec->autocfg.speaker_pins[0];
4584 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4586 nid = spec->autocfg.hp_pins[0];
4588 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4591 #define ALC260_PIN_CD_NID 0x16
4592 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4594 struct alc_spec *spec = codec->spec;
4597 for (i = 0; i < AUTO_PIN_LAST; i++) {
4598 hda_nid_t nid = spec->autocfg.input_pins[i];
4600 snd_hda_codec_write(codec, nid, 0,
4601 AC_VERB_SET_PIN_WIDGET_CONTROL,
4602 i <= AUTO_PIN_FRONT_MIC ?
4603 PIN_VREF80 : PIN_IN);
4604 if (nid != ALC260_PIN_CD_NID)
4605 snd_hda_codec_write(codec, nid, 0,
4606 AC_VERB_SET_AMP_GAIN_MUTE,
4613 * generic initialization of ADC, input mixers and output mixers
4615 static struct hda_verb alc260_volume_init_verbs[] = {
4617 * Unmute ADC0-1 and set the default input to mic-in
4619 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4620 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4621 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4622 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4624 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4626 * Note: PASD motherboards uses the Line In 2 as the input for
4627 * front panel mic (mic 2)
4629 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4630 /* mute analog inputs */
4631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4638 * Set up output mixers (0x08 - 0x0a)
4640 /* set vol=0 to output mixers */
4641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4642 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4643 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4644 /* set up input amps for analog loopback */
4645 /* Amp Indices: DAC = 0, mixer = 1 */
4646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4650 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4651 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4656 static int alc260_parse_auto_config(struct hda_codec *codec)
4658 struct alc_spec *spec = codec->spec;
4661 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4663 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4667 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4670 if (!spec->kctl_alloc)
4671 return 0; /* can't find valid BIOS pin config */
4672 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4676 spec->multiout.max_channels = 2;
4678 if (spec->autocfg.dig_out_pin)
4679 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4680 if (spec->kctl_alloc)
4681 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4683 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4685 spec->num_mux_defs = 1;
4686 spec->input_mux = &spec->private_imux;
4688 /* check whether NID 0x04 is valid */
4689 wcap = get_wcaps(codec, 0x04);
4690 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4691 if (wcap != AC_WID_AUD_IN) {
4692 spec->adc_nids = alc260_adc_nids_alt;
4693 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4694 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4696 spec->adc_nids = alc260_adc_nids;
4697 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4698 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4705 /* additional initialization for auto-configuration model */
4706 static void alc260_auto_init(struct hda_codec *codec)
4708 alc260_auto_init_multi_out(codec);
4709 alc260_auto_init_analog_input(codec);
4712 #ifdef CONFIG_SND_HDA_POWER_SAVE
4713 static struct hda_amp_list alc260_loopbacks[] = {
4714 { 0x07, HDA_INPUT, 0 },
4715 { 0x07, HDA_INPUT, 1 },
4716 { 0x07, HDA_INPUT, 2 },
4717 { 0x07, HDA_INPUT, 3 },
4718 { 0x07, HDA_INPUT, 4 },
4724 * ALC260 configurations
4726 static const char *alc260_models[ALC260_MODEL_LAST] = {
4727 [ALC260_BASIC] = "basic",
4729 [ALC260_HP_3013] = "hp-3013",
4730 [ALC260_FUJITSU_S702X] = "fujitsu",
4731 [ALC260_ACER] = "acer",
4732 [ALC260_WILL] = "will",
4733 [ALC260_REPLACER_672V] = "replacer",
4734 #ifdef CONFIG_SND_DEBUG
4735 [ALC260_TEST] = "test",
4737 [ALC260_AUTO] = "auto",
4740 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4741 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4742 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4743 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4744 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4745 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4746 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4747 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4748 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4749 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4750 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4751 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4752 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4753 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4754 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4755 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4756 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4757 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4758 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4762 static struct alc_config_preset alc260_presets[] = {
4764 .mixers = { alc260_base_output_mixer,
4766 alc260_pc_beep_mixer,
4767 alc260_capture_mixer },
4768 .init_verbs = { alc260_init_verbs },
4769 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4770 .dac_nids = alc260_dac_nids,
4771 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4772 .adc_nids = alc260_adc_nids,
4773 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4774 .channel_mode = alc260_modes,
4775 .input_mux = &alc260_capture_source,
4778 .mixers = { alc260_base_output_mixer,
4780 alc260_capture_alt_mixer },
4781 .init_verbs = { alc260_init_verbs },
4782 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4783 .dac_nids = alc260_dac_nids,
4784 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4785 .adc_nids = alc260_hp_adc_nids,
4786 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4787 .channel_mode = alc260_modes,
4788 .input_mux = &alc260_capture_source,
4790 [ALC260_HP_3013] = {
4791 .mixers = { alc260_hp_3013_mixer,
4793 alc260_capture_alt_mixer },
4794 .init_verbs = { alc260_hp_3013_init_verbs },
4795 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4796 .dac_nids = alc260_dac_nids,
4797 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4798 .adc_nids = alc260_hp_adc_nids,
4799 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4800 .channel_mode = alc260_modes,
4801 .input_mux = &alc260_capture_source,
4803 [ALC260_FUJITSU_S702X] = {
4804 .mixers = { alc260_fujitsu_mixer,
4805 alc260_capture_mixer },
4806 .init_verbs = { alc260_fujitsu_init_verbs },
4807 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4808 .dac_nids = alc260_dac_nids,
4809 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4810 .adc_nids = alc260_dual_adc_nids,
4811 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4812 .channel_mode = alc260_modes,
4813 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4814 .input_mux = alc260_fujitsu_capture_sources,
4817 .mixers = { alc260_acer_mixer,
4818 alc260_capture_mixer },
4819 .init_verbs = { alc260_acer_init_verbs },
4820 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4821 .dac_nids = alc260_dac_nids,
4822 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4823 .adc_nids = alc260_dual_adc_nids,
4824 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4825 .channel_mode = alc260_modes,
4826 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4827 .input_mux = alc260_acer_capture_sources,
4830 .mixers = { alc260_will_mixer,
4831 alc260_capture_mixer },
4832 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4833 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4834 .dac_nids = alc260_dac_nids,
4835 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4836 .adc_nids = alc260_adc_nids,
4837 .dig_out_nid = ALC260_DIGOUT_NID,
4838 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4839 .channel_mode = alc260_modes,
4840 .input_mux = &alc260_capture_source,
4842 [ALC260_REPLACER_672V] = {
4843 .mixers = { alc260_replacer_672v_mixer,
4844 alc260_capture_mixer },
4845 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4846 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4847 .dac_nids = alc260_dac_nids,
4848 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4849 .adc_nids = alc260_adc_nids,
4850 .dig_out_nid = ALC260_DIGOUT_NID,
4851 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4852 .channel_mode = alc260_modes,
4853 .input_mux = &alc260_capture_source,
4854 .unsol_event = alc260_replacer_672v_unsol_event,
4855 .init_hook = alc260_replacer_672v_automute,
4857 #ifdef CONFIG_SND_DEBUG
4859 .mixers = { alc260_test_mixer,
4860 alc260_capture_mixer },
4861 .init_verbs = { alc260_test_init_verbs },
4862 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4863 .dac_nids = alc260_test_dac_nids,
4864 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4865 .adc_nids = alc260_test_adc_nids,
4866 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4867 .channel_mode = alc260_modes,
4868 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4869 .input_mux = alc260_test_capture_sources,
4874 static int patch_alc260(struct hda_codec *codec)
4876 struct alc_spec *spec;
4877 int err, board_config;
4879 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4885 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4888 if (board_config < 0) {
4889 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4890 "trying auto-probe from BIOS...\n");
4891 board_config = ALC260_AUTO;
4894 if (board_config == ALC260_AUTO) {
4895 /* automatic parse from the BIOS config */
4896 err = alc260_parse_auto_config(codec);
4902 "hda_codec: Cannot set up configuration "
4903 "from BIOS. Using base mode...\n");
4904 board_config = ALC260_BASIC;
4908 if (board_config != ALC260_AUTO)
4909 setup_preset(spec, &alc260_presets[board_config]);
4911 spec->stream_name_analog = "ALC260 Analog";
4912 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4913 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4915 spec->stream_name_digital = "ALC260 Digital";
4916 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4917 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4919 codec->patch_ops = alc_patch_ops;
4920 if (board_config == ALC260_AUTO)
4921 spec->init_hook = alc260_auto_init;
4922 #ifdef CONFIG_SND_HDA_POWER_SAVE
4923 if (!spec->loopback.amplist)
4924 spec->loopback.amplist = alc260_loopbacks;
4934 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4935 * configuration. Each pin widget can choose any input DACs and a mixer.
4936 * Each ADC is connected from a mixer of all inputs. This makes possible
4937 * 6-channel independent captures.
4939 * In addition, an independent DAC for the multi-playback (not used in this
4942 #define ALC882_DIGOUT_NID 0x06
4943 #define ALC882_DIGIN_NID 0x0a
4945 static struct hda_channel_mode alc882_ch_modes[1] = {
4949 static hda_nid_t alc882_dac_nids[4] = {
4950 /* front, rear, clfe, rear_surr */
4951 0x02, 0x03, 0x04, 0x05
4954 /* identical with ALC880 */
4955 #define alc882_adc_nids alc880_adc_nids
4956 #define alc882_adc_nids_alt alc880_adc_nids_alt
4959 /* FIXME: should be a matrix-type input source selection */
4961 static struct hda_input_mux alc882_capture_source = {
4965 { "Front Mic", 0x1 },
4970 #define alc882_mux_enum_info alc_mux_enum_info
4971 #define alc882_mux_enum_get alc_mux_enum_get
4973 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4974 struct snd_ctl_elem_value *ucontrol)
4976 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4977 struct alc_spec *spec = codec->spec;
4978 const struct hda_input_mux *imux = spec->input_mux;
4979 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4980 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4981 hda_nid_t nid = capture_mixers[adc_idx];
4982 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4983 unsigned int i, idx;
4985 idx = ucontrol->value.enumerated.item[0];
4986 if (idx >= imux->num_items)
4987 idx = imux->num_items - 1;
4988 if (*cur_val == idx)
4990 for (i = 0; i < imux->num_items; i++) {
4991 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4992 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4993 imux->items[i].index,
5003 static struct hda_verb alc882_3ST_ch2_init[] = {
5004 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5005 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5006 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5007 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5014 static struct hda_verb alc882_3ST_ch6_init[] = {
5015 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5016 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5017 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5018 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5019 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5020 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5024 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5025 { 2, alc882_3ST_ch2_init },
5026 { 6, alc882_3ST_ch6_init },
5032 static struct hda_verb alc882_sixstack_ch6_init[] = {
5033 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5034 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5035 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5036 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5043 static struct hda_verb alc882_sixstack_ch8_init[] = {
5044 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5045 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5046 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5047 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5051 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5052 { 6, alc882_sixstack_ch6_init },
5053 { 8, alc882_sixstack_ch8_init },
5057 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5063 static struct hda_verb alc885_mbp_ch2_init[] = {
5064 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5065 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5066 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5073 static struct hda_verb alc885_mbp_ch6_init[] = {
5074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5076 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5077 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5078 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5082 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5083 { 2, alc885_mbp_ch2_init },
5084 { 6, alc885_mbp_ch6_init },
5088 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5089 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5091 static struct snd_kcontrol_new alc882_base_mixer[] = {
5092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5093 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5094 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5095 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5096 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5097 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5098 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5099 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5100 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5101 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5111 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5113 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5114 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5118 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5119 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT),
5120 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT),
5121 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT),
5122 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT),
5123 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT),
5124 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT),
5125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5126 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5127 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT),
5128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5131 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5133 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5139 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5140 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5141 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5142 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5146 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5147 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5148 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5159 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5163 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5164 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5166 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5167 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5168 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5170 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5171 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5172 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5175 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5176 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5183 static struct snd_kcontrol_new alc882_asus_a7m_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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5187 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5188 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5190 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5194 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5195 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5199 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5202 .name = "Channel Mode",
5203 .info = alc_ch_mode_info,
5204 .get = alc_ch_mode_get,
5205 .put = alc_ch_mode_put,
5210 static struct hda_verb alc882_init_verbs[] = {
5211 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5222 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5224 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5226 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5228 /* Front Pin: output 0 (0x0c) */
5229 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5232 /* Rear Pin: output 1 (0x0d) */
5233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5234 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5235 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5236 /* CLFE Pin: output 2 (0x0e) */
5237 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5238 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5239 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5240 /* Side Pin: output 3 (0x0f) */
5241 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5242 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5243 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5244 /* Mic (rear) pin: input vref at 80% */
5245 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5246 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5247 /* Front Mic pin: input vref at 80% */
5248 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5250 /* Line In pin: input */
5251 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5252 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5253 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5254 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5255 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5256 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5257 /* CD pin widget for input */
5258 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5260 /* FIXME: use matrix-type input source selection */
5261 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5262 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5277 /* ADC1: mute amp left and right */
5278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5279 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5280 /* ADC2: mute amp left and right */
5281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5282 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5283 /* ADC3: mute amp left and right */
5284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5285 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5290 static struct hda_verb alc882_eapd_verbs[] = {
5291 /* change to EAPD mode */
5292 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5293 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5298 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5299 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5300 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5301 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5302 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5303 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5304 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5305 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5309 static struct hda_verb alc882_macpro_init_verbs[] = {
5310 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5314 /* Front Pin: output 0 (0x0c) */
5315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5317 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5318 /* Front Mic pin: input vref at 80% */
5319 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5320 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5321 /* Speaker: output */
5322 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5323 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5324 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5325 /* Headphone output (output 0 - 0x0c) */
5326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5328 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5330 /* FIXME: use matrix-type input source selection */
5331 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5332 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5347 /* ADC1: mute amp left and right */
5348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5349 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5350 /* ADC2: mute amp left and right */
5351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5352 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5353 /* ADC3: mute amp left and right */
5354 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5355 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5360 /* Macbook Pro rev3 */
5361 static struct hda_verb alc885_mbp3_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)},
5367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5370 /* Front Pin: output 0 (0x0c) */
5371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5373 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5374 /* HP Pin: output 0 (0x0d) */
5375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5378 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5379 /* Mic (rear) pin: input vref at 80% */
5380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5382 /* Front Mic pin: input vref at 80% */
5383 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5385 /* Line In pin: use output 1 when in LineOut mode */
5386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5388 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5390 /* FIXME: use matrix-type input source selection */
5391 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5392 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5407 /* ADC1: mute amp left and right */
5408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5409 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5410 /* ADC2: mute amp left and right */
5411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5412 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5413 /* ADC3: mute amp left and right */
5414 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5415 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5420 /* iMac 24 mixer. */
5421 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5422 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5423 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5427 /* iMac 24 init verbs. */
5428 static struct hda_verb alc885_imac24_init_verbs[] = {
5429 /* Internal speakers: output 0 (0x0c) */
5430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5433 /* Internal speakers: output 0 (0x0c) */
5434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5435 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5436 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5437 /* Headphone: output 0 (0x0c) */
5438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5440 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5441 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5442 /* Front Mic: input vref at 80% */
5443 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5444 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5448 /* Toggle speaker-output according to the hp-jack state */
5449 static void alc885_imac24_automute(struct hda_codec *codec)
5451 unsigned int present;
5453 present = snd_hda_codec_read(codec, 0x14, 0,
5454 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5455 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5456 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5457 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5461 /* Processes unsolicited events. */
5462 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5465 /* Headphone insertion or removal. */
5466 if ((res >> 26) == ALC880_HP_EVENT)
5467 alc885_imac24_automute(codec);
5470 static void alc885_mbp3_automute(struct hda_codec *codec)
5472 unsigned int present;
5474 present = snd_hda_codec_read(codec, 0x15, 0,
5475 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5476 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5477 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5478 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5479 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5482 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5485 /* Headphone insertion or removal. */
5486 if ((res >> 26) == ALC880_HP_EVENT)
5487 alc885_mbp3_automute(codec);
5491 static struct hda_verb alc882_targa_verbs[] = {
5492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5496 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5498 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5499 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5500 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5502 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5503 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5504 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5505 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5509 /* toggle speaker-output according to the hp-jack state */
5510 static void alc882_targa_automute(struct hda_codec *codec)
5512 unsigned int present;
5514 present = snd_hda_codec_read(codec, 0x14, 0,
5515 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5516 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5517 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5518 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5522 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5524 /* Looks like the unsol event is incompatible with the standard
5525 * definition. 4bit tag is placed at 26 bit!
5527 if (((res >> 26) == ALC880_HP_EVENT)) {
5528 alc882_targa_automute(codec);
5532 static struct hda_verb alc882_asus_a7j_verbs[] = {
5533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5540 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5541 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5542 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5544 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5545 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5546 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5550 static struct hda_verb alc882_asus_a7m_verbs[] = {
5551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5556 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5558 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5559 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5560 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5562 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5563 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5564 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5568 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5570 unsigned int gpiostate, gpiomask, gpiodir;
5572 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5573 AC_VERB_GET_GPIO_DATA, 0);
5576 gpiostate |= (1 << pin);
5578 gpiostate &= ~(1 << pin);
5580 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5581 AC_VERB_GET_GPIO_MASK, 0);
5582 gpiomask |= (1 << pin);
5584 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5585 AC_VERB_GET_GPIO_DIRECTION, 0);
5586 gpiodir |= (1 << pin);
5589 snd_hda_codec_write(codec, codec->afg, 0,
5590 AC_VERB_SET_GPIO_MASK, gpiomask);
5591 snd_hda_codec_write(codec, codec->afg, 0,
5592 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5596 snd_hda_codec_write(codec, codec->afg, 0,
5597 AC_VERB_SET_GPIO_DATA, gpiostate);
5600 /* set up GPIO at initialization */
5601 static void alc885_macpro_init_hook(struct hda_codec *codec)
5603 alc882_gpio_mute(codec, 0, 0);
5604 alc882_gpio_mute(codec, 1, 0);
5607 /* set up GPIO and update auto-muting at initialization */
5608 static void alc885_imac24_init_hook(struct hda_codec *codec)
5610 alc885_macpro_init_hook(codec);
5611 alc885_imac24_automute(codec);
5615 * generic initialization of ADC, input mixers and output mixers
5617 static struct hda_verb alc882_auto_init_verbs[] = {
5619 * Unmute ADC0-2 and set the default input to mic-in
5621 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5623 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5625 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5628 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5630 * Note: PASD motherboards uses the Line In 2 as the input for
5631 * front panel mic (mic 2)
5633 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5641 * Set up output mixers (0x0c - 0x0f)
5643 /* set vol=0 to output mixers */
5644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5648 /* set up input amps for analog loopback */
5649 /* Amp Indices: DAC = 0, mixer = 1 */
5650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5658 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5659 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5661 /* FIXME: use matrix-type input source selection */
5662 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5663 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5672 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5682 /* capture mixer elements */
5683 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5686 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5687 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5690 /* The multiple "Capture Source" controls confuse alsamixer
5691 * So call somewhat different..
5692 * FIXME: the controls appear in the "playback" view!
5694 /* .name = "Capture Source", */
5695 .name = "Input Source",
5697 .info = alc882_mux_enum_info,
5698 .get = alc882_mux_enum_get,
5699 .put = alc882_mux_enum_put,
5704 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5705 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5706 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5707 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5708 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5709 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5710 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5713 /* The multiple "Capture Source" controls confuse alsamixer
5714 * So call somewhat different..
5715 * FIXME: the controls appear in the "playback" view!
5717 /* .name = "Capture Source", */
5718 .name = "Input Source",
5720 .info = alc882_mux_enum_info,
5721 .get = alc882_mux_enum_get,
5722 .put = alc882_mux_enum_put,
5727 #ifdef CONFIG_SND_HDA_POWER_SAVE
5728 #define alc882_loopbacks alc880_loopbacks
5731 /* pcm configuration: identiacal with ALC880 */
5732 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5733 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5734 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5735 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5738 * configuration and preset
5740 static const char *alc882_models[ALC882_MODEL_LAST] = {
5741 [ALC882_3ST_DIG] = "3stack-dig",
5742 [ALC882_6ST_DIG] = "6stack-dig",
5743 [ALC882_ARIMA] = "arima",
5744 [ALC882_W2JC] = "w2jc",
5745 [ALC882_TARGA] = "targa",
5746 [ALC882_ASUS_A7J] = "asus-a7j",
5747 [ALC882_ASUS_A7M] = "asus-a7m",
5748 [ALC885_MACPRO] = "macpro",
5749 [ALC885_MBP3] = "mbp3",
5750 [ALC885_IMAC24] = "imac24",
5751 [ALC882_AUTO] = "auto",
5754 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5755 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5756 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5757 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5758 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5759 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5760 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5761 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5762 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5763 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5764 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5765 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5769 static struct alc_config_preset alc882_presets[] = {
5770 [ALC882_3ST_DIG] = {
5771 .mixers = { alc882_base_mixer },
5772 .init_verbs = { alc882_init_verbs },
5773 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5774 .dac_nids = alc882_dac_nids,
5775 .dig_out_nid = ALC882_DIGOUT_NID,
5776 .dig_in_nid = ALC882_DIGIN_NID,
5777 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5778 .channel_mode = alc882_ch_modes,
5780 .input_mux = &alc882_capture_source,
5782 [ALC882_6ST_DIG] = {
5783 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5784 .init_verbs = { alc882_init_verbs },
5785 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5786 .dac_nids = alc882_dac_nids,
5787 .dig_out_nid = ALC882_DIGOUT_NID,
5788 .dig_in_nid = ALC882_DIGIN_NID,
5789 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5790 .channel_mode = alc882_sixstack_modes,
5791 .input_mux = &alc882_capture_source,
5794 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5795 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5796 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5797 .dac_nids = alc882_dac_nids,
5798 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5799 .channel_mode = alc882_sixstack_modes,
5800 .input_mux = &alc882_capture_source,
5803 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5804 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5805 alc880_gpio1_init_verbs },
5806 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5807 .dac_nids = alc882_dac_nids,
5808 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5809 .channel_mode = alc880_threestack_modes,
5811 .input_mux = &alc882_capture_source,
5812 .dig_out_nid = ALC882_DIGOUT_NID,
5815 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5816 .init_verbs = { alc885_mbp3_init_verbs,
5817 alc880_gpio1_init_verbs },
5818 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5819 .dac_nids = alc882_dac_nids,
5820 .channel_mode = alc885_mbp_6ch_modes,
5821 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5822 .input_mux = &alc882_capture_source,
5823 .dig_out_nid = ALC882_DIGOUT_NID,
5824 .dig_in_nid = ALC882_DIGIN_NID,
5825 .unsol_event = alc885_mbp3_unsol_event,
5826 .init_hook = alc885_mbp3_automute,
5829 .mixers = { alc882_macpro_mixer },
5830 .init_verbs = { alc882_macpro_init_verbs },
5831 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5832 .dac_nids = alc882_dac_nids,
5833 .dig_out_nid = ALC882_DIGOUT_NID,
5834 .dig_in_nid = ALC882_DIGIN_NID,
5835 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5836 .channel_mode = alc882_ch_modes,
5837 .input_mux = &alc882_capture_source,
5838 .init_hook = alc885_macpro_init_hook,
5841 .mixers = { alc885_imac24_mixer },
5842 .init_verbs = { alc885_imac24_init_verbs },
5843 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5844 .dac_nids = alc882_dac_nids,
5845 .dig_out_nid = ALC882_DIGOUT_NID,
5846 .dig_in_nid = ALC882_DIGIN_NID,
5847 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5848 .channel_mode = alc882_ch_modes,
5849 .input_mux = &alc882_capture_source,
5850 .unsol_event = alc885_imac24_unsol_event,
5851 .init_hook = alc885_imac24_init_hook,
5854 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5855 alc882_capture_mixer },
5856 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5857 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5858 .dac_nids = alc882_dac_nids,
5859 .dig_out_nid = ALC882_DIGOUT_NID,
5860 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5861 .adc_nids = alc882_adc_nids,
5862 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5863 .channel_mode = alc882_3ST_6ch_modes,
5865 .input_mux = &alc882_capture_source,
5866 .unsol_event = alc882_targa_unsol_event,
5867 .init_hook = alc882_targa_automute,
5869 [ALC882_ASUS_A7J] = {
5870 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5871 alc882_capture_mixer },
5872 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5873 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5874 .dac_nids = alc882_dac_nids,
5875 .dig_out_nid = ALC882_DIGOUT_NID,
5876 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5877 .adc_nids = alc882_adc_nids,
5878 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5879 .channel_mode = alc882_3ST_6ch_modes,
5881 .input_mux = &alc882_capture_source,
5883 [ALC882_ASUS_A7M] = {
5884 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
5885 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5886 alc880_gpio1_init_verbs,
5887 alc882_asus_a7m_verbs },
5888 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5889 .dac_nids = alc882_dac_nids,
5890 .dig_out_nid = ALC882_DIGOUT_NID,
5891 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5892 .channel_mode = alc880_threestack_modes,
5894 .input_mux = &alc882_capture_source,
5903 PINFIX_ABIT_AW9D_MAX
5906 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5907 { 0x15, 0x01080104 }, /* side */
5908 { 0x16, 0x01011012 }, /* rear */
5909 { 0x17, 0x01016011 }, /* clfe */
5913 static const struct alc_pincfg *alc882_pin_fixes[] = {
5914 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5917 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5918 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5923 * BIOS auto configuration
5925 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5926 hda_nid_t nid, int pin_type,
5930 struct alc_spec *spec = codec->spec;
5933 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5936 idx = spec->multiout.dac_nids[dac_idx] - 2;
5938 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5940 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5942 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5946 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5948 struct alc_spec *spec = codec->spec;
5951 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5952 for (i = 0; i <= HDA_SIDE; i++) {
5953 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5954 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5956 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5961 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5963 struct alc_spec *spec = codec->spec;
5966 pin = spec->autocfg.hp_pins[0];
5967 if (pin) /* connect to front */
5969 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5972 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5973 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5975 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5977 struct alc_spec *spec = codec->spec;
5980 for (i = 0; i < AUTO_PIN_LAST; i++) {
5981 hda_nid_t nid = spec->autocfg.input_pins[i];
5982 if (alc882_is_input_pin(nid)) {
5983 snd_hda_codec_write(codec, nid, 0,
5984 AC_VERB_SET_PIN_WIDGET_CONTROL,
5985 i <= AUTO_PIN_FRONT_MIC ?
5986 PIN_VREF80 : PIN_IN);
5987 if (nid != ALC882_PIN_CD_NID)
5988 snd_hda_codec_write(codec, nid, 0,
5989 AC_VERB_SET_AMP_GAIN_MUTE,
5995 /* add mic boosts if needed */
5996 static int alc_auto_add_mic_boost(struct hda_codec *codec)
5998 struct alc_spec *spec = codec->spec;
6002 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6004 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6006 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6010 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6012 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6014 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6021 /* almost identical with ALC880 parser... */
6022 static int alc882_parse_auto_config(struct hda_codec *codec)
6024 struct alc_spec *spec = codec->spec;
6025 int err = alc880_parse_auto_config(codec);
6030 return 0; /* no config found */
6032 err = alc_auto_add_mic_boost(codec);
6036 /* hack - override the init verbs */
6037 spec->init_verbs[0] = alc882_auto_init_verbs;
6039 return 1; /* config found */
6042 /* additional initialization for auto-configuration model */
6043 static void alc882_auto_init(struct hda_codec *codec)
6045 alc882_auto_init_multi_out(codec);
6046 alc882_auto_init_hp_out(codec);
6047 alc882_auto_init_analog_input(codec);
6050 static int patch_alc882(struct hda_codec *codec)
6052 struct alc_spec *spec;
6053 int err, board_config;
6055 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6061 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6065 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6066 /* Pick up systems that don't supply PCI SSID */
6067 switch (codec->subsystem_id) {
6068 case 0x106b0c00: /* Mac Pro */
6069 board_config = ALC885_MACPRO;
6071 case 0x106b1000: /* iMac 24 */
6072 board_config = ALC885_IMAC24;
6074 case 0x106b2c00: /* Macbook Pro rev3 */
6075 board_config = ALC885_MBP3;
6078 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6079 "trying auto-probe from BIOS...\n");
6080 board_config = ALC882_AUTO;
6084 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6086 if (board_config == ALC882_AUTO) {
6087 /* automatic parse from the BIOS config */
6088 err = alc882_parse_auto_config(codec);
6094 "hda_codec: Cannot set up configuration "
6095 "from BIOS. Using base mode...\n");
6096 board_config = ALC882_3ST_DIG;
6100 if (board_config != ALC882_AUTO)
6101 setup_preset(spec, &alc882_presets[board_config]);
6103 spec->stream_name_analog = "ALC882 Analog";
6104 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6105 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6107 spec->stream_name_digital = "ALC882 Digital";
6108 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6109 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6111 if (!spec->adc_nids && spec->input_mux) {
6112 /* check whether NID 0x07 is valid */
6113 unsigned int wcap = get_wcaps(codec, 0x07);
6115 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6116 if (wcap != AC_WID_AUD_IN) {
6117 spec->adc_nids = alc882_adc_nids_alt;
6118 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6119 spec->mixers[spec->num_mixers] =
6120 alc882_capture_alt_mixer;
6123 spec->adc_nids = alc882_adc_nids;
6124 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6125 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6130 codec->patch_ops = alc_patch_ops;
6131 if (board_config == ALC882_AUTO)
6132 spec->init_hook = alc882_auto_init;
6133 #ifdef CONFIG_SND_HDA_POWER_SAVE
6134 if (!spec->loopback.amplist)
6135 spec->loopback.amplist = alc882_loopbacks;
6144 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6145 * configuration. Each pin widget can choose any input DACs and a mixer.
6146 * Each ADC is connected from a mixer of all inputs. This makes possible
6147 * 6-channel independent captures.
6149 * In addition, an independent DAC for the multi-playback (not used in this
6152 #define ALC883_DIGOUT_NID 0x06
6153 #define ALC883_DIGIN_NID 0x0a
6155 static hda_nid_t alc883_dac_nids[4] = {
6156 /* front, rear, clfe, rear_surr */
6157 0x02, 0x04, 0x03, 0x05
6160 static hda_nid_t alc883_adc_nids[2] = {
6166 /* FIXME: should be a matrix-type input source selection */
6168 static struct hda_input_mux alc883_capture_source = {
6172 { "Front Mic", 0x1 },
6178 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6186 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6196 #define alc883_mux_enum_info alc_mux_enum_info
6197 #define alc883_mux_enum_get alc_mux_enum_get
6199 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6200 struct snd_ctl_elem_value *ucontrol)
6202 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6203 struct alc_spec *spec = codec->spec;
6204 const struct hda_input_mux *imux = spec->input_mux;
6205 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6206 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6207 hda_nid_t nid = capture_mixers[adc_idx];
6208 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6209 unsigned int i, idx;
6211 idx = ucontrol->value.enumerated.item[0];
6212 if (idx >= imux->num_items)
6213 idx = imux->num_items - 1;
6214 if (*cur_val == idx)
6216 for (i = 0; i < imux->num_items; i++) {
6217 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6218 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6219 imux->items[i].index,
6229 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6236 static struct hda_verb alc883_3ST_ch2_init[] = {
6237 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6238 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6239 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6240 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6247 static struct hda_verb alc883_3ST_ch4_init[] = {
6248 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6249 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6250 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6251 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6252 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6259 static struct hda_verb alc883_3ST_ch6_init[] = {
6260 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6261 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6262 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6263 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6264 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6265 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6269 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6270 { 2, alc883_3ST_ch2_init },
6271 { 4, alc883_3ST_ch4_init },
6272 { 6, alc883_3ST_ch6_init },
6278 static struct hda_verb alc883_sixstack_ch6_init[] = {
6279 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6280 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6281 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6282 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6289 static struct hda_verb alc883_sixstack_ch8_init[] = {
6290 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6291 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6292 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6293 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6297 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6298 { 6, alc883_sixstack_ch6_init },
6299 { 8, alc883_sixstack_ch8_init },
6302 static struct hda_verb alc883_medion_eapd_verbs[] = {
6303 /* eanable EAPD on medion laptop */
6304 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6305 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6309 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6310 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6313 static struct snd_kcontrol_new alc883_base_mixer[] = {
6314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6315 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6317 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6318 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6319 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6320 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6321 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6322 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6323 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6325 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6326 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6327 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6328 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6330 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6332 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6333 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6334 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6335 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6336 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6337 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6338 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6339 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6340 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6342 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6343 /* .name = "Capture Source", */
6344 .name = "Input Source",
6346 .info = alc883_mux_enum_info,
6347 .get = alc883_mux_enum_get,
6348 .put = alc883_mux_enum_put,
6353 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
6354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6355 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6356 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6357 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6358 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6359 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6362 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6364 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6365 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6367 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6368 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6369 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6370 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6373 /* .name = "Capture Source", */
6374 .name = "Input Source",
6376 .info = alc883_mux_enum_info,
6377 .get = alc883_mux_enum_get,
6378 .put = alc883_mux_enum_put,
6383 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6384 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6385 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6389 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6390 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6392 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6395 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6397 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6398 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6399 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6400 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6401 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6402 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6404 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6405 /* .name = "Capture Source", */
6406 .name = "Input Source",
6408 .info = alc883_mux_enum_info,
6409 .get = alc883_mux_enum_get,
6410 .put = alc883_mux_enum_put,
6415 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6417 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6418 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6419 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6420 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6421 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6422 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6423 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6425 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6426 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6427 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6428 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6430 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6431 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6433 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6434 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6435 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6436 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6437 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6438 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6439 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6440 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6443 /* .name = "Capture Source", */
6444 .name = "Input Source",
6446 .info = alc883_mux_enum_info,
6447 .get = alc883_mux_enum_get,
6448 .put = alc883_mux_enum_put,
6453 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6454 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6455 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6456 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6457 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6458 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6459 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6460 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6461 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6464 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6468 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6470 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6471 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6472 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6473 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6474 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6475 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6476 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6479 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6480 /* .name = "Capture Source", */
6481 .name = "Input Source",
6483 .info = alc883_mux_enum_info,
6484 .get = alc883_mux_enum_get,
6485 .put = alc883_mux_enum_put,
6490 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6493 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6494 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6495 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6496 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6497 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6498 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6499 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6500 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6501 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6505 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6506 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6507 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6508 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6509 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6510 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6512 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6513 /* .name = "Capture Source", */
6514 .name = "Input Source",
6516 .info = alc883_mux_enum_info,
6517 .get = alc883_mux_enum_get,
6518 .put = alc883_mux_enum_put,
6523 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6524 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6525 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6526 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6528 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6530 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6532 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6533 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6534 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6535 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6538 /* .name = "Capture Source", */
6539 .name = "Input Source",
6541 .info = alc883_mux_enum_info,
6542 .get = alc883_mux_enum_get,
6543 .put = alc883_mux_enum_put,
6548 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6549 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6550 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6551 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6552 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6553 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6555 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6557 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6558 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6561 /* .name = "Capture Source", */
6562 .name = "Input Source",
6564 .info = alc883_mux_enum_info,
6565 .get = alc883_mux_enum_get,
6566 .put = alc883_mux_enum_put,
6571 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6577 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6578 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6579 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6580 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6581 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6582 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6583 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6584 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6586 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6587 /* .name = "Capture Source", */
6588 .name = "Input Source",
6590 .info = alc883_mux_enum_info,
6591 .get = alc883_mux_enum_get,
6592 .put = alc883_mux_enum_put,
6597 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6600 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6601 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6602 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6607 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6608 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6609 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6610 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 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 alc888_6st_hp_mixer[] = {
6624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6626 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6627 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6628 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6629 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6630 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6631 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6632 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6633 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6635 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6636 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6637 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6638 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6640 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6645 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6646 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6647 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6648 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6649 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6650 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6653 /* .name = "Capture Source", */
6654 .name = "Input Source",
6656 .info = alc883_mux_enum_info,
6657 .get = alc883_mux_enum_get,
6658 .put = alc883_mux_enum_put,
6663 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6664 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6665 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6666 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6667 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6668 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6669 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6670 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6671 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6673 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6674 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6680 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6681 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6682 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6683 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6684 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6685 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6686 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6687 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6688 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6690 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6691 /* .name = "Capture Source", */
6692 .name = "Input Source",
6694 .info = alc883_mux_enum_info,
6695 .get = alc883_mux_enum_get,
6696 .put = alc883_mux_enum_put,
6701 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6708 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6710 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6711 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6712 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6713 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6716 /* .name = "Capture Source", */
6717 .name = "Input Source",
6719 .info = alc883_mux_enum_info,
6720 .get = alc883_mux_enum_get,
6721 .put = alc883_mux_enum_put,
6726 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6729 .name = "Channel Mode",
6730 .info = alc_ch_mode_info,
6731 .get = alc_ch_mode_get,
6732 .put = alc_ch_mode_put,
6737 static struct hda_verb alc883_init_verbs[] = {
6738 /* ADC1: mute amp left and right */
6739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6740 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6741 /* ADC2: mute amp left and right */
6742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6743 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6744 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6751 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6761 /* mute analog input loopbacks */
6762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6768 /* Front Pin: output 0 (0x0c) */
6769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6771 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6772 /* Rear Pin: output 1 (0x0d) */
6773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6775 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6776 /* CLFE Pin: output 2 (0x0e) */
6777 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6778 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6779 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6780 /* Side Pin: output 3 (0x0f) */
6781 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6782 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6783 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6784 /* Mic (rear) pin: input vref at 80% */
6785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6786 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6787 /* Front Mic pin: input vref at 80% */
6788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6789 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6790 /* Line In pin: input */
6791 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6792 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6793 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6794 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6795 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6796 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6797 /* CD pin widget for input */
6798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6800 /* FIXME: use matrix-type input source selection */
6801 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6803 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6804 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6805 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6809 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6815 /* toggle speaker-output according to the hp-jack state */
6816 static void alc883_mitac_hp_automute(struct hda_codec *codec)
6818 unsigned int present;
6820 present = snd_hda_codec_read(codec, 0x15, 0,
6821 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6822 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6823 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6824 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
6825 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6828 /* auto-toggle front mic */
6830 static void alc883_mitac_mic_automute(struct hda_codec *codec)
6832 unsigned int present;
6835 present = snd_hda_codec_read(codec, 0x18, 0,
6836 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6837 bits = present ? HDA_AMP_MUTE : 0;
6838 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
6842 static void alc883_mitac_automute(struct hda_codec *codec)
6844 alc883_mitac_hp_automute(codec);
6845 /* alc883_mitac_mic_automute(codec); */
6848 static void alc883_mitac_unsol_event(struct hda_codec *codec,
6851 switch (res >> 26) {
6852 case ALC880_HP_EVENT:
6853 alc883_mitac_hp_automute(codec);
6855 case ALC880_MIC_EVENT:
6856 /* alc883_mitac_mic_automute(codec); */
6861 static struct hda_verb alc883_mitac_verbs[] = {
6863 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6866 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
6867 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6869 /* enable unsolicited event */
6870 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6871 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
6876 static struct hda_verb alc883_tagra_verbs[] = {
6877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6878 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6880 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6881 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6883 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6884 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6885 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6887 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6888 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6889 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6890 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6895 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6896 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6897 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6898 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6902 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6903 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6905 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6906 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6910 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6912 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6913 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6914 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6919 static struct hda_verb alc883_haier_w66_verbs[] = {
6920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6925 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6926 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6927 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6932 static struct hda_verb alc888_6st_hp_verbs[] = {
6933 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6934 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6935 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6936 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6940 static struct hda_verb alc888_3st_hp_verbs[] = {
6941 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6942 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6943 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6947 static struct hda_verb alc888_3st_hp_2ch_init[] = {
6948 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6949 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6950 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6951 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6955 static struct hda_verb alc888_3st_hp_6ch_init[] = {
6956 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6957 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6958 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6963 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
6964 { 2, alc888_3st_hp_2ch_init },
6965 { 6, alc888_3st_hp_6ch_init },
6968 /* toggle front-jack and RCA according to the hp-jack state */
6969 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6971 unsigned int present;
6973 present = snd_hda_codec_read(codec, 0x1b, 0,
6974 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6975 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6976 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6977 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6978 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6981 /* toggle RCA according to the front-jack state */
6982 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6984 unsigned int present;
6986 present = snd_hda_codec_read(codec, 0x14, 0,
6987 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6988 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6989 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6992 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6995 if ((res >> 26) == ALC880_HP_EVENT)
6996 alc888_lenovo_ms7195_front_automute(codec);
6997 if ((res >> 26) == ALC880_FRONT_EVENT)
6998 alc888_lenovo_ms7195_rca_automute(codec);
7001 static struct hda_verb alc883_medion_md2_verbs[] = {
7002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7007 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7011 /* toggle speaker-output according to the hp-jack state */
7012 static void alc883_medion_md2_automute(struct hda_codec *codec)
7014 unsigned int present;
7016 present = snd_hda_codec_read(codec, 0x14, 0,
7017 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7018 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7019 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7022 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
7025 if ((res >> 26) == ALC880_HP_EVENT)
7026 alc883_medion_md2_automute(codec);
7029 /* toggle speaker-output according to the hp-jack state */
7030 static void alc883_tagra_automute(struct hda_codec *codec)
7032 unsigned int present;
7035 present = snd_hda_codec_read(codec, 0x14, 0,
7036 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7037 bits = present ? HDA_AMP_MUTE : 0;
7038 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
7039 HDA_AMP_MUTE, bits);
7040 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7044 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
7046 if ((res >> 26) == ALC880_HP_EVENT)
7047 alc883_tagra_automute(codec);
7050 static void alc883_haier_w66_automute(struct hda_codec *codec)
7052 unsigned int present;
7055 present = snd_hda_codec_read(codec, 0x1b, 0,
7056 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7057 bits = present ? 0x80 : 0;
7058 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7062 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
7065 if ((res >> 26) == ALC880_HP_EVENT)
7066 alc883_haier_w66_automute(codec);
7069 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
7071 unsigned int present;
7074 present = snd_hda_codec_read(codec, 0x14, 0,
7075 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7076 bits = present ? HDA_AMP_MUTE : 0;
7077 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7078 HDA_AMP_MUTE, bits);
7081 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
7083 unsigned int present;
7086 present = snd_hda_codec_read(codec, 0x1b, 0,
7087 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7088 bits = present ? HDA_AMP_MUTE : 0;
7089 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7090 HDA_AMP_MUTE, bits);
7091 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7092 HDA_AMP_MUTE, bits);
7095 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7098 if ((res >> 26) == ALC880_HP_EVENT)
7099 alc883_lenovo_101e_all_automute(codec);
7100 if ((res >> 26) == ALC880_FRONT_EVENT)
7101 alc883_lenovo_101e_ispeaker_automute(codec);
7104 /* toggle speaker-output according to the hp-jack state */
7105 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7107 unsigned int present;
7109 present = snd_hda_codec_read(codec, 0x14, 0,
7110 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7111 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7112 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7113 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7114 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7117 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7120 if ((res >> 26) == ALC880_HP_EVENT)
7121 alc883_acer_aspire_automute(codec);
7124 static struct hda_verb alc883_acer_eapd_verbs[] = {
7125 /* HP Pin: output 0 (0x0c) */
7126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7128 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7129 /* Front Pin: output 0 (0x0c) */
7130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7131 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7133 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7134 /* eanable EAPD on medion laptop */
7135 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7136 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7137 /* enable unsolicited event */
7138 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7143 * generic initialization of ADC, input mixers and output mixers
7145 static struct hda_verb alc883_auto_init_verbs[] = {
7147 * Unmute ADC0-2 and set the default input to mic-in
7149 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7150 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7151 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7152 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7154 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7156 * Note: PASD motherboards uses the Line In 2 as the input for
7157 * front panel mic (mic 2)
7159 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7160 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7161 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7162 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7163 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7167 * Set up output mixers (0x0c - 0x0f)
7169 /* set vol=0 to output mixers */
7170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7171 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7174 /* set up input amps for analog loopback */
7175 /* Amp Indices: DAC = 0, mixer = 1 */
7176 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7178 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7180 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7182 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7183 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7184 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7185 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7187 /* FIXME: use matrix-type input source selection */
7188 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7193 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7199 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7205 /* capture mixer elements */
7206 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7207 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7208 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7209 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7210 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7213 /* The multiple "Capture Source" controls confuse alsamixer
7214 * So call somewhat different..
7215 * FIXME: the controls appear in the "playback" view!
7217 /* .name = "Capture Source", */
7218 .name = "Input Source",
7220 .info = alc882_mux_enum_info,
7221 .get = alc882_mux_enum_get,
7222 .put = alc882_mux_enum_put,
7227 #ifdef CONFIG_SND_HDA_POWER_SAVE
7228 #define alc883_loopbacks alc880_loopbacks
7231 /* pcm configuration: identiacal with ALC880 */
7232 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7233 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7234 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7235 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7238 * configuration and preset
7240 static const char *alc883_models[ALC883_MODEL_LAST] = {
7241 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7242 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7243 [ALC883_3ST_6ch] = "3stack-6ch",
7244 [ALC883_6ST_DIG] = "6stack-dig",
7245 [ALC883_TARGA_DIG] = "targa-dig",
7246 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7247 [ALC883_ACER] = "acer",
7248 [ALC883_ACER_ASPIRE] = "acer-aspire",
7249 [ALC883_MEDION] = "medion",
7250 [ALC883_MEDION_MD2] = "medion-md2",
7251 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7252 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7253 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7254 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7255 [ALC883_HAIER_W66] = "haier-w66",
7256 [ALC888_6ST_HP] = "6stack-hp",
7257 [ALC888_3ST_HP] = "3stack-hp",
7258 [ALC883_MITAC] = "mitac",
7259 [ALC883_AUTO] = "auto",
7262 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7263 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7264 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7265 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7266 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7267 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7268 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7269 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7270 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7271 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7272 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7273 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7274 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7275 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7276 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7277 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7278 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7279 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7280 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7281 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7282 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7283 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7284 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7285 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7286 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7287 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7288 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7289 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7290 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7291 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
7292 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7293 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7294 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
7295 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7296 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7297 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7298 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7299 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7300 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7301 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7302 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7303 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7304 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7305 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7306 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7307 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7311 static struct alc_config_preset alc883_presets[] = {
7312 [ALC883_3ST_2ch_DIG] = {
7313 .mixers = { alc883_3ST_2ch_mixer },
7314 .init_verbs = { alc883_init_verbs },
7315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7316 .dac_nids = alc883_dac_nids,
7317 .dig_out_nid = ALC883_DIGOUT_NID,
7318 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7319 .adc_nids = alc883_adc_nids,
7320 .dig_in_nid = ALC883_DIGIN_NID,
7321 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7322 .channel_mode = alc883_3ST_2ch_modes,
7323 .input_mux = &alc883_capture_source,
7325 [ALC883_3ST_6ch_DIG] = {
7326 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7327 .init_verbs = { alc883_init_verbs },
7328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7329 .dac_nids = alc883_dac_nids,
7330 .dig_out_nid = ALC883_DIGOUT_NID,
7331 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7332 .adc_nids = alc883_adc_nids,
7333 .dig_in_nid = ALC883_DIGIN_NID,
7334 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7335 .channel_mode = alc883_3ST_6ch_modes,
7337 .input_mux = &alc883_capture_source,
7339 [ALC883_3ST_6ch] = {
7340 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7341 .init_verbs = { alc883_init_verbs },
7342 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7343 .dac_nids = alc883_dac_nids,
7344 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7345 .adc_nids = alc883_adc_nids,
7346 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7347 .channel_mode = alc883_3ST_6ch_modes,
7349 .input_mux = &alc883_capture_source,
7351 [ALC883_6ST_DIG] = {
7352 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7353 .init_verbs = { alc883_init_verbs },
7354 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7355 .dac_nids = alc883_dac_nids,
7356 .dig_out_nid = ALC883_DIGOUT_NID,
7357 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7358 .adc_nids = alc883_adc_nids,
7359 .dig_in_nid = ALC883_DIGIN_NID,
7360 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7361 .channel_mode = alc883_sixstack_modes,
7362 .input_mux = &alc883_capture_source,
7364 [ALC883_TARGA_DIG] = {
7365 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7366 .init_verbs = { alc883_init_verbs, alc883_tagra_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 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7373 .channel_mode = alc883_3ST_6ch_modes,
7375 .input_mux = &alc883_capture_source,
7376 .unsol_event = alc883_tagra_unsol_event,
7377 .init_hook = alc883_tagra_automute,
7379 [ALC883_TARGA_2ch_DIG] = {
7380 .mixers = { alc883_tagra_2ch_mixer},
7381 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7382 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7383 .dac_nids = alc883_dac_nids,
7384 .dig_out_nid = ALC883_DIGOUT_NID,
7385 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7386 .adc_nids = alc883_adc_nids,
7387 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7388 .channel_mode = alc883_3ST_2ch_modes,
7389 .input_mux = &alc883_capture_source,
7390 .unsol_event = alc883_tagra_unsol_event,
7391 .init_hook = alc883_tagra_automute,
7394 .mixers = { alc883_base_mixer },
7395 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7396 * and the headphone jack. Turn this on and rely on the
7397 * standard mute methods whenever the user wants to turn
7398 * these outputs off.
7400 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7402 .dac_nids = alc883_dac_nids,
7403 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7404 .adc_nids = alc883_adc_nids,
7405 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7406 .channel_mode = alc883_3ST_2ch_modes,
7407 .input_mux = &alc883_capture_source,
7409 [ALC883_ACER_ASPIRE] = {
7410 .mixers = { alc883_acer_aspire_mixer },
7411 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7413 .dac_nids = alc883_dac_nids,
7414 .dig_out_nid = ALC883_DIGOUT_NID,
7415 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7416 .adc_nids = alc883_adc_nids,
7417 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7418 .channel_mode = alc883_3ST_2ch_modes,
7419 .input_mux = &alc883_capture_source,
7420 .unsol_event = alc883_acer_aspire_unsol_event,
7421 .init_hook = alc883_acer_aspire_automute,
7424 .mixers = { alc883_fivestack_mixer,
7425 alc883_chmode_mixer },
7426 .init_verbs = { alc883_init_verbs,
7427 alc883_medion_eapd_verbs },
7428 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7429 .dac_nids = alc883_dac_nids,
7430 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7431 .adc_nids = alc883_adc_nids,
7432 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7433 .channel_mode = alc883_sixstack_modes,
7434 .input_mux = &alc883_capture_source,
7436 [ALC883_MEDION_MD2] = {
7437 .mixers = { alc883_medion_md2_mixer},
7438 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7439 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7440 .dac_nids = alc883_dac_nids,
7441 .dig_out_nid = ALC883_DIGOUT_NID,
7442 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7443 .adc_nids = alc883_adc_nids,
7444 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7445 .channel_mode = alc883_3ST_2ch_modes,
7446 .input_mux = &alc883_capture_source,
7447 .unsol_event = alc883_medion_md2_unsol_event,
7448 .init_hook = alc883_medion_md2_automute,
7450 [ALC883_LAPTOP_EAPD] = {
7451 .mixers = { alc883_base_mixer },
7452 .init_verbs = { alc883_init_verbs, alc882_eapd_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_LENOVO_101E_2ch] = {
7462 .mixers = { alc883_lenovo_101e_2ch_mixer},
7463 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7464 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7465 .dac_nids = alc883_dac_nids,
7466 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7467 .adc_nids = alc883_adc_nids,
7468 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7469 .channel_mode = alc883_3ST_2ch_modes,
7470 .input_mux = &alc883_lenovo_101e_capture_source,
7471 .unsol_event = alc883_lenovo_101e_unsol_event,
7472 .init_hook = alc883_lenovo_101e_all_automute,
7474 [ALC883_LENOVO_NB0763] = {
7475 .mixers = { alc883_lenovo_nb0763_mixer },
7476 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7477 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7478 .dac_nids = alc883_dac_nids,
7479 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7480 .adc_nids = alc883_adc_nids,
7481 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7482 .channel_mode = alc883_3ST_2ch_modes,
7484 .input_mux = &alc883_lenovo_nb0763_capture_source,
7485 .unsol_event = alc883_medion_md2_unsol_event,
7486 .init_hook = alc883_medion_md2_automute,
7488 [ALC888_LENOVO_MS7195_DIG] = {
7489 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7490 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_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_6ch_modes),
7497 .channel_mode = alc883_3ST_6ch_modes,
7499 .input_mux = &alc883_capture_source,
7500 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7501 .init_hook = alc888_lenovo_ms7195_front_automute,
7503 [ALC883_HAIER_W66] = {
7504 .mixers = { alc883_tagra_2ch_mixer},
7505 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7506 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7507 .dac_nids = alc883_dac_nids,
7508 .dig_out_nid = ALC883_DIGOUT_NID,
7509 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7510 .adc_nids = alc883_adc_nids,
7511 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7512 .channel_mode = alc883_3ST_2ch_modes,
7513 .input_mux = &alc883_capture_source,
7514 .unsol_event = alc883_haier_w66_unsol_event,
7515 .init_hook = alc883_haier_w66_automute,
7518 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7519 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7520 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7521 .dac_nids = alc883_dac_nids,
7522 .dig_out_nid = ALC883_DIGOUT_NID,
7523 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7524 .adc_nids = alc883_adc_nids,
7525 .dig_in_nid = ALC883_DIGIN_NID,
7526 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7527 .channel_mode = alc883_sixstack_modes,
7528 .input_mux = &alc883_capture_source,
7531 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7532 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7534 .dac_nids = alc883_dac_nids,
7535 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7536 .adc_nids = alc883_adc_nids,
7537 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7538 .channel_mode = alc888_3st_hp_modes,
7540 .input_mux = &alc883_capture_source,
7543 .mixers = { alc883_mitac_mixer },
7544 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
7545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7546 .dac_nids = alc883_dac_nids,
7547 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7548 .adc_nids = alc883_adc_nids,
7549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7550 .channel_mode = alc883_3ST_2ch_modes,
7551 .input_mux = &alc883_capture_source,
7552 .unsol_event = alc883_mitac_unsol_event,
7553 .init_hook = alc883_mitac_automute,
7559 * BIOS auto configuration
7561 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7562 hda_nid_t nid, int pin_type,
7566 struct alc_spec *spec = codec->spec;
7569 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7572 idx = spec->multiout.dac_nids[dac_idx] - 2;
7574 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7576 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7578 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7582 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7584 struct alc_spec *spec = codec->spec;
7587 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7588 for (i = 0; i <= HDA_SIDE; i++) {
7589 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7590 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7592 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7597 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7599 struct alc_spec *spec = codec->spec;
7602 pin = spec->autocfg.hp_pins[0];
7603 if (pin) /* connect to front */
7605 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7608 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7609 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7611 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7613 struct alc_spec *spec = codec->spec;
7616 for (i = 0; i < AUTO_PIN_LAST; i++) {
7617 hda_nid_t nid = spec->autocfg.input_pins[i];
7618 if (alc883_is_input_pin(nid)) {
7619 snd_hda_codec_write(codec, nid, 0,
7620 AC_VERB_SET_PIN_WIDGET_CONTROL,
7621 (i <= AUTO_PIN_FRONT_MIC ?
7622 PIN_VREF80 : PIN_IN));
7623 if (nid != ALC883_PIN_CD_NID)
7624 snd_hda_codec_write(codec, nid, 0,
7625 AC_VERB_SET_AMP_GAIN_MUTE,
7631 /* almost identical with ALC880 parser... */
7632 static int alc883_parse_auto_config(struct hda_codec *codec)
7634 struct alc_spec *spec = codec->spec;
7635 int err = alc880_parse_auto_config(codec);
7640 return 0; /* no config found */
7642 err = alc_auto_add_mic_boost(codec);
7646 /* hack - override the init verbs */
7647 spec->init_verbs[0] = alc883_auto_init_verbs;
7648 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7651 return 1; /* config found */
7654 /* additional initialization for auto-configuration model */
7655 static void alc883_auto_init(struct hda_codec *codec)
7657 alc883_auto_init_multi_out(codec);
7658 alc883_auto_init_hp_out(codec);
7659 alc883_auto_init_analog_input(codec);
7662 static int patch_alc883(struct hda_codec *codec)
7664 struct alc_spec *spec;
7665 int err, board_config;
7667 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7673 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7676 if (board_config < 0) {
7677 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7678 "trying auto-probe from BIOS...\n");
7679 board_config = ALC883_AUTO;
7682 if (board_config == ALC883_AUTO) {
7683 /* automatic parse from the BIOS config */
7684 err = alc883_parse_auto_config(codec);
7690 "hda_codec: Cannot set up configuration "
7691 "from BIOS. Using base mode...\n");
7692 board_config = ALC883_3ST_2ch_DIG;
7696 if (board_config != ALC883_AUTO)
7697 setup_preset(spec, &alc883_presets[board_config]);
7699 spec->stream_name_analog = "ALC883 Analog";
7700 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7701 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7703 spec->stream_name_digital = "ALC883 Digital";
7704 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7705 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7707 if (!spec->adc_nids && spec->input_mux) {
7708 spec->adc_nids = alc883_adc_nids;
7709 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7712 codec->patch_ops = alc_patch_ops;
7713 if (board_config == ALC883_AUTO)
7714 spec->init_hook = alc883_auto_init;
7715 #ifdef CONFIG_SND_HDA_POWER_SAVE
7716 if (!spec->loopback.amplist)
7717 spec->loopback.amplist = alc883_loopbacks;
7727 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7728 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7730 #define alc262_dac_nids alc260_dac_nids
7731 #define alc262_adc_nids alc882_adc_nids
7732 #define alc262_adc_nids_alt alc882_adc_nids_alt
7734 #define alc262_modes alc260_modes
7735 #define alc262_capture_source alc882_capture_source
7737 static struct snd_kcontrol_new alc262_base_mixer[] = {
7738 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7739 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7740 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7741 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7743 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7748 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7749 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7750 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7751 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7754 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7755 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7759 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7761 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7762 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7763 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7765 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7769 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7771 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7772 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7773 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7774 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7779 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7783 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7784 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7789 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7791 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7792 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7793 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7794 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7795 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7796 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7797 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7798 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7799 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7803 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7804 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7805 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7808 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7809 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7814 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7815 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7816 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7817 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7818 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7822 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7823 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7824 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7825 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7829 static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = {
7830 .ops = &snd_hda_bind_vol,
7832 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7833 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7838 static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = {
7839 .ops = &snd_hda_bind_sw,
7841 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7842 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7847 /* mute/unmute internal speaker according to the hp jack and mute state */
7848 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
7850 struct alc_spec *spec = codec->spec;
7853 if (force || !spec->sense_updated) {
7854 unsigned int present;
7855 present = snd_hda_codec_read(codec, 0x15, 0,
7856 AC_VERB_GET_PIN_SENSE, 0);
7857 spec->jack_present = (present & 0x80000000) != 0;
7858 spec->sense_updated = 1;
7860 if (spec->jack_present)
7861 mute = (0x7080 | ((0)<<8)); /* mute internal speaker */
7862 else /* unmute internal speaker if necessary */
7863 mute = (0x7000 | ((0)<<8));
7864 snd_hda_codec_write(codec, 0x0c, 0,
7865 AC_VERB_SET_AMP_GAIN_MUTE, mute );
7868 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
7871 if ((res >> 26) != ALC880_HP_EVENT)
7873 alc262_hp_t5735_automute(codec, 1);
7876 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
7878 alc262_hp_t5735_automute(codec, 1);
7881 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
7882 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol),
7883 HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw),
7884 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7885 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7886 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7887 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7896 static struct hda_verb alc262_hp_t5735_verbs[] = {
7897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7900 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7904 /* bind hp and internal speaker mute (with plug check) */
7905 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
7906 struct snd_ctl_elem_value *ucontrol)
7908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7909 long *valp = ucontrol->value.integer.value;
7912 /* change hp mute */
7913 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7915 valp[0] ? 0 : HDA_AMP_MUTE);
7916 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7918 valp[1] ? 0 : HDA_AMP_MUTE);
7920 /* change speaker according to HP jack state */
7921 struct alc_spec *spec = codec->spec;
7923 if (spec->jack_present)
7924 mute = HDA_AMP_MUTE;
7926 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
7928 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7929 HDA_AMP_MUTE, mute);
7934 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7935 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7938 .name = "Master Playback Switch",
7939 .info = snd_hda_mixer_amp_switch_info,
7940 .get = snd_hda_mixer_amp_switch_get,
7941 .put = alc262_sony_master_sw_put,
7942 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7944 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7945 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7946 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7947 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7951 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7952 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7953 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7954 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7957 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7958 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7962 #define alc262_capture_mixer alc882_capture_mixer
7963 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7966 * generic initialization of ADC, input mixers and output mixers
7968 static struct hda_verb alc262_init_verbs[] = {
7970 * Unmute ADC0-2 and set the default input to mic-in
7972 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7979 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7981 * Note: PASD motherboards uses the Line In 2 as the input for
7982 * front panel mic (mic 2)
7984 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7992 * Set up output mixers (0x0c - 0x0e)
7994 /* set vol=0 to output mixers */
7995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7996 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7997 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7998 /* set up input amps for analog loopback */
7999 /* Amp Indices: DAC = 0, mixer = 1 */
8000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8009 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8012 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8020 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8023 /* FIXME: use matrix-type input source selection */
8024 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8025 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8044 static struct hda_verb alc262_hippo_unsol_verbs[] = {
8045 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8046 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8050 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
8051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8052 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8053 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
8055 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8056 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8060 static struct hda_verb alc262_sony_unsol_verbs[] = {
8061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8062 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
8065 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8069 /* mute/unmute internal speaker according to the hp jack and mute state */
8070 static void alc262_hippo_automute(struct hda_codec *codec)
8072 struct alc_spec *spec = codec->spec;
8074 unsigned int present;
8076 /* need to execute and sync at first */
8077 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8078 present = snd_hda_codec_read(codec, 0x15, 0,
8079 AC_VERB_GET_PIN_SENSE, 0);
8080 spec->jack_present = (present & 0x80000000) != 0;
8081 if (spec->jack_present) {
8082 /* mute internal speaker */
8083 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8084 HDA_AMP_MUTE, HDA_AMP_MUTE);
8086 /* unmute internal speaker if necessary */
8087 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8088 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8089 HDA_AMP_MUTE, mute);
8093 /* unsolicited event for HP jack sensing */
8094 static void alc262_hippo_unsol_event(struct hda_codec *codec,
8097 if ((res >> 26) != ALC880_HP_EVENT)
8099 alc262_hippo_automute(codec);
8102 static void alc262_hippo1_automute(struct hda_codec *codec)
8105 unsigned int present;
8107 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8108 present = snd_hda_codec_read(codec, 0x1b, 0,
8109 AC_VERB_GET_PIN_SENSE, 0);
8110 present = (present & 0x80000000) != 0;
8112 /* mute internal speaker */
8113 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8114 HDA_AMP_MUTE, HDA_AMP_MUTE);
8116 /* unmute internal speaker if necessary */
8117 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8118 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8119 HDA_AMP_MUTE, mute);
8123 /* unsolicited event for HP jack sensing */
8124 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8127 if ((res >> 26) != ALC880_HP_EVENT)
8129 alc262_hippo1_automute(codec);
8134 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8137 #define ALC_HP_EVENT 0x37
8139 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8140 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8141 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8145 static struct hda_input_mux alc262_fujitsu_capture_source = {
8154 static struct hda_input_mux alc262_HP_capture_source = {
8158 { "Front Mic", 0x1 },
8165 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8169 { "Front Mic", 0x2 },
8175 /* mute/unmute internal speaker according to the hp jack and mute state */
8176 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8178 struct alc_spec *spec = codec->spec;
8181 if (force || !spec->sense_updated) {
8182 unsigned int present;
8183 /* need to execute and sync at first */
8184 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8185 present = snd_hda_codec_read(codec, 0x14, 0,
8186 AC_VERB_GET_PIN_SENSE, 0);
8187 spec->jack_present = (present & 0x80000000) != 0;
8188 spec->sense_updated = 1;
8190 if (spec->jack_present) {
8191 /* mute internal speaker */
8192 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8193 HDA_AMP_MUTE, HDA_AMP_MUTE);
8195 /* unmute internal speaker if necessary */
8196 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8197 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8198 HDA_AMP_MUTE, mute);
8202 /* unsolicited event for HP jack sensing */
8203 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8206 if ((res >> 26) != ALC_HP_EVENT)
8208 alc262_fujitsu_automute(codec, 1);
8211 /* bind volumes of both NID 0x0c and 0x0d */
8212 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8213 .ops = &snd_hda_bind_vol,
8215 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8216 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8221 /* bind hp and internal speaker mute (with plug check) */
8222 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8223 struct snd_ctl_elem_value *ucontrol)
8225 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8226 long *valp = ucontrol->value.integer.value;
8229 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8231 valp[0] ? 0 : HDA_AMP_MUTE);
8232 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8234 valp[1] ? 0 : HDA_AMP_MUTE);
8236 alc262_fujitsu_automute(codec, 0);
8240 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8241 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8243 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8244 .name = "Master Playback Switch",
8245 .info = snd_hda_mixer_amp_switch_info,
8246 .get = snd_hda_mixer_amp_switch_get,
8247 .put = alc262_fujitsu_master_sw_put,
8248 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8250 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8251 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8257 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8261 /* additional init verbs for Benq laptops */
8262 static struct hda_verb alc262_EAPD_verbs[] = {
8263 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8264 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8268 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8269 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8270 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8272 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8273 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8277 /* Samsung Q1 Ultra Vista model setup */
8278 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8279 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8280 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8281 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8284 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8288 static struct hda_verb alc262_ultra_verbs[] = {
8289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8292 /* Mic is on Node 0x19 */
8293 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8294 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8295 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8296 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8298 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8303 static struct hda_input_mux alc262_ultra_capture_source = {
8310 /* mute/unmute internal speaker according to the hp jack and mute state */
8311 static void alc262_ultra_automute(struct hda_codec *codec)
8313 struct alc_spec *spec = codec->spec;
8315 unsigned int present;
8317 /* need to execute and sync at first */
8318 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8319 present = snd_hda_codec_read(codec, 0x15, 0,
8320 AC_VERB_GET_PIN_SENSE, 0);
8321 spec->jack_present = (present & 0x80000000) != 0;
8322 if (spec->jack_present) {
8323 /* mute internal speaker */
8324 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8325 HDA_AMP_MUTE, HDA_AMP_MUTE);
8327 /* unmute internal speaker if necessary */
8328 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8329 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8330 HDA_AMP_MUTE, mute);
8334 /* unsolicited event for HP jack sensing */
8335 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8338 if ((res >> 26) != ALC880_HP_EVENT)
8340 alc262_ultra_automute(codec);
8343 /* add playback controls from the parsed DAC table */
8344 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8345 const struct auto_pin_cfg *cfg)
8350 spec->multiout.num_dacs = 1; /* only use one dac */
8351 spec->multiout.dac_nids = spec->private_dac_nids;
8352 spec->multiout.dac_nids[0] = 2;
8354 nid = cfg->line_out_pins[0];
8356 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8357 "Front Playback Volume",
8358 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8361 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8362 "Front Playback Switch",
8363 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8368 nid = cfg->speaker_pins[0];
8371 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8372 "Speaker Playback Volume",
8373 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8377 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8378 "Speaker Playback Switch",
8379 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8384 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8385 "Speaker Playback Switch",
8386 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8392 nid = cfg->hp_pins[0];
8394 /* spec->multiout.hp_nid = 2; */
8396 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8397 "Headphone Playback Volume",
8398 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8402 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8403 "Headphone Playback Switch",
8404 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8409 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8410 "Headphone Playback Switch",
8411 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8420 /* identical with ALC880 */
8421 #define alc262_auto_create_analog_input_ctls \
8422 alc880_auto_create_analog_input_ctls
8425 * generic initialization of ADC, input mixers and output mixers
8427 static struct hda_verb alc262_volume_init_verbs[] = {
8429 * Unmute ADC0-2 and set the default input to mic-in
8431 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8433 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8434 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8435 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8438 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8440 * Note: PASD motherboards uses the Line In 2 as the input for
8441 * front panel mic (mic 2)
8443 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8451 * Set up output mixers (0x0c - 0x0f)
8453 /* set vol=0 to output mixers */
8454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8455 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8456 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8458 /* set up input amps for analog loopback */
8459 /* Amp Indices: DAC = 0, mixer = 1 */
8460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8461 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 /* FIXME: use matrix-type input source selection */
8468 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8469 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8488 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8490 * Unmute ADC0-2 and set the default input to mic-in
8492 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8494 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8496 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8499 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8501 * Note: PASD motherboards uses the Line In 2 as the input for
8502 * front panel mic (mic 2)
8504 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8514 * Set up output mixers (0x0c - 0x0e)
8516 /* set vol=0 to output mixers */
8517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8521 /* set up input amps for analog loopback */
8522 /* Amp Indices: DAC = 0, mixer = 1 */
8523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8541 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8542 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8544 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8546 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8548 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8550 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8551 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8554 /* FIXME: use matrix-type input source selection */
8555 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8556 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8559 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8560 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8575 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8577 * Unmute ADC0-2 and set the default input to mic-in
8579 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8581 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8582 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8583 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8584 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8586 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8588 * Note: PASD motherboards uses the Line In 2 as the input for front
8591 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8601 * Set up output mixers (0x0c - 0x0e)
8603 /* set vol=0 to output mixers */
8604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8608 /* set up input amps for analog loopback */
8609 /* Amp Indices: DAC = 0, mixer = 1 */
8610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8612 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8613 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8615 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8619 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8622 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8623 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8624 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8626 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8629 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8632 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8634 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8636 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8637 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8639 /* FIXME: use matrix-type input source selection */
8640 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8641 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8647 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8655 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8656 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8663 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8669 #ifdef CONFIG_SND_HDA_POWER_SAVE
8670 #define alc262_loopbacks alc880_loopbacks
8673 /* pcm configuration: identiacal with ALC880 */
8674 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8675 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8676 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8677 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8680 * BIOS auto configuration
8682 static int alc262_parse_auto_config(struct hda_codec *codec)
8684 struct alc_spec *spec = codec->spec;
8686 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8688 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8692 if (!spec->autocfg.line_outs)
8693 return 0; /* can't find valid BIOS pin config */
8694 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8697 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8701 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8703 if (spec->autocfg.dig_out_pin)
8704 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8705 if (spec->autocfg.dig_in_pin)
8706 spec->dig_in_nid = ALC262_DIGIN_NID;
8708 if (spec->kctl_alloc)
8709 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8711 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8712 spec->num_mux_defs = 1;
8713 spec->input_mux = &spec->private_imux;
8715 err = alc_auto_add_mic_boost(codec);
8722 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8723 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8724 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8727 /* init callback for auto-configuration model -- overriding the default init */
8728 static void alc262_auto_init(struct hda_codec *codec)
8730 alc262_auto_init_multi_out(codec);
8731 alc262_auto_init_hp_out(codec);
8732 alc262_auto_init_analog_input(codec);
8736 * configuration and preset
8738 static const char *alc262_models[ALC262_MODEL_LAST] = {
8739 [ALC262_BASIC] = "basic",
8740 [ALC262_HIPPO] = "hippo",
8741 [ALC262_HIPPO_1] = "hippo_1",
8742 [ALC262_FUJITSU] = "fujitsu",
8743 [ALC262_HP_BPC] = "hp-bpc",
8744 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8745 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
8746 [ALC262_BENQ_ED8] = "benq",
8747 [ALC262_BENQ_T31] = "benq-t31",
8748 [ALC262_SONY_ASSAMD] = "sony-assamd",
8749 [ALC262_ULTRA] = "ultra",
8750 [ALC262_AUTO] = "auto",
8753 static struct snd_pci_quirk alc262_cfg_tbl[] = {
8754 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
8755 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
8756 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
8757 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
8758 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
8759 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
8760 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
8761 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
8762 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
8763 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
8764 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
8765 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
8766 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
8767 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
8768 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
8769 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
8770 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
8771 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
8772 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
8773 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
8774 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
8775 ALC262_HP_TC_T5735),
8776 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
8777 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
8778 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
8779 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
8780 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
8781 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8782 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
8783 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8784 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8785 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
8789 static struct alc_config_preset alc262_presets[] = {
8791 .mixers = { alc262_base_mixer },
8792 .init_verbs = { alc262_init_verbs },
8793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8794 .dac_nids = alc262_dac_nids,
8796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8797 .channel_mode = alc262_modes,
8798 .input_mux = &alc262_capture_source,
8801 .mixers = { alc262_base_mixer },
8802 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8803 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8804 .dac_nids = alc262_dac_nids,
8806 .dig_out_nid = ALC262_DIGOUT_NID,
8807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8808 .channel_mode = alc262_modes,
8809 .input_mux = &alc262_capture_source,
8810 .unsol_event = alc262_hippo_unsol_event,
8811 .init_hook = alc262_hippo_automute,
8813 [ALC262_HIPPO_1] = {
8814 .mixers = { alc262_hippo1_mixer },
8815 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8816 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8817 .dac_nids = alc262_dac_nids,
8819 .dig_out_nid = ALC262_DIGOUT_NID,
8820 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8821 .channel_mode = alc262_modes,
8822 .input_mux = &alc262_capture_source,
8823 .unsol_event = alc262_hippo1_unsol_event,
8824 .init_hook = alc262_hippo1_automute,
8826 [ALC262_FUJITSU] = {
8827 .mixers = { alc262_fujitsu_mixer },
8828 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
8829 alc262_fujitsu_unsol_verbs },
8830 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8831 .dac_nids = alc262_dac_nids,
8833 .dig_out_nid = ALC262_DIGOUT_NID,
8834 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8835 .channel_mode = alc262_modes,
8836 .input_mux = &alc262_fujitsu_capture_source,
8837 .unsol_event = alc262_fujitsu_unsol_event,
8840 .mixers = { alc262_HP_BPC_mixer },
8841 .init_verbs = { alc262_HP_BPC_init_verbs },
8842 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8843 .dac_nids = alc262_dac_nids,
8845 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8846 .channel_mode = alc262_modes,
8847 .input_mux = &alc262_HP_capture_source,
8849 [ALC262_HP_BPC_D7000_WF] = {
8850 .mixers = { alc262_HP_BPC_WildWest_mixer },
8851 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8852 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8853 .dac_nids = alc262_dac_nids,
8855 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8856 .channel_mode = alc262_modes,
8857 .input_mux = &alc262_HP_D7000_capture_source,
8859 [ALC262_HP_BPC_D7000_WL] = {
8860 .mixers = { alc262_HP_BPC_WildWest_mixer,
8861 alc262_HP_BPC_WildWest_option_mixer },
8862 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8863 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8864 .dac_nids = alc262_dac_nids,
8866 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8867 .channel_mode = alc262_modes,
8868 .input_mux = &alc262_HP_D7000_capture_source,
8870 [ALC262_HP_TC_T5735] = {
8871 .mixers = { alc262_hp_t5735_mixer },
8872 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
8873 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8874 .dac_nids = alc262_dac_nids,
8876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8877 .channel_mode = alc262_modes,
8878 .input_mux = &alc262_capture_source,
8879 .unsol_event = alc262_hp_t5735_unsol_event,
8880 .init_hook = alc262_hp_t5735_init_hook,
8882 [ALC262_BENQ_ED8] = {
8883 .mixers = { alc262_base_mixer },
8884 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
8885 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8886 .dac_nids = alc262_dac_nids,
8888 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8889 .channel_mode = alc262_modes,
8890 .input_mux = &alc262_capture_source,
8892 [ALC262_SONY_ASSAMD] = {
8893 .mixers = { alc262_sony_mixer },
8894 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
8895 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8896 .dac_nids = alc262_dac_nids,
8898 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8899 .channel_mode = alc262_modes,
8900 .input_mux = &alc262_capture_source,
8901 .unsol_event = alc262_hippo_unsol_event,
8902 .init_hook = alc262_hippo_automute,
8904 [ALC262_BENQ_T31] = {
8905 .mixers = { alc262_benq_t31_mixer },
8906 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
8907 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8908 .dac_nids = alc262_dac_nids,
8910 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8911 .channel_mode = alc262_modes,
8912 .input_mux = &alc262_capture_source,
8913 .unsol_event = alc262_hippo_unsol_event,
8914 .init_hook = alc262_hippo_automute,
8917 .mixers = { alc262_ultra_mixer },
8918 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
8919 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8920 .dac_nids = alc262_dac_nids,
8922 .dig_out_nid = ALC262_DIGOUT_NID,
8923 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8924 .channel_mode = alc262_modes,
8925 .input_mux = &alc262_ultra_capture_source,
8926 .unsol_event = alc262_ultra_unsol_event,
8927 .init_hook = alc262_ultra_automute,
8931 static int patch_alc262(struct hda_codec *codec)
8933 struct alc_spec *spec;
8937 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8943 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8948 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8949 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8950 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8951 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8955 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8959 if (board_config < 0) {
8960 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8961 "trying auto-probe from BIOS...\n");
8962 board_config = ALC262_AUTO;
8965 if (board_config == ALC262_AUTO) {
8966 /* automatic parse from the BIOS config */
8967 err = alc262_parse_auto_config(codec);
8973 "hda_codec: Cannot set up configuration "
8974 "from BIOS. Using base mode...\n");
8975 board_config = ALC262_BASIC;
8979 if (board_config != ALC262_AUTO)
8980 setup_preset(spec, &alc262_presets[board_config]);
8982 spec->stream_name_analog = "ALC262 Analog";
8983 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8984 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8986 spec->stream_name_digital = "ALC262 Digital";
8987 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8988 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8990 if (!spec->adc_nids && spec->input_mux) {
8991 /* check whether NID 0x07 is valid */
8992 unsigned int wcap = get_wcaps(codec, 0x07);
8995 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8996 if (wcap != AC_WID_AUD_IN) {
8997 spec->adc_nids = alc262_adc_nids_alt;
8998 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8999 spec->mixers[spec->num_mixers] =
9000 alc262_capture_alt_mixer;
9003 spec->adc_nids = alc262_adc_nids;
9004 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
9005 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
9010 codec->patch_ops = alc_patch_ops;
9011 if (board_config == ALC262_AUTO)
9012 spec->init_hook = alc262_auto_init;
9013 #ifdef CONFIG_SND_HDA_POWER_SAVE
9014 if (!spec->loopback.amplist)
9015 spec->loopback.amplist = alc262_loopbacks;
9022 * ALC268 channel source setting (2 channel)
9024 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9025 #define alc268_modes alc260_modes
9027 static hda_nid_t alc268_dac_nids[2] = {
9032 static hda_nid_t alc268_adc_nids[2] = {
9037 static hda_nid_t alc268_adc_nids_alt[1] = {
9042 static struct snd_kcontrol_new alc268_base_mixer[] = {
9043 /* output mixer control */
9044 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
9045 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9046 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
9047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9049 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9050 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9054 static struct hda_verb alc268_eapd_verbs[] = {
9055 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9056 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9060 /* Toshiba specific */
9061 #define alc268_toshiba_automute alc262_hippo_automute
9063 static struct hda_verb alc268_toshiba_verbs[] = {
9064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9069 /* bind volumes of both NID 0x02 and 0x03 */
9070 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
9071 .ops = &snd_hda_bind_vol,
9073 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
9074 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
9079 /* mute/unmute internal speaker according to the hp jack and mute state */
9080 static void alc268_acer_automute(struct hda_codec *codec, int force)
9082 struct alc_spec *spec = codec->spec;
9085 if (force || !spec->sense_updated) {
9086 unsigned int present;
9087 present = snd_hda_codec_read(codec, 0x14, 0,
9088 AC_VERB_GET_PIN_SENSE, 0);
9089 spec->jack_present = (present & 0x80000000) != 0;
9090 spec->sense_updated = 1;
9092 if (spec->jack_present)
9093 mute = HDA_AMP_MUTE; /* mute internal speaker */
9094 else /* unmute internal speaker if necessary */
9095 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
9096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9097 HDA_AMP_MUTE, mute);
9101 /* bind hp and internal speaker mute (with plug check) */
9102 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
9103 struct snd_ctl_elem_value *ucontrol)
9105 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9106 long *valp = ucontrol->value.integer.value;
9109 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9111 valp[0] ? 0 : HDA_AMP_MUTE);
9112 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9114 valp[1] ? 0 : HDA_AMP_MUTE);
9116 alc268_acer_automute(codec, 0);
9120 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9121 /* output mixer control */
9122 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9125 .name = "Master Playback Switch",
9126 .info = snd_hda_mixer_amp_switch_info,
9127 .get = snd_hda_mixer_amp_switch_get,
9128 .put = alc268_acer_master_sw_put,
9129 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9132 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9133 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9137 static struct hda_verb alc268_acer_verbs[] = {
9138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9141 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9145 /* unsolicited event for HP jack sensing */
9146 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9149 if ((res >> 26) != ALC880_HP_EVENT)
9151 alc268_toshiba_automute(codec);
9154 static void alc268_acer_unsol_event(struct hda_codec *codec,
9157 if ((res >> 26) != ALC880_HP_EVENT)
9159 alc268_acer_automute(codec, 1);
9162 static void alc268_acer_init_hook(struct hda_codec *codec)
9164 alc268_acer_automute(codec, 1);
9168 * generic initialization of ADC, input mixers and output mixers
9170 static struct hda_verb alc268_base_init_verbs[] = {
9171 /* Unmute DAC0-1 and set vol = 0 */
9172 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9173 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9174 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9175 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9176 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9177 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9180 * Set up output mixers (0x0c - 0x0e)
9182 /* set vol=0 to output mixers */
9183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9184 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9186 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9189 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9193 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9194 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9197 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9198 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9200 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9202 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9203 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9204 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9205 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9206 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9207 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9209 /* FIXME: use matrix-type input source selection */
9210 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
9211 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9213 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9214 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9215 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9216 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9226 * generic initialization of ADC, input mixers and output mixers
9228 static struct hda_verb alc268_volume_init_verbs[] = {
9229 /* set output DAC */
9230 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9231 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9232 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9233 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9235 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9236 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9237 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9238 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9239 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9241 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9242 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9244 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9245 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9248 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9249 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9250 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9252 /* set PCBEEP vol = 0 */
9253 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9258 #define alc268_mux_enum_info alc_mux_enum_info
9259 #define alc268_mux_enum_get alc_mux_enum_get
9261 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9262 struct snd_ctl_elem_value *ucontrol)
9264 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9265 struct alc_spec *spec = codec->spec;
9266 const struct hda_input_mux *imux = spec->input_mux;
9267 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9268 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9269 hda_nid_t nid = capture_mixers[adc_idx];
9270 unsigned int *cur_val = &spec->cur_mux[adc_idx];
9271 unsigned int i, idx;
9273 idx = ucontrol->value.enumerated.item[0];
9274 if (idx >= imux->num_items)
9275 idx = imux->num_items - 1;
9276 if (*cur_val == idx)
9278 for (i = 0; i < imux->num_items; i++) {
9279 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
9280 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
9281 imux->items[i].index,
9283 snd_hda_codec_write_cache(codec, nid, 0,
9284 AC_VERB_SET_CONNECT_SEL,
9291 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9292 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9293 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9296 /* The multiple "Capture Source" controls confuse alsamixer
9297 * So call somewhat different..
9298 * FIXME: the controls appear in the "playback" view!
9300 /* .name = "Capture Source", */
9301 .name = "Input Source",
9303 .info = alc268_mux_enum_info,
9304 .get = alc268_mux_enum_get,
9305 .put = alc268_mux_enum_put,
9310 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9311 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9312 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9313 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9314 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9317 /* The multiple "Capture Source" controls confuse alsamixer
9318 * So call somewhat different..
9319 * FIXME: the controls appear in the "playback" view!
9321 /* .name = "Capture Source", */
9322 .name = "Input Source",
9324 .info = alc268_mux_enum_info,
9325 .get = alc268_mux_enum_get,
9326 .put = alc268_mux_enum_put,
9331 static struct hda_input_mux alc268_capture_source = {
9335 { "Front Mic", 0x1 },
9341 /* create input playback/capture controls for the given pin */
9342 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9343 const char *ctlname, int idx)
9348 sprintf(name, "%s Playback Volume", ctlname);
9350 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9351 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9355 } else if (nid == 0x15) {
9356 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9357 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9363 sprintf(name, "%s Playback Switch", ctlname);
9364 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9365 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9371 /* add playback controls from the parsed DAC table */
9372 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9373 const struct auto_pin_cfg *cfg)
9378 spec->multiout.num_dacs = 2; /* only use one dac */
9379 spec->multiout.dac_nids = spec->private_dac_nids;
9380 spec->multiout.dac_nids[0] = 2;
9381 spec->multiout.dac_nids[1] = 3;
9383 nid = cfg->line_out_pins[0];
9385 alc268_new_analog_output(spec, nid, "Front", 0);
9387 nid = cfg->speaker_pins[0];
9389 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9390 "Speaker Playback Volume",
9391 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9395 nid = cfg->hp_pins[0];
9397 alc268_new_analog_output(spec, nid, "Headphone", 0);
9399 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9401 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9402 "Mono Playback Switch",
9403 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9410 /* create playback/capture controls for input pins */
9411 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9412 const struct auto_pin_cfg *cfg)
9414 struct hda_input_mux *imux = &spec->private_imux;
9417 for (i = 0; i < AUTO_PIN_LAST; i++) {
9418 switch(cfg->input_pins[i]) {
9420 idx1 = 0; /* Mic 1 */
9423 idx1 = 1; /* Mic 2 */
9426 idx1 = 2; /* Line In */
9434 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9435 imux->items[imux->num_items].index = idx1;
9441 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9443 struct alc_spec *spec = codec->spec;
9444 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9445 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9446 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9447 unsigned int dac_vol1, dac_vol2;
9450 snd_hda_codec_write(codec, speaker_nid, 0,
9451 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9452 snd_hda_codec_write(codec, 0x0f, 0,
9453 AC_VERB_SET_AMP_GAIN_MUTE,
9455 snd_hda_codec_write(codec, 0x10, 0,
9456 AC_VERB_SET_AMP_GAIN_MUTE,
9459 snd_hda_codec_write(codec, 0x0f, 0,
9460 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9461 snd_hda_codec_write(codec, 0x10, 0,
9462 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9465 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9466 if (line_nid == 0x14)
9467 dac_vol2 = AMP_OUT_ZERO;
9468 else if (line_nid == 0x15)
9469 dac_vol1 = AMP_OUT_ZERO;
9471 dac_vol2 = AMP_OUT_ZERO;
9472 else if (hp_nid == 0x15)
9473 dac_vol1 = AMP_OUT_ZERO;
9474 if (line_nid != 0x16 || hp_nid != 0x16 ||
9475 spec->autocfg.line_out_pins[1] != 0x16 ||
9476 spec->autocfg.line_out_pins[2] != 0x16)
9477 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9479 snd_hda_codec_write(codec, 0x02, 0,
9480 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9481 snd_hda_codec_write(codec, 0x03, 0,
9482 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9485 /* pcm configuration: identiacal with ALC880 */
9486 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9487 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9488 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9491 * BIOS auto configuration
9493 static int alc268_parse_auto_config(struct hda_codec *codec)
9495 struct alc_spec *spec = codec->spec;
9497 static hda_nid_t alc268_ignore[] = { 0 };
9499 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9503 if (!spec->autocfg.line_outs)
9504 return 0; /* can't find valid BIOS pin config */
9506 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9509 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9513 spec->multiout.max_channels = 2;
9515 /* digital only support output */
9516 if (spec->autocfg.dig_out_pin)
9517 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9519 if (spec->kctl_alloc)
9520 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9522 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9523 spec->num_mux_defs = 1;
9524 spec->input_mux = &spec->private_imux;
9526 err = alc_auto_add_mic_boost(codec);
9533 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9534 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9535 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9537 /* init callback for auto-configuration model -- overriding the default init */
9538 static void alc268_auto_init(struct hda_codec *codec)
9540 alc268_auto_init_multi_out(codec);
9541 alc268_auto_init_hp_out(codec);
9542 alc268_auto_init_mono_speaker_out(codec);
9543 alc268_auto_init_analog_input(codec);
9547 * configuration and preset
9549 static const char *alc268_models[ALC268_MODEL_LAST] = {
9550 [ALC268_3ST] = "3stack",
9551 [ALC268_TOSHIBA] = "toshiba",
9552 [ALC268_ACER] = "acer",
9553 [ALC268_AUTO] = "auto",
9556 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9557 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9558 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9559 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9560 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9561 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9562 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9563 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9567 static struct alc_config_preset alc268_presets[] = {
9569 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9570 .init_verbs = { alc268_base_init_verbs },
9571 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9572 .dac_nids = alc268_dac_nids,
9573 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9574 .adc_nids = alc268_adc_nids_alt,
9576 .dig_out_nid = ALC268_DIGOUT_NID,
9577 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9578 .channel_mode = alc268_modes,
9579 .input_mux = &alc268_capture_source,
9581 [ALC268_TOSHIBA] = {
9582 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9583 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9584 alc268_toshiba_verbs },
9585 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9586 .dac_nids = alc268_dac_nids,
9587 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9588 .adc_nids = alc268_adc_nids_alt,
9590 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9591 .channel_mode = alc268_modes,
9592 .input_mux = &alc268_capture_source,
9593 .unsol_event = alc268_toshiba_unsol_event,
9594 .init_hook = alc268_toshiba_automute,
9597 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9598 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9599 alc268_acer_verbs },
9600 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9601 .dac_nids = alc268_dac_nids,
9602 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9603 .adc_nids = alc268_adc_nids_alt,
9605 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9606 .channel_mode = alc268_modes,
9607 .input_mux = &alc268_capture_source,
9608 .unsol_event = alc268_acer_unsol_event,
9609 .init_hook = alc268_acer_init_hook,
9613 static int patch_alc268(struct hda_codec *codec)
9615 struct alc_spec *spec;
9619 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
9625 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
9629 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
9630 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
9631 "trying auto-probe from BIOS...\n");
9632 board_config = ALC268_AUTO;
9635 if (board_config == ALC268_AUTO) {
9636 /* automatic parse from the BIOS config */
9637 err = alc268_parse_auto_config(codec);
9643 "hda_codec: Cannot set up configuration "
9644 "from BIOS. Using base mode...\n");
9645 board_config = ALC268_3ST;
9649 if (board_config != ALC268_AUTO)
9650 setup_preset(spec, &alc268_presets[board_config]);
9652 spec->stream_name_analog = "ALC268 Analog";
9653 spec->stream_analog_playback = &alc268_pcm_analog_playback;
9654 spec->stream_analog_capture = &alc268_pcm_analog_capture;
9656 spec->stream_name_digital = "ALC268 Digital";
9657 spec->stream_digital_playback = &alc268_pcm_digital_playback;
9659 if (board_config == ALC268_AUTO) {
9660 if (!spec->adc_nids && spec->input_mux) {
9661 /* check whether NID 0x07 is valid */
9662 unsigned int wcap = get_wcaps(codec, 0x07);
9665 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9666 if (wcap != AC_WID_AUD_IN) {
9667 spec->adc_nids = alc268_adc_nids_alt;
9668 spec->num_adc_nids =
9669 ARRAY_SIZE(alc268_adc_nids_alt);
9670 spec->mixers[spec->num_mixers] =
9671 alc268_capture_alt_mixer;
9674 spec->adc_nids = alc268_adc_nids;
9675 spec->num_adc_nids =
9676 ARRAY_SIZE(alc268_adc_nids);
9677 spec->mixers[spec->num_mixers] =
9678 alc268_capture_mixer;
9683 codec->patch_ops = alc_patch_ops;
9684 if (board_config == ALC268_AUTO)
9685 spec->init_hook = alc268_auto_init;
9691 * ALC269 channel source setting (2 channel)
9693 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
9695 #define alc269_dac_nids alc260_dac_nids
9697 static hda_nid_t alc269_adc_nids[1] = {
9702 #define alc269_modes alc260_modes
9703 #define alc269_capture_source alc880_lg_lw_capture_source
9705 static struct snd_kcontrol_new alc269_base_mixer[] = {
9706 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9707 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9708 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9709 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9710 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9711 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9713 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9714 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9715 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9717 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9721 /* capture mixer elements */
9722 static struct snd_kcontrol_new alc269_capture_mixer[] = {
9723 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9724 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9726 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9727 /* The multiple "Capture Source" controls confuse alsamixer
9728 * So call somewhat different..
9729 * FIXME: the controls appear in the "playback" view!
9731 /* .name = "Capture Source", */
9732 .name = "Input Source",
9734 .info = alc_mux_enum_info,
9735 .get = alc_mux_enum_get,
9736 .put = alc_mux_enum_put,
9742 * generic initialization of ADC, input mixers and output mixers
9744 static struct hda_verb alc269_init_verbs[] = {
9746 * Unmute ADC0 and set the default input to mic-in
9748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9750 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
9751 * analog-loopback mixer widget
9752 * Note: PASD motherboards uses the Line In 2 as the input for
9753 * front panel mic (mic 2)
9755 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9756 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9763 * Set up output mixers (0x0c - 0x0e)
9765 /* set vol=0 to output mixers */
9766 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9767 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9769 /* set up input amps for analog loopback */
9770 /* Amp Indices: DAC = 0, mixer = 1 */
9771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9773 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9774 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9775 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9776 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9779 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9780 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9783 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9784 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9788 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9790 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9792 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9794 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9795 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9797 /* FIXME: use matrix-type input source selection */
9798 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
9799 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9800 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9801 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9802 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9803 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9806 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9807 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9811 /* add playback controls from the parsed DAC table */
9812 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
9813 const struct auto_pin_cfg *cfg)
9818 spec->multiout.num_dacs = 1; /* only use one dac */
9819 spec->multiout.dac_nids = spec->private_dac_nids;
9820 spec->multiout.dac_nids[0] = 2;
9822 nid = cfg->line_out_pins[0];
9824 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9825 "Front Playback Volume",
9826 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
9829 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9830 "Front Playback Switch",
9831 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9836 nid = cfg->speaker_pins[0];
9838 if (!cfg->line_out_pins[0]) {
9839 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9840 "Speaker Playback Volume",
9841 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9847 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9848 "Speaker Playback Switch",
9849 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9854 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9855 "Speaker Playback Switch",
9856 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9862 nid = cfg->hp_pins[0];
9864 /* spec->multiout.hp_nid = 2; */
9865 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
9866 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9867 "Headphone Playback Volume",
9868 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9874 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9875 "Headphone Playback Switch",
9876 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9881 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9882 "Headphone Playback Switch",
9883 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9892 #define alc269_auto_create_analog_input_ctls \
9893 alc880_auto_create_analog_input_ctls
9895 #ifdef CONFIG_SND_HDA_POWER_SAVE
9896 #define alc269_loopbacks alc880_loopbacks
9899 /* pcm configuration: identiacal with ALC880 */
9900 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
9901 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
9902 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
9903 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
9906 * BIOS auto configuration
9908 static int alc269_parse_auto_config(struct hda_codec *codec)
9910 struct alc_spec *spec = codec->spec;
9912 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
9914 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9919 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
9922 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
9926 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9928 if (spec->autocfg.dig_out_pin)
9929 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
9931 if (spec->kctl_alloc)
9932 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9934 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
9935 spec->num_mux_defs = 1;
9936 spec->input_mux = &spec->private_imux;
9938 err = alc_auto_add_mic_boost(codec);
9945 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
9946 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
9947 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
9950 /* init callback for auto-configuration model -- overriding the default init */
9951 static void alc269_auto_init(struct hda_codec *codec)
9953 alc269_auto_init_multi_out(codec);
9954 alc269_auto_init_hp_out(codec);
9955 alc269_auto_init_analog_input(codec);
9959 * configuration and preset
9961 static const char *alc269_models[ALC269_MODEL_LAST] = {
9962 [ALC269_BASIC] = "basic",
9965 static struct snd_pci_quirk alc269_cfg_tbl[] = {
9969 static struct alc_config_preset alc269_presets[] = {
9971 .mixers = { alc269_base_mixer },
9972 .init_verbs = { alc269_init_verbs },
9973 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
9974 .dac_nids = alc269_dac_nids,
9976 .num_channel_mode = ARRAY_SIZE(alc269_modes),
9977 .channel_mode = alc269_modes,
9978 .input_mux = &alc269_capture_source,
9982 static int patch_alc269(struct hda_codec *codec)
9984 struct alc_spec *spec;
9988 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9994 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
9998 if (board_config < 0) {
9999 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
10000 "trying auto-probe from BIOS...\n");
10001 board_config = ALC269_AUTO;
10004 if (board_config == ALC269_AUTO) {
10005 /* automatic parse from the BIOS config */
10006 err = alc269_parse_auto_config(codec);
10012 "hda_codec: Cannot set up configuration "
10013 "from BIOS. Using base mode...\n");
10014 board_config = ALC269_BASIC;
10018 if (board_config != ALC269_AUTO)
10019 setup_preset(spec, &alc269_presets[board_config]);
10021 spec->stream_name_analog = "ALC269 Analog";
10022 spec->stream_analog_playback = &alc269_pcm_analog_playback;
10023 spec->stream_analog_capture = &alc269_pcm_analog_capture;
10025 spec->stream_name_digital = "ALC269 Digital";
10026 spec->stream_digital_playback = &alc269_pcm_digital_playback;
10027 spec->stream_digital_capture = &alc269_pcm_digital_capture;
10029 spec->adc_nids = alc269_adc_nids;
10030 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
10031 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
10032 spec->num_mixers++;
10034 codec->patch_ops = alc_patch_ops;
10035 if (board_config == ALC269_AUTO)
10036 spec->init_hook = alc269_auto_init;
10037 #ifdef CONFIG_SND_HDA_POWER_SAVE
10038 if (!spec->loopback.amplist)
10039 spec->loopback.amplist = alc269_loopbacks;
10046 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10050 * set the path ways for 2 channel output
10051 * need to set the codec line out and mic 1 pin widgets to inputs
10053 static struct hda_verb alc861_threestack_ch2_init[] = {
10054 /* set pin widget 1Ah (line in) for input */
10055 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10056 /* set pin widget 18h (mic1/2) for input, for mic also enable
10059 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10061 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10063 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10064 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10070 * need to set the codec line out and mic 1 pin widgets to outputs
10072 static struct hda_verb alc861_threestack_ch6_init[] = {
10073 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10074 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10075 /* set pin widget 18h (mic1) for output (CLFE)*/
10076 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10078 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10079 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10081 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10083 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10084 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10089 static struct hda_channel_mode alc861_threestack_modes[2] = {
10090 { 2, alc861_threestack_ch2_init },
10091 { 6, alc861_threestack_ch6_init },
10093 /* Set mic1 as input and unmute the mixer */
10094 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
10095 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10096 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10099 /* Set mic1 as output and mute mixer */
10100 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
10101 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10102 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10106 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10107 { 2, alc861_uniwill_m31_ch2_init },
10108 { 4, alc861_uniwill_m31_ch4_init },
10111 /* Set mic1 and line-in as input and unmute the mixer */
10112 static struct hda_verb alc861_asus_ch2_init[] = {
10113 /* set pin widget 1Ah (line in) for input */
10114 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10115 /* set pin widget 18h (mic1/2) for input, for mic also enable
10118 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10120 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10122 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10123 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10127 /* Set mic1 nad line-in as output and mute mixer */
10128 static struct hda_verb alc861_asus_ch6_init[] = {
10129 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10130 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10131 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10132 /* set pin widget 18h (mic1) for output (CLFE)*/
10133 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10134 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10135 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10136 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10138 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10140 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10141 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10146 static struct hda_channel_mode alc861_asus_modes[2] = {
10147 { 2, alc861_asus_ch2_init },
10148 { 6, alc861_asus_ch6_init },
10153 static struct snd_kcontrol_new alc861_base_mixer[] = {
10154 /* output mixer control */
10155 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10156 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10157 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10158 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10159 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10161 /*Input mixer control */
10162 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10163 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10164 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10165 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10166 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10167 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10169 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10170 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10173 /* Capture mixer control */
10174 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10175 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10177 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10178 .name = "Capture Source",
10180 .info = alc_mux_enum_info,
10181 .get = alc_mux_enum_get,
10182 .put = alc_mux_enum_put,
10187 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10188 /* output mixer control */
10189 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10190 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10191 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10192 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10193 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10195 /* Input mixer control */
10196 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10197 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10198 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10199 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10201 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10203 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10207 /* Capture mixer control */
10208 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10209 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10212 .name = "Capture Source",
10214 .info = alc_mux_enum_info,
10215 .get = alc_mux_enum_get,
10216 .put = alc_mux_enum_put,
10219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10220 .name = "Channel Mode",
10221 .info = alc_ch_mode_info,
10222 .get = alc_ch_mode_get,
10223 .put = alc_ch_mode_put,
10224 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10229 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10230 /* output mixer control */
10231 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10233 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10235 /*Capture mixer control */
10236 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10237 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10240 .name = "Capture Source",
10242 .info = alc_mux_enum_info,
10243 .get = alc_mux_enum_get,
10244 .put = alc_mux_enum_put,
10250 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10251 /* output mixer control */
10252 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10253 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10254 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10255 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10256 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10258 /* Input mixer control */
10259 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10260 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10261 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10262 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10263 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10264 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10266 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10267 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10270 /* Capture mixer control */
10271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10275 .name = "Capture Source",
10277 .info = alc_mux_enum_info,
10278 .get = alc_mux_enum_get,
10279 .put = alc_mux_enum_put,
10282 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10283 .name = "Channel Mode",
10284 .info = alc_ch_mode_info,
10285 .get = alc_ch_mode_get,
10286 .put = alc_ch_mode_put,
10287 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10292 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10293 /* output mixer control */
10294 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10295 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10296 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10297 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10298 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10300 /* Input mixer control */
10301 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10302 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10303 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10304 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10305 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10306 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10308 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10309 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10312 /* Capture mixer control */
10313 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10314 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10317 .name = "Capture Source",
10319 .info = alc_mux_enum_info,
10320 .get = alc_mux_enum_get,
10321 .put = alc_mux_enum_put,
10324 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10325 .name = "Channel Mode",
10326 .info = alc_ch_mode_info,
10327 .get = alc_ch_mode_get,
10328 .put = alc_ch_mode_put,
10329 .private_value = ARRAY_SIZE(alc861_asus_modes),
10334 /* additional mixer */
10335 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10336 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10337 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10338 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10339 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10344 * generic initialization of ADC, input mixers and output mixers
10346 static struct hda_verb alc861_base_init_verbs[] = {
10348 * Unmute ADC0 and set the default input to mic-in
10350 /* port-A for surround (rear panel) */
10351 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10352 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10353 /* port-B for mic-in (rear panel) with vref */
10354 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10355 /* port-C for line-in (rear panel) */
10356 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10357 /* port-D for Front */
10358 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10359 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10360 /* port-E for HP out (front panel) */
10361 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10362 /* route front PCM to HP */
10363 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10364 /* port-F for mic-in (front panel) with vref */
10365 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10366 /* port-G for CLFE (rear panel) */
10367 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10368 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10369 /* port-H for side (rear panel) */
10370 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10371 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10373 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10374 /* route front mic to ADC1*/
10375 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10378 /* Unmute DAC0~3 & spdif out*/
10379 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10380 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10381 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10382 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10385 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10386 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10387 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10388 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10389 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10391 /* Unmute Stereo Mixer 15 */
10392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10393 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10397 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10398 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10399 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10400 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10405 /* hp used DAC 3 (Front) */
10406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10412 static struct hda_verb alc861_threestack_init_verbs[] = {
10414 * Unmute ADC0 and set the default input to mic-in
10416 /* port-A for surround (rear panel) */
10417 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10418 /* port-B for mic-in (rear panel) with vref */
10419 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10420 /* port-C for line-in (rear panel) */
10421 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10422 /* port-D for Front */
10423 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10424 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10425 /* port-E for HP out (front panel) */
10426 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10427 /* route front PCM to HP */
10428 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10429 /* port-F for mic-in (front panel) with vref */
10430 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10431 /* port-G for CLFE (rear panel) */
10432 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10433 /* port-H for side (rear panel) */
10434 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10436 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10437 /* route front mic to ADC1*/
10438 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10440 /* Unmute DAC0~3 & spdif out*/
10441 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10442 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10443 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10444 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10447 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10448 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10449 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10450 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10451 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10453 /* Unmute Stereo Mixer 15 */
10454 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10456 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10459 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10460 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10461 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10462 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10464 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10465 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10466 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10467 /* hp used DAC 3 (Front) */
10468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10473 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10475 * Unmute ADC0 and set the default input to mic-in
10477 /* port-A for surround (rear panel) */
10478 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10479 /* port-B for mic-in (rear panel) with vref */
10480 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10481 /* port-C for line-in (rear panel) */
10482 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10483 /* port-D for Front */
10484 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10485 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10486 /* port-E for HP out (front panel) */
10487 /* this has to be set to VREF80 */
10488 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10489 /* route front PCM to HP */
10490 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10491 /* port-F for mic-in (front panel) with vref */
10492 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10493 /* port-G for CLFE (rear panel) */
10494 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10495 /* port-H for side (rear panel) */
10496 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10498 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10499 /* route front mic to ADC1*/
10500 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10502 /* Unmute DAC0~3 & spdif out*/
10503 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10504 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10505 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10506 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10509 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10510 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10511 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10512 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10513 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10515 /* Unmute Stereo Mixer 15 */
10516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10522 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10523 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10524 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10529 /* hp used DAC 3 (Front) */
10530 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10535 static struct hda_verb alc861_asus_init_verbs[] = {
10537 * Unmute ADC0 and set the default input to mic-in
10539 /* port-A for surround (rear panel)
10540 * according to codec#0 this is the HP jack
10542 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10543 /* route front PCM to HP */
10544 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10545 /* port-B for mic-in (rear panel) with vref */
10546 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10547 /* port-C for line-in (rear panel) */
10548 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10549 /* port-D for Front */
10550 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10551 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10552 /* port-E for HP out (front panel) */
10553 /* this has to be set to VREF80 */
10554 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10555 /* route front PCM to HP */
10556 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10557 /* port-F for mic-in (front panel) with vref */
10558 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10559 /* port-G for CLFE (rear panel) */
10560 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10561 /* port-H for side (rear panel) */
10562 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10564 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10565 /* route front mic to ADC1*/
10566 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10567 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10568 /* Unmute DAC0~3 & spdif out*/
10569 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10570 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10571 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10572 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10574 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10575 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10576 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10577 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10578 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10580 /* Unmute Stereo Mixer 15 */
10581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10586 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10587 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10588 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10589 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10590 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10591 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10592 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10593 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10594 /* hp used DAC 3 (Front) */
10595 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10596 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10600 /* additional init verbs for ASUS laptops */
10601 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
10602 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
10603 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
10608 * generic initialization of ADC, input mixers and output mixers
10610 static struct hda_verb alc861_auto_init_verbs[] = {
10612 * Unmute ADC0 and set the default input to mic-in
10614 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10617 /* Unmute DAC0~3 & spdif out*/
10618 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10619 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10620 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10621 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10624 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10625 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10626 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10627 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10628 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10630 /* Unmute Stereo Mixer 15 */
10631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
10636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10637 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10638 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10639 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10640 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10641 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10642 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10645 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10648 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10654 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
10659 static struct hda_verb alc861_toshiba_init_verbs[] = {
10660 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10665 /* toggle speaker-output according to the hp-jack state */
10666 static void alc861_toshiba_automute(struct hda_codec *codec)
10668 unsigned int present;
10670 present = snd_hda_codec_read(codec, 0x0f, 0,
10671 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10672 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
10673 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10674 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
10675 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
10678 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
10681 if ((res >> 26) == ALC880_HP_EVENT)
10682 alc861_toshiba_automute(codec);
10685 /* pcm configuration: identiacal with ALC880 */
10686 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10687 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10688 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10689 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10692 #define ALC861_DIGOUT_NID 0x07
10694 static struct hda_channel_mode alc861_8ch_modes[1] = {
10698 static hda_nid_t alc861_dac_nids[4] = {
10699 /* front, surround, clfe, side */
10700 0x03, 0x06, 0x05, 0x04
10703 static hda_nid_t alc660_dac_nids[3] = {
10704 /* front, clfe, surround */
10708 static hda_nid_t alc861_adc_nids[1] = {
10713 static struct hda_input_mux alc861_capture_source = {
10717 { "Front Mic", 0x3 },
10724 /* fill in the dac_nids table from the parsed pin configuration */
10725 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
10726 const struct auto_pin_cfg *cfg)
10731 spec->multiout.dac_nids = spec->private_dac_nids;
10732 for (i = 0; i < cfg->line_outs; i++) {
10733 nid = cfg->line_out_pins[i];
10735 if (i >= ARRAY_SIZE(alc861_dac_nids))
10737 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
10740 spec->multiout.num_dacs = cfg->line_outs;
10744 /* add playback controls from the parsed DAC table */
10745 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
10746 const struct auto_pin_cfg *cfg)
10749 static const char *chname[4] = {
10750 "Front", "Surround", NULL /*CLFE*/, "Side"
10755 for (i = 0; i < cfg->line_outs; i++) {
10756 nid = spec->multiout.dac_nids[i];
10761 err = add_control(spec, ALC_CTL_BIND_MUTE,
10762 "Center Playback Switch",
10763 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
10767 err = add_control(spec, ALC_CTL_BIND_MUTE,
10768 "LFE Playback Switch",
10769 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10774 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
10776 if (nid == alc861_dac_nids[idx])
10778 sprintf(name, "%s Playback Switch", chname[idx]);
10779 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10780 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10789 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
10797 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
10799 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10800 "Headphone Playback Switch",
10801 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10804 spec->multiout.hp_nid = nid;
10809 /* create playback/capture controls for input pins */
10810 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
10811 const struct auto_pin_cfg *cfg)
10813 struct hda_input_mux *imux = &spec->private_imux;
10814 int i, err, idx, idx1;
10816 for (i = 0; i < AUTO_PIN_LAST; i++) {
10817 switch (cfg->input_pins[i]) {
10820 idx = 2; /* Line In */
10824 idx = 2; /* Line In */
10828 idx = 1; /* Mic In */
10832 idx = 1; /* Mic In */
10842 err = new_analog_input(spec, cfg->input_pins[i],
10843 auto_pin_cfg_labels[i], idx, 0x15);
10847 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10848 imux->items[imux->num_items].index = idx1;
10854 static struct snd_kcontrol_new alc861_capture_mixer[] = {
10855 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10856 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10860 /* The multiple "Capture Source" controls confuse alsamixer
10861 * So call somewhat different..
10862 *FIXME: the controls appear in the "playback" view!
10864 /* .name = "Capture Source", */
10865 .name = "Input Source",
10867 .info = alc_mux_enum_info,
10868 .get = alc_mux_enum_get,
10869 .put = alc_mux_enum_put,
10874 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
10876 int pin_type, int dac_idx)
10878 /* set as output */
10880 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10882 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
10887 static void alc861_auto_init_multi_out(struct hda_codec *codec)
10889 struct alc_spec *spec = codec->spec;
10892 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
10893 for (i = 0; i < spec->autocfg.line_outs; i++) {
10894 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10895 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10897 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
10898 spec->multiout.dac_nids[i]);
10902 static void alc861_auto_init_hp_out(struct hda_codec *codec)
10904 struct alc_spec *spec = codec->spec;
10907 pin = spec->autocfg.hp_pins[0];
10908 if (pin) /* connect to front */
10909 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
10910 spec->multiout.dac_nids[0]);
10913 static void alc861_auto_init_analog_input(struct hda_codec *codec)
10915 struct alc_spec *spec = codec->spec;
10918 for (i = 0; i < AUTO_PIN_LAST; i++) {
10919 hda_nid_t nid = spec->autocfg.input_pins[i];
10920 if (nid >= 0x0c && nid <= 0x11) {
10921 snd_hda_codec_write(codec, nid, 0,
10922 AC_VERB_SET_PIN_WIDGET_CONTROL,
10923 i <= AUTO_PIN_FRONT_MIC ?
10924 PIN_VREF80 : PIN_IN);
10929 /* parse the BIOS configuration and set up the alc_spec */
10930 /* return 1 if successful, 0 if the proper config is not found,
10931 * or a negative error code
10933 static int alc861_parse_auto_config(struct hda_codec *codec)
10935 struct alc_spec *spec = codec->spec;
10937 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10939 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10943 if (!spec->autocfg.line_outs)
10944 return 0; /* can't find valid BIOS pin config */
10946 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
10949 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
10952 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
10955 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
10959 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10961 if (spec->autocfg.dig_out_pin)
10962 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
10964 if (spec->kctl_alloc)
10965 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10967 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
10969 spec->num_mux_defs = 1;
10970 spec->input_mux = &spec->private_imux;
10972 spec->adc_nids = alc861_adc_nids;
10973 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
10974 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
10975 spec->num_mixers++;
10980 /* additional initialization for auto-configuration model */
10981 static void alc861_auto_init(struct hda_codec *codec)
10983 alc861_auto_init_multi_out(codec);
10984 alc861_auto_init_hp_out(codec);
10985 alc861_auto_init_analog_input(codec);
10988 #ifdef CONFIG_SND_HDA_POWER_SAVE
10989 static struct hda_amp_list alc861_loopbacks[] = {
10990 { 0x15, HDA_INPUT, 0 },
10991 { 0x15, HDA_INPUT, 1 },
10992 { 0x15, HDA_INPUT, 2 },
10993 { 0x15, HDA_INPUT, 3 },
11000 * configuration and preset
11002 static const char *alc861_models[ALC861_MODEL_LAST] = {
11003 [ALC861_3ST] = "3stack",
11004 [ALC660_3ST] = "3stack-660",
11005 [ALC861_3ST_DIG] = "3stack-dig",
11006 [ALC861_6ST_DIG] = "6stack-dig",
11007 [ALC861_UNIWILL_M31] = "uniwill-m31",
11008 [ALC861_TOSHIBA] = "toshiba",
11009 [ALC861_ASUS] = "asus",
11010 [ALC861_ASUS_LAPTOP] = "asus-laptop",
11011 [ALC861_AUTO] = "auto",
11014 static struct snd_pci_quirk alc861_cfg_tbl[] = {
11015 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
11016 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11017 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
11018 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
11019 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
11020 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
11021 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
11022 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
11023 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11024 * Any other models that need this preset?
11026 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11027 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
11028 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
11029 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
11030 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
11031 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
11032 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
11033 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
11037 static struct alc_config_preset alc861_presets[] = {
11039 .mixers = { alc861_3ST_mixer },
11040 .init_verbs = { alc861_threestack_init_verbs },
11041 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11042 .dac_nids = alc861_dac_nids,
11043 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11044 .channel_mode = alc861_threestack_modes,
11046 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11047 .adc_nids = alc861_adc_nids,
11048 .input_mux = &alc861_capture_source,
11050 [ALC861_3ST_DIG] = {
11051 .mixers = { alc861_base_mixer },
11052 .init_verbs = { alc861_threestack_init_verbs },
11053 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11054 .dac_nids = alc861_dac_nids,
11055 .dig_out_nid = ALC861_DIGOUT_NID,
11056 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11057 .channel_mode = alc861_threestack_modes,
11059 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11060 .adc_nids = alc861_adc_nids,
11061 .input_mux = &alc861_capture_source,
11063 [ALC861_6ST_DIG] = {
11064 .mixers = { alc861_base_mixer },
11065 .init_verbs = { alc861_base_init_verbs },
11066 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11067 .dac_nids = alc861_dac_nids,
11068 .dig_out_nid = ALC861_DIGOUT_NID,
11069 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
11070 .channel_mode = alc861_8ch_modes,
11071 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11072 .adc_nids = alc861_adc_nids,
11073 .input_mux = &alc861_capture_source,
11076 .mixers = { alc861_3ST_mixer },
11077 .init_verbs = { alc861_threestack_init_verbs },
11078 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
11079 .dac_nids = alc660_dac_nids,
11080 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
11081 .channel_mode = alc861_threestack_modes,
11083 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11084 .adc_nids = alc861_adc_nids,
11085 .input_mux = &alc861_capture_source,
11087 [ALC861_UNIWILL_M31] = {
11088 .mixers = { alc861_uniwill_m31_mixer },
11089 .init_verbs = { alc861_uniwill_m31_init_verbs },
11090 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11091 .dac_nids = alc861_dac_nids,
11092 .dig_out_nid = ALC861_DIGOUT_NID,
11093 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
11094 .channel_mode = alc861_uniwill_m31_modes,
11096 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11097 .adc_nids = alc861_adc_nids,
11098 .input_mux = &alc861_capture_source,
11100 [ALC861_TOSHIBA] = {
11101 .mixers = { alc861_toshiba_mixer },
11102 .init_verbs = { alc861_base_init_verbs,
11103 alc861_toshiba_init_verbs },
11104 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11105 .dac_nids = alc861_dac_nids,
11106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11107 .channel_mode = alc883_3ST_2ch_modes,
11108 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11109 .adc_nids = alc861_adc_nids,
11110 .input_mux = &alc861_capture_source,
11111 .unsol_event = alc861_toshiba_unsol_event,
11112 .init_hook = alc861_toshiba_automute,
11115 .mixers = { alc861_asus_mixer },
11116 .init_verbs = { alc861_asus_init_verbs },
11117 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11118 .dac_nids = alc861_dac_nids,
11119 .dig_out_nid = ALC861_DIGOUT_NID,
11120 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11121 .channel_mode = alc861_asus_modes,
11124 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11125 .adc_nids = alc861_adc_nids,
11126 .input_mux = &alc861_capture_source,
11128 [ALC861_ASUS_LAPTOP] = {
11129 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11130 .init_verbs = { alc861_asus_init_verbs,
11131 alc861_asus_laptop_init_verbs },
11132 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11133 .dac_nids = alc861_dac_nids,
11134 .dig_out_nid = ALC861_DIGOUT_NID,
11135 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11136 .channel_mode = alc883_3ST_2ch_modes,
11138 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11139 .adc_nids = alc861_adc_nids,
11140 .input_mux = &alc861_capture_source,
11145 static int patch_alc861(struct hda_codec *codec)
11147 struct alc_spec *spec;
11151 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11155 codec->spec = spec;
11157 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11161 if (board_config < 0) {
11162 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11163 "trying auto-probe from BIOS...\n");
11164 board_config = ALC861_AUTO;
11167 if (board_config == ALC861_AUTO) {
11168 /* automatic parse from the BIOS config */
11169 err = alc861_parse_auto_config(codec);
11175 "hda_codec: Cannot set up configuration "
11176 "from BIOS. Using base mode...\n");
11177 board_config = ALC861_3ST_DIG;
11181 if (board_config != ALC861_AUTO)
11182 setup_preset(spec, &alc861_presets[board_config]);
11184 spec->stream_name_analog = "ALC861 Analog";
11185 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11186 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11188 spec->stream_name_digital = "ALC861 Digital";
11189 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11190 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11192 codec->patch_ops = alc_patch_ops;
11193 if (board_config == ALC861_AUTO)
11194 spec->init_hook = alc861_auto_init;
11195 #ifdef CONFIG_SND_HDA_POWER_SAVE
11196 if (!spec->loopback.amplist)
11197 spec->loopback.amplist = alc861_loopbacks;
11204 * ALC861-VD support
11208 * In addition, an independent DAC
11210 #define ALC861VD_DIGOUT_NID 0x06
11212 static hda_nid_t alc861vd_dac_nids[4] = {
11213 /* front, surr, clfe, side surr */
11214 0x02, 0x03, 0x04, 0x05
11217 /* dac_nids for ALC660vd are in a different order - according to
11218 * Realtek's driver.
11219 * This should probably tesult in a different mixer for 6stack models
11220 * of ALC660vd codecs, but for now there is only 3stack mixer
11221 * - and it is the same as in 861vd.
11222 * adc_nids in ALC660vd are (is) the same as in 861vd
11224 static hda_nid_t alc660vd_dac_nids[3] = {
11225 /* front, rear, clfe, rear_surr */
11229 static hda_nid_t alc861vd_adc_nids[1] = {
11235 /* FIXME: should be a matrix-type input source selection */
11236 static struct hda_input_mux alc861vd_capture_source = {
11240 { "Front Mic", 0x1 },
11246 static struct hda_input_mux alc861vd_dallas_capture_source = {
11249 { "Front Mic", 0x0 },
11250 { "ATAPI Mic", 0x1 },
11251 { "Line In", 0x5 },
11255 static struct hda_input_mux alc861vd_hp_capture_source = {
11258 { "Front Mic", 0x0 },
11259 { "ATAPI Mic", 0x1 },
11263 #define alc861vd_mux_enum_info alc_mux_enum_info
11264 #define alc861vd_mux_enum_get alc_mux_enum_get
11266 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11267 struct snd_ctl_elem_value *ucontrol)
11269 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11270 struct alc_spec *spec = codec->spec;
11271 const struct hda_input_mux *imux = spec->input_mux;
11272 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11273 static hda_nid_t capture_mixers[1] = { 0x22 };
11274 hda_nid_t nid = capture_mixers[adc_idx];
11275 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11276 unsigned int i, idx;
11278 idx = ucontrol->value.enumerated.item[0];
11279 if (idx >= imux->num_items)
11280 idx = imux->num_items - 1;
11281 if (*cur_val == idx)
11283 for (i = 0; i < imux->num_items; i++) {
11284 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11285 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11286 imux->items[i].index,
11296 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11303 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11304 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11305 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11306 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11307 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11314 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11315 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11316 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11317 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11318 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11322 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11323 { 6, alc861vd_6stack_ch6_init },
11324 { 8, alc861vd_6stack_ch8_init },
11327 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11329 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11330 .name = "Channel Mode",
11331 .info = alc_ch_mode_info,
11332 .get = alc_ch_mode_get,
11333 .put = alc_ch_mode_put,
11338 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11339 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11340 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11343 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11344 /* The multiple "Capture Source" controls confuse alsamixer
11345 * So call somewhat different..
11346 *FIXME: the controls appear in the "playback" view!
11348 /* .name = "Capture Source", */
11349 .name = "Input Source",
11351 .info = alc861vd_mux_enum_info,
11352 .get = alc861vd_mux_enum_get,
11353 .put = alc861vd_mux_enum_put,
11358 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11359 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11361 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11362 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11363 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11365 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11366 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11368 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11370 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11372 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11373 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11375 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11376 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11380 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11382 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11384 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11385 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11386 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11388 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11389 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11394 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11395 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11400 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11401 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11402 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11406 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11407 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11410 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11411 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11412 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11414 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11415 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11420 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11421 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11426 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11427 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11428 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11429 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11435 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11437 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11438 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11439 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11441 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11442 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11447 /* Pin assignment: Front=0x14, HP = 0x15,
11448 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11450 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11451 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11452 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11453 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11454 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11455 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11456 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11457 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11458 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11459 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11460 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11464 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11465 * Front Mic=0x18, ATAPI Mic = 0x19,
11467 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11468 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11470 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11471 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11472 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11473 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11474 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11475 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11481 * generic initialization of ADC, input mixers and output mixers
11483 static struct hda_verb alc861vd_volume_init_verbs[] = {
11485 * Unmute ADC0 and set the default input to mic-in
11487 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11490 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11491 * the analog-loopback mixer widget
11493 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11494 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11495 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11496 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11497 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11498 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11500 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11507 * Set up output mixers (0x02 - 0x05)
11509 /* set vol=0 to output mixers */
11510 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11511 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11513 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11515 /* set up input amps for analog loopback */
11516 /* Amp Indices: DAC = 0, mixer = 1 */
11517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11521 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11523 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11524 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11530 * 3-stack pin configuration:
11531 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11533 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11535 * Set pin mode and muting
11537 /* set front pin widgets 0x14 for output */
11538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11540 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11542 /* Mic (rear) pin: input vref at 80% */
11543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11544 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11545 /* Front Mic pin: input vref at 80% */
11546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11548 /* Line In pin: input */
11549 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11551 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11553 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11554 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11555 /* CD pin widget for input */
11556 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11562 * 6-stack pin configuration:
11564 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11566 * Set pin mode and muting
11568 /* set front pin widgets 0x14 for output */
11569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11571 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11573 /* Rear Pin: output 1 (0x0d) */
11574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11576 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11577 /* CLFE Pin: output 2 (0x0e) */
11578 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11579 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11580 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11581 /* Side Pin: output 3 (0x0f) */
11582 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11583 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11584 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11586 /* Mic (rear) pin: input vref at 80% */
11587 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11589 /* Front Mic pin: input vref at 80% */
11590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11592 /* Line In pin: input */
11593 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11594 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11595 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11597 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11598 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11599 /* CD pin widget for input */
11600 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11605 static struct hda_verb alc861vd_eapd_verbs[] = {
11606 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11610 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
11611 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11615 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11619 /* toggle speaker-output according to the hp-jack state */
11620 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
11622 unsigned int present;
11623 unsigned char bits;
11625 present = snd_hda_codec_read(codec, 0x1b, 0,
11626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11627 bits = present ? HDA_AMP_MUTE : 0;
11628 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11629 HDA_AMP_MUTE, bits);
11632 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
11634 unsigned int present;
11635 unsigned char bits;
11637 present = snd_hda_codec_read(codec, 0x18, 0,
11638 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11639 bits = present ? HDA_AMP_MUTE : 0;
11640 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
11641 HDA_AMP_MUTE, bits);
11644 static void alc861vd_lenovo_automute(struct hda_codec *codec)
11646 alc861vd_lenovo_hp_automute(codec);
11647 alc861vd_lenovo_mic_automute(codec);
11650 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
11653 switch (res >> 26) {
11654 case ALC880_HP_EVENT:
11655 alc861vd_lenovo_hp_automute(codec);
11657 case ALC880_MIC_EVENT:
11658 alc861vd_lenovo_mic_automute(codec);
11663 static struct hda_verb alc861vd_dallas_verbs[] = {
11664 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11665 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11666 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11667 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11684 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11685 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11687 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11688 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11689 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11692 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11693 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11694 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11702 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11703 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11708 /* toggle speaker-output according to the hp-jack state */
11709 static void alc861vd_dallas_automute(struct hda_codec *codec)
11711 unsigned int present;
11713 present = snd_hda_codec_read(codec, 0x15, 0,
11714 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11715 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11716 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11719 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
11721 if ((res >> 26) == ALC880_HP_EVENT)
11722 alc861vd_dallas_automute(codec);
11725 #ifdef CONFIG_SND_HDA_POWER_SAVE
11726 #define alc861vd_loopbacks alc880_loopbacks
11729 /* pcm configuration: identiacal with ALC880 */
11730 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11731 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11732 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11733 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11736 * configuration and preset
11738 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
11739 [ALC660VD_3ST] = "3stack-660",
11740 [ALC660VD_3ST_DIG] = "3stack-660-digout",
11741 [ALC861VD_3ST] = "3stack",
11742 [ALC861VD_3ST_DIG] = "3stack-digout",
11743 [ALC861VD_6ST_DIG] = "6stack-digout",
11744 [ALC861VD_LENOVO] = "lenovo",
11745 [ALC861VD_DALLAS] = "dallas",
11746 [ALC861VD_HP] = "hp",
11747 [ALC861VD_AUTO] = "auto",
11750 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
11751 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
11752 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
11753 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
11754 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
11755 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
11757 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11758 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
11759 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
11760 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
11761 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
11762 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
11763 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
11764 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
11765 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
11769 static struct alc_config_preset alc861vd_presets[] = {
11771 .mixers = { alc861vd_3st_mixer },
11772 .init_verbs = { alc861vd_volume_init_verbs,
11773 alc861vd_3stack_init_verbs },
11774 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11775 .dac_nids = alc660vd_dac_nids,
11776 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11777 .adc_nids = alc861vd_adc_nids,
11778 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11779 .channel_mode = alc861vd_3stack_2ch_modes,
11780 .input_mux = &alc861vd_capture_source,
11782 [ALC660VD_3ST_DIG] = {
11783 .mixers = { alc861vd_3st_mixer },
11784 .init_verbs = { alc861vd_volume_init_verbs,
11785 alc861vd_3stack_init_verbs },
11786 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11787 .dac_nids = alc660vd_dac_nids,
11788 .dig_out_nid = ALC861VD_DIGOUT_NID,
11789 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11790 .adc_nids = alc861vd_adc_nids,
11791 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11792 .channel_mode = alc861vd_3stack_2ch_modes,
11793 .input_mux = &alc861vd_capture_source,
11796 .mixers = { alc861vd_3st_mixer },
11797 .init_verbs = { alc861vd_volume_init_verbs,
11798 alc861vd_3stack_init_verbs },
11799 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11800 .dac_nids = alc861vd_dac_nids,
11801 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11802 .channel_mode = alc861vd_3stack_2ch_modes,
11803 .input_mux = &alc861vd_capture_source,
11805 [ALC861VD_3ST_DIG] = {
11806 .mixers = { alc861vd_3st_mixer },
11807 .init_verbs = { alc861vd_volume_init_verbs,
11808 alc861vd_3stack_init_verbs },
11809 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11810 .dac_nids = alc861vd_dac_nids,
11811 .dig_out_nid = ALC861VD_DIGOUT_NID,
11812 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11813 .channel_mode = alc861vd_3stack_2ch_modes,
11814 .input_mux = &alc861vd_capture_source,
11816 [ALC861VD_6ST_DIG] = {
11817 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
11818 .init_verbs = { alc861vd_volume_init_verbs,
11819 alc861vd_6stack_init_verbs },
11820 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11821 .dac_nids = alc861vd_dac_nids,
11822 .dig_out_nid = ALC861VD_DIGOUT_NID,
11823 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
11824 .channel_mode = alc861vd_6stack_modes,
11825 .input_mux = &alc861vd_capture_source,
11827 [ALC861VD_LENOVO] = {
11828 .mixers = { alc861vd_lenovo_mixer },
11829 .init_verbs = { alc861vd_volume_init_verbs,
11830 alc861vd_3stack_init_verbs,
11831 alc861vd_eapd_verbs,
11832 alc861vd_lenovo_unsol_verbs },
11833 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11834 .dac_nids = alc660vd_dac_nids,
11835 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11836 .adc_nids = alc861vd_adc_nids,
11837 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11838 .channel_mode = alc861vd_3stack_2ch_modes,
11839 .input_mux = &alc861vd_capture_source,
11840 .unsol_event = alc861vd_lenovo_unsol_event,
11841 .init_hook = alc861vd_lenovo_automute,
11843 [ALC861VD_DALLAS] = {
11844 .mixers = { alc861vd_dallas_mixer },
11845 .init_verbs = { alc861vd_dallas_verbs },
11846 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11847 .dac_nids = alc861vd_dac_nids,
11848 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11849 .adc_nids = alc861vd_adc_nids,
11850 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11851 .channel_mode = alc861vd_3stack_2ch_modes,
11852 .input_mux = &alc861vd_dallas_capture_source,
11853 .unsol_event = alc861vd_dallas_unsol_event,
11854 .init_hook = alc861vd_dallas_automute,
11857 .mixers = { alc861vd_hp_mixer },
11858 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
11859 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11860 .dac_nids = alc861vd_dac_nids,
11861 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11862 .dig_out_nid = ALC861VD_DIGOUT_NID,
11863 .adc_nids = alc861vd_adc_nids,
11864 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11865 .channel_mode = alc861vd_3stack_2ch_modes,
11866 .input_mux = &alc861vd_hp_capture_source,
11867 .unsol_event = alc861vd_dallas_unsol_event,
11868 .init_hook = alc861vd_dallas_automute,
11873 * BIOS auto configuration
11875 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
11876 hda_nid_t nid, int pin_type, int dac_idx)
11878 /* set as output */
11879 snd_hda_codec_write(codec, nid, 0,
11880 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11881 snd_hda_codec_write(codec, nid, 0,
11882 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11885 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
11887 struct alc_spec *spec = codec->spec;
11890 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
11891 for (i = 0; i <= HDA_SIDE; i++) {
11892 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11893 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11895 alc861vd_auto_set_output_and_unmute(codec, nid,
11901 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
11903 struct alc_spec *spec = codec->spec;
11906 pin = spec->autocfg.hp_pins[0];
11907 if (pin) /* connect to front and use dac 0 */
11908 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11911 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
11912 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
11914 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
11916 struct alc_spec *spec = codec->spec;
11919 for (i = 0; i < AUTO_PIN_LAST; i++) {
11920 hda_nid_t nid = spec->autocfg.input_pins[i];
11921 if (alc861vd_is_input_pin(nid)) {
11922 snd_hda_codec_write(codec, nid, 0,
11923 AC_VERB_SET_PIN_WIDGET_CONTROL,
11924 i <= AUTO_PIN_FRONT_MIC ?
11925 PIN_VREF80 : PIN_IN);
11926 if (nid != ALC861VD_PIN_CD_NID)
11927 snd_hda_codec_write(codec, nid, 0,
11928 AC_VERB_SET_AMP_GAIN_MUTE,
11934 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
11935 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
11937 /* add playback controls from the parsed DAC table */
11938 /* Based on ALC880 version. But ALC861VD has separate,
11939 * different NIDs for mute/unmute switch and volume control */
11940 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
11941 const struct auto_pin_cfg *cfg)
11944 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
11945 hda_nid_t nid_v, nid_s;
11948 for (i = 0; i < cfg->line_outs; i++) {
11949 if (!spec->multiout.dac_nids[i])
11951 nid_v = alc861vd_idx_to_mixer_vol(
11953 spec->multiout.dac_nids[i]));
11954 nid_s = alc861vd_idx_to_mixer_switch(
11956 spec->multiout.dac_nids[i]));
11960 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11961 "Center Playback Volume",
11962 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
11966 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11967 "LFE Playback Volume",
11968 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
11972 err = add_control(spec, ALC_CTL_BIND_MUTE,
11973 "Center Playback Switch",
11974 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
11978 err = add_control(spec, ALC_CTL_BIND_MUTE,
11979 "LFE Playback Switch",
11980 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
11985 sprintf(name, "%s Playback Volume", chname[i]);
11986 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11987 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
11991 sprintf(name, "%s Playback Switch", chname[i]);
11992 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11993 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
12002 /* add playback controls for speaker and HP outputs */
12003 /* Based on ALC880 version. But ALC861VD has separate,
12004 * different NIDs for mute/unmute switch and volume control */
12005 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
12006 hda_nid_t pin, const char *pfx)
12008 hda_nid_t nid_v, nid_s;
12015 if (alc880_is_fixed_pin(pin)) {
12016 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12017 /* specify the DAC as the extra output */
12018 if (!spec->multiout.hp_nid)
12019 spec->multiout.hp_nid = nid_v;
12021 spec->multiout.extra_out_nid[0] = nid_v;
12022 /* control HP volume/switch on the output mixer amp */
12023 nid_v = alc861vd_idx_to_mixer_vol(
12024 alc880_fixed_pin_idx(pin));
12025 nid_s = alc861vd_idx_to_mixer_switch(
12026 alc880_fixed_pin_idx(pin));
12028 sprintf(name, "%s Playback Volume", pfx);
12029 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12030 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
12033 sprintf(name, "%s Playback Switch", pfx);
12034 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12035 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
12038 } else if (alc880_is_multi_pin(pin)) {
12039 /* set manual connection */
12040 /* we have only a switch on HP-out PIN */
12041 sprintf(name, "%s Playback Switch", pfx);
12042 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12043 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12050 /* parse the BIOS configuration and set up the alc_spec
12051 * return 1 if successful, 0 if the proper config is not found,
12052 * or a negative error code
12053 * Based on ALC880 version - had to change it to override
12054 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12055 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12057 struct alc_spec *spec = codec->spec;
12059 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12061 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12065 if (!spec->autocfg.line_outs)
12066 return 0; /* can't find valid BIOS pin config */
12068 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12071 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
12074 err = alc861vd_auto_create_extra_out(spec,
12075 spec->autocfg.speaker_pins[0],
12079 err = alc861vd_auto_create_extra_out(spec,
12080 spec->autocfg.hp_pins[0],
12084 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
12088 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12090 if (spec->autocfg.dig_out_pin)
12091 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
12093 if (spec->kctl_alloc)
12094 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12096 spec->init_verbs[spec->num_init_verbs++]
12097 = alc861vd_volume_init_verbs;
12099 spec->num_mux_defs = 1;
12100 spec->input_mux = &spec->private_imux;
12102 err = alc_auto_add_mic_boost(codec);
12109 /* additional initialization for auto-configuration model */
12110 static void alc861vd_auto_init(struct hda_codec *codec)
12112 alc861vd_auto_init_multi_out(codec);
12113 alc861vd_auto_init_hp_out(codec);
12114 alc861vd_auto_init_analog_input(codec);
12117 static int patch_alc861vd(struct hda_codec *codec)
12119 struct alc_spec *spec;
12120 int err, board_config;
12122 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12126 codec->spec = spec;
12128 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12132 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12133 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12134 "ALC861VD, trying auto-probe from BIOS...\n");
12135 board_config = ALC861VD_AUTO;
12138 if (board_config == ALC861VD_AUTO) {
12139 /* automatic parse from the BIOS config */
12140 err = alc861vd_parse_auto_config(codec);
12146 "hda_codec: Cannot set up configuration "
12147 "from BIOS. Using base mode...\n");
12148 board_config = ALC861VD_3ST;
12152 if (board_config != ALC861VD_AUTO)
12153 setup_preset(spec, &alc861vd_presets[board_config]);
12155 spec->stream_name_analog = "ALC861VD Analog";
12156 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12157 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12159 spec->stream_name_digital = "ALC861VD Digital";
12160 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12161 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12163 spec->adc_nids = alc861vd_adc_nids;
12164 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12166 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12167 spec->num_mixers++;
12169 codec->patch_ops = alc_patch_ops;
12171 if (board_config == ALC861VD_AUTO)
12172 spec->init_hook = alc861vd_auto_init;
12173 #ifdef CONFIG_SND_HDA_POWER_SAVE
12174 if (!spec->loopback.amplist)
12175 spec->loopback.amplist = alc861vd_loopbacks;
12184 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12185 * configuration. Each pin widget can choose any input DACs and a mixer.
12186 * Each ADC is connected from a mixer of all inputs. This makes possible
12187 * 6-channel independent captures.
12189 * In addition, an independent DAC for the multi-playback (not used in this
12192 #define ALC662_DIGOUT_NID 0x06
12193 #define ALC662_DIGIN_NID 0x0a
12195 static hda_nid_t alc662_dac_nids[4] = {
12196 /* front, rear, clfe, rear_surr */
12200 static hda_nid_t alc662_adc_nids[1] = {
12205 /* FIXME: should be a matrix-type input source selection */
12207 static struct hda_input_mux alc662_capture_source = {
12211 { "Front Mic", 0x1 },
12217 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12225 static struct hda_input_mux alc662_eeepc_capture_source = {
12233 #define alc662_mux_enum_info alc_mux_enum_info
12234 #define alc662_mux_enum_get alc_mux_enum_get
12236 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12237 struct snd_ctl_elem_value *ucontrol)
12239 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12240 struct alc_spec *spec = codec->spec;
12241 const struct hda_input_mux *imux = spec->input_mux;
12242 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12243 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12244 hda_nid_t nid = capture_mixers[adc_idx];
12245 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12246 unsigned int i, idx;
12248 idx = ucontrol->value.enumerated.item[0];
12249 if (idx >= imux->num_items)
12250 idx = imux->num_items - 1;
12251 if (*cur_val == idx)
12253 for (i = 0; i < imux->num_items; i++) {
12254 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12255 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12256 imux->items[i].index,
12265 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12272 static struct hda_verb alc662_3ST_ch2_init[] = {
12273 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12274 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12275 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12276 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12283 static struct hda_verb alc662_3ST_ch6_init[] = {
12284 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12285 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12286 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12287 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12288 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12289 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12293 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12294 { 2, alc662_3ST_ch2_init },
12295 { 6, alc662_3ST_ch6_init },
12301 static struct hda_verb alc662_sixstack_ch6_init[] = {
12302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12303 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12304 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12311 static struct hda_verb alc662_sixstack_ch8_init[] = {
12312 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12313 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12314 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12318 static struct hda_channel_mode alc662_5stack_modes[2] = {
12319 { 2, alc662_sixstack_ch6_init },
12320 { 6, alc662_sixstack_ch8_init },
12323 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12324 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12327 static struct snd_kcontrol_new alc662_base_mixer[] = {
12328 /* output mixer control */
12329 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12330 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12331 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12332 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12333 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12334 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12335 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12336 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12339 /*Input mixer control */
12340 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12341 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12342 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12343 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12344 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12345 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12349 /* Capture mixer control */
12350 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12351 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12354 .name = "Capture Source",
12356 .info = alc_mux_enum_info,
12357 .get = alc_mux_enum_get,
12358 .put = alc_mux_enum_put,
12363 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12364 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12365 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12366 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12375 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12376 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12377 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12378 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12380 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12381 /* .name = "Capture Source", */
12382 .name = "Input Source",
12384 .info = alc662_mux_enum_info,
12385 .get = alc662_mux_enum_get,
12386 .put = alc662_mux_enum_put,
12391 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12392 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12393 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12394 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12395 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12396 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12397 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12398 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12399 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12400 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12401 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12402 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12404 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12407 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12408 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12409 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12410 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12411 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12412 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12415 /* .name = "Capture Source", */
12416 .name = "Input Source",
12418 .info = alc662_mux_enum_info,
12419 .get = alc662_mux_enum_get,
12420 .put = alc662_mux_enum_put,
12425 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12426 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12427 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12428 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12429 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
12430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12435 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12436 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12439 /* .name = "Capture Source", */
12440 .name = "Input Source",
12442 .info = alc662_mux_enum_info,
12443 .get = alc662_mux_enum_get,
12444 .put = alc662_mux_enum_put,
12449 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12450 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12452 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12453 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12455 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12456 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12457 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12459 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12460 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12461 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12465 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12468 .name = "Channel Mode",
12469 .info = alc_ch_mode_info,
12470 .get = alc_ch_mode_get,
12471 .put = alc_ch_mode_put,
12476 static struct hda_verb alc662_init_verbs[] = {
12477 /* ADC: mute amp left and right */
12478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12479 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12480 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12490 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12491 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12492 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12493 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12495 /* Front Pin: output 0 (0x0c) */
12496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12499 /* Rear Pin: output 1 (0x0d) */
12500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12501 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12503 /* CLFE Pin: output 2 (0x0e) */
12504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12505 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12507 /* Mic (rear) pin: input vref at 80% */
12508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12510 /* Front Mic pin: input vref at 80% */
12511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12513 /* Line In pin: input */
12514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12516 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12517 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12518 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12520 /* CD pin widget for input */
12521 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12523 /* FIXME: use matrix-type input source selection */
12524 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12532 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12534 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12538 static struct hda_verb alc662_sue_init_verbs[] = {
12539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12540 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12544 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12546 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12551 * generic initialization of ADC, input mixers and output mixers
12553 static struct hda_verb alc662_auto_init_verbs[] = {
12555 * Unmute ADC and set the default input to mic-in
12557 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12558 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12560 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12562 * Note: PASD motherboards uses the Line In 2 as the input for front
12563 * panel mic (mic 2)
12565 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12573 * Set up output mixers (0x0c - 0x0f)
12575 /* set vol=0 to output mixers */
12576 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12577 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12578 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12580 /* set up input amps for analog loopback */
12581 /* Amp Indices: DAC = 0, mixer = 1 */
12582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12590 /* FIXME: use matrix-type input source selection */
12591 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12594 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12598 /* capture mixer elements */
12599 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12600 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12601 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12604 /* The multiple "Capture Source" controls confuse alsamixer
12605 * So call somewhat different..
12606 * FIXME: the controls appear in the "playback" view!
12608 /* .name = "Capture Source", */
12609 .name = "Input Source",
12611 .info = alc882_mux_enum_info,
12612 .get = alc882_mux_enum_get,
12613 .put = alc882_mux_enum_put,
12618 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
12620 unsigned int present;
12621 unsigned char bits;
12623 present = snd_hda_codec_read(codec, 0x14, 0,
12624 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12625 bits = present ? HDA_AMP_MUTE : 0;
12626 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12627 HDA_AMP_MUTE, bits);
12630 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
12632 unsigned int present;
12633 unsigned char bits;
12635 present = snd_hda_codec_read(codec, 0x1b, 0,
12636 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12637 bits = present ? HDA_AMP_MUTE : 0;
12638 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12639 HDA_AMP_MUTE, bits);
12640 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12641 HDA_AMP_MUTE, bits);
12644 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
12647 if ((res >> 26) == ALC880_HP_EVENT)
12648 alc662_lenovo_101e_all_automute(codec);
12649 if ((res >> 26) == ALC880_FRONT_EVENT)
12650 alc662_lenovo_101e_ispeaker_automute(codec);
12653 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
12655 unsigned int present;
12657 present = snd_hda_codec_read(codec, 0x18, 0,
12658 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12659 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12660 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12661 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12662 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12663 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12664 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12665 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12666 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12669 /* unsolicited event for HP jack sensing */
12670 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
12673 if ((res >> 26) == ALC880_HP_EVENT)
12674 alc262_hippo1_automute( codec );
12676 if ((res >> 26) == ALC880_MIC_EVENT)
12677 alc662_eeepc_mic_automute(codec);
12680 static void alc662_eeepc_inithook(struct hda_codec *codec)
12682 alc262_hippo1_automute( codec );
12683 alc662_eeepc_mic_automute(codec);
12686 #ifdef CONFIG_SND_HDA_POWER_SAVE
12687 #define alc662_loopbacks alc880_loopbacks
12691 /* pcm configuration: identiacal with ALC880 */
12692 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12693 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12694 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12695 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12698 * configuration and preset
12700 static const char *alc662_models[ALC662_MODEL_LAST] = {
12701 [ALC662_3ST_2ch_DIG] = "3stack-dig",
12702 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
12703 [ALC662_3ST_6ch] = "3stack-6ch",
12704 [ALC662_5ST_DIG] = "6stack-dig",
12705 [ALC662_LENOVO_101E] = "lenovo-101e",
12706 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
12707 [ALC662_AUTO] = "auto",
12710 static struct snd_pci_quirk alc662_cfg_tbl[] = {
12711 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
12712 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
12716 static struct alc_config_preset alc662_presets[] = {
12717 [ALC662_3ST_2ch_DIG] = {
12718 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
12719 .init_verbs = { alc662_init_verbs },
12720 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12721 .dac_nids = alc662_dac_nids,
12722 .dig_out_nid = ALC662_DIGOUT_NID,
12723 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12724 .adc_nids = alc662_adc_nids,
12725 .dig_in_nid = ALC662_DIGIN_NID,
12726 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12727 .channel_mode = alc662_3ST_2ch_modes,
12728 .input_mux = &alc662_capture_source,
12730 [ALC662_3ST_6ch_DIG] = {
12731 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12732 alc662_capture_mixer },
12733 .init_verbs = { alc662_init_verbs },
12734 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12735 .dac_nids = alc662_dac_nids,
12736 .dig_out_nid = ALC662_DIGOUT_NID,
12737 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12738 .adc_nids = alc662_adc_nids,
12739 .dig_in_nid = ALC662_DIGIN_NID,
12740 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12741 .channel_mode = alc662_3ST_6ch_modes,
12743 .input_mux = &alc662_capture_source,
12745 [ALC662_3ST_6ch] = {
12746 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12747 alc662_capture_mixer },
12748 .init_verbs = { alc662_init_verbs },
12749 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12750 .dac_nids = alc662_dac_nids,
12751 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12752 .adc_nids = alc662_adc_nids,
12753 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12754 .channel_mode = alc662_3ST_6ch_modes,
12756 .input_mux = &alc662_capture_source,
12758 [ALC662_5ST_DIG] = {
12759 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
12760 alc662_capture_mixer },
12761 .init_verbs = { alc662_init_verbs },
12762 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12763 .dac_nids = alc662_dac_nids,
12764 .dig_out_nid = ALC662_DIGOUT_NID,
12765 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12766 .adc_nids = alc662_adc_nids,
12767 .dig_in_nid = ALC662_DIGIN_NID,
12768 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
12769 .channel_mode = alc662_5stack_modes,
12770 .input_mux = &alc662_capture_source,
12772 [ALC662_LENOVO_101E] = {
12773 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
12774 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
12775 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12776 .dac_nids = alc662_dac_nids,
12777 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12778 .adc_nids = alc662_adc_nids,
12779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12780 .channel_mode = alc662_3ST_2ch_modes,
12781 .input_mux = &alc662_lenovo_101e_capture_source,
12782 .unsol_event = alc662_lenovo_101e_unsol_event,
12783 .init_hook = alc662_lenovo_101e_all_automute,
12785 [ALC662_ASUS_EEEPC_P701] = {
12786 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
12787 .init_verbs = { alc662_init_verbs,
12788 alc662_eeepc_sue_init_verbs },
12789 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12790 .dac_nids = alc662_dac_nids,
12791 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12792 .adc_nids = alc662_adc_nids,
12793 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12794 .channel_mode = alc662_3ST_2ch_modes,
12795 .input_mux = &alc662_eeepc_capture_source,
12796 .unsol_event = alc662_eeepc_unsol_event,
12797 .init_hook = alc662_eeepc_inithook,
12804 * BIOS auto configuration
12807 /* add playback controls from the parsed DAC table */
12808 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
12809 const struct auto_pin_cfg *cfg)
12812 static const char *chname[4] = {
12813 "Front", "Surround", NULL /*CLFE*/, "Side"
12818 for (i = 0; i < cfg->line_outs; i++) {
12819 if (!spec->multiout.dac_nids[i])
12821 nid = alc880_idx_to_dac(i);
12824 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12825 "Center Playback Volume",
12826 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12830 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12831 "LFE Playback Volume",
12832 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12836 err = add_control(spec, ALC_CTL_BIND_MUTE,
12837 "Center Playback Switch",
12838 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
12842 err = add_control(spec, ALC_CTL_BIND_MUTE,
12843 "LFE Playback Switch",
12844 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
12849 sprintf(name, "%s Playback Volume", chname[i]);
12850 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12851 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12855 sprintf(name, "%s Playback Switch", chname[i]);
12856 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12857 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
12866 /* add playback controls for speaker and HP outputs */
12867 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
12877 if (alc880_is_fixed_pin(pin)) {
12878 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12879 /* printk("DAC nid=%x\n",nid); */
12880 /* specify the DAC as the extra output */
12881 if (!spec->multiout.hp_nid)
12882 spec->multiout.hp_nid = nid;
12884 spec->multiout.extra_out_nid[0] = nid;
12885 /* control HP volume/switch on the output mixer amp */
12886 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12887 sprintf(name, "%s Playback Volume", pfx);
12888 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12889 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12892 sprintf(name, "%s Playback Switch", pfx);
12893 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12894 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
12897 } else if (alc880_is_multi_pin(pin)) {
12898 /* set manual connection */
12899 /* we have only a switch on HP-out PIN */
12900 sprintf(name, "%s Playback Switch", pfx);
12901 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12902 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12909 /* create playback/capture controls for input pins */
12910 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
12911 const struct auto_pin_cfg *cfg)
12913 struct hda_input_mux *imux = &spec->private_imux;
12916 for (i = 0; i < AUTO_PIN_LAST; i++) {
12917 if (alc880_is_input_pin(cfg->input_pins[i])) {
12918 idx = alc880_input_pin_idx(cfg->input_pins[i]);
12919 err = new_analog_input(spec, cfg->input_pins[i],
12920 auto_pin_cfg_labels[i],
12924 imux->items[imux->num_items].label =
12925 auto_pin_cfg_labels[i];
12926 imux->items[imux->num_items].index =
12927 alc880_input_pin_idx(cfg->input_pins[i]);
12934 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
12935 hda_nid_t nid, int pin_type,
12938 /* set as output */
12939 snd_hda_codec_write(codec, nid, 0,
12940 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12941 snd_hda_codec_write(codec, nid, 0,
12942 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12943 /* need the manual connection? */
12944 if (alc880_is_multi_pin(nid)) {
12945 struct alc_spec *spec = codec->spec;
12946 int idx = alc880_multi_pin_idx(nid);
12947 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
12948 AC_VERB_SET_CONNECT_SEL,
12949 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
12953 static void alc662_auto_init_multi_out(struct hda_codec *codec)
12955 struct alc_spec *spec = codec->spec;
12958 for (i = 0; i <= HDA_SIDE; i++) {
12959 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12960 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12962 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
12967 static void alc662_auto_init_hp_out(struct hda_codec *codec)
12969 struct alc_spec *spec = codec->spec;
12972 pin = spec->autocfg.hp_pins[0];
12973 if (pin) /* connect to front */
12975 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12978 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
12979 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
12981 static void alc662_auto_init_analog_input(struct hda_codec *codec)
12983 struct alc_spec *spec = codec->spec;
12986 for (i = 0; i < AUTO_PIN_LAST; i++) {
12987 hda_nid_t nid = spec->autocfg.input_pins[i];
12988 if (alc662_is_input_pin(nid)) {
12989 snd_hda_codec_write(codec, nid, 0,
12990 AC_VERB_SET_PIN_WIDGET_CONTROL,
12991 (i <= AUTO_PIN_FRONT_MIC ?
12992 PIN_VREF80 : PIN_IN));
12993 if (nid != ALC662_PIN_CD_NID)
12994 snd_hda_codec_write(codec, nid, 0,
12995 AC_VERB_SET_AMP_GAIN_MUTE,
13001 static int alc662_parse_auto_config(struct hda_codec *codec)
13003 struct alc_spec *spec = codec->spec;
13005 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
13007 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13011 if (!spec->autocfg.line_outs)
13012 return 0; /* can't find valid BIOS pin config */
13014 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
13017 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
13020 err = alc662_auto_create_extra_out(spec,
13021 spec->autocfg.speaker_pins[0],
13025 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
13029 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
13033 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13035 if (spec->autocfg.dig_out_pin)
13036 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
13038 if (spec->kctl_alloc)
13039 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
13041 spec->num_mux_defs = 1;
13042 spec->input_mux = &spec->private_imux;
13044 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
13045 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
13046 spec->num_mixers++;
13050 /* additional initialization for auto-configuration model */
13051 static void alc662_auto_init(struct hda_codec *codec)
13053 alc662_auto_init_multi_out(codec);
13054 alc662_auto_init_hp_out(codec);
13055 alc662_auto_init_analog_input(codec);
13058 static int patch_alc662(struct hda_codec *codec)
13060 struct alc_spec *spec;
13061 int err, board_config;
13063 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13067 codec->spec = spec;
13069 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
13072 if (board_config < 0) {
13073 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
13074 "trying auto-probe from BIOS...\n");
13075 board_config = ALC662_AUTO;
13078 if (board_config == ALC662_AUTO) {
13079 /* automatic parse from the BIOS config */
13080 err = alc662_parse_auto_config(codec);
13086 "hda_codec: Cannot set up configuration "
13087 "from BIOS. Using base mode...\n");
13088 board_config = ALC662_3ST_2ch_DIG;
13092 if (board_config != ALC662_AUTO)
13093 setup_preset(spec, &alc662_presets[board_config]);
13095 spec->stream_name_analog = "ALC662 Analog";
13096 spec->stream_analog_playback = &alc662_pcm_analog_playback;
13097 spec->stream_analog_capture = &alc662_pcm_analog_capture;
13099 spec->stream_name_digital = "ALC662 Digital";
13100 spec->stream_digital_playback = &alc662_pcm_digital_playback;
13101 spec->stream_digital_capture = &alc662_pcm_digital_capture;
13103 if (!spec->adc_nids && spec->input_mux) {
13104 spec->adc_nids = alc662_adc_nids;
13105 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13108 codec->patch_ops = alc_patch_ops;
13109 if (board_config == ALC662_AUTO)
13110 spec->init_hook = alc662_auto_init;
13111 #ifdef CONFIG_SND_HDA_POWER_SAVE
13112 if (!spec->loopback.amplist)
13113 spec->loopback.amplist = alc662_loopbacks;
13122 struct hda_codec_preset snd_hda_preset_realtek[] = {
13123 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13124 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13125 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13126 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13127 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13128 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13129 .patch = patch_alc861 },
13130 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13131 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13132 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13133 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13134 .patch = patch_alc883 },
13135 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13136 .patch = patch_alc662 },
13137 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13138 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13139 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13140 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13141 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13142 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13143 {} /* terminator */