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,
200 #define GPIO_MASK 0x03
203 /* codec parameterization */
204 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
205 unsigned int num_mixers;
207 const struct hda_verb *init_verbs[5]; /* initialization verbs
211 unsigned int num_init_verbs;
213 char *stream_name_analog; /* analog PCM stream */
214 struct hda_pcm_stream *stream_analog_playback;
215 struct hda_pcm_stream *stream_analog_capture;
217 char *stream_name_digital; /* digital PCM stream */
218 struct hda_pcm_stream *stream_digital_playback;
219 struct hda_pcm_stream *stream_digital_capture;
222 struct hda_multi_out multiout; /* playback set-up
223 * max_channels, dacs must be set
224 * dig_out_nid and hp_nid are optional
228 unsigned int num_adc_nids;
230 hda_nid_t dig_in_nid; /* digital-in NID; optional */
233 unsigned int num_mux_defs;
234 const struct hda_input_mux *input_mux;
235 unsigned int cur_mux[3];
238 const struct hda_channel_mode *channel_mode;
239 int num_channel_mode;
242 /* PCM information */
243 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
245 /* dynamic controls, init_verbs and input_mux */
246 struct auto_pin_cfg autocfg;
247 unsigned int num_kctl_alloc, num_kctl_used;
248 struct snd_kcontrol_new *kctl_alloc;
249 struct hda_input_mux private_imux;
250 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
253 void (*init_hook)(struct hda_codec *codec);
254 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
256 /* for pin sensing */
257 unsigned int sense_updated: 1;
258 unsigned int jack_present: 1;
260 #ifdef CONFIG_SND_HDA_POWER_SAVE
261 struct hda_loopback_check loopback;
266 * configuration template - to be copied to the spec instance
268 struct alc_config_preset {
269 struct snd_kcontrol_new *mixers[5]; /* should be identical size
272 const struct hda_verb *init_verbs[5];
273 unsigned int num_dacs;
275 hda_nid_t dig_out_nid; /* optional */
276 hda_nid_t hp_nid; /* optional */
277 unsigned int num_adc_nids;
279 hda_nid_t dig_in_nid;
280 unsigned int num_channel_mode;
281 const struct hda_channel_mode *channel_mode;
283 unsigned int num_mux_defs;
284 const struct hda_input_mux *input_mux;
285 void (*unsol_event)(struct hda_codec *, unsigned int);
286 void (*init_hook)(struct hda_codec *);
287 #ifdef CONFIG_SND_HDA_POWER_SAVE
288 struct hda_amp_list *loopbacks;
296 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
297 struct snd_ctl_elem_info *uinfo)
299 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
300 struct alc_spec *spec = codec->spec;
301 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
302 if (mux_idx >= spec->num_mux_defs)
304 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
307 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
308 struct snd_ctl_elem_value *ucontrol)
310 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
311 struct alc_spec *spec = codec->spec;
312 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
314 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
318 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
319 struct snd_ctl_elem_value *ucontrol)
321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
322 struct alc_spec *spec = codec->spec;
323 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
324 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
325 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
326 spec->adc_nids[adc_idx],
327 &spec->cur_mux[adc_idx]);
332 * channel mode setting
334 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
335 struct snd_ctl_elem_info *uinfo)
337 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
338 struct alc_spec *spec = codec->spec;
339 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
340 spec->num_channel_mode);
343 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
344 struct snd_ctl_elem_value *ucontrol)
346 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
347 struct alc_spec *spec = codec->spec;
348 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
349 spec->num_channel_mode,
350 spec->multiout.max_channels);
353 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
354 struct snd_ctl_elem_value *ucontrol)
356 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
357 struct alc_spec *spec = codec->spec;
358 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
359 spec->num_channel_mode,
360 &spec->multiout.max_channels);
361 if (err >= 0 && spec->need_dac_fix)
362 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
367 * Control the mode of pin widget settings via the mixer. "pc" is used
368 * instead of "%" to avoid consequences of accidently treating the % as
369 * being part of a format specifier. Maximum allowed length of a value is
370 * 63 characters plus NULL terminator.
372 * Note: some retasking pin complexes seem to ignore requests for input
373 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
374 * are requested. Therefore order this list so that this behaviour will not
375 * cause problems when mixer clients move through the enum sequentially.
376 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
379 static char *alc_pin_mode_names[] = {
380 "Mic 50pc bias", "Mic 80pc bias",
381 "Line in", "Line out", "Headphone out",
383 static unsigned char alc_pin_mode_values[] = {
384 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
386 /* The control can present all 5 options, or it can limit the options based
387 * in the pin being assumed to be exclusively an input or an output pin. In
388 * addition, "input" pins may or may not process the mic bias option
389 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
390 * accept requests for bias as of chip versions up to March 2006) and/or
391 * wiring in the computer.
393 #define ALC_PIN_DIR_IN 0x00
394 #define ALC_PIN_DIR_OUT 0x01
395 #define ALC_PIN_DIR_INOUT 0x02
396 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
397 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
399 /* Info about the pin modes supported by the different pin direction modes.
400 * For each direction the minimum and maximum values are given.
402 static signed char alc_pin_mode_dir_info[5][2] = {
403 { 0, 2 }, /* ALC_PIN_DIR_IN */
404 { 3, 4 }, /* ALC_PIN_DIR_OUT */
405 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
406 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
407 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
409 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
410 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
411 #define alc_pin_mode_n_items(_dir) \
412 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
414 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
415 struct snd_ctl_elem_info *uinfo)
417 unsigned int item_num = uinfo->value.enumerated.item;
418 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
420 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
422 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
424 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
425 item_num = alc_pin_mode_min(dir);
426 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
430 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_value *ucontrol)
434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
435 hda_nid_t nid = kcontrol->private_value & 0xffff;
436 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
437 long *valp = ucontrol->value.integer.value;
438 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
439 AC_VERB_GET_PIN_WIDGET_CONTROL,
442 /* Find enumerated value for current pinctl setting */
443 i = alc_pin_mode_min(dir);
444 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
446 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
450 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
451 struct snd_ctl_elem_value *ucontrol)
454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
455 hda_nid_t nid = kcontrol->private_value & 0xffff;
456 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
457 long val = *ucontrol->value.integer.value;
458 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
459 AC_VERB_GET_PIN_WIDGET_CONTROL,
462 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
463 val = alc_pin_mode_min(dir);
465 change = pinctl != alc_pin_mode_values[val];
467 /* Set pin mode to that requested */
468 snd_hda_codec_write_cache(codec, nid, 0,
469 AC_VERB_SET_PIN_WIDGET_CONTROL,
470 alc_pin_mode_values[val]);
472 /* Also enable the retasking pin's input/output as required
473 * for the requested pin mode. Enum values of 2 or less are
476 * Dynamically switching the input/output buffers probably
477 * reduces noise slightly (particularly on input) so we'll
478 * do it. However, having both input and output buffers
479 * enabled simultaneously doesn't seem to be problematic if
480 * this turns out to be necessary in the future.
483 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
484 HDA_AMP_MUTE, HDA_AMP_MUTE);
485 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
488 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
489 HDA_AMP_MUTE, HDA_AMP_MUTE);
490 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
497 #define ALC_PIN_MODE(xname, nid, dir) \
498 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
499 .info = alc_pin_mode_info, \
500 .get = alc_pin_mode_get, \
501 .put = alc_pin_mode_put, \
502 .private_value = nid | (dir<<16) }
504 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
505 * together using a mask with more than one bit set. This control is
506 * currently used only by the ALC260 test model. At this stage they are not
507 * needed for any "production" models.
509 #ifdef CONFIG_SND_DEBUG
510 #define alc_gpio_data_info snd_ctl_boolean_mono_info
512 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
513 struct snd_ctl_elem_value *ucontrol)
515 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
516 hda_nid_t nid = kcontrol->private_value & 0xffff;
517 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
518 long *valp = ucontrol->value.integer.value;
519 unsigned int val = snd_hda_codec_read(codec, nid, 0,
520 AC_VERB_GET_GPIO_DATA, 0x00);
522 *valp = (val & mask) != 0;
525 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
526 struct snd_ctl_elem_value *ucontrol)
529 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
530 hda_nid_t nid = kcontrol->private_value & 0xffff;
531 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
532 long val = *ucontrol->value.integer.value;
533 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
534 AC_VERB_GET_GPIO_DATA,
537 /* Set/unset the masked GPIO bit(s) as needed */
538 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
543 snd_hda_codec_write_cache(codec, nid, 0,
544 AC_VERB_SET_GPIO_DATA, gpio_data);
548 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
549 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
550 .info = alc_gpio_data_info, \
551 .get = alc_gpio_data_get, \
552 .put = alc_gpio_data_put, \
553 .private_value = nid | (mask<<16) }
554 #endif /* CONFIG_SND_DEBUG */
556 /* A switch control to allow the enabling of the digital IO pins on the
557 * ALC260. This is incredibly simplistic; the intention of this control is
558 * to provide something in the test model allowing digital outputs to be
559 * identified if present. If models are found which can utilise these
560 * outputs a more complete mixer control can be devised for those models if
563 #ifdef CONFIG_SND_DEBUG
564 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
566 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
567 struct snd_ctl_elem_value *ucontrol)
569 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
570 hda_nid_t nid = kcontrol->private_value & 0xffff;
571 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
572 long *valp = ucontrol->value.integer.value;
573 unsigned int val = snd_hda_codec_read(codec, nid, 0,
574 AC_VERB_GET_DIGI_CONVERT, 0x00);
576 *valp = (val & mask) != 0;
579 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
580 struct snd_ctl_elem_value *ucontrol)
583 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
584 hda_nid_t nid = kcontrol->private_value & 0xffff;
585 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
586 long val = *ucontrol->value.integer.value;
587 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
588 AC_VERB_GET_DIGI_CONVERT,
591 /* Set/unset the masked control bit(s) as needed */
592 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
597 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
602 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
603 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
604 .info = alc_spdif_ctrl_info, \
605 .get = alc_spdif_ctrl_get, \
606 .put = alc_spdif_ctrl_put, \
607 .private_value = nid | (mask<<16) }
608 #endif /* CONFIG_SND_DEBUG */
611 * set up from the preset table
613 static void setup_preset(struct alc_spec *spec,
614 const struct alc_config_preset *preset)
618 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
619 spec->mixers[spec->num_mixers++] = preset->mixers[i];
620 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
622 spec->init_verbs[spec->num_init_verbs++] =
623 preset->init_verbs[i];
625 spec->channel_mode = preset->channel_mode;
626 spec->num_channel_mode = preset->num_channel_mode;
627 spec->need_dac_fix = preset->need_dac_fix;
629 spec->multiout.max_channels = spec->channel_mode[0].channels;
631 spec->multiout.num_dacs = preset->num_dacs;
632 spec->multiout.dac_nids = preset->dac_nids;
633 spec->multiout.dig_out_nid = preset->dig_out_nid;
634 spec->multiout.hp_nid = preset->hp_nid;
636 spec->num_mux_defs = preset->num_mux_defs;
637 if (!spec->num_mux_defs)
638 spec->num_mux_defs = 1;
639 spec->input_mux = preset->input_mux;
641 spec->num_adc_nids = preset->num_adc_nids;
642 spec->adc_nids = preset->adc_nids;
643 spec->dig_in_nid = preset->dig_in_nid;
645 spec->unsol_event = preset->unsol_event;
646 spec->init_hook = preset->init_hook;
647 #ifdef CONFIG_SND_HDA_POWER_SAVE
648 spec->loopback.amplist = preset->loopbacks;
652 /* Enable GPIO mask and set output */
653 static struct hda_verb alc_gpio1_init_verbs[] = {
654 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
655 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
656 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
660 static struct hda_verb alc_gpio2_init_verbs[] = {
661 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
662 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
663 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
667 static struct hda_verb alc_gpio3_init_verbs[] = {
668 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
669 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
670 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
674 static void alc_sku_automute(struct hda_codec *codec)
676 struct alc_spec *spec = codec->spec;
678 unsigned int present;
679 unsigned int hp_nid = spec->autocfg.hp_pins[0];
680 unsigned int sp_nid = spec->autocfg.speaker_pins[0];
682 /* need to execute and sync at first */
683 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
684 present = snd_hda_codec_read(codec, hp_nid, 0,
685 AC_VERB_GET_PIN_SENSE, 0);
686 spec->jack_present = (present & 0x80000000) != 0;
687 if (spec->jack_present) {
688 /* mute internal speaker */
689 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
690 HDA_AMP_MUTE, HDA_AMP_MUTE);
692 /* unmute internal speaker if necessary */
693 mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
694 snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
699 /* unsolicited event for HP jack sensing */
700 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
702 if (codec->vendor_id == 0x10ec0880)
706 if (res != ALC880_HP_EVENT)
709 alc_sku_automute(codec);
712 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
713 * 31 ~ 16 : Manufacture ID
715 * 7 ~ 0 : Assembly ID
716 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
718 static void alc_subsystem_id(struct hda_codec *codec,
719 unsigned int porta, unsigned int porte,
722 unsigned int ass, tmp, i;
724 struct alc_spec *spec = codec->spec;
726 ass = codec->subsystem_id & 0xffff;
727 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
731 * 31~30 : port conetcivity
734 * 19~16 : Check sum (15:1)
739 if (codec->vendor_id == 0x10ec0260)
741 ass = snd_hda_codec_read(codec, nid, 0,
742 AC_VERB_GET_CONFIG_DEFAULT, 0);
743 if (!(ass & 1) && !(ass & 0x100000))
745 if ((ass >> 30) != 1) /* no physical connection */
750 for (i = 1; i < 16; i++) {
754 if (((ass >> 16) & 0xf) != tmp)
760 * 2 : 0 --> Desktop, 1 --> Laptop
761 * 3~5 : External Amplifier control
764 tmp = (ass & 0x38) >> 3; /* external Amp control */
767 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
770 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
773 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
775 case 5: /* set EAPD output high */
776 switch (codec->vendor_id) {
778 snd_hda_codec_write(codec, 0x0f, 0,
779 AC_VERB_SET_EAPD_BTLENABLE, 2);
780 snd_hda_codec_write(codec, 0x10, 0,
781 AC_VERB_SET_EAPD_BTLENABLE, 2);
789 snd_hda_codec_write(codec, 0x14, 0,
790 AC_VERB_SET_EAPD_BTLENABLE, 2);
791 snd_hda_codec_write(codec, 0x15, 0,
792 AC_VERB_SET_EAPD_BTLENABLE, 2);
795 switch (codec->vendor_id) {
797 snd_hda_codec_write(codec, 0x1a, 0,
798 AC_VERB_SET_COEF_INDEX, 7);
799 tmp = snd_hda_codec_read(codec, 0x1a, 0,
800 AC_VERB_GET_PROC_COEF, 0);
801 snd_hda_codec_write(codec, 0x1a, 0,
802 AC_VERB_SET_COEF_INDEX, 7);
803 snd_hda_codec_write(codec, 0x1a, 0,
804 AC_VERB_SET_PROC_COEF,
813 snd_hda_codec_write(codec, 0x20, 0,
814 AC_VERB_SET_COEF_INDEX, 7);
815 tmp = snd_hda_codec_read(codec, 0x20, 0,
816 AC_VERB_GET_PROC_COEF, 0);
817 snd_hda_codec_write(codec, 0x20, 0,
818 AC_VERB_SET_COEF_INDEX, 7);
819 snd_hda_codec_write(codec, 0x20, 0,
820 AC_VERB_SET_PROC_COEF,
825 snd_hda_codec_write(codec, 0x20, 0,
826 AC_VERB_SET_COEF_INDEX, 7);
827 tmp = snd_hda_codec_read(codec, 0x20, 0,
828 AC_VERB_GET_PROC_COEF, 0);
829 snd_hda_codec_write(codec, 0x20, 0,
830 AC_VERB_SET_COEF_INDEX, 7);
831 snd_hda_codec_write(codec, 0x20, 0,
832 AC_VERB_SET_PROC_COEF,
840 /* is laptop and enable the function "Mute internal speaker
841 * when the external headphone out jack is plugged"
843 if (!(ass & 0x4) || !(ass & 0x8000))
846 * 10~8 : Jack location
847 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
849 * 15 : 1 --> enable the function "Mute internal speaker
850 * when the external headphone out jack is plugged"
852 if (!spec->autocfg.speaker_pins[0]) {
853 if (spec->multiout.dac_nids[0])
854 spec->autocfg.speaker_pins[0] =
855 spec->multiout.dac_nids[0];
860 if (!spec->autocfg.hp_pins[0]) {
861 tmp = (ass >> 11) & 0x3; /* HP to chassis */
863 spec->autocfg.hp_pins[0] = porta;
865 spec->autocfg.hp_pins[0] = porte;
867 spec->autocfg.hp_pins[0] = portd;
872 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
873 AC_VERB_SET_UNSOLICITED_ENABLE,
874 AC_USRSP_EN | ALC880_HP_EVENT);
875 spec->unsol_event = alc_sku_unsol_event;
876 spec->init_hook = alc_sku_automute;
880 * Fix-up pin default configurations
888 static void alc_fix_pincfg(struct hda_codec *codec,
889 const struct snd_pci_quirk *quirk,
890 const struct alc_pincfg **pinfix)
892 const struct alc_pincfg *cfg;
894 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
898 cfg = pinfix[quirk->value];
899 for (; cfg->nid; cfg++) {
902 for (i = 0; i < 4; i++) {
903 snd_hda_codec_write(codec, cfg->nid, 0,
904 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
912 * ALC880 3-stack model
914 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
915 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
916 * F-Mic = 0x1b, HP = 0x19
919 static hda_nid_t alc880_dac_nids[4] = {
920 /* front, rear, clfe, rear_surr */
921 0x02, 0x05, 0x04, 0x03
924 static hda_nid_t alc880_adc_nids[3] = {
929 /* The datasheet says the node 0x07 is connected from inputs,
930 * but it shows zero connection in the real implementation on some devices.
931 * Note: this is a 915GAV bug, fixed on 915GLV
933 static hda_nid_t alc880_adc_nids_alt[2] = {
938 #define ALC880_DIGOUT_NID 0x06
939 #define ALC880_DIGIN_NID 0x0a
941 static struct hda_input_mux alc880_capture_source = {
945 { "Front Mic", 0x3 },
951 /* channel source setting (2/6 channel selection for 3-stack) */
953 static struct hda_verb alc880_threestack_ch2_init[] = {
954 /* set line-in to input, mute it */
955 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
956 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
957 /* set mic-in to input vref 80%, mute it */
958 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
959 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
964 static struct hda_verb alc880_threestack_ch6_init[] = {
965 /* set line-in to output, unmute it */
966 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
967 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
968 /* set mic-in to output, unmute it */
969 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
970 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
974 static struct hda_channel_mode alc880_threestack_modes[2] = {
975 { 2, alc880_threestack_ch2_init },
976 { 6, alc880_threestack_ch6_init },
979 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
981 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
983 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
984 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
985 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
986 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
987 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
994 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
996 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
997 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1001 .name = "Channel Mode",
1002 .info = alc_ch_mode_info,
1003 .get = alc_ch_mode_get,
1004 .put = alc_ch_mode_put,
1009 /* capture mixer elements */
1010 static struct snd_kcontrol_new alc880_capture_mixer[] = {
1011 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
1012 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
1013 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
1014 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
1015 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
1016 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
1018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1019 /* The multiple "Capture Source" controls confuse alsamixer
1020 * So call somewhat different..
1021 * FIXME: the controls appear in the "playback" view!
1023 /* .name = "Capture Source", */
1024 .name = "Input Source",
1026 .info = alc_mux_enum_info,
1027 .get = alc_mux_enum_get,
1028 .put = alc_mux_enum_put,
1033 /* capture mixer elements (in case NID 0x07 not available) */
1034 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
1035 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1036 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1037 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
1038 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
1040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1041 /* The multiple "Capture Source" controls confuse alsamixer
1042 * So call somewhat different..
1043 * FIXME: the controls appear in the "playback" view!
1045 /* .name = "Capture Source", */
1046 .name = "Input Source",
1048 .info = alc_mux_enum_info,
1049 .get = alc_mux_enum_get,
1050 .put = alc_mux_enum_put,
1058 * ALC880 5-stack model
1060 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1062 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1063 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1066 /* additional mixers to alc880_three_stack_mixer */
1067 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1068 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1069 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1073 /* channel source setting (6/8 channel selection for 5-stack) */
1075 static struct hda_verb alc880_fivestack_ch6_init[] = {
1076 /* set line-in to input, mute it */
1077 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1078 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1083 static struct hda_verb alc880_fivestack_ch8_init[] = {
1084 /* set line-in to output, unmute it */
1085 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1086 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1090 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1091 { 6, alc880_fivestack_ch6_init },
1092 { 8, alc880_fivestack_ch8_init },
1097 * ALC880 6-stack model
1099 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1100 * Side = 0x05 (0x0f)
1101 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1102 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1105 static hda_nid_t alc880_6st_dac_nids[4] = {
1106 /* front, rear, clfe, rear_surr */
1107 0x02, 0x03, 0x04, 0x05
1110 static struct hda_input_mux alc880_6stack_capture_source = {
1114 { "Front Mic", 0x1 },
1120 /* fixed 8-channels */
1121 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1125 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1127 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1128 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1129 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1130 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1131 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1132 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1133 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1134 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1135 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1142 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1143 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1144 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1145 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1147 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1148 .name = "Channel Mode",
1149 .info = alc_ch_mode_info,
1150 .get = alc_ch_mode_get,
1151 .put = alc_ch_mode_put,
1160 * W810 has rear IO for:
1163 * Center/LFE (DAC 04)
1166 * The system also has a pair of internal speakers, and a headphone jack.
1167 * These are both connected to Line2 on the codec, hence to DAC 02.
1169 * There is a variable resistor to control the speaker or headphone
1170 * volume. This is a hardware-only device without a software API.
1172 * Plugging headphones in will disable the internal speakers. This is
1173 * implemented in hardware, not via the driver using jack sense. In
1174 * a similar fashion, plugging into the rear socket marked "front" will
1175 * disable both the speakers and headphones.
1177 * For input, there's a microphone jack, and an "audio in" jack.
1178 * These may not do anything useful with this driver yet, because I
1179 * haven't setup any initialization verbs for these yet...
1182 static hda_nid_t alc880_w810_dac_nids[3] = {
1183 /* front, rear/surround, clfe */
1187 /* fixed 6 channels */
1188 static struct hda_channel_mode alc880_w810_modes[1] = {
1192 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1193 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1195 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1196 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1197 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1199 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1200 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1201 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1210 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1211 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1215 static hda_nid_t alc880_z71v_dac_nids[1] = {
1218 #define ALC880_Z71V_HP_DAC 0x03
1220 /* fixed 2 channels */
1221 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1225 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1227 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1229 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1240 * ALC880 F1734 model
1242 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1243 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1246 static hda_nid_t alc880_f1734_dac_nids[1] = {
1249 #define ALC880_F1734_HP_DAC 0x02
1251 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1252 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1253 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1254 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1255 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1256 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1257 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1268 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1269 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1270 * Mic = 0x18, Line = 0x1a
1273 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1274 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1276 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1277 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1278 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1279 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1280 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1281 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1282 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1283 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1284 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1285 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1286 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1287 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1288 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1292 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1293 .name = "Channel Mode",
1294 .info = alc_ch_mode_info,
1295 .get = alc_ch_mode_get,
1296 .put = alc_ch_mode_put,
1303 * ALC880 ASUS W1V model
1305 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1306 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1307 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1310 /* additional mixers to alc880_asus_mixer */
1311 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1312 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1313 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1317 /* additional mixers to alc880_asus_mixer */
1318 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1319 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1320 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1325 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1327 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1330 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1333 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1334 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1337 /* The multiple "Capture Source" controls confuse alsamixer
1338 * So call somewhat different..
1339 * FIXME: the controls appear in the "playback" view!
1341 /* .name = "Capture Source", */
1342 .name = "Input Source",
1344 .info = alc_mux_enum_info,
1345 .get = alc_mux_enum_get,
1346 .put = alc_mux_enum_put,
1352 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1353 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1354 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1355 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1356 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1357 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1358 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1359 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1360 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1361 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1362 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1363 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1364 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1367 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1368 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1369 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1370 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1373 .name = "Channel Mode",
1374 .info = alc_ch_mode_info,
1375 .get = alc_ch_mode_get,
1376 .put = alc_ch_mode_put,
1381 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1382 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1383 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1384 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1385 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1388 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1389 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1390 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1391 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1395 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1396 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1397 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1398 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1399 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1406 * build control elements
1408 static int alc_build_controls(struct hda_codec *codec)
1410 struct alc_spec *spec = codec->spec;
1414 for (i = 0; i < spec->num_mixers; i++) {
1415 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1420 if (spec->multiout.dig_out_nid) {
1421 err = snd_hda_create_spdif_out_ctls(codec,
1422 spec->multiout.dig_out_nid);
1426 if (spec->dig_in_nid) {
1427 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1436 * initialize the codec volumes, etc
1440 * generic initialization of ADC, input mixers and output mixers
1442 static struct hda_verb alc880_volume_init_verbs[] = {
1444 * Unmute ADC0-2 and set the default input to mic-in
1446 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1447 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1448 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1450 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1453 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1455 * Note: PASD motherboards uses the Line In 2 as the input for front
1458 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1468 * Set up output mixers (0x0c - 0x0f)
1470 /* set vol=0 to output mixers */
1471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1475 /* set up input amps for analog loopback */
1476 /* Amp Indices: DAC = 0, mixer = 1 */
1477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1490 * 3-stack pin configuration:
1491 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1493 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1495 * preset connection lists of input pins
1496 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1498 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1499 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1500 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1503 * Set pin mode and muting
1505 /* set front pin widgets 0x14 for output */
1506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1508 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1510 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1511 /* Mic2 (as headphone out) for HP output */
1512 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 /* Line In pin widget for input */
1515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1517 /* Line2 (as front mic) pin widget for input and vref at 80% */
1518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1519 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1520 /* CD pin widget for input */
1521 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1527 * 5-stack pin configuration:
1528 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1529 * line-in/side = 0x1a, f-mic = 0x1b
1531 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1533 * preset connection lists of input pins
1534 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1536 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1537 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1540 * Set pin mode and muting
1542 /* set pin widgets 0x14-0x17 for output */
1543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1546 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1547 /* unmute pins for output (no gain on this amp) */
1548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1550 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1551 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1553 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1555 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1556 /* Mic2 (as headphone out) for HP output */
1557 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1558 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1559 /* Line In pin widget for input */
1560 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1562 /* Line2 (as front mic) pin widget for input and vref at 80% */
1563 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1564 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1565 /* CD pin widget for input */
1566 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1572 * W810 pin configuration:
1573 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1575 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1576 /* hphone/speaker input selector: front DAC */
1577 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1580 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1582 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1583 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1584 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1586 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1587 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1593 * Z71V pin configuration:
1594 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1596 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1600 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1602 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1603 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1605 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1611 * 6-stack pin configuration:
1612 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1613 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1615 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1616 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1619 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1620 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1621 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1622 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1623 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1624 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1625 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1628 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1632 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1633 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1634 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1641 * Uniwill pin configuration:
1642 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1645 static struct hda_verb alc880_uniwill_init_verbs[] = {
1646 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1648 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1649 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1652 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1653 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1654 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1663 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1664 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1665 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1667 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1668 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1669 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1670 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1671 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1673 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1674 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1681 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1683 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1684 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1694 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1696 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1697 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1699 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1701 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1703 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1706 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1707 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1712 static struct hda_verb alc880_beep_init_verbs[] = {
1713 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1717 /* toggle speaker-output according to the hp-jack state */
1718 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1720 unsigned int present;
1723 present = snd_hda_codec_read(codec, 0x14, 0,
1724 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1725 bits = present ? HDA_AMP_MUTE : 0;
1726 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1727 HDA_AMP_MUTE, bits);
1728 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1729 HDA_AMP_MUTE, bits);
1732 /* auto-toggle front mic */
1733 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1735 unsigned int present;
1738 present = snd_hda_codec_read(codec, 0x18, 0,
1739 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1740 bits = present ? HDA_AMP_MUTE : 0;
1741 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1744 static void alc880_uniwill_automute(struct hda_codec *codec)
1746 alc880_uniwill_hp_automute(codec);
1747 alc880_uniwill_mic_automute(codec);
1750 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1753 /* Looks like the unsol event is incompatible with the standard
1754 * definition. 4bit tag is placed at 28 bit!
1756 switch (res >> 28) {
1757 case ALC880_HP_EVENT:
1758 alc880_uniwill_hp_automute(codec);
1760 case ALC880_MIC_EVENT:
1761 alc880_uniwill_mic_automute(codec);
1766 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1768 unsigned int present;
1771 present = snd_hda_codec_read(codec, 0x14, 0,
1772 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1773 bits = present ? HDA_AMP_MUTE : 0;
1774 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1777 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1779 unsigned int present;
1781 present = snd_hda_codec_read(codec, 0x21, 0,
1782 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1783 present &= HDA_AMP_VOLMASK;
1784 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1785 HDA_AMP_VOLMASK, present);
1786 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1787 HDA_AMP_VOLMASK, present);
1790 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1793 /* Looks like the unsol event is incompatible with the standard
1794 * definition. 4bit tag is placed at 28 bit!
1796 if ((res >> 28) == ALC880_HP_EVENT)
1797 alc880_uniwill_p53_hp_automute(codec);
1798 if ((res >> 28) == ALC880_DCVOL_EVENT)
1799 alc880_uniwill_p53_dcvol_automute(codec);
1804 * F1734 pin configuration:
1805 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1807 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1808 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1809 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1810 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1811 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1818 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1819 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1820 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1821 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1822 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1823 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1826 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1833 * ASUS pin configuration:
1834 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1836 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1837 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1838 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1839 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1840 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1842 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1846 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1848 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1849 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1853 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1855 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1856 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1857 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1858 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1859 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1864 /* Enable GPIO mask and set output */
1865 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1866 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1868 /* Clevo m520g init */
1869 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1870 /* headphone output */
1871 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1879 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1880 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 /* Mic1 (rear panel) */
1882 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1884 /* Mic2 (front panel) */
1885 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1890 /* change to EAPD mode */
1891 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1892 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1897 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1898 /* change to EAPD mode */
1899 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1900 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1902 /* Headphone output */
1903 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1905 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1906 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1908 /* Line In pin widget for input */
1909 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1910 /* CD pin widget for input */
1911 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1912 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1915 /* change to EAPD mode */
1916 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1917 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1923 * LG m1 express dual
1926 * Rear Line-In/Out (blue): 0x14
1927 * Build-in Mic-In: 0x15
1929 * HP-Out (green): 0x1b
1930 * Mic-In/Out (red): 0x19
1934 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1935 static hda_nid_t alc880_lg_dac_nids[3] = {
1939 /* seems analog CD is not working */
1940 static struct hda_input_mux alc880_lg_capture_source = {
1945 { "Internal Mic", 0x6 },
1949 /* 2,4,6 channel modes */
1950 static struct hda_verb alc880_lg_ch2_init[] = {
1951 /* set line-in and mic-in to input */
1952 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1953 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1957 static struct hda_verb alc880_lg_ch4_init[] = {
1958 /* set line-in to out and mic-in to input */
1959 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1960 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1964 static struct hda_verb alc880_lg_ch6_init[] = {
1965 /* set line-in and mic-in to output */
1966 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1967 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1971 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
1972 { 2, alc880_lg_ch2_init },
1973 { 4, alc880_lg_ch4_init },
1974 { 6, alc880_lg_ch6_init },
1977 static struct snd_kcontrol_new alc880_lg_mixer[] = {
1978 /* FIXME: it's not really "master" but front channels */
1979 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1980 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
1981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1982 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
1983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
1984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
1985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
1986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1989 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
1990 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
1992 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
1994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1995 .name = "Channel Mode",
1996 .info = alc_ch_mode_info,
1997 .get = alc_ch_mode_get,
1998 .put = alc_ch_mode_put,
2003 static struct hda_verb alc880_lg_init_verbs[] = {
2004 /* set capture source to mic-in */
2005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2006 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2007 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2008 /* mute all amp mixer inputs */
2009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2012 /* line-in to input */
2013 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2016 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2019 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2020 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2021 /* mic-in to input */
2022 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2023 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2024 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2026 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2027 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2028 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2030 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2034 /* toggle speaker-output according to the hp-jack state */
2035 static void alc880_lg_automute(struct hda_codec *codec)
2037 unsigned int present;
2040 present = snd_hda_codec_read(codec, 0x1b, 0,
2041 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2042 bits = present ? HDA_AMP_MUTE : 0;
2043 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2044 HDA_AMP_MUTE, bits);
2047 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
2049 /* Looks like the unsol event is incompatible with the standard
2050 * definition. 4bit tag is placed at 28 bit!
2052 if ((res >> 28) == 0x01)
2053 alc880_lg_automute(codec);
2062 * Built-in Mic-In: 0x19
2068 static struct hda_input_mux alc880_lg_lw_capture_source = {
2072 { "Internal Mic", 0x1 },
2077 #define alc880_lg_lw_modes alc880_threestack_modes
2079 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2080 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2081 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2082 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2083 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2084 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2085 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2086 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2087 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2088 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2089 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2090 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2092 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2093 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2095 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2096 .name = "Channel Mode",
2097 .info = alc_ch_mode_info,
2098 .get = alc_ch_mode_get,
2099 .put = alc_ch_mode_put,
2104 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2105 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2106 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2107 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2109 /* set capture source to mic-in */
2110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2111 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2112 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2115 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2116 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2120 /* mic-in to input */
2121 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2124 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2125 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2127 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
2131 /* toggle speaker-output according to the hp-jack state */
2132 static void alc880_lg_lw_automute(struct hda_codec *codec)
2134 unsigned int present;
2137 present = snd_hda_codec_read(codec, 0x1b, 0,
2138 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2139 bits = present ? HDA_AMP_MUTE : 0;
2140 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2141 HDA_AMP_MUTE, bits);
2144 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2146 /* Looks like the unsol event is incompatible with the standard
2147 * definition. 4bit tag is placed at 28 bit!
2149 if ((res >> 28) == 0x01)
2150 alc880_lg_lw_automute(codec);
2153 #ifdef CONFIG_SND_HDA_POWER_SAVE
2154 static struct hda_amp_list alc880_loopbacks[] = {
2155 { 0x0b, HDA_INPUT, 0 },
2156 { 0x0b, HDA_INPUT, 1 },
2157 { 0x0b, HDA_INPUT, 2 },
2158 { 0x0b, HDA_INPUT, 3 },
2159 { 0x0b, HDA_INPUT, 4 },
2163 static struct hda_amp_list alc880_lg_loopbacks[] = {
2164 { 0x0b, HDA_INPUT, 1 },
2165 { 0x0b, HDA_INPUT, 6 },
2166 { 0x0b, HDA_INPUT, 7 },
2175 static int alc_init(struct hda_codec *codec)
2177 struct alc_spec *spec = codec->spec;
2180 for (i = 0; i < spec->num_init_verbs; i++)
2181 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2183 if (spec->init_hook)
2184 spec->init_hook(codec);
2189 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2191 struct alc_spec *spec = codec->spec;
2193 if (spec->unsol_event)
2194 spec->unsol_event(codec, res);
2197 #ifdef CONFIG_SND_HDA_POWER_SAVE
2198 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2200 struct alc_spec *spec = codec->spec;
2201 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2206 * Analog playback callbacks
2208 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2209 struct hda_codec *codec,
2210 struct snd_pcm_substream *substream)
2212 struct alc_spec *spec = codec->spec;
2213 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2216 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2217 struct hda_codec *codec,
2218 unsigned int stream_tag,
2219 unsigned int format,
2220 struct snd_pcm_substream *substream)
2222 struct alc_spec *spec = codec->spec;
2223 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2224 stream_tag, format, substream);
2227 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2228 struct hda_codec *codec,
2229 struct snd_pcm_substream *substream)
2231 struct alc_spec *spec = codec->spec;
2232 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2238 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2239 struct hda_codec *codec,
2240 struct snd_pcm_substream *substream)
2242 struct alc_spec *spec = codec->spec;
2243 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2246 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2247 struct hda_codec *codec,
2248 unsigned int stream_tag,
2249 unsigned int format,
2250 struct snd_pcm_substream *substream)
2252 struct alc_spec *spec = codec->spec;
2253 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2254 stream_tag, format, substream);
2257 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2258 struct hda_codec *codec,
2259 struct snd_pcm_substream *substream)
2261 struct alc_spec *spec = codec->spec;
2262 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2268 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2269 struct hda_codec *codec,
2270 unsigned int stream_tag,
2271 unsigned int format,
2272 struct snd_pcm_substream *substream)
2274 struct alc_spec *spec = codec->spec;
2276 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2277 stream_tag, 0, format);
2281 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2282 struct hda_codec *codec,
2283 struct snd_pcm_substream *substream)
2285 struct alc_spec *spec = codec->spec;
2287 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2295 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2299 /* NID is set in alc_build_pcms */
2301 .open = alc880_playback_pcm_open,
2302 .prepare = alc880_playback_pcm_prepare,
2303 .cleanup = alc880_playback_pcm_cleanup
2307 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2311 /* NID is set in alc_build_pcms */
2313 .prepare = alc880_capture_pcm_prepare,
2314 .cleanup = alc880_capture_pcm_cleanup
2318 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2322 /* NID is set in alc_build_pcms */
2324 .open = alc880_dig_playback_pcm_open,
2325 .close = alc880_dig_playback_pcm_close,
2326 .prepare = alc880_dig_playback_pcm_prepare
2330 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2334 /* NID is set in alc_build_pcms */
2337 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2338 static struct hda_pcm_stream alc_pcm_null_playback = {
2344 static int alc_build_pcms(struct hda_codec *codec)
2346 struct alc_spec *spec = codec->spec;
2347 struct hda_pcm *info = spec->pcm_rec;
2350 codec->num_pcms = 1;
2351 codec->pcm_info = info;
2353 info->name = spec->stream_name_analog;
2354 if (spec->stream_analog_playback) {
2355 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2356 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2357 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2359 if (spec->stream_analog_capture) {
2360 snd_assert(spec->adc_nids, return -EINVAL);
2361 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2362 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2365 if (spec->channel_mode) {
2366 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2367 for (i = 0; i < spec->num_channel_mode; i++) {
2368 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2369 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2374 /* SPDIF for stream index #1 */
2375 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2376 codec->num_pcms = 2;
2377 info = spec->pcm_rec + 1;
2378 info->name = spec->stream_name_digital;
2379 if (spec->multiout.dig_out_nid &&
2380 spec->stream_digital_playback) {
2381 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2382 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2384 if (spec->dig_in_nid &&
2385 spec->stream_digital_capture) {
2386 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2387 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2391 /* If the use of more than one ADC is requested for the current
2392 * model, configure a second analog capture-only PCM.
2394 /* Additional Analaog capture for index #2 */
2395 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2397 codec->num_pcms = 3;
2398 info = spec->pcm_rec + 2;
2399 info->name = spec->stream_name_analog;
2400 /* No playback stream for second PCM */
2401 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2402 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2403 if (spec->stream_analog_capture) {
2404 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2405 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2412 static void alc_free(struct hda_codec *codec)
2414 struct alc_spec *spec = codec->spec;
2420 if (spec->kctl_alloc) {
2421 for (i = 0; i < spec->num_kctl_used; i++)
2422 kfree(spec->kctl_alloc[i].name);
2423 kfree(spec->kctl_alloc);
2430 static struct hda_codec_ops alc_patch_ops = {
2431 .build_controls = alc_build_controls,
2432 .build_pcms = alc_build_pcms,
2435 .unsol_event = alc_unsol_event,
2436 #ifdef CONFIG_SND_HDA_POWER_SAVE
2437 .check_power_status = alc_check_power_status,
2443 * Test configuration for debugging
2445 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2448 #ifdef CONFIG_SND_DEBUG
2449 static hda_nid_t alc880_test_dac_nids[4] = {
2450 0x02, 0x03, 0x04, 0x05
2453 static struct hda_input_mux alc880_test_capture_source = {
2462 { "Surround", 0x6 },
2466 static struct hda_channel_mode alc880_test_modes[4] = {
2473 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2474 struct snd_ctl_elem_info *uinfo)
2476 static char *texts[] = {
2477 "N/A", "Line Out", "HP Out",
2478 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2480 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2482 uinfo->value.enumerated.items = 8;
2483 if (uinfo->value.enumerated.item >= 8)
2484 uinfo->value.enumerated.item = 7;
2485 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2489 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2490 struct snd_ctl_elem_value *ucontrol)
2492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2493 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2494 unsigned int pin_ctl, item = 0;
2496 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2497 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2498 if (pin_ctl & AC_PINCTL_OUT_EN) {
2499 if (pin_ctl & AC_PINCTL_HP_EN)
2503 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2504 switch (pin_ctl & AC_PINCTL_VREFEN) {
2505 case AC_PINCTL_VREF_HIZ: item = 3; break;
2506 case AC_PINCTL_VREF_50: item = 4; break;
2507 case AC_PINCTL_VREF_GRD: item = 5; break;
2508 case AC_PINCTL_VREF_80: item = 6; break;
2509 case AC_PINCTL_VREF_100: item = 7; break;
2512 ucontrol->value.enumerated.item[0] = item;
2516 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2517 struct snd_ctl_elem_value *ucontrol)
2519 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2520 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2521 static unsigned int ctls[] = {
2522 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2523 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2524 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2525 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2526 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2527 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2529 unsigned int old_ctl, new_ctl;
2531 old_ctl = snd_hda_codec_read(codec, nid, 0,
2532 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2533 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2534 if (old_ctl != new_ctl) {
2536 snd_hda_codec_write_cache(codec, nid, 0,
2537 AC_VERB_SET_PIN_WIDGET_CONTROL,
2539 val = ucontrol->value.enumerated.item[0] >= 3 ?
2541 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2548 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2549 struct snd_ctl_elem_info *uinfo)
2551 static char *texts[] = {
2552 "Front", "Surround", "CLFE", "Side"
2554 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2556 uinfo->value.enumerated.items = 4;
2557 if (uinfo->value.enumerated.item >= 4)
2558 uinfo->value.enumerated.item = 3;
2559 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2563 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2564 struct snd_ctl_elem_value *ucontrol)
2566 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2567 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2570 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2571 ucontrol->value.enumerated.item[0] = sel & 3;
2575 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2576 struct snd_ctl_elem_value *ucontrol)
2578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2579 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2582 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2583 if (ucontrol->value.enumerated.item[0] != sel) {
2584 sel = ucontrol->value.enumerated.item[0] & 3;
2585 snd_hda_codec_write_cache(codec, nid, 0,
2586 AC_VERB_SET_CONNECT_SEL, sel);
2592 #define PIN_CTL_TEST(xname,nid) { \
2593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2595 .info = alc_test_pin_ctl_info, \
2596 .get = alc_test_pin_ctl_get, \
2597 .put = alc_test_pin_ctl_put, \
2598 .private_value = nid \
2601 #define PIN_SRC_TEST(xname,nid) { \
2602 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2604 .info = alc_test_pin_src_info, \
2605 .get = alc_test_pin_src_get, \
2606 .put = alc_test_pin_src_put, \
2607 .private_value = nid \
2610 static struct snd_kcontrol_new alc880_test_mixer[] = {
2611 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2613 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2614 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2615 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2616 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2617 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2618 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2619 PIN_CTL_TEST("Front Pin Mode", 0x14),
2620 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2621 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2622 PIN_CTL_TEST("Side Pin Mode", 0x17),
2623 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2624 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2625 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2626 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2627 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2628 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2629 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2630 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2631 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2632 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2633 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2634 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2635 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2636 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2637 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2638 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2639 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2640 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2643 .name = "Channel Mode",
2644 .info = alc_ch_mode_info,
2645 .get = alc_ch_mode_get,
2646 .put = alc_ch_mode_put,
2651 static struct hda_verb alc880_test_init_verbs[] = {
2652 /* Unmute inputs of 0x0c - 0x0f */
2653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2658 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2661 /* Vol output for 0x0c-0x0f */
2662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2666 /* Set output pins 0x14-0x17 */
2667 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2669 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2670 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2671 /* Unmute output pins 0x14-0x17 */
2672 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2674 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2676 /* Set input pins 0x18-0x1c */
2677 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2678 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2679 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2680 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2681 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2682 /* Mute input pins 0x18-0x1b */
2683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2685 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2686 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2689 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2690 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2691 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2692 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2693 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2694 /* Analog input/passthru */
2695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2707 static const char *alc880_models[ALC880_MODEL_LAST] = {
2708 [ALC880_3ST] = "3stack",
2709 [ALC880_TCL_S700] = "tcl",
2710 [ALC880_3ST_DIG] = "3stack-digout",
2711 [ALC880_CLEVO] = "clevo",
2712 [ALC880_5ST] = "5stack",
2713 [ALC880_5ST_DIG] = "5stack-digout",
2714 [ALC880_W810] = "w810",
2715 [ALC880_Z71V] = "z71v",
2716 [ALC880_6ST] = "6stack",
2717 [ALC880_6ST_DIG] = "6stack-digout",
2718 [ALC880_ASUS] = "asus",
2719 [ALC880_ASUS_W1V] = "asus-w1v",
2720 [ALC880_ASUS_DIG] = "asus-dig",
2721 [ALC880_ASUS_DIG2] = "asus-dig2",
2722 [ALC880_UNIWILL_DIG] = "uniwill",
2723 [ALC880_UNIWILL_P53] = "uniwill-p53",
2724 [ALC880_FUJITSU] = "fujitsu",
2725 [ALC880_F1734] = "F1734",
2727 [ALC880_LG_LW] = "lg-lw",
2728 #ifdef CONFIG_SND_DEBUG
2729 [ALC880_TEST] = "test",
2731 [ALC880_AUTO] = "auto",
2734 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2735 /* Broken BIOS configuration */
2736 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2737 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2739 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2740 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2741 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2742 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2743 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2744 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2745 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2746 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2747 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2749 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2750 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2752 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2753 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2754 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2755 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2756 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2757 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2758 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2759 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2760 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2761 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2762 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2763 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2764 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2765 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2766 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2768 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2769 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2770 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2771 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2772 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2773 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2774 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2775 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2776 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2777 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2778 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2779 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2780 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2781 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2782 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2783 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2784 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2785 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2787 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2788 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2789 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2790 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2792 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2793 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2794 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2795 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2797 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2798 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2799 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2800 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2802 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2803 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2804 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2805 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2806 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2807 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2808 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2809 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2810 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2811 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2812 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2818 * ALC880 codec presets
2820 static struct alc_config_preset alc880_presets[] = {
2822 .mixers = { alc880_three_stack_mixer },
2823 .init_verbs = { alc880_volume_init_verbs,
2824 alc880_pin_3stack_init_verbs },
2825 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2826 .dac_nids = alc880_dac_nids,
2827 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2828 .channel_mode = alc880_threestack_modes,
2830 .input_mux = &alc880_capture_source,
2832 [ALC880_3ST_DIG] = {
2833 .mixers = { alc880_three_stack_mixer },
2834 .init_verbs = { alc880_volume_init_verbs,
2835 alc880_pin_3stack_init_verbs },
2836 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2837 .dac_nids = alc880_dac_nids,
2838 .dig_out_nid = ALC880_DIGOUT_NID,
2839 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2840 .channel_mode = alc880_threestack_modes,
2842 .input_mux = &alc880_capture_source,
2844 [ALC880_TCL_S700] = {
2845 .mixers = { alc880_tcl_s700_mixer },
2846 .init_verbs = { alc880_volume_init_verbs,
2847 alc880_pin_tcl_S700_init_verbs,
2848 alc880_gpio2_init_verbs },
2849 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2850 .dac_nids = alc880_dac_nids,
2852 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2853 .channel_mode = alc880_2_jack_modes,
2854 .input_mux = &alc880_capture_source,
2857 .mixers = { alc880_three_stack_mixer,
2858 alc880_five_stack_mixer},
2859 .init_verbs = { alc880_volume_init_verbs,
2860 alc880_pin_5stack_init_verbs },
2861 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2862 .dac_nids = alc880_dac_nids,
2863 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2864 .channel_mode = alc880_fivestack_modes,
2865 .input_mux = &alc880_capture_source,
2867 [ALC880_5ST_DIG] = {
2868 .mixers = { alc880_three_stack_mixer,
2869 alc880_five_stack_mixer },
2870 .init_verbs = { alc880_volume_init_verbs,
2871 alc880_pin_5stack_init_verbs },
2872 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2873 .dac_nids = alc880_dac_nids,
2874 .dig_out_nid = ALC880_DIGOUT_NID,
2875 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2876 .channel_mode = alc880_fivestack_modes,
2877 .input_mux = &alc880_capture_source,
2880 .mixers = { alc880_six_stack_mixer },
2881 .init_verbs = { alc880_volume_init_verbs,
2882 alc880_pin_6stack_init_verbs },
2883 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2884 .dac_nids = alc880_6st_dac_nids,
2885 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2886 .channel_mode = alc880_sixstack_modes,
2887 .input_mux = &alc880_6stack_capture_source,
2889 [ALC880_6ST_DIG] = {
2890 .mixers = { alc880_six_stack_mixer },
2891 .init_verbs = { alc880_volume_init_verbs,
2892 alc880_pin_6stack_init_verbs },
2893 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2894 .dac_nids = alc880_6st_dac_nids,
2895 .dig_out_nid = ALC880_DIGOUT_NID,
2896 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2897 .channel_mode = alc880_sixstack_modes,
2898 .input_mux = &alc880_6stack_capture_source,
2901 .mixers = { alc880_w810_base_mixer },
2902 .init_verbs = { alc880_volume_init_verbs,
2903 alc880_pin_w810_init_verbs,
2904 alc880_gpio2_init_verbs },
2905 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2906 .dac_nids = alc880_w810_dac_nids,
2907 .dig_out_nid = ALC880_DIGOUT_NID,
2908 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2909 .channel_mode = alc880_w810_modes,
2910 .input_mux = &alc880_capture_source,
2913 .mixers = { alc880_z71v_mixer },
2914 .init_verbs = { alc880_volume_init_verbs,
2915 alc880_pin_z71v_init_verbs },
2916 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2917 .dac_nids = alc880_z71v_dac_nids,
2918 .dig_out_nid = ALC880_DIGOUT_NID,
2920 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2921 .channel_mode = alc880_2_jack_modes,
2922 .input_mux = &alc880_capture_source,
2925 .mixers = { alc880_f1734_mixer },
2926 .init_verbs = { alc880_volume_init_verbs,
2927 alc880_pin_f1734_init_verbs },
2928 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2929 .dac_nids = alc880_f1734_dac_nids,
2931 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2932 .channel_mode = alc880_2_jack_modes,
2933 .input_mux = &alc880_capture_source,
2936 .mixers = { alc880_asus_mixer },
2937 .init_verbs = { alc880_volume_init_verbs,
2938 alc880_pin_asus_init_verbs,
2939 alc880_gpio1_init_verbs },
2940 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2941 .dac_nids = alc880_asus_dac_nids,
2942 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2943 .channel_mode = alc880_asus_modes,
2945 .input_mux = &alc880_capture_source,
2947 [ALC880_ASUS_DIG] = {
2948 .mixers = { alc880_asus_mixer },
2949 .init_verbs = { alc880_volume_init_verbs,
2950 alc880_pin_asus_init_verbs,
2951 alc880_gpio1_init_verbs },
2952 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2953 .dac_nids = alc880_asus_dac_nids,
2954 .dig_out_nid = ALC880_DIGOUT_NID,
2955 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2956 .channel_mode = alc880_asus_modes,
2958 .input_mux = &alc880_capture_source,
2960 [ALC880_ASUS_DIG2] = {
2961 .mixers = { alc880_asus_mixer },
2962 .init_verbs = { alc880_volume_init_verbs,
2963 alc880_pin_asus_init_verbs,
2964 alc880_gpio2_init_verbs }, /* use GPIO2 */
2965 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2966 .dac_nids = alc880_asus_dac_nids,
2967 .dig_out_nid = ALC880_DIGOUT_NID,
2968 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2969 .channel_mode = alc880_asus_modes,
2971 .input_mux = &alc880_capture_source,
2973 [ALC880_ASUS_W1V] = {
2974 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2975 .init_verbs = { alc880_volume_init_verbs,
2976 alc880_pin_asus_init_verbs,
2977 alc880_gpio1_init_verbs },
2978 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2979 .dac_nids = alc880_asus_dac_nids,
2980 .dig_out_nid = ALC880_DIGOUT_NID,
2981 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2982 .channel_mode = alc880_asus_modes,
2984 .input_mux = &alc880_capture_source,
2986 [ALC880_UNIWILL_DIG] = {
2987 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2988 .init_verbs = { alc880_volume_init_verbs,
2989 alc880_pin_asus_init_verbs },
2990 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2991 .dac_nids = alc880_asus_dac_nids,
2992 .dig_out_nid = ALC880_DIGOUT_NID,
2993 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2994 .channel_mode = alc880_asus_modes,
2996 .input_mux = &alc880_capture_source,
2998 [ALC880_UNIWILL] = {
2999 .mixers = { alc880_uniwill_mixer },
3000 .init_verbs = { alc880_volume_init_verbs,
3001 alc880_uniwill_init_verbs },
3002 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3003 .dac_nids = alc880_asus_dac_nids,
3004 .dig_out_nid = ALC880_DIGOUT_NID,
3005 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3006 .channel_mode = alc880_threestack_modes,
3008 .input_mux = &alc880_capture_source,
3009 .unsol_event = alc880_uniwill_unsol_event,
3010 .init_hook = alc880_uniwill_automute,
3012 [ALC880_UNIWILL_P53] = {
3013 .mixers = { alc880_uniwill_p53_mixer },
3014 .init_verbs = { alc880_volume_init_verbs,
3015 alc880_uniwill_p53_init_verbs },
3016 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3017 .dac_nids = alc880_asus_dac_nids,
3018 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3019 .channel_mode = alc880_threestack_modes,
3020 .input_mux = &alc880_capture_source,
3021 .unsol_event = alc880_uniwill_p53_unsol_event,
3022 .init_hook = alc880_uniwill_p53_hp_automute,
3024 [ALC880_FUJITSU] = {
3025 .mixers = { alc880_fujitsu_mixer,
3026 alc880_pcbeep_mixer, },
3027 .init_verbs = { alc880_volume_init_verbs,
3028 alc880_uniwill_p53_init_verbs,
3029 alc880_beep_init_verbs },
3030 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3031 .dac_nids = alc880_dac_nids,
3032 .dig_out_nid = ALC880_DIGOUT_NID,
3033 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3034 .channel_mode = alc880_2_jack_modes,
3035 .input_mux = &alc880_capture_source,
3036 .unsol_event = alc880_uniwill_p53_unsol_event,
3037 .init_hook = alc880_uniwill_p53_hp_automute,
3040 .mixers = { alc880_three_stack_mixer },
3041 .init_verbs = { alc880_volume_init_verbs,
3042 alc880_pin_clevo_init_verbs },
3043 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3044 .dac_nids = alc880_dac_nids,
3046 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3047 .channel_mode = alc880_threestack_modes,
3049 .input_mux = &alc880_capture_source,
3052 .mixers = { alc880_lg_mixer },
3053 .init_verbs = { alc880_volume_init_verbs,
3054 alc880_lg_init_verbs },
3055 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
3056 .dac_nids = alc880_lg_dac_nids,
3057 .dig_out_nid = ALC880_DIGOUT_NID,
3058 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
3059 .channel_mode = alc880_lg_ch_modes,
3061 .input_mux = &alc880_lg_capture_source,
3062 .unsol_event = alc880_lg_unsol_event,
3063 .init_hook = alc880_lg_automute,
3064 #ifdef CONFIG_SND_HDA_POWER_SAVE
3065 .loopbacks = alc880_lg_loopbacks,
3069 .mixers = { alc880_lg_lw_mixer },
3070 .init_verbs = { alc880_volume_init_verbs,
3071 alc880_lg_lw_init_verbs },
3072 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3073 .dac_nids = alc880_dac_nids,
3074 .dig_out_nid = ALC880_DIGOUT_NID,
3075 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3076 .channel_mode = alc880_lg_lw_modes,
3077 .input_mux = &alc880_lg_lw_capture_source,
3078 .unsol_event = alc880_lg_lw_unsol_event,
3079 .init_hook = alc880_lg_lw_automute,
3081 #ifdef CONFIG_SND_DEBUG
3083 .mixers = { alc880_test_mixer },
3084 .init_verbs = { alc880_test_init_verbs },
3085 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
3086 .dac_nids = alc880_test_dac_nids,
3087 .dig_out_nid = ALC880_DIGOUT_NID,
3088 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
3089 .channel_mode = alc880_test_modes,
3090 .input_mux = &alc880_test_capture_source,
3096 * Automatic parse of I/O pins from the BIOS configuration
3099 #define NUM_CONTROL_ALLOC 32
3100 #define NUM_VERB_ALLOC 32
3104 ALC_CTL_WIDGET_MUTE,
3107 static struct snd_kcontrol_new alc880_control_templates[] = {
3108 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
3109 HDA_CODEC_MUTE(NULL, 0, 0, 0),
3110 HDA_BIND_MUTE(NULL, 0, 0, 0),
3113 /* add dynamic controls */
3114 static int add_control(struct alc_spec *spec, int type, const char *name,
3117 struct snd_kcontrol_new *knew;
3119 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
3120 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
3122 /* array + terminator */
3123 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
3126 if (spec->kctl_alloc) {
3127 memcpy(knew, spec->kctl_alloc,
3128 sizeof(*knew) * spec->num_kctl_alloc);
3129 kfree(spec->kctl_alloc);
3131 spec->kctl_alloc = knew;
3132 spec->num_kctl_alloc = num;
3135 knew = &spec->kctl_alloc[spec->num_kctl_used];
3136 *knew = alc880_control_templates[type];
3137 knew->name = kstrdup(name, GFP_KERNEL);
3140 knew->private_value = val;
3141 spec->num_kctl_used++;
3145 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3146 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3147 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3148 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3149 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3150 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3151 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3152 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3153 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3154 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3155 #define ALC880_PIN_CD_NID 0x1c
3157 /* fill in the dac_nids table from the parsed pin configuration */
3158 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3159 const struct auto_pin_cfg *cfg)
3165 memset(assigned, 0, sizeof(assigned));
3166 spec->multiout.dac_nids = spec->private_dac_nids;
3168 /* check the pins hardwired to audio widget */
3169 for (i = 0; i < cfg->line_outs; i++) {
3170 nid = cfg->line_out_pins[i];
3171 if (alc880_is_fixed_pin(nid)) {
3172 int idx = alc880_fixed_pin_idx(nid);
3173 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3177 /* left pins can be connect to any audio widget */
3178 for (i = 0; i < cfg->line_outs; i++) {
3179 nid = cfg->line_out_pins[i];
3180 if (alc880_is_fixed_pin(nid))
3182 /* search for an empty channel */
3183 for (j = 0; j < cfg->line_outs; j++) {
3185 spec->multiout.dac_nids[i] =
3186 alc880_idx_to_dac(j);
3192 spec->multiout.num_dacs = cfg->line_outs;
3196 /* add playback controls from the parsed DAC table */
3197 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3198 const struct auto_pin_cfg *cfg)
3201 static const char *chname[4] = {
3202 "Front", "Surround", NULL /*CLFE*/, "Side"
3207 for (i = 0; i < cfg->line_outs; i++) {
3208 if (!spec->multiout.dac_nids[i])
3210 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3213 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3214 "Center Playback Volume",
3215 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3219 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3220 "LFE Playback Volume",
3221 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3225 err = add_control(spec, ALC_CTL_BIND_MUTE,
3226 "Center Playback Switch",
3227 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3231 err = add_control(spec, ALC_CTL_BIND_MUTE,
3232 "LFE Playback Switch",
3233 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3238 sprintf(name, "%s Playback Volume", chname[i]);
3239 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3240 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3244 sprintf(name, "%s Playback Switch", chname[i]);
3245 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3246 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3255 /* add playback controls for speaker and HP outputs */
3256 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3266 if (alc880_is_fixed_pin(pin)) {
3267 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3268 /* specify the DAC as the extra output */
3269 if (!spec->multiout.hp_nid)
3270 spec->multiout.hp_nid = nid;
3272 spec->multiout.extra_out_nid[0] = nid;
3273 /* control HP volume/switch on the output mixer amp */
3274 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3275 sprintf(name, "%s Playback Volume", pfx);
3276 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3277 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3280 sprintf(name, "%s Playback Switch", pfx);
3281 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3282 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3285 } else if (alc880_is_multi_pin(pin)) {
3286 /* set manual connection */
3287 /* we have only a switch on HP-out PIN */
3288 sprintf(name, "%s Playback Switch", pfx);
3289 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3290 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3297 /* create input playback/capture controls for the given pin */
3298 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3299 const char *ctlname,
3300 int idx, hda_nid_t mix_nid)
3305 sprintf(name, "%s Playback Volume", ctlname);
3306 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3307 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3310 sprintf(name, "%s Playback Switch", ctlname);
3311 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3312 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3318 /* create playback/capture controls for input pins */
3319 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3320 const struct auto_pin_cfg *cfg)
3322 struct hda_input_mux *imux = &spec->private_imux;
3325 for (i = 0; i < AUTO_PIN_LAST; i++) {
3326 if (alc880_is_input_pin(cfg->input_pins[i])) {
3327 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3328 err = new_analog_input(spec, cfg->input_pins[i],
3329 auto_pin_cfg_labels[i],
3333 imux->items[imux->num_items].label =
3334 auto_pin_cfg_labels[i];
3335 imux->items[imux->num_items].index =
3336 alc880_input_pin_idx(cfg->input_pins[i]);
3343 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3344 hda_nid_t nid, int pin_type,
3348 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3350 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3352 /* need the manual connection? */
3353 if (alc880_is_multi_pin(nid)) {
3354 struct alc_spec *spec = codec->spec;
3355 int idx = alc880_multi_pin_idx(nid);
3356 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3357 AC_VERB_SET_CONNECT_SEL,
3358 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3362 static int get_pin_type(int line_out_type)
3364 if (line_out_type == AUTO_PIN_HP_OUT)
3370 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3372 struct alc_spec *spec = codec->spec;
3375 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3376 for (i = 0; i < spec->autocfg.line_outs; i++) {
3377 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3378 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3379 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3383 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3385 struct alc_spec *spec = codec->spec;
3388 pin = spec->autocfg.speaker_pins[0];
3389 if (pin) /* connect to front */
3390 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3391 pin = spec->autocfg.hp_pins[0];
3392 if (pin) /* connect to front */
3393 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3396 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3398 struct alc_spec *spec = codec->spec;
3401 for (i = 0; i < AUTO_PIN_LAST; i++) {
3402 hda_nid_t nid = spec->autocfg.input_pins[i];
3403 if (alc880_is_input_pin(nid)) {
3404 snd_hda_codec_write(codec, nid, 0,
3405 AC_VERB_SET_PIN_WIDGET_CONTROL,
3406 i <= AUTO_PIN_FRONT_MIC ?
3407 PIN_VREF80 : PIN_IN);
3408 if (nid != ALC880_PIN_CD_NID)
3409 snd_hda_codec_write(codec, nid, 0,
3410 AC_VERB_SET_AMP_GAIN_MUTE,
3416 /* parse the BIOS configuration and set up the alc_spec */
3417 /* return 1 if successful, 0 if the proper config is not found,
3418 * or a negative error code
3420 static int alc880_parse_auto_config(struct hda_codec *codec)
3422 struct alc_spec *spec = codec->spec;
3424 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3426 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3430 if (!spec->autocfg.line_outs)
3431 return 0; /* can't find valid BIOS pin config */
3433 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3436 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3439 err = alc880_auto_create_extra_out(spec,
3440 spec->autocfg.speaker_pins[0],
3444 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3448 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3452 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3454 if (spec->autocfg.dig_out_pin)
3455 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3456 if (spec->autocfg.dig_in_pin)
3457 spec->dig_in_nid = ALC880_DIGIN_NID;
3459 if (spec->kctl_alloc)
3460 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3462 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3464 spec->num_mux_defs = 1;
3465 spec->input_mux = &spec->private_imux;
3470 /* additional initialization for auto-configuration model */
3471 static void alc880_auto_init(struct hda_codec *codec)
3473 alc880_auto_init_multi_out(codec);
3474 alc880_auto_init_extra_out(codec);
3475 alc880_auto_init_analog_input(codec);
3479 * OK, here we have finally the patch for ALC880
3482 static int patch_alc880(struct hda_codec *codec)
3484 struct alc_spec *spec;
3488 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3494 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3497 if (board_config < 0) {
3498 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3499 "trying auto-probe from BIOS...\n");
3500 board_config = ALC880_AUTO;
3503 if (board_config == ALC880_AUTO) {
3504 /* automatic parse from the BIOS config */
3505 err = alc880_parse_auto_config(codec);
3511 "hda_codec: Cannot set up configuration "
3512 "from BIOS. Using 3-stack mode...\n");
3513 board_config = ALC880_3ST;
3517 if (board_config != ALC880_AUTO)
3518 setup_preset(spec, &alc880_presets[board_config]);
3520 spec->stream_name_analog = "ALC880 Analog";
3521 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3522 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3524 spec->stream_name_digital = "ALC880 Digital";
3525 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3526 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3528 if (!spec->adc_nids && spec->input_mux) {
3529 /* check whether NID 0x07 is valid */
3530 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3532 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3533 if (wcap != AC_WID_AUD_IN) {
3534 spec->adc_nids = alc880_adc_nids_alt;
3535 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3536 spec->mixers[spec->num_mixers] =
3537 alc880_capture_alt_mixer;
3540 spec->adc_nids = alc880_adc_nids;
3541 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3542 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3547 codec->patch_ops = alc_patch_ops;
3548 if (board_config == ALC880_AUTO)
3549 spec->init_hook = alc880_auto_init;
3550 #ifdef CONFIG_SND_HDA_POWER_SAVE
3551 if (!spec->loopback.amplist)
3552 spec->loopback.amplist = alc880_loopbacks;
3563 static hda_nid_t alc260_dac_nids[1] = {
3568 static hda_nid_t alc260_adc_nids[1] = {
3573 static hda_nid_t alc260_adc_nids_alt[1] = {
3578 static hda_nid_t alc260_hp_adc_nids[2] = {
3583 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3584 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3586 static hda_nid_t alc260_dual_adc_nids[2] = {
3591 #define ALC260_DIGOUT_NID 0x03
3592 #define ALC260_DIGIN_NID 0x06
3594 static struct hda_input_mux alc260_capture_source = {
3598 { "Front Mic", 0x1 },
3604 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3605 * headphone jack and the internal CD lines since these are the only pins at
3606 * which audio can appear. For flexibility, also allow the option of
3607 * recording the mixer output on the second ADC (ADC0 doesn't have a
3608 * connection to the mixer output).
3610 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3614 { "Mic/Line", 0x0 },
3616 { "Headphone", 0x2 },
3622 { "Mic/Line", 0x0 },
3624 { "Headphone", 0x2 },
3631 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3632 * the Fujitsu S702x, but jacks are marked differently.
3634 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3641 { "Headphone", 0x5 },
3650 { "Headphone", 0x6 },
3656 * This is just place-holder, so there's something for alc_build_pcms to look
3657 * at when it calculates the maximum number of channels. ALC260 has no mixer
3658 * element which allows changing the channel mode, so the verb list is
3661 static struct hda_channel_mode alc260_modes[1] = {
3666 /* Mixer combinations
3668 * basic: base_output + input + pc_beep + capture
3669 * HP: base_output + input + capture_alt
3670 * HP_3013: hp_3013 + input + capture
3671 * fujitsu: fujitsu + capture
3672 * acer: acer + capture
3675 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3676 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3677 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3679 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3680 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3681 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3685 static struct snd_kcontrol_new alc260_input_mixer[] = {
3686 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3687 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3688 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3689 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3691 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3692 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3693 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3697 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3698 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3699 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3703 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3704 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3705 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3706 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3707 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3710 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3711 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3715 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3716 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3718 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3719 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3720 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3721 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3722 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3723 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3724 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3725 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3726 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3727 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3728 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3729 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3730 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3734 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3735 * versions of the ALC260 don't act on requests to enable mic bias from NID
3736 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3737 * datasheet doesn't mention this restriction. At this stage it's not clear
3738 * whether this behaviour is intentional or is a hardware bug in chip
3739 * revisions available in early 2006. Therefore for now allow the
3740 * "Headphone Jack Mode" control to span all choices, but if it turns out
3741 * that the lack of mic bias for this NID is intentional we could change the
3742 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3744 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3745 * don't appear to make the mic bias available from the "line" jack, even
3746 * though the NID used for this jack (0x14) can supply it. The theory is
3747 * that perhaps Acer have included blocking capacitors between the ALC260
3748 * and the output jack. If this turns out to be the case for all such
3749 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3750 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3752 * The C20x Tablet series have a mono internal speaker which is controlled
3753 * via the chip's Mono sum widget and pin complex, so include the necessary
3754 * controls for such models. On models without a "mono speaker" the control
3755 * won't do anything.
3757 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3758 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3759 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3760 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3761 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3763 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3765 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3766 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3768 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3769 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3770 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3771 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3772 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3773 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3774 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3778 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3779 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3781 static struct snd_kcontrol_new alc260_will_mixer[] = {
3782 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3783 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3785 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3786 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3787 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3788 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3789 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3790 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3791 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3792 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3793 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3797 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3798 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3800 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3801 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3802 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3804 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3805 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3806 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3807 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3808 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3809 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3810 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3814 /* capture mixer elements */
3815 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3816 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3817 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3818 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3819 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3822 /* The multiple "Capture Source" controls confuse alsamixer
3823 * So call somewhat different..
3824 * FIXME: the controls appear in the "playback" view!
3826 /* .name = "Capture Source", */
3827 .name = "Input Source",
3829 .info = alc_mux_enum_info,
3830 .get = alc_mux_enum_get,
3831 .put = alc_mux_enum_put,
3836 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3837 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3838 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3841 /* The multiple "Capture Source" controls confuse alsamixer
3842 * So call somewhat different..
3843 * FIXME: the controls appear in the "playback" view!
3845 /* .name = "Capture Source", */
3846 .name = "Input Source",
3848 .info = alc_mux_enum_info,
3849 .get = alc_mux_enum_get,
3850 .put = alc_mux_enum_put,
3856 * initialization verbs
3858 static struct hda_verb alc260_init_verbs[] = {
3859 /* Line In pin widget for input */
3860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3861 /* CD pin widget for input */
3862 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3863 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3864 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3865 /* Mic2 (front panel) pin widget for input and vref at 80% */
3866 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3867 /* LINE-2 is used for line-out in rear */
3868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3869 /* select line-out */
3870 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3872 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3874 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3876 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3877 /* mute capture amp left and right */
3878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3879 /* set connection select to line in (default select for this ADC) */
3880 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3881 /* mute capture amp left and right */
3882 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3883 /* set connection select to line in (default select for this ADC) */
3884 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3885 /* set vol=0 Line-Out mixer amp left and right */
3886 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3887 /* unmute pin widget amp left and right (no gain on this amp) */
3888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3889 /* set vol=0 HP mixer amp left and right */
3890 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3891 /* unmute pin widget amp left and right (no gain on this amp) */
3892 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3893 /* set vol=0 Mono mixer amp left and right */
3894 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3895 /* unmute pin widget amp left and right (no gain on this amp) */
3896 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3897 /* unmute LINE-2 out pin */
3898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3899 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3902 /* mute analog inputs */
3903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3908 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3909 /* mute Front out path */
3910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3911 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3912 /* mute Headphone out path */
3913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3914 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3915 /* mute Mono out path */
3916 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3917 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3921 #if 0 /* should be identical with alc260_init_verbs? */
3922 static struct hda_verb alc260_hp_init_verbs[] = {
3923 /* Headphone and output */
3924 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3926 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3927 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3928 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3929 /* Mic2 (front panel) pin widget for input and vref at 80% */
3930 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3931 /* Line In pin widget for input */
3932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3933 /* Line-2 pin widget for output */
3934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3935 /* CD pin widget for input */
3936 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3937 /* unmute amp left and right */
3938 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3939 /* set connection select to line in (default select for this ADC) */
3940 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3941 /* unmute Line-Out mixer amp left and right (volume = 0) */
3942 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3943 /* mute pin widget amp left and right (no gain on this amp) */
3944 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3945 /* unmute HP mixer amp left and right (volume = 0) */
3946 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3947 /* mute pin widget amp left and right (no gain on this amp) */
3948 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3949 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3952 /* mute analog inputs */
3953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3958 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3959 /* Unmute Front out path */
3960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3961 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3962 /* Unmute Headphone out path */
3963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3964 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3965 /* Unmute Mono out path */
3966 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3967 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3972 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3973 /* Line out and output */
3974 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3976 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3977 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3978 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3979 /* Mic2 (front panel) pin widget for input and vref at 80% */
3980 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3981 /* Line In pin widget for input */
3982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3983 /* Headphone pin widget for output */
3984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3985 /* CD pin widget for input */
3986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3987 /* unmute amp left and right */
3988 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3989 /* set connection select to line in (default select for this ADC) */
3990 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3991 /* unmute Line-Out mixer amp left and right (volume = 0) */
3992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3993 /* mute pin widget amp left and right (no gain on this amp) */
3994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3995 /* unmute HP mixer amp left and right (volume = 0) */
3996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3997 /* mute pin widget amp left and right (no gain on this amp) */
3998 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3999 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4002 /* mute analog inputs */
4003 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4004 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4008 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4009 /* Unmute Front out path */
4010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4011 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4012 /* Unmute Headphone out path */
4013 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4014 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4015 /* Unmute Mono out path */
4016 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
4017 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
4021 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4022 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4023 * audio = 0x16, internal speaker = 0x10.
4025 static struct hda_verb alc260_fujitsu_init_verbs[] = {
4026 /* Disable all GPIOs */
4027 {0x01, AC_VERB_SET_GPIO_MASK, 0},
4028 /* Internal speaker is connected to headphone pin */
4029 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4030 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4032 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4033 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4034 /* Ensure all other unused pins are disabled and muted. */
4035 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4036 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4037 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4038 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4039 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4040 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4041 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4042 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4044 /* Disable digital (SPDIF) pins */
4045 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4046 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4048 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4049 * when acting as an output.
4051 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4053 /* Start with output sum widgets muted and their output gains at min */
4054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4055 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4057 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4060 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4061 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4064 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4065 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4066 /* Unmute Line1 pin widget output buffer since it starts as an output.
4067 * If the pin mode is changed by the user the pin mode control will
4068 * take care of enabling the pin's input/output buffers as needed.
4069 * Therefore there's no need to enable the input buffer at this
4072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4073 /* Unmute input buffer of pin widget used for Line-in (no equiv
4076 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4078 /* Mute capture amp left and right */
4079 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4080 /* Set ADC connection select to match default mixer setting - line
4083 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4085 /* Do the same for the second ADC: mute capture input amp and
4086 * set ADC connection to line in (on mic1 pin)
4088 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4089 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4091 /* Mute all inputs to mixer widget (even unconnected ones) */
4092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4104 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4105 * similar laptops (adapted from Fujitsu init verbs).
4107 static struct hda_verb alc260_acer_init_verbs[] = {
4108 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4109 * the headphone jack. Turn this on and rely on the standard mute
4110 * methods whenever the user wants to turn these outputs off.
4112 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4113 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4114 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
4115 /* Internal speaker/Headphone jack is connected to Line-out pin */
4116 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4117 /* Internal microphone/Mic jack is connected to Mic1 pin */
4118 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
4119 /* Line In jack is connected to Line1 pin */
4120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4121 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4122 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4123 /* Ensure all other unused pins are disabled and muted. */
4124 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4125 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4126 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4127 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4128 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4130 /* Disable digital (SPDIF) pins */
4131 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4132 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4134 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4135 * bus when acting as outputs.
4137 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4138 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4140 /* Start with output sum widgets muted and their output gains at min */
4141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4146 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4149 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4151 /* Unmute Line-out pin widget amp left and right
4152 * (no equiv mixer ctrl)
4154 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4155 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4156 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4157 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4158 * inputs. If the pin mode is changed by the user the pin mode control
4159 * will take care of enabling the pin's input/output buffers as needed.
4160 * Therefore there's no need to enable the input buffer at this
4163 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4164 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4166 /* Mute capture amp left and right */
4167 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4168 /* Set ADC connection select to match default mixer setting - mic
4171 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4173 /* Do similar with the second ADC: mute capture input amp and
4174 * set ADC connection to mic to match ALSA's default state.
4176 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4177 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4179 /* Mute all inputs to mixer widget (even unconnected ones) */
4180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4192 static struct hda_verb alc260_will_verbs[] = {
4193 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4194 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4195 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4196 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4197 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4198 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4202 static struct hda_verb alc260_replacer_672v_verbs[] = {
4203 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4204 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4205 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4207 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4208 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4209 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4211 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4215 /* toggle speaker-output according to the hp-jack state */
4216 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4218 unsigned int present;
4220 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4221 present = snd_hda_codec_read(codec, 0x0f, 0,
4222 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4224 snd_hda_codec_write_cache(codec, 0x01, 0,
4225 AC_VERB_SET_GPIO_DATA, 1);
4226 snd_hda_codec_write_cache(codec, 0x0f, 0,
4227 AC_VERB_SET_PIN_WIDGET_CONTROL,
4230 snd_hda_codec_write_cache(codec, 0x01, 0,
4231 AC_VERB_SET_GPIO_DATA, 0);
4232 snd_hda_codec_write_cache(codec, 0x0f, 0,
4233 AC_VERB_SET_PIN_WIDGET_CONTROL,
4238 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4241 if ((res >> 26) == ALC880_HP_EVENT)
4242 alc260_replacer_672v_automute(codec);
4245 /* Test configuration for debugging, modelled after the ALC880 test
4248 #ifdef CONFIG_SND_DEBUG
4249 static hda_nid_t alc260_test_dac_nids[1] = {
4252 static hda_nid_t alc260_test_adc_nids[2] = {
4255 /* For testing the ALC260, each input MUX needs its own definition since
4256 * the signal assignments are different. This assumes that the first ADC
4259 static struct hda_input_mux alc260_test_capture_sources[2] = {
4263 { "MIC1 pin", 0x0 },
4264 { "MIC2 pin", 0x1 },
4265 { "LINE1 pin", 0x2 },
4266 { "LINE2 pin", 0x3 },
4268 { "LINE-OUT pin", 0x5 },
4269 { "HP-OUT pin", 0x6 },
4275 { "MIC1 pin", 0x0 },
4276 { "MIC2 pin", 0x1 },
4277 { "LINE1 pin", 0x2 },
4278 { "LINE2 pin", 0x3 },
4281 { "LINE-OUT pin", 0x6 },
4282 { "HP-OUT pin", 0x7 },
4286 static struct snd_kcontrol_new alc260_test_mixer[] = {
4287 /* Output driver widgets */
4288 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4289 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4290 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4291 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4292 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4293 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4295 /* Modes for retasking pin widgets
4296 * Note: the ALC260 doesn't seem to act on requests to enable mic
4297 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4298 * mention this restriction. At this stage it's not clear whether
4299 * this behaviour is intentional or is a hardware bug in chip
4300 * revisions available at least up until early 2006. Therefore for
4301 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4302 * choices, but if it turns out that the lack of mic bias for these
4303 * NIDs is intentional we could change their modes from
4304 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4306 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4307 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4308 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4309 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4310 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4311 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4313 /* Loopback mixer controls */
4314 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4315 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4316 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4317 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4318 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4319 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4320 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4321 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4322 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4323 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4324 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4325 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4326 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4327 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4328 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4329 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4331 /* Controls for GPIO pins, assuming they are configured as outputs */
4332 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4333 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4334 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4335 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4337 /* Switches to allow the digital IO pins to be enabled. The datasheet
4338 * is ambigious as to which NID is which; testing on laptops which
4339 * make this output available should provide clarification.
4341 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4342 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4346 static struct hda_verb alc260_test_init_verbs[] = {
4347 /* Enable all GPIOs as outputs with an initial value of 0 */
4348 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4349 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4350 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4352 /* Enable retasking pins as output, initially without power amp */
4353 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4354 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4357 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4358 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4360 /* Disable digital (SPDIF) pins initially, but users can enable
4361 * them via a mixer switch. In the case of SPDIF-out, this initverb
4362 * payload also sets the generation to 0, output to be in "consumer"
4363 * PCM format, copyright asserted, no pre-emphasis and no validity
4366 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4367 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4369 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4370 * OUT1 sum bus when acting as an output.
4372 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4373 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4374 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4375 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4377 /* Start with output sum widgets muted and their output gains at min */
4378 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4383 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4384 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4385 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4386 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4388 /* Unmute retasking pin widget output buffers since the default
4389 * state appears to be output. As the pin mode is changed by the
4390 * user the pin mode control will take care of enabling the pin's
4391 * input/output buffers as needed.
4393 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4394 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4396 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4397 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4398 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4399 /* Also unmute the mono-out pin widget */
4400 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4402 /* Mute capture amp left and right */
4403 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4404 /* Set ADC connection select to match default mixer setting (mic1
4407 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4409 /* Do the same for the second ADC: mute capture input amp and
4410 * set ADC connection to mic1 pin
4412 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4413 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4415 /* Mute all inputs to mixer widget (even unconnected ones) */
4416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4420 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4429 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4435 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4441 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4442 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4445 * for BIOS auto-configuration
4448 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4452 unsigned long vol_val, sw_val;
4456 if (nid >= 0x0f && nid < 0x11) {
4457 nid_vol = nid - 0x7;
4458 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4459 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4460 } else if (nid == 0x11) {
4461 nid_vol = nid - 0x7;
4462 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4463 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4464 } else if (nid >= 0x12 && nid <= 0x15) {
4466 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4467 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4471 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4472 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4475 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4476 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4482 /* add playback controls from the parsed DAC table */
4483 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4484 const struct auto_pin_cfg *cfg)
4489 spec->multiout.num_dacs = 1;
4490 spec->multiout.dac_nids = spec->private_dac_nids;
4491 spec->multiout.dac_nids[0] = 0x02;
4493 nid = cfg->line_out_pins[0];
4495 err = alc260_add_playback_controls(spec, nid, "Front");
4500 nid = cfg->speaker_pins[0];
4502 err = alc260_add_playback_controls(spec, nid, "Speaker");
4507 nid = cfg->hp_pins[0];
4509 err = alc260_add_playback_controls(spec, nid, "Headphone");
4516 /* create playback/capture controls for input pins */
4517 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4518 const struct auto_pin_cfg *cfg)
4520 struct hda_input_mux *imux = &spec->private_imux;
4523 for (i = 0; i < AUTO_PIN_LAST; i++) {
4524 if (cfg->input_pins[i] >= 0x12) {
4525 idx = cfg->input_pins[i] - 0x12;
4526 err = new_analog_input(spec, cfg->input_pins[i],
4527 auto_pin_cfg_labels[i], idx,
4531 imux->items[imux->num_items].label =
4532 auto_pin_cfg_labels[i];
4533 imux->items[imux->num_items].index = idx;
4536 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4537 idx = cfg->input_pins[i] - 0x09;
4538 err = new_analog_input(spec, cfg->input_pins[i],
4539 auto_pin_cfg_labels[i], idx,
4543 imux->items[imux->num_items].label =
4544 auto_pin_cfg_labels[i];
4545 imux->items[imux->num_items].index = idx;
4552 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4553 hda_nid_t nid, int pin_type,
4557 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4559 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4561 /* need the manual connection? */
4563 int idx = nid - 0x12;
4564 snd_hda_codec_write(codec, idx + 0x0b, 0,
4565 AC_VERB_SET_CONNECT_SEL, sel_idx);
4569 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4571 struct alc_spec *spec = codec->spec;
4574 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4575 nid = spec->autocfg.line_out_pins[0];
4577 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4578 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4581 nid = spec->autocfg.speaker_pins[0];
4583 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4585 nid = spec->autocfg.hp_pins[0];
4587 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4590 #define ALC260_PIN_CD_NID 0x16
4591 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4593 struct alc_spec *spec = codec->spec;
4596 for (i = 0; i < AUTO_PIN_LAST; i++) {
4597 hda_nid_t nid = spec->autocfg.input_pins[i];
4599 snd_hda_codec_write(codec, nid, 0,
4600 AC_VERB_SET_PIN_WIDGET_CONTROL,
4601 i <= AUTO_PIN_FRONT_MIC ?
4602 PIN_VREF80 : PIN_IN);
4603 if (nid != ALC260_PIN_CD_NID)
4604 snd_hda_codec_write(codec, nid, 0,
4605 AC_VERB_SET_AMP_GAIN_MUTE,
4612 * generic initialization of ADC, input mixers and output mixers
4614 static struct hda_verb alc260_volume_init_verbs[] = {
4616 * Unmute ADC0-1 and set the default input to mic-in
4618 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4619 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4620 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4621 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4623 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4625 * Note: PASD motherboards uses the Line In 2 as the input for
4626 * front panel mic (mic 2)
4628 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4629 /* mute analog inputs */
4630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4637 * Set up output mixers (0x08 - 0x0a)
4639 /* set vol=0 to output mixers */
4640 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4641 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4642 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4643 /* set up input amps for analog loopback */
4644 /* Amp Indices: DAC = 0, mixer = 1 */
4645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4647 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4649 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4650 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4655 static int alc260_parse_auto_config(struct hda_codec *codec)
4657 struct alc_spec *spec = codec->spec;
4660 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4662 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4666 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4669 if (!spec->kctl_alloc)
4670 return 0; /* can't find valid BIOS pin config */
4671 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4675 spec->multiout.max_channels = 2;
4677 if (spec->autocfg.dig_out_pin)
4678 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4679 if (spec->kctl_alloc)
4680 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4682 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4684 spec->num_mux_defs = 1;
4685 spec->input_mux = &spec->private_imux;
4687 /* check whether NID 0x04 is valid */
4688 wcap = get_wcaps(codec, 0x04);
4689 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4690 if (wcap != AC_WID_AUD_IN) {
4691 spec->adc_nids = alc260_adc_nids_alt;
4692 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4693 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4695 spec->adc_nids = alc260_adc_nids;
4696 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4697 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4704 /* additional initialization for auto-configuration model */
4705 static void alc260_auto_init(struct hda_codec *codec)
4707 alc260_auto_init_multi_out(codec);
4708 alc260_auto_init_analog_input(codec);
4711 #ifdef CONFIG_SND_HDA_POWER_SAVE
4712 static struct hda_amp_list alc260_loopbacks[] = {
4713 { 0x07, HDA_INPUT, 0 },
4714 { 0x07, HDA_INPUT, 1 },
4715 { 0x07, HDA_INPUT, 2 },
4716 { 0x07, HDA_INPUT, 3 },
4717 { 0x07, HDA_INPUT, 4 },
4723 * ALC260 configurations
4725 static const char *alc260_models[ALC260_MODEL_LAST] = {
4726 [ALC260_BASIC] = "basic",
4728 [ALC260_HP_3013] = "hp-3013",
4729 [ALC260_FUJITSU_S702X] = "fujitsu",
4730 [ALC260_ACER] = "acer",
4731 [ALC260_WILL] = "will",
4732 [ALC260_REPLACER_672V] = "replacer",
4733 #ifdef CONFIG_SND_DEBUG
4734 [ALC260_TEST] = "test",
4736 [ALC260_AUTO] = "auto",
4739 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4740 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4741 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4742 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4743 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4744 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4745 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4746 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4747 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4748 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4749 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4750 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4751 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4752 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4753 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4754 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4755 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4756 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4757 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4761 static struct alc_config_preset alc260_presets[] = {
4763 .mixers = { alc260_base_output_mixer,
4765 alc260_pc_beep_mixer,
4766 alc260_capture_mixer },
4767 .init_verbs = { alc260_init_verbs },
4768 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4769 .dac_nids = alc260_dac_nids,
4770 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4771 .adc_nids = alc260_adc_nids,
4772 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4773 .channel_mode = alc260_modes,
4774 .input_mux = &alc260_capture_source,
4777 .mixers = { alc260_base_output_mixer,
4779 alc260_capture_alt_mixer },
4780 .init_verbs = { alc260_init_verbs },
4781 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4782 .dac_nids = alc260_dac_nids,
4783 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4784 .adc_nids = alc260_hp_adc_nids,
4785 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4786 .channel_mode = alc260_modes,
4787 .input_mux = &alc260_capture_source,
4789 [ALC260_HP_3013] = {
4790 .mixers = { alc260_hp_3013_mixer,
4792 alc260_capture_alt_mixer },
4793 .init_verbs = { alc260_hp_3013_init_verbs },
4794 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4795 .dac_nids = alc260_dac_nids,
4796 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4797 .adc_nids = alc260_hp_adc_nids,
4798 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4799 .channel_mode = alc260_modes,
4800 .input_mux = &alc260_capture_source,
4802 [ALC260_FUJITSU_S702X] = {
4803 .mixers = { alc260_fujitsu_mixer,
4804 alc260_capture_mixer },
4805 .init_verbs = { alc260_fujitsu_init_verbs },
4806 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4807 .dac_nids = alc260_dac_nids,
4808 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4809 .adc_nids = alc260_dual_adc_nids,
4810 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4811 .channel_mode = alc260_modes,
4812 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4813 .input_mux = alc260_fujitsu_capture_sources,
4816 .mixers = { alc260_acer_mixer,
4817 alc260_capture_mixer },
4818 .init_verbs = { alc260_acer_init_verbs },
4819 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4820 .dac_nids = alc260_dac_nids,
4821 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4822 .adc_nids = alc260_dual_adc_nids,
4823 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4824 .channel_mode = alc260_modes,
4825 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4826 .input_mux = alc260_acer_capture_sources,
4829 .mixers = { alc260_will_mixer,
4830 alc260_capture_mixer },
4831 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4832 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4833 .dac_nids = alc260_dac_nids,
4834 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4835 .adc_nids = alc260_adc_nids,
4836 .dig_out_nid = ALC260_DIGOUT_NID,
4837 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4838 .channel_mode = alc260_modes,
4839 .input_mux = &alc260_capture_source,
4841 [ALC260_REPLACER_672V] = {
4842 .mixers = { alc260_replacer_672v_mixer,
4843 alc260_capture_mixer },
4844 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4845 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4846 .dac_nids = alc260_dac_nids,
4847 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4848 .adc_nids = alc260_adc_nids,
4849 .dig_out_nid = ALC260_DIGOUT_NID,
4850 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4851 .channel_mode = alc260_modes,
4852 .input_mux = &alc260_capture_source,
4853 .unsol_event = alc260_replacer_672v_unsol_event,
4854 .init_hook = alc260_replacer_672v_automute,
4856 #ifdef CONFIG_SND_DEBUG
4858 .mixers = { alc260_test_mixer,
4859 alc260_capture_mixer },
4860 .init_verbs = { alc260_test_init_verbs },
4861 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4862 .dac_nids = alc260_test_dac_nids,
4863 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4864 .adc_nids = alc260_test_adc_nids,
4865 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4866 .channel_mode = alc260_modes,
4867 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4868 .input_mux = alc260_test_capture_sources,
4873 static int patch_alc260(struct hda_codec *codec)
4875 struct alc_spec *spec;
4876 int err, board_config;
4878 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4884 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4887 if (board_config < 0) {
4888 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4889 "trying auto-probe from BIOS...\n");
4890 board_config = ALC260_AUTO;
4893 if (board_config == ALC260_AUTO) {
4894 /* automatic parse from the BIOS config */
4895 err = alc260_parse_auto_config(codec);
4901 "hda_codec: Cannot set up configuration "
4902 "from BIOS. Using base mode...\n");
4903 board_config = ALC260_BASIC;
4907 if (board_config != ALC260_AUTO)
4908 setup_preset(spec, &alc260_presets[board_config]);
4910 spec->stream_name_analog = "ALC260 Analog";
4911 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4912 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4914 spec->stream_name_digital = "ALC260 Digital";
4915 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4916 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4918 codec->patch_ops = alc_patch_ops;
4919 if (board_config == ALC260_AUTO)
4920 spec->init_hook = alc260_auto_init;
4921 #ifdef CONFIG_SND_HDA_POWER_SAVE
4922 if (!spec->loopback.amplist)
4923 spec->loopback.amplist = alc260_loopbacks;
4933 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4934 * configuration. Each pin widget can choose any input DACs and a mixer.
4935 * Each ADC is connected from a mixer of all inputs. This makes possible
4936 * 6-channel independent captures.
4938 * In addition, an independent DAC for the multi-playback (not used in this
4941 #define ALC882_DIGOUT_NID 0x06
4942 #define ALC882_DIGIN_NID 0x0a
4944 static struct hda_channel_mode alc882_ch_modes[1] = {
4948 static hda_nid_t alc882_dac_nids[4] = {
4949 /* front, rear, clfe, rear_surr */
4950 0x02, 0x03, 0x04, 0x05
4953 /* identical with ALC880 */
4954 #define alc882_adc_nids alc880_adc_nids
4955 #define alc882_adc_nids_alt alc880_adc_nids_alt
4958 /* FIXME: should be a matrix-type input source selection */
4960 static struct hda_input_mux alc882_capture_source = {
4964 { "Front Mic", 0x1 },
4969 #define alc882_mux_enum_info alc_mux_enum_info
4970 #define alc882_mux_enum_get alc_mux_enum_get
4972 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4973 struct snd_ctl_elem_value *ucontrol)
4975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4976 struct alc_spec *spec = codec->spec;
4977 const struct hda_input_mux *imux = spec->input_mux;
4978 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4979 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4980 hda_nid_t nid = capture_mixers[adc_idx];
4981 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4982 unsigned int i, idx;
4984 idx = ucontrol->value.enumerated.item[0];
4985 if (idx >= imux->num_items)
4986 idx = imux->num_items - 1;
4987 if (*cur_val == idx)
4989 for (i = 0; i < imux->num_items; i++) {
4990 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4991 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4992 imux->items[i].index,
5002 static struct hda_verb alc882_3ST_ch2_init[] = {
5003 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5004 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5005 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5006 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5013 static struct hda_verb alc882_3ST_ch6_init[] = {
5014 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5015 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5016 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5017 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5018 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5019 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5023 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
5024 { 2, alc882_3ST_ch2_init },
5025 { 6, alc882_3ST_ch6_init },
5031 static struct hda_verb alc882_sixstack_ch6_init[] = {
5032 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5033 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5034 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5035 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5042 static struct hda_verb alc882_sixstack_ch8_init[] = {
5043 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5044 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5045 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5046 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5050 static struct hda_channel_mode alc882_sixstack_modes[2] = {
5051 { 6, alc882_sixstack_ch6_init },
5052 { 8, alc882_sixstack_ch8_init },
5056 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5062 static struct hda_verb alc885_mbp_ch2_init[] = {
5063 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5064 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5065 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5072 static struct hda_verb alc885_mbp_ch6_init[] = {
5073 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5074 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5075 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5076 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5077 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5081 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
5082 { 2, alc885_mbp_ch2_init },
5083 { 6, alc885_mbp_ch6_init },
5087 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5088 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5090 static struct snd_kcontrol_new alc882_base_mixer[] = {
5091 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5093 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5094 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5095 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5096 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5097 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5098 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5099 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5100 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5101 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5105 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5106 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5110 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5112 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5113 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5117 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
5118 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT),
5119 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT),
5120 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT),
5121 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT),
5122 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT),
5123 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT),
5124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
5125 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
5126 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT),
5127 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
5130 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
5131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5132 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5133 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5134 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5135 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5136 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5138 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5140 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5141 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5145 static struct snd_kcontrol_new alc882_targa_mixer[] = {
5146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5149 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5150 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5155 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5156 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5158 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5162 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5163 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5165 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5166 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5167 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5169 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5170 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5171 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5174 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5175 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5178 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5182 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
5183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5191 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5193 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5194 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5198 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5200 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5201 .name = "Channel Mode",
5202 .info = alc_ch_mode_info,
5203 .get = alc_ch_mode_get,
5204 .put = alc_ch_mode_put,
5209 static struct hda_verb alc882_init_verbs[] = {
5210 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5211 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5212 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5215 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5219 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5223 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5224 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5225 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5227 /* Front Pin: output 0 (0x0c) */
5228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5229 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5230 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5231 /* Rear Pin: output 1 (0x0d) */
5232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5234 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5235 /* CLFE Pin: output 2 (0x0e) */
5236 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5237 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5238 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5239 /* Side Pin: output 3 (0x0f) */
5240 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5241 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5242 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5243 /* Mic (rear) pin: input vref at 80% */
5244 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5246 /* Front Mic pin: input vref at 80% */
5247 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5248 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5249 /* Line In pin: input */
5250 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5251 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5252 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5255 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5256 /* CD pin widget for input */
5257 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5259 /* FIXME: use matrix-type input source selection */
5260 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5261 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5267 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5272 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5276 /* ADC1: mute amp left and right */
5277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5278 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5279 /* ADC2: mute amp left and right */
5280 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5281 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5282 /* ADC3: mute amp left and right */
5283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5284 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5289 static struct hda_verb alc882_eapd_verbs[] = {
5290 /* change to EAPD mode */
5291 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5292 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5297 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5298 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5299 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5303 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5304 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5308 static struct hda_verb alc882_macpro_init_verbs[] = {
5309 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5313 /* Front Pin: output 0 (0x0c) */
5314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5317 /* Front Mic pin: input vref at 80% */
5318 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5319 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5320 /* Speaker: output */
5321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5323 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5324 /* Headphone output (output 0 - 0x0c) */
5325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5327 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5329 /* FIXME: use matrix-type input source selection */
5330 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5331 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5346 /* ADC1: mute amp left and right */
5347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5349 /* ADC2: mute amp left and right */
5350 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5351 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5352 /* ADC3: mute amp left and right */
5353 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5354 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5359 /* Macbook Pro rev3 */
5360 static struct hda_verb alc885_mbp3_init_verbs[] = {
5361 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5367 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5369 /* Front Pin: output 0 (0x0c) */
5370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5372 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5373 /* HP Pin: output 0 (0x0d) */
5374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5376 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5378 /* Mic (rear) pin: input vref at 80% */
5379 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5380 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5381 /* Front Mic pin: input vref at 80% */
5382 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5383 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5384 /* Line In pin: use output 1 when in LineOut mode */
5385 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5386 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5387 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5389 /* FIXME: use matrix-type input source selection */
5390 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5391 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5397 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5406 /* ADC1: mute amp left and right */
5407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5409 /* ADC2: mute amp left and right */
5410 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5411 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5412 /* ADC3: mute amp left and right */
5413 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5414 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5419 /* iMac 24 mixer. */
5420 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5421 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5422 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5426 /* iMac 24 init verbs. */
5427 static struct hda_verb alc885_imac24_init_verbs[] = {
5428 /* Internal speakers: output 0 (0x0c) */
5429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5431 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5432 /* Internal speakers: output 0 (0x0c) */
5433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5435 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5436 /* Headphone: output 0 (0x0c) */
5437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5439 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5440 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5441 /* Front Mic: input vref at 80% */
5442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5447 /* Toggle speaker-output according to the hp-jack state */
5448 static void alc885_imac24_automute(struct hda_codec *codec)
5450 unsigned int present;
5452 present = snd_hda_codec_read(codec, 0x14, 0,
5453 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5454 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5455 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5456 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5457 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5460 /* Processes unsolicited events. */
5461 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5464 /* Headphone insertion or removal. */
5465 if ((res >> 26) == ALC880_HP_EVENT)
5466 alc885_imac24_automute(codec);
5469 static void alc885_mbp3_automute(struct hda_codec *codec)
5471 unsigned int present;
5473 present = snd_hda_codec_read(codec, 0x15, 0,
5474 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5475 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5476 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5477 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5478 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5481 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5484 /* Headphone insertion or removal. */
5485 if ((res >> 26) == ALC880_HP_EVENT)
5486 alc885_mbp3_automute(codec);
5490 static struct hda_verb alc882_targa_verbs[] = {
5491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5497 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5498 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5499 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5501 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5502 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5503 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5504 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5508 /* toggle speaker-output according to the hp-jack state */
5509 static void alc882_targa_automute(struct hda_codec *codec)
5511 unsigned int present;
5513 present = snd_hda_codec_read(codec, 0x14, 0,
5514 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5515 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5516 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5517 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5521 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5523 /* Looks like the unsol event is incompatible with the standard
5524 * definition. 4bit tag is placed at 26 bit!
5526 if (((res >> 26) == ALC880_HP_EVENT)) {
5527 alc882_targa_automute(codec);
5531 static struct hda_verb alc882_asus_a7j_verbs[] = {
5532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5541 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5543 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5544 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5545 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5549 static struct hda_verb alc882_asus_a7m_verbs[] = {
5550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5555 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5557 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5558 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5559 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5561 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5562 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5563 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5567 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5569 unsigned int gpiostate, gpiomask, gpiodir;
5571 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5572 AC_VERB_GET_GPIO_DATA, 0);
5575 gpiostate |= (1 << pin);
5577 gpiostate &= ~(1 << pin);
5579 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5580 AC_VERB_GET_GPIO_MASK, 0);
5581 gpiomask |= (1 << pin);
5583 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5584 AC_VERB_GET_GPIO_DIRECTION, 0);
5585 gpiodir |= (1 << pin);
5588 snd_hda_codec_write(codec, codec->afg, 0,
5589 AC_VERB_SET_GPIO_MASK, gpiomask);
5590 snd_hda_codec_write(codec, codec->afg, 0,
5591 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5595 snd_hda_codec_write(codec, codec->afg, 0,
5596 AC_VERB_SET_GPIO_DATA, gpiostate);
5599 /* set up GPIO at initialization */
5600 static void alc885_macpro_init_hook(struct hda_codec *codec)
5602 alc882_gpio_mute(codec, 0, 0);
5603 alc882_gpio_mute(codec, 1, 0);
5606 /* set up GPIO and update auto-muting at initialization */
5607 static void alc885_imac24_init_hook(struct hda_codec *codec)
5609 alc885_macpro_init_hook(codec);
5610 alc885_imac24_automute(codec);
5614 * generic initialization of ADC, input mixers and output mixers
5616 static struct hda_verb alc882_auto_init_verbs[] = {
5618 * Unmute ADC0-2 and set the default input to mic-in
5620 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5622 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5624 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5627 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5629 * Note: PASD motherboards uses the Line In 2 as the input for
5630 * front panel mic (mic 2)
5632 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5640 * Set up output mixers (0x0c - 0x0f)
5642 /* set vol=0 to output mixers */
5643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5647 /* set up input amps for analog loopback */
5648 /* Amp Indices: DAC = 0, mixer = 1 */
5649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5653 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5657 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5658 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5660 /* FIXME: use matrix-type input source selection */
5661 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5662 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5670 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5681 /* capture mixer elements */
5682 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5683 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5684 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5685 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5686 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5689 /* The multiple "Capture Source" controls confuse alsamixer
5690 * So call somewhat different..
5691 * FIXME: the controls appear in the "playback" view!
5693 /* .name = "Capture Source", */
5694 .name = "Input Source",
5696 .info = alc882_mux_enum_info,
5697 .get = alc882_mux_enum_get,
5698 .put = alc882_mux_enum_put,
5703 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5704 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5705 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5706 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5707 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5708 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5709 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5711 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5712 /* The multiple "Capture Source" controls confuse alsamixer
5713 * So call somewhat different..
5714 * FIXME: the controls appear in the "playback" view!
5716 /* .name = "Capture Source", */
5717 .name = "Input Source",
5719 .info = alc882_mux_enum_info,
5720 .get = alc882_mux_enum_get,
5721 .put = alc882_mux_enum_put,
5726 #ifdef CONFIG_SND_HDA_POWER_SAVE
5727 #define alc882_loopbacks alc880_loopbacks
5730 /* pcm configuration: identiacal with ALC880 */
5731 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5732 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5733 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5734 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5737 * configuration and preset
5739 static const char *alc882_models[ALC882_MODEL_LAST] = {
5740 [ALC882_3ST_DIG] = "3stack-dig",
5741 [ALC882_6ST_DIG] = "6stack-dig",
5742 [ALC882_ARIMA] = "arima",
5743 [ALC882_W2JC] = "w2jc",
5744 [ALC882_TARGA] = "targa",
5745 [ALC882_ASUS_A7J] = "asus-a7j",
5746 [ALC882_ASUS_A7M] = "asus-a7m",
5747 [ALC885_MACPRO] = "macpro",
5748 [ALC885_MBP3] = "mbp3",
5749 [ALC885_IMAC24] = "imac24",
5750 [ALC882_AUTO] = "auto",
5753 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5754 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5755 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5756 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5757 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5758 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5759 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5760 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
5761 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
5762 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5763 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5764 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5768 static struct alc_config_preset alc882_presets[] = {
5769 [ALC882_3ST_DIG] = {
5770 .mixers = { alc882_base_mixer },
5771 .init_verbs = { alc882_init_verbs },
5772 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5773 .dac_nids = alc882_dac_nids,
5774 .dig_out_nid = ALC882_DIGOUT_NID,
5775 .dig_in_nid = ALC882_DIGIN_NID,
5776 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5777 .channel_mode = alc882_ch_modes,
5779 .input_mux = &alc882_capture_source,
5781 [ALC882_6ST_DIG] = {
5782 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5783 .init_verbs = { alc882_init_verbs },
5784 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5785 .dac_nids = alc882_dac_nids,
5786 .dig_out_nid = ALC882_DIGOUT_NID,
5787 .dig_in_nid = ALC882_DIGIN_NID,
5788 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5789 .channel_mode = alc882_sixstack_modes,
5790 .input_mux = &alc882_capture_source,
5793 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5794 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5795 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5796 .dac_nids = alc882_dac_nids,
5797 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5798 .channel_mode = alc882_sixstack_modes,
5799 .input_mux = &alc882_capture_source,
5802 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5803 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5804 alc880_gpio1_init_verbs },
5805 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5806 .dac_nids = alc882_dac_nids,
5807 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5808 .channel_mode = alc880_threestack_modes,
5810 .input_mux = &alc882_capture_source,
5811 .dig_out_nid = ALC882_DIGOUT_NID,
5814 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5815 .init_verbs = { alc885_mbp3_init_verbs,
5816 alc880_gpio1_init_verbs },
5817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5818 .dac_nids = alc882_dac_nids,
5819 .channel_mode = alc885_mbp_6ch_modes,
5820 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5821 .input_mux = &alc882_capture_source,
5822 .dig_out_nid = ALC882_DIGOUT_NID,
5823 .dig_in_nid = ALC882_DIGIN_NID,
5824 .unsol_event = alc885_mbp3_unsol_event,
5825 .init_hook = alc885_mbp3_automute,
5828 .mixers = { alc882_macpro_mixer },
5829 .init_verbs = { alc882_macpro_init_verbs },
5830 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5831 .dac_nids = alc882_dac_nids,
5832 .dig_out_nid = ALC882_DIGOUT_NID,
5833 .dig_in_nid = ALC882_DIGIN_NID,
5834 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5835 .channel_mode = alc882_ch_modes,
5836 .input_mux = &alc882_capture_source,
5837 .init_hook = alc885_macpro_init_hook,
5840 .mixers = { alc885_imac24_mixer },
5841 .init_verbs = { alc885_imac24_init_verbs },
5842 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5843 .dac_nids = alc882_dac_nids,
5844 .dig_out_nid = ALC882_DIGOUT_NID,
5845 .dig_in_nid = ALC882_DIGIN_NID,
5846 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5847 .channel_mode = alc882_ch_modes,
5848 .input_mux = &alc882_capture_source,
5849 .unsol_event = alc885_imac24_unsol_event,
5850 .init_hook = alc885_imac24_init_hook,
5853 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5854 alc882_capture_mixer },
5855 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5856 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5857 .dac_nids = alc882_dac_nids,
5858 .dig_out_nid = ALC882_DIGOUT_NID,
5859 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5860 .adc_nids = alc882_adc_nids,
5861 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5862 .channel_mode = alc882_3ST_6ch_modes,
5864 .input_mux = &alc882_capture_source,
5865 .unsol_event = alc882_targa_unsol_event,
5866 .init_hook = alc882_targa_automute,
5868 [ALC882_ASUS_A7J] = {
5869 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5870 alc882_capture_mixer },
5871 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5872 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5873 .dac_nids = alc882_dac_nids,
5874 .dig_out_nid = ALC882_DIGOUT_NID,
5875 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5876 .adc_nids = alc882_adc_nids,
5877 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5878 .channel_mode = alc882_3ST_6ch_modes,
5880 .input_mux = &alc882_capture_source,
5882 [ALC882_ASUS_A7M] = {
5883 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
5884 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5885 alc880_gpio1_init_verbs,
5886 alc882_asus_a7m_verbs },
5887 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5888 .dac_nids = alc882_dac_nids,
5889 .dig_out_nid = ALC882_DIGOUT_NID,
5890 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5891 .channel_mode = alc880_threestack_modes,
5893 .input_mux = &alc882_capture_source,
5902 PINFIX_ABIT_AW9D_MAX
5905 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5906 { 0x15, 0x01080104 }, /* side */
5907 { 0x16, 0x01011012 }, /* rear */
5908 { 0x17, 0x01016011 }, /* clfe */
5912 static const struct alc_pincfg *alc882_pin_fixes[] = {
5913 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5916 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5917 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5922 * BIOS auto configuration
5924 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5925 hda_nid_t nid, int pin_type,
5929 struct alc_spec *spec = codec->spec;
5932 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5935 idx = spec->multiout.dac_nids[dac_idx] - 2;
5937 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5939 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5941 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5945 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5947 struct alc_spec *spec = codec->spec;
5950 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5951 for (i = 0; i <= HDA_SIDE; i++) {
5952 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5953 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5955 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5960 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5962 struct alc_spec *spec = codec->spec;
5965 pin = spec->autocfg.hp_pins[0];
5966 if (pin) /* connect to front */
5968 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5971 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5972 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5974 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5976 struct alc_spec *spec = codec->spec;
5979 for (i = 0; i < AUTO_PIN_LAST; i++) {
5980 hda_nid_t nid = spec->autocfg.input_pins[i];
5981 if (alc882_is_input_pin(nid)) {
5982 snd_hda_codec_write(codec, nid, 0,
5983 AC_VERB_SET_PIN_WIDGET_CONTROL,
5984 i <= AUTO_PIN_FRONT_MIC ?
5985 PIN_VREF80 : PIN_IN);
5986 if (nid != ALC882_PIN_CD_NID)
5987 snd_hda_codec_write(codec, nid, 0,
5988 AC_VERB_SET_AMP_GAIN_MUTE,
5994 /* add mic boosts if needed */
5995 static int alc_auto_add_mic_boost(struct hda_codec *codec)
5997 struct alc_spec *spec = codec->spec;
6001 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
6003 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6005 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6009 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
6011 err = add_control(spec, ALC_CTL_WIDGET_VOL,
6013 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
6020 /* almost identical with ALC880 parser... */
6021 static int alc882_parse_auto_config(struct hda_codec *codec)
6023 struct alc_spec *spec = codec->spec;
6024 int err = alc880_parse_auto_config(codec);
6029 return 0; /* no config found */
6031 err = alc_auto_add_mic_boost(codec);
6035 /* hack - override the init verbs */
6036 spec->init_verbs[0] = alc882_auto_init_verbs;
6038 return 1; /* config found */
6041 /* additional initialization for auto-configuration model */
6042 static void alc882_auto_init(struct hda_codec *codec)
6044 alc882_auto_init_multi_out(codec);
6045 alc882_auto_init_hp_out(codec);
6046 alc882_auto_init_analog_input(codec);
6049 static int patch_alc882(struct hda_codec *codec)
6051 struct alc_spec *spec;
6052 int err, board_config;
6054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6060 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
6064 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
6065 /* Pick up systems that don't supply PCI SSID */
6066 switch (codec->subsystem_id) {
6067 case 0x106b0c00: /* Mac Pro */
6068 board_config = ALC885_MACPRO;
6070 case 0x106b1000: /* iMac 24 */
6071 board_config = ALC885_IMAC24;
6073 case 0x106b2c00: /* Macbook Pro rev3 */
6074 board_config = ALC885_MBP3;
6077 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
6078 "trying auto-probe from BIOS...\n");
6079 board_config = ALC882_AUTO;
6083 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
6085 if (board_config == ALC882_AUTO) {
6086 /* automatic parse from the BIOS config */
6087 err = alc882_parse_auto_config(codec);
6093 "hda_codec: Cannot set up configuration "
6094 "from BIOS. Using base mode...\n");
6095 board_config = ALC882_3ST_DIG;
6099 if (board_config != ALC882_AUTO)
6100 setup_preset(spec, &alc882_presets[board_config]);
6102 spec->stream_name_analog = "ALC882 Analog";
6103 spec->stream_analog_playback = &alc882_pcm_analog_playback;
6104 spec->stream_analog_capture = &alc882_pcm_analog_capture;
6106 spec->stream_name_digital = "ALC882 Digital";
6107 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6108 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6110 if (!spec->adc_nids && spec->input_mux) {
6111 /* check whether NID 0x07 is valid */
6112 unsigned int wcap = get_wcaps(codec, 0x07);
6114 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6115 if (wcap != AC_WID_AUD_IN) {
6116 spec->adc_nids = alc882_adc_nids_alt;
6117 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
6118 spec->mixers[spec->num_mixers] =
6119 alc882_capture_alt_mixer;
6122 spec->adc_nids = alc882_adc_nids;
6123 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
6124 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
6129 codec->patch_ops = alc_patch_ops;
6130 if (board_config == ALC882_AUTO)
6131 spec->init_hook = alc882_auto_init;
6132 #ifdef CONFIG_SND_HDA_POWER_SAVE
6133 if (!spec->loopback.amplist)
6134 spec->loopback.amplist = alc882_loopbacks;
6143 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6144 * configuration. Each pin widget can choose any input DACs and a mixer.
6145 * Each ADC is connected from a mixer of all inputs. This makes possible
6146 * 6-channel independent captures.
6148 * In addition, an independent DAC for the multi-playback (not used in this
6151 #define ALC883_DIGOUT_NID 0x06
6152 #define ALC883_DIGIN_NID 0x0a
6154 static hda_nid_t alc883_dac_nids[4] = {
6155 /* front, rear, clfe, rear_surr */
6156 0x02, 0x04, 0x03, 0x05
6159 static hda_nid_t alc883_adc_nids[2] = {
6165 /* FIXME: should be a matrix-type input source selection */
6167 static struct hda_input_mux alc883_capture_source = {
6171 { "Front Mic", 0x1 },
6177 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6185 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6195 #define alc883_mux_enum_info alc_mux_enum_info
6196 #define alc883_mux_enum_get alc_mux_enum_get
6198 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6199 struct snd_ctl_elem_value *ucontrol)
6201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6202 struct alc_spec *spec = codec->spec;
6203 const struct hda_input_mux *imux = spec->input_mux;
6204 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6205 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
6206 hda_nid_t nid = capture_mixers[adc_idx];
6207 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6208 unsigned int i, idx;
6210 idx = ucontrol->value.enumerated.item[0];
6211 if (idx >= imux->num_items)
6212 idx = imux->num_items - 1;
6213 if (*cur_val == idx)
6215 for (i = 0; i < imux->num_items; i++) {
6216 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
6217 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
6218 imux->items[i].index,
6228 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6235 static struct hda_verb alc883_3ST_ch2_init[] = {
6236 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6237 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6238 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6239 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6246 static struct hda_verb alc883_3ST_ch4_init[] = {
6247 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6248 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6249 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6250 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6251 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6258 static struct hda_verb alc883_3ST_ch6_init[] = {
6259 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6260 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6261 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6262 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6263 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6264 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6268 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
6269 { 2, alc883_3ST_ch2_init },
6270 { 4, alc883_3ST_ch4_init },
6271 { 6, alc883_3ST_ch6_init },
6277 static struct hda_verb alc883_sixstack_ch6_init[] = {
6278 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6279 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6280 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6281 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6288 static struct hda_verb alc883_sixstack_ch8_init[] = {
6289 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6290 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6291 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6292 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6296 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6297 { 6, alc883_sixstack_ch6_init },
6298 { 8, alc883_sixstack_ch8_init },
6301 static struct hda_verb alc883_medion_eapd_verbs[] = {
6302 /* eanable EAPD on medion laptop */
6303 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6304 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6308 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6309 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6312 static struct snd_kcontrol_new alc883_base_mixer[] = {
6313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6314 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6315 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6316 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6317 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6319 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6320 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6321 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6322 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6324 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6325 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6326 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6327 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6328 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6329 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6331 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6332 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6333 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6334 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6335 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6336 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6337 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6338 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6339 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6341 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6342 /* .name = "Capture Source", */
6343 .name = "Input Source",
6345 .info = alc883_mux_enum_info,
6346 .get = alc883_mux_enum_get,
6347 .put = alc883_mux_enum_put,
6352 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6353 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6354 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6355 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6356 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6357 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6358 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6359 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6363 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6364 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6365 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6366 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6367 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6368 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6369 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6370 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6371 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6374 /* .name = "Capture Source", */
6375 .name = "Input Source",
6377 .info = alc883_mux_enum_info,
6378 .get = alc883_mux_enum_get,
6379 .put = alc883_mux_enum_put,
6384 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6385 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6386 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6387 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6388 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6389 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6402 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6403 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6404 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6405 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6406 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6407 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6408 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6409 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6412 /* .name = "Capture Source", */
6413 .name = "Input Source",
6415 .info = alc883_mux_enum_info,
6416 .get = alc883_mux_enum_get,
6417 .put = alc883_mux_enum_put,
6422 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6424 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6425 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6426 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6427 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6428 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6429 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6430 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6433 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6434 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6435 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6437 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6439 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6440 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6441 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6442 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6443 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6444 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6445 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6449 /* .name = "Capture Source", */
6450 .name = "Input Source",
6452 .info = alc883_mux_enum_info,
6453 .get = alc883_mux_enum_get,
6454 .put = alc883_mux_enum_put,
6459 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6462 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6463 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6464 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6465 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6466 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6467 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6468 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6469 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6470 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6471 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6472 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6474 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6476 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6477 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6478 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6479 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6481 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6482 /* .name = "Capture Source", */
6483 .name = "Input Source",
6485 .info = alc883_mux_enum_info,
6486 .get = alc883_mux_enum_get,
6487 .put = alc883_mux_enum_put,
6492 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6495 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6496 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6497 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6499 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6501 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6502 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6503 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6504 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6506 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6507 /* .name = "Capture Source", */
6508 .name = "Input Source",
6510 .info = alc883_mux_enum_info,
6511 .get = alc883_mux_enum_get,
6512 .put = alc883_mux_enum_put,
6517 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6518 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6519 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6520 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6521 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6524 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6525 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6526 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6527 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6529 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6530 /* .name = "Capture Source", */
6531 .name = "Input Source",
6533 .info = alc883_mux_enum_info,
6534 .get = alc883_mux_enum_get,
6535 .put = alc883_mux_enum_put,
6540 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6541 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6542 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6544 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6545 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6546 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6547 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6548 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6549 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6550 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6551 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6552 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6553 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6555 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6556 /* .name = "Capture Source", */
6557 .name = "Input Source",
6559 .info = alc883_mux_enum_info,
6560 .get = alc883_mux_enum_get,
6561 .put = alc883_mux_enum_put,
6566 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6568 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6569 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6570 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6571 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6572 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6574 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6575 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6576 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6577 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6578 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6579 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6582 /* .name = "Capture Source", */
6583 .name = "Input Source",
6585 .info = alc883_mux_enum_info,
6586 .get = alc883_mux_enum_get,
6587 .put = alc883_mux_enum_put,
6592 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6593 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6594 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6595 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6596 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6597 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6598 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6599 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6600 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6601 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6602 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6603 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6604 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6605 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6606 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6607 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6610 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6611 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6612 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6613 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6614 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6615 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6616 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6617 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6618 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6619 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6622 /* .name = "Capture Source", */
6623 .name = "Input Source",
6625 .info = alc883_mux_enum_info,
6626 .get = alc883_mux_enum_get,
6627 .put = alc883_mux_enum_put,
6632 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6635 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6636 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6637 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6638 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6639 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6640 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6649 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6650 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6651 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6652 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6653 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6654 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6655 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6656 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6657 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6659 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6660 /* .name = "Capture Source", */
6661 .name = "Input Source",
6663 .info = alc883_mux_enum_info,
6664 .get = alc883_mux_enum_get,
6665 .put = alc883_mux_enum_put,
6670 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6671 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6672 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6674 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6675 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6676 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6677 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6679 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6680 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6681 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6682 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6684 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6685 /* .name = "Capture Source", */
6686 .name = "Input Source",
6688 .info = alc883_mux_enum_info,
6689 .get = alc883_mux_enum_get,
6690 .put = alc883_mux_enum_put,
6695 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6698 .name = "Channel Mode",
6699 .info = alc_ch_mode_info,
6700 .get = alc_ch_mode_get,
6701 .put = alc_ch_mode_put,
6706 static struct hda_verb alc883_init_verbs[] = {
6707 /* ADC1: mute amp left and right */
6708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6709 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6710 /* ADC2: mute amp left and right */
6711 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6712 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6713 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6718 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6719 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6720 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6722 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6723 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6730 /* mute analog input loopbacks */
6731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6737 /* Front Pin: output 0 (0x0c) */
6738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6740 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6741 /* Rear Pin: output 1 (0x0d) */
6742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6744 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6745 /* CLFE Pin: output 2 (0x0e) */
6746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6748 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6749 /* Side Pin: output 3 (0x0f) */
6750 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6751 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6752 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6753 /* Mic (rear) pin: input vref at 80% */
6754 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6756 /* Front Mic pin: input vref at 80% */
6757 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6758 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6759 /* Line In pin: input */
6760 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6762 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6763 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6764 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6765 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6766 /* CD pin widget for input */
6767 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6769 /* FIXME: use matrix-type input source selection */
6770 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6784 static struct hda_verb alc883_tagra_verbs[] = {
6785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6789 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6791 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6792 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6793 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6796 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6797 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6798 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6803 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6805 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6806 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6810 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6813 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6818 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6822 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6823 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6827 static struct hda_verb alc883_haier_w66_verbs[] = {
6828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6833 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6835 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6840 static struct hda_verb alc888_6st_hp_verbs[] = {
6841 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6843 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6844 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6848 static struct hda_verb alc888_3st_hp_verbs[] = {
6849 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6850 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6851 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6855 static struct hda_verb alc888_3st_hp_2ch_init[] = {
6856 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6857 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6858 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6859 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6863 static struct hda_verb alc888_3st_hp_6ch_init[] = {
6864 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6865 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6866 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6867 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6871 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
6872 { 2, alc888_3st_hp_2ch_init },
6873 { 6, alc888_3st_hp_6ch_init },
6876 /* toggle front-jack and RCA according to the hp-jack state */
6877 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6879 unsigned int present;
6881 present = snd_hda_codec_read(codec, 0x1b, 0,
6882 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6883 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6884 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6885 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6886 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6889 /* toggle RCA according to the front-jack state */
6890 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6892 unsigned int present;
6894 present = snd_hda_codec_read(codec, 0x14, 0,
6895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6896 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6897 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6900 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6903 if ((res >> 26) == ALC880_HP_EVENT)
6904 alc888_lenovo_ms7195_front_automute(codec);
6905 if ((res >> 26) == ALC880_FRONT_EVENT)
6906 alc888_lenovo_ms7195_rca_automute(codec);
6909 static struct hda_verb alc883_medion_md2_verbs[] = {
6910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6913 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6915 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6919 /* toggle speaker-output according to the hp-jack state */
6920 static void alc883_medion_md2_automute(struct hda_codec *codec)
6922 unsigned int present;
6924 present = snd_hda_codec_read(codec, 0x14, 0,
6925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6926 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6927 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6930 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
6933 if ((res >> 26) == ALC880_HP_EVENT)
6934 alc883_medion_md2_automute(codec);
6937 /* toggle speaker-output according to the hp-jack state */
6938 static void alc883_tagra_automute(struct hda_codec *codec)
6940 unsigned int present;
6943 present = snd_hda_codec_read(codec, 0x14, 0,
6944 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6945 bits = present ? HDA_AMP_MUTE : 0;
6946 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6947 HDA_AMP_MUTE, bits);
6948 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6952 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
6954 if ((res >> 26) == ALC880_HP_EVENT)
6955 alc883_tagra_automute(codec);
6958 static void alc883_haier_w66_automute(struct hda_codec *codec)
6960 unsigned int present;
6963 present = snd_hda_codec_read(codec, 0x1b, 0,
6964 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6965 bits = present ? 0x80 : 0;
6966 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6970 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
6973 if ((res >> 26) == ALC880_HP_EVENT)
6974 alc883_haier_w66_automute(codec);
6977 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6979 unsigned int present;
6982 present = snd_hda_codec_read(codec, 0x14, 0,
6983 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6984 bits = present ? HDA_AMP_MUTE : 0;
6985 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6986 HDA_AMP_MUTE, bits);
6989 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6991 unsigned int present;
6994 present = snd_hda_codec_read(codec, 0x1b, 0,
6995 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6996 bits = present ? HDA_AMP_MUTE : 0;
6997 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6998 HDA_AMP_MUTE, bits);
6999 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7000 HDA_AMP_MUTE, bits);
7003 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
7006 if ((res >> 26) == ALC880_HP_EVENT)
7007 alc883_lenovo_101e_all_automute(codec);
7008 if ((res >> 26) == ALC880_FRONT_EVENT)
7009 alc883_lenovo_101e_ispeaker_automute(codec);
7012 /* toggle speaker-output according to the hp-jack state */
7013 static void alc883_acer_aspire_automute(struct hda_codec *codec)
7015 unsigned int present;
7017 present = snd_hda_codec_read(codec, 0x14, 0,
7018 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7020 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7021 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
7022 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7025 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
7028 if ((res >> 26) == ALC880_HP_EVENT)
7029 alc883_acer_aspire_automute(codec);
7032 static struct hda_verb alc883_acer_eapd_verbs[] = {
7033 /* HP Pin: output 0 (0x0c) */
7034 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7035 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7036 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7037 /* Front Pin: output 0 (0x0c) */
7038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7039 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7041 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
7042 /* eanable EAPD on medion laptop */
7043 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7044 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7045 /* enable unsolicited event */
7046 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7051 * generic initialization of ADC, input mixers and output mixers
7053 static struct hda_verb alc883_auto_init_verbs[] = {
7055 * Unmute ADC0-2 and set the default input to mic-in
7057 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7059 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7062 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7064 * Note: PASD motherboards uses the Line In 2 as the input for
7065 * front panel mic (mic 2)
7067 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7075 * Set up output mixers (0x0c - 0x0f)
7077 /* set vol=0 to output mixers */
7078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7082 /* set up input amps for analog loopback */
7083 /* Amp Indices: DAC = 0, mixer = 1 */
7084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7092 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7093 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7095 /* FIXME: use matrix-type input source selection */
7096 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7101 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7107 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7113 /* capture mixer elements */
7114 static struct snd_kcontrol_new alc883_capture_mixer[] = {
7115 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
7116 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
7117 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
7118 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
7120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7121 /* The multiple "Capture Source" controls confuse alsamixer
7122 * So call somewhat different..
7123 * FIXME: the controls appear in the "playback" view!
7125 /* .name = "Capture Source", */
7126 .name = "Input Source",
7128 .info = alc882_mux_enum_info,
7129 .get = alc882_mux_enum_get,
7130 .put = alc882_mux_enum_put,
7135 #ifdef CONFIG_SND_HDA_POWER_SAVE
7136 #define alc883_loopbacks alc880_loopbacks
7139 /* pcm configuration: identiacal with ALC880 */
7140 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7141 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7142 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7143 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7146 * configuration and preset
7148 static const char *alc883_models[ALC883_MODEL_LAST] = {
7149 [ALC883_3ST_2ch_DIG] = "3stack-dig",
7150 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
7151 [ALC883_3ST_6ch] = "3stack-6ch",
7152 [ALC883_6ST_DIG] = "6stack-dig",
7153 [ALC883_TARGA_DIG] = "targa-dig",
7154 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
7155 [ALC883_ACER] = "acer",
7156 [ALC883_ACER_ASPIRE] = "acer-aspire",
7157 [ALC883_MEDION] = "medion",
7158 [ALC883_MEDION_MD2] = "medion-md2",
7159 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
7160 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
7161 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
7162 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
7163 [ALC883_HAIER_W66] = "haier-w66",
7164 [ALC888_6ST_HP] = "6stack-hp",
7165 [ALC888_3ST_HP] = "3stack-hp",
7166 [ALC883_AUTO] = "auto",
7169 static struct snd_pci_quirk alc883_cfg_tbl[] = {
7170 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
7171 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
7172 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
7173 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
7174 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
7175 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
7176 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
7177 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
7178 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
7179 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
7180 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
7181 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
7182 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
7183 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
7184 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
7185 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
7186 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
7187 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
7188 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
7189 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
7190 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
7191 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
7192 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
7193 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
7194 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
7195 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
7196 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
7197 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
7198 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
7199 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
7200 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
7201 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
7202 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
7203 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
7204 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7205 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7206 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
7207 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
7208 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
7209 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
7210 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
7211 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
7212 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
7213 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
7217 static struct alc_config_preset alc883_presets[] = {
7218 [ALC883_3ST_2ch_DIG] = {
7219 .mixers = { alc883_3ST_2ch_mixer },
7220 .init_verbs = { alc883_init_verbs },
7221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7222 .dac_nids = alc883_dac_nids,
7223 .dig_out_nid = ALC883_DIGOUT_NID,
7224 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7225 .adc_nids = alc883_adc_nids,
7226 .dig_in_nid = ALC883_DIGIN_NID,
7227 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7228 .channel_mode = alc883_3ST_2ch_modes,
7229 .input_mux = &alc883_capture_source,
7231 [ALC883_3ST_6ch_DIG] = {
7232 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7233 .init_verbs = { alc883_init_verbs },
7234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7235 .dac_nids = alc883_dac_nids,
7236 .dig_out_nid = ALC883_DIGOUT_NID,
7237 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7238 .adc_nids = alc883_adc_nids,
7239 .dig_in_nid = ALC883_DIGIN_NID,
7240 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7241 .channel_mode = alc883_3ST_6ch_modes,
7243 .input_mux = &alc883_capture_source,
7245 [ALC883_3ST_6ch] = {
7246 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7247 .init_verbs = { alc883_init_verbs },
7248 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7249 .dac_nids = alc883_dac_nids,
7250 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7251 .adc_nids = alc883_adc_nids,
7252 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7253 .channel_mode = alc883_3ST_6ch_modes,
7255 .input_mux = &alc883_capture_source,
7257 [ALC883_6ST_DIG] = {
7258 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
7259 .init_verbs = { alc883_init_verbs },
7260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7261 .dac_nids = alc883_dac_nids,
7262 .dig_out_nid = ALC883_DIGOUT_NID,
7263 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7264 .adc_nids = alc883_adc_nids,
7265 .dig_in_nid = ALC883_DIGIN_NID,
7266 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7267 .channel_mode = alc883_sixstack_modes,
7268 .input_mux = &alc883_capture_source,
7270 [ALC883_TARGA_DIG] = {
7271 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7272 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7274 .dac_nids = alc883_dac_nids,
7275 .dig_out_nid = ALC883_DIGOUT_NID,
7276 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7277 .adc_nids = alc883_adc_nids,
7278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7279 .channel_mode = alc883_3ST_6ch_modes,
7281 .input_mux = &alc883_capture_source,
7282 .unsol_event = alc883_tagra_unsol_event,
7283 .init_hook = alc883_tagra_automute,
7285 [ALC883_TARGA_2ch_DIG] = {
7286 .mixers = { alc883_tagra_2ch_mixer},
7287 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7288 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7289 .dac_nids = alc883_dac_nids,
7290 .dig_out_nid = ALC883_DIGOUT_NID,
7291 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7292 .adc_nids = alc883_adc_nids,
7293 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7294 .channel_mode = alc883_3ST_2ch_modes,
7295 .input_mux = &alc883_capture_source,
7296 .unsol_event = alc883_tagra_unsol_event,
7297 .init_hook = alc883_tagra_automute,
7300 .mixers = { alc883_base_mixer },
7301 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7302 * and the headphone jack. Turn this on and rely on the
7303 * standard mute methods whenever the user wants to turn
7304 * these outputs off.
7306 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7307 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7308 .dac_nids = alc883_dac_nids,
7309 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7310 .adc_nids = alc883_adc_nids,
7311 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7312 .channel_mode = alc883_3ST_2ch_modes,
7313 .input_mux = &alc883_capture_source,
7315 [ALC883_ACER_ASPIRE] = {
7316 .mixers = { alc883_acer_aspire_mixer },
7317 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7318 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7319 .dac_nids = alc883_dac_nids,
7320 .dig_out_nid = ALC883_DIGOUT_NID,
7321 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7322 .adc_nids = alc883_adc_nids,
7323 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7324 .channel_mode = alc883_3ST_2ch_modes,
7325 .input_mux = &alc883_capture_source,
7326 .unsol_event = alc883_acer_aspire_unsol_event,
7327 .init_hook = alc883_acer_aspire_automute,
7330 .mixers = { alc883_fivestack_mixer,
7331 alc883_chmode_mixer },
7332 .init_verbs = { alc883_init_verbs,
7333 alc883_medion_eapd_verbs },
7334 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7335 .dac_nids = alc883_dac_nids,
7336 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7337 .adc_nids = alc883_adc_nids,
7338 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7339 .channel_mode = alc883_sixstack_modes,
7340 .input_mux = &alc883_capture_source,
7342 [ALC883_MEDION_MD2] = {
7343 .mixers = { alc883_medion_md2_mixer},
7344 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7345 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7346 .dac_nids = alc883_dac_nids,
7347 .dig_out_nid = ALC883_DIGOUT_NID,
7348 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7349 .adc_nids = alc883_adc_nids,
7350 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7351 .channel_mode = alc883_3ST_2ch_modes,
7352 .input_mux = &alc883_capture_source,
7353 .unsol_event = alc883_medion_md2_unsol_event,
7354 .init_hook = alc883_medion_md2_automute,
7356 [ALC883_LAPTOP_EAPD] = {
7357 .mixers = { alc883_base_mixer },
7358 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7359 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7360 .dac_nids = alc883_dac_nids,
7361 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7362 .adc_nids = alc883_adc_nids,
7363 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7364 .channel_mode = alc883_3ST_2ch_modes,
7365 .input_mux = &alc883_capture_source,
7367 [ALC883_LENOVO_101E_2ch] = {
7368 .mixers = { alc883_lenovo_101e_2ch_mixer},
7369 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7370 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7371 .dac_nids = alc883_dac_nids,
7372 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7373 .adc_nids = alc883_adc_nids,
7374 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7375 .channel_mode = alc883_3ST_2ch_modes,
7376 .input_mux = &alc883_lenovo_101e_capture_source,
7377 .unsol_event = alc883_lenovo_101e_unsol_event,
7378 .init_hook = alc883_lenovo_101e_all_automute,
7380 [ALC883_LENOVO_NB0763] = {
7381 .mixers = { alc883_lenovo_nb0763_mixer },
7382 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7383 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7384 .dac_nids = alc883_dac_nids,
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,
7390 .input_mux = &alc883_lenovo_nb0763_capture_source,
7391 .unsol_event = alc883_medion_md2_unsol_event,
7392 .init_hook = alc883_medion_md2_automute,
7394 [ALC888_LENOVO_MS7195_DIG] = {
7395 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7396 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7398 .dac_nids = alc883_dac_nids,
7399 .dig_out_nid = ALC883_DIGOUT_NID,
7400 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7401 .adc_nids = alc883_adc_nids,
7402 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7403 .channel_mode = alc883_3ST_6ch_modes,
7405 .input_mux = &alc883_capture_source,
7406 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7407 .init_hook = alc888_lenovo_ms7195_front_automute,
7409 [ALC883_HAIER_W66] = {
7410 .mixers = { alc883_tagra_2ch_mixer},
7411 .init_verbs = { alc883_init_verbs, alc883_haier_w66_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_haier_w66_unsol_event,
7421 .init_hook = alc883_haier_w66_automute,
7424 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7425 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7426 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7427 .dac_nids = alc883_dac_nids,
7428 .dig_out_nid = ALC883_DIGOUT_NID,
7429 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7430 .adc_nids = alc883_adc_nids,
7431 .dig_in_nid = ALC883_DIGIN_NID,
7432 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7433 .channel_mode = alc883_sixstack_modes,
7434 .input_mux = &alc883_capture_source,
7437 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7438 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7439 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7440 .dac_nids = alc883_dac_nids,
7441 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7442 .adc_nids = alc883_adc_nids,
7443 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7444 .channel_mode = alc888_3st_hp_modes,
7446 .input_mux = &alc883_capture_source,
7452 * BIOS auto configuration
7454 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7455 hda_nid_t nid, int pin_type,
7459 struct alc_spec *spec = codec->spec;
7462 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7465 idx = spec->multiout.dac_nids[dac_idx] - 2;
7467 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7469 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7471 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7475 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7477 struct alc_spec *spec = codec->spec;
7480 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7481 for (i = 0; i <= HDA_SIDE; i++) {
7482 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7483 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7485 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7490 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7492 struct alc_spec *spec = codec->spec;
7495 pin = spec->autocfg.hp_pins[0];
7496 if (pin) /* connect to front */
7498 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7501 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7502 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7504 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7506 struct alc_spec *spec = codec->spec;
7509 for (i = 0; i < AUTO_PIN_LAST; i++) {
7510 hda_nid_t nid = spec->autocfg.input_pins[i];
7511 if (alc883_is_input_pin(nid)) {
7512 snd_hda_codec_write(codec, nid, 0,
7513 AC_VERB_SET_PIN_WIDGET_CONTROL,
7514 (i <= AUTO_PIN_FRONT_MIC ?
7515 PIN_VREF80 : PIN_IN));
7516 if (nid != ALC883_PIN_CD_NID)
7517 snd_hda_codec_write(codec, nid, 0,
7518 AC_VERB_SET_AMP_GAIN_MUTE,
7524 /* almost identical with ALC880 parser... */
7525 static int alc883_parse_auto_config(struct hda_codec *codec)
7527 struct alc_spec *spec = codec->spec;
7528 int err = alc880_parse_auto_config(codec);
7533 return 0; /* no config found */
7535 err = alc_auto_add_mic_boost(codec);
7539 /* hack - override the init verbs */
7540 spec->init_verbs[0] = alc883_auto_init_verbs;
7541 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7544 return 1; /* config found */
7547 /* additional initialization for auto-configuration model */
7548 static void alc883_auto_init(struct hda_codec *codec)
7550 alc883_auto_init_multi_out(codec);
7551 alc883_auto_init_hp_out(codec);
7552 alc883_auto_init_analog_input(codec);
7555 static int patch_alc883(struct hda_codec *codec)
7557 struct alc_spec *spec;
7558 int err, board_config;
7560 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7566 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7569 if (board_config < 0) {
7570 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7571 "trying auto-probe from BIOS...\n");
7572 board_config = ALC883_AUTO;
7575 if (board_config == ALC883_AUTO) {
7576 /* automatic parse from the BIOS config */
7577 err = alc883_parse_auto_config(codec);
7583 "hda_codec: Cannot set up configuration "
7584 "from BIOS. Using base mode...\n");
7585 board_config = ALC883_3ST_2ch_DIG;
7589 if (board_config != ALC883_AUTO)
7590 setup_preset(spec, &alc883_presets[board_config]);
7592 spec->stream_name_analog = "ALC883 Analog";
7593 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7594 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7596 spec->stream_name_digital = "ALC883 Digital";
7597 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7598 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7600 if (!spec->adc_nids && spec->input_mux) {
7601 spec->adc_nids = alc883_adc_nids;
7602 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7605 codec->patch_ops = alc_patch_ops;
7606 if (board_config == ALC883_AUTO)
7607 spec->init_hook = alc883_auto_init;
7608 #ifdef CONFIG_SND_HDA_POWER_SAVE
7609 if (!spec->loopback.amplist)
7610 spec->loopback.amplist = alc883_loopbacks;
7620 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7621 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7623 #define alc262_dac_nids alc260_dac_nids
7624 #define alc262_adc_nids alc882_adc_nids
7625 #define alc262_adc_nids_alt alc882_adc_nids_alt
7627 #define alc262_modes alc260_modes
7628 #define alc262_capture_source alc882_capture_source
7630 static struct snd_kcontrol_new alc262_base_mixer[] = {
7631 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7632 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7633 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7634 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7643 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7644 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7646 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7647 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7648 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7652 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7654 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7661 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7665 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7666 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7667 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7672 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7673 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7674 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7675 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7676 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7677 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7681 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7683 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7684 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7686 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7687 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7688 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7689 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7690 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7691 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7692 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7696 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7697 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7698 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7699 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7701 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7702 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7703 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7705 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7708 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7709 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7710 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7711 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7715 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7716 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7717 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7718 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7722 static struct hda_bind_ctls alc262_hp_t5735_bind_front_vol = {
7723 .ops = &snd_hda_bind_vol,
7725 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7726 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7731 static struct hda_bind_ctls alc262_hp_t5735_bind_front_sw = {
7732 .ops = &snd_hda_bind_sw,
7734 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7735 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7740 /* mute/unmute internal speaker according to the hp jack and mute state */
7741 static void alc262_hp_t5735_automute(struct hda_codec *codec, int force)
7743 struct alc_spec *spec = codec->spec;
7746 if (force || !spec->sense_updated) {
7747 unsigned int present;
7748 present = snd_hda_codec_read(codec, 0x15, 0,
7749 AC_VERB_GET_PIN_SENSE, 0);
7750 spec->jack_present = (present & 0x80000000) != 0;
7751 spec->sense_updated = 1;
7753 if (spec->jack_present)
7754 mute = (0x7080 | ((0)<<8)); /* mute internal speaker */
7755 else /* unmute internal speaker if necessary */
7756 mute = (0x7000 | ((0)<<8));
7757 snd_hda_codec_write(codec, 0x0c, 0,
7758 AC_VERB_SET_AMP_GAIN_MUTE, mute );
7761 static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
7764 if ((res >> 26) != ALC880_HP_EVENT)
7766 alc262_hp_t5735_automute(codec, 1);
7769 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
7771 alc262_hp_t5735_automute(codec, 1);
7774 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
7775 HDA_BIND_VOL("PCM Playback Volume", &alc262_hp_t5735_bind_front_vol),
7776 HDA_BIND_SW("PCM Playback Switch",&alc262_hp_t5735_bind_front_sw),
7777 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7778 HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7779 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7789 static struct hda_verb alc262_hp_t5735_verbs[] = {
7790 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7793 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7797 /* bind hp and internal speaker mute (with plug check) */
7798 static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol,
7799 struct snd_ctl_elem_value *ucontrol)
7801 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7802 long *valp = ucontrol->value.integer.value;
7805 /* change hp mute */
7806 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7808 valp[0] ? 0 : HDA_AMP_MUTE);
7809 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7811 valp[1] ? 0 : HDA_AMP_MUTE);
7813 /* change speaker according to HP jack state */
7814 struct alc_spec *spec = codec->spec;
7816 if (spec->jack_present)
7817 mute = HDA_AMP_MUTE;
7819 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
7821 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7822 HDA_AMP_MUTE, mute);
7827 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7828 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7831 .name = "Master Playback Switch",
7832 .info = snd_hda_mixer_amp_switch_info,
7833 .get = snd_hda_mixer_amp_switch_get,
7834 .put = alc262_sony_master_sw_put,
7835 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7838 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7839 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7840 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7844 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7846 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7847 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7850 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7851 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7855 #define alc262_capture_mixer alc882_capture_mixer
7856 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7859 * generic initialization of ADC, input mixers and output mixers
7861 static struct hda_verb alc262_init_verbs[] = {
7863 * Unmute ADC0-2 and set the default input to mic-in
7865 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7867 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7869 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7872 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7874 * Note: PASD motherboards uses the Line In 2 as the input for
7875 * front panel mic (mic 2)
7877 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7885 * Set up output mixers (0x0c - 0x0e)
7887 /* set vol=0 to output mixers */
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7891 /* set up input amps for analog loopback */
7892 /* Amp Indices: DAC = 0, mixer = 1 */
7893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7904 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7905 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7907 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7908 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7910 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7913 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7914 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7916 /* FIXME: use matrix-type input source selection */
7917 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7918 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7919 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7920 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7921 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7922 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7924 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7926 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7937 static struct hda_verb alc262_hippo_unsol_verbs[] = {
7938 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7943 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
7944 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7945 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7949 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7953 static struct hda_verb alc262_sony_unsol_verbs[] = {
7954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7955 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7956 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
7958 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7962 /* mute/unmute internal speaker according to the hp jack and mute state */
7963 static void alc262_hippo_automute(struct hda_codec *codec)
7965 struct alc_spec *spec = codec->spec;
7967 unsigned int present;
7969 /* need to execute and sync at first */
7970 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7971 present = snd_hda_codec_read(codec, 0x15, 0,
7972 AC_VERB_GET_PIN_SENSE, 0);
7973 spec->jack_present = (present & 0x80000000) != 0;
7974 if (spec->jack_present) {
7975 /* mute internal speaker */
7976 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7977 HDA_AMP_MUTE, HDA_AMP_MUTE);
7979 /* unmute internal speaker if necessary */
7980 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7981 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7982 HDA_AMP_MUTE, mute);
7986 /* unsolicited event for HP jack sensing */
7987 static void alc262_hippo_unsol_event(struct hda_codec *codec,
7990 if ((res >> 26) != ALC880_HP_EVENT)
7992 alc262_hippo_automute(codec);
7995 static void alc262_hippo1_automute(struct hda_codec *codec)
7998 unsigned int present;
8000 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
8001 present = snd_hda_codec_read(codec, 0x1b, 0,
8002 AC_VERB_GET_PIN_SENSE, 0);
8003 present = (present & 0x80000000) != 0;
8005 /* mute internal speaker */
8006 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8007 HDA_AMP_MUTE, HDA_AMP_MUTE);
8009 /* unmute internal speaker if necessary */
8010 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8011 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8012 HDA_AMP_MUTE, mute);
8016 /* unsolicited event for HP jack sensing */
8017 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
8020 if ((res >> 26) != ALC880_HP_EVENT)
8022 alc262_hippo1_automute(codec);
8027 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8030 #define ALC_HP_EVENT 0x37
8032 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
8033 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
8034 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8038 static struct hda_input_mux alc262_fujitsu_capture_source = {
8047 static struct hda_input_mux alc262_HP_capture_source = {
8051 { "Front Mic", 0x1 },
8058 static struct hda_input_mux alc262_HP_D7000_capture_source = {
8062 { "Front Mic", 0x2 },
8068 /* mute/unmute internal speaker according to the hp jack and mute state */
8069 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
8071 struct alc_spec *spec = codec->spec;
8074 if (force || !spec->sense_updated) {
8075 unsigned int present;
8076 /* need to execute and sync at first */
8077 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
8078 present = snd_hda_codec_read(codec, 0x14, 0,
8079 AC_VERB_GET_PIN_SENSE, 0);
8080 spec->jack_present = (present & 0x80000000) != 0;
8081 spec->sense_updated = 1;
8083 if (spec->jack_present) {
8084 /* mute internal speaker */
8085 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8086 HDA_AMP_MUTE, HDA_AMP_MUTE);
8088 /* unmute internal speaker if necessary */
8089 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8090 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8091 HDA_AMP_MUTE, mute);
8095 /* unsolicited event for HP jack sensing */
8096 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
8099 if ((res >> 26) != ALC_HP_EVENT)
8101 alc262_fujitsu_automute(codec, 1);
8104 /* bind volumes of both NID 0x0c and 0x0d */
8105 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
8106 .ops = &snd_hda_bind_vol,
8108 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
8109 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
8114 /* bind hp and internal speaker mute (with plug check) */
8115 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
8116 struct snd_ctl_elem_value *ucontrol)
8118 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8119 long *valp = ucontrol->value.integer.value;
8122 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
8124 valp[0] ? 0 : HDA_AMP_MUTE);
8125 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
8127 valp[1] ? 0 : HDA_AMP_MUTE);
8129 alc262_fujitsu_automute(codec, 0);
8133 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
8134 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
8136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8137 .name = "Master Playback Switch",
8138 .info = snd_hda_mixer_amp_switch_info,
8139 .get = snd_hda_mixer_amp_switch_get,
8140 .put = alc262_fujitsu_master_sw_put,
8141 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8143 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8144 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8150 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8154 /* additional init verbs for Benq laptops */
8155 static struct hda_verb alc262_EAPD_verbs[] = {
8156 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8157 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8161 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
8162 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8165 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8166 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8170 /* Samsung Q1 Ultra Vista model setup */
8171 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
8172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8173 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8177 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8181 static struct hda_verb alc262_ultra_verbs[] = {
8182 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8184 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8185 /* Mic is on Node 0x19 */
8186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8187 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
8188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8189 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
8190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8191 {0x24, AC_VERB_SET_CONNECT_SEL, 0x01},
8192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8196 static struct hda_input_mux alc262_ultra_capture_source = {
8203 /* mute/unmute internal speaker according to the hp jack and mute state */
8204 static void alc262_ultra_automute(struct hda_codec *codec)
8206 struct alc_spec *spec = codec->spec;
8208 unsigned int present;
8210 /* need to execute and sync at first */
8211 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
8212 present = snd_hda_codec_read(codec, 0x15, 0,
8213 AC_VERB_GET_PIN_SENSE, 0);
8214 spec->jack_present = (present & 0x80000000) != 0;
8215 if (spec->jack_present) {
8216 /* mute internal speaker */
8217 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8218 HDA_AMP_MUTE, HDA_AMP_MUTE);
8220 /* unmute internal speaker if necessary */
8221 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
8222 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8223 HDA_AMP_MUTE, mute);
8227 /* unsolicited event for HP jack sensing */
8228 static void alc262_ultra_unsol_event(struct hda_codec *codec,
8231 if ((res >> 26) != ALC880_HP_EVENT)
8233 alc262_ultra_automute(codec);
8236 /* add playback controls from the parsed DAC table */
8237 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
8238 const struct auto_pin_cfg *cfg)
8243 spec->multiout.num_dacs = 1; /* only use one dac */
8244 spec->multiout.dac_nids = spec->private_dac_nids;
8245 spec->multiout.dac_nids[0] = 2;
8247 nid = cfg->line_out_pins[0];
8249 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8250 "Front Playback Volume",
8251 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
8254 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8255 "Front Playback Switch",
8256 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
8261 nid = cfg->speaker_pins[0];
8264 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8265 "Speaker Playback Volume",
8266 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8270 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8271 "Speaker Playback Switch",
8272 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8277 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8278 "Speaker Playback Switch",
8279 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8285 nid = cfg->hp_pins[0];
8287 /* spec->multiout.hp_nid = 2; */
8289 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8290 "Headphone Playback Volume",
8291 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8295 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8296 "Headphone Playback Switch",
8297 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
8302 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8303 "Headphone Playback Switch",
8304 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
8313 /* identical with ALC880 */
8314 #define alc262_auto_create_analog_input_ctls \
8315 alc880_auto_create_analog_input_ctls
8318 * generic initialization of ADC, input mixers and output mixers
8320 static struct hda_verb alc262_volume_init_verbs[] = {
8322 * Unmute ADC0-2 and set the default input to mic-in
8324 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8326 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8328 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8329 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8331 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8333 * Note: PASD motherboards uses the Line In 2 as the input for
8334 * front panel mic (mic 2)
8336 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8344 * Set up output mixers (0x0c - 0x0f)
8346 /* set vol=0 to output mixers */
8347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8351 /* set up input amps for analog loopback */
8352 /* Amp Indices: DAC = 0, mixer = 1 */
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8360 /* FIXME: use matrix-type input source selection */
8361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8362 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8381 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
8383 * Unmute ADC0-2 and set the default input to mic-in
8385 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8387 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8389 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8392 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8394 * Note: PASD motherboards uses the Line In 2 as the input for
8395 * front panel mic (mic 2)
8397 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8407 * Set up output mixers (0x0c - 0x0e)
8409 /* set vol=0 to output mixers */
8410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8414 /* set up input amps for analog loopback */
8415 /* Amp Indices: DAC = 0, mixer = 1 */
8416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8427 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8430 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8435 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8437 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8442 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8443 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8444 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8447 /* FIXME: use matrix-type input source selection */
8448 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8449 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8468 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8470 * Unmute ADC0-2 and set the default input to mic-in
8472 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8477 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8479 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8481 * Note: PASD motherboards uses the Line In 2 as the input for front
8484 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8494 * Set up output mixers (0x0c - 0x0e)
8496 /* set vol=0 to output mixers */
8497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8498 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8499 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8501 /* set up input amps for analog loopback */
8502 /* Amp Indices: DAC = 0, mixer = 1 */
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8517 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8519 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8523 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8525 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8528 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8529 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8530 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8532 /* FIXME: use matrix-type input source selection */
8533 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8534 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8536 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8540 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8548 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8556 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8562 #ifdef CONFIG_SND_HDA_POWER_SAVE
8563 #define alc262_loopbacks alc880_loopbacks
8566 /* pcm configuration: identiacal with ALC880 */
8567 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8568 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8569 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8570 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8573 * BIOS auto configuration
8575 static int alc262_parse_auto_config(struct hda_codec *codec)
8577 struct alc_spec *spec = codec->spec;
8579 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8581 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8585 if (!spec->autocfg.line_outs)
8586 return 0; /* can't find valid BIOS pin config */
8587 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8590 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8594 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8596 if (spec->autocfg.dig_out_pin)
8597 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8598 if (spec->autocfg.dig_in_pin)
8599 spec->dig_in_nid = ALC262_DIGIN_NID;
8601 if (spec->kctl_alloc)
8602 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8604 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8605 spec->num_mux_defs = 1;
8606 spec->input_mux = &spec->private_imux;
8608 err = alc_auto_add_mic_boost(codec);
8615 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8616 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8617 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8620 /* init callback for auto-configuration model -- overriding the default init */
8621 static void alc262_auto_init(struct hda_codec *codec)
8623 alc262_auto_init_multi_out(codec);
8624 alc262_auto_init_hp_out(codec);
8625 alc262_auto_init_analog_input(codec);
8629 * configuration and preset
8631 static const char *alc262_models[ALC262_MODEL_LAST] = {
8632 [ALC262_BASIC] = "basic",
8633 [ALC262_HIPPO] = "hippo",
8634 [ALC262_HIPPO_1] = "hippo_1",
8635 [ALC262_FUJITSU] = "fujitsu",
8636 [ALC262_HP_BPC] = "hp-bpc",
8637 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8638 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
8639 [ALC262_BENQ_ED8] = "benq",
8640 [ALC262_BENQ_T31] = "benq-t31",
8641 [ALC262_SONY_ASSAMD] = "sony-assamd",
8642 [ALC262_ULTRA] = "ultra",
8643 [ALC262_AUTO] = "auto",
8646 static struct snd_pci_quirk alc262_cfg_tbl[] = {
8647 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
8648 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
8649 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
8650 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
8651 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
8652 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC),
8653 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
8654 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
8655 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC),
8656 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
8657 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
8658 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC),
8659 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
8660 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
8661 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
8662 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
8663 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
8664 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
8665 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
8666 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
8667 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
8668 ALC262_HP_TC_T5735),
8669 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
8670 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
8671 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
8672 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
8673 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
8674 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8675 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
8676 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8677 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8678 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
8682 static struct alc_config_preset alc262_presets[] = {
8684 .mixers = { alc262_base_mixer },
8685 .init_verbs = { alc262_init_verbs },
8686 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8687 .dac_nids = alc262_dac_nids,
8689 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8690 .channel_mode = alc262_modes,
8691 .input_mux = &alc262_capture_source,
8694 .mixers = { alc262_base_mixer },
8695 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8696 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8697 .dac_nids = alc262_dac_nids,
8699 .dig_out_nid = ALC262_DIGOUT_NID,
8700 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8701 .channel_mode = alc262_modes,
8702 .input_mux = &alc262_capture_source,
8703 .unsol_event = alc262_hippo_unsol_event,
8704 .init_hook = alc262_hippo_automute,
8706 [ALC262_HIPPO_1] = {
8707 .mixers = { alc262_hippo1_mixer },
8708 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8709 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8710 .dac_nids = alc262_dac_nids,
8712 .dig_out_nid = ALC262_DIGOUT_NID,
8713 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8714 .channel_mode = alc262_modes,
8715 .input_mux = &alc262_capture_source,
8716 .unsol_event = alc262_hippo1_unsol_event,
8717 .init_hook = alc262_hippo1_automute,
8719 [ALC262_FUJITSU] = {
8720 .mixers = { alc262_fujitsu_mixer },
8721 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
8722 alc262_fujitsu_unsol_verbs },
8723 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8724 .dac_nids = alc262_dac_nids,
8726 .dig_out_nid = ALC262_DIGOUT_NID,
8727 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8728 .channel_mode = alc262_modes,
8729 .input_mux = &alc262_fujitsu_capture_source,
8730 .unsol_event = alc262_fujitsu_unsol_event,
8733 .mixers = { alc262_HP_BPC_mixer },
8734 .init_verbs = { alc262_HP_BPC_init_verbs },
8735 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8736 .dac_nids = alc262_dac_nids,
8738 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8739 .channel_mode = alc262_modes,
8740 .input_mux = &alc262_HP_capture_source,
8742 [ALC262_HP_BPC_D7000_WF] = {
8743 .mixers = { alc262_HP_BPC_WildWest_mixer },
8744 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8745 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8746 .dac_nids = alc262_dac_nids,
8748 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8749 .channel_mode = alc262_modes,
8750 .input_mux = &alc262_HP_D7000_capture_source,
8752 [ALC262_HP_BPC_D7000_WL] = {
8753 .mixers = { alc262_HP_BPC_WildWest_mixer,
8754 alc262_HP_BPC_WildWest_option_mixer },
8755 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8756 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8757 .dac_nids = alc262_dac_nids,
8759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8760 .channel_mode = alc262_modes,
8761 .input_mux = &alc262_HP_D7000_capture_source,
8763 [ALC262_HP_TC_T5735] = {
8764 .mixers = { alc262_hp_t5735_mixer },
8765 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
8766 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8767 .dac_nids = alc262_dac_nids,
8769 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8770 .channel_mode = alc262_modes,
8771 .input_mux = &alc262_capture_source,
8772 .unsol_event = alc262_hp_t5735_unsol_event,
8773 .init_hook = alc262_hp_t5735_init_hook,
8775 [ALC262_BENQ_ED8] = {
8776 .mixers = { alc262_base_mixer },
8777 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
8778 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8779 .dac_nids = alc262_dac_nids,
8781 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8782 .channel_mode = alc262_modes,
8783 .input_mux = &alc262_capture_source,
8785 [ALC262_SONY_ASSAMD] = {
8786 .mixers = { alc262_sony_mixer },
8787 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
8788 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8789 .dac_nids = alc262_dac_nids,
8791 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8792 .channel_mode = alc262_modes,
8793 .input_mux = &alc262_capture_source,
8794 .unsol_event = alc262_hippo_unsol_event,
8795 .init_hook = alc262_hippo_automute,
8797 [ALC262_BENQ_T31] = {
8798 .mixers = { alc262_benq_t31_mixer },
8799 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
8800 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8801 .dac_nids = alc262_dac_nids,
8803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8804 .channel_mode = alc262_modes,
8805 .input_mux = &alc262_capture_source,
8806 .unsol_event = alc262_hippo_unsol_event,
8807 .init_hook = alc262_hippo_automute,
8810 .mixers = { alc262_ultra_mixer },
8811 .init_verbs = { alc262_init_verbs, alc262_ultra_verbs },
8812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8813 .dac_nids = alc262_dac_nids,
8815 .dig_out_nid = ALC262_DIGOUT_NID,
8816 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8817 .channel_mode = alc262_modes,
8818 .input_mux = &alc262_ultra_capture_source,
8819 .unsol_event = alc262_ultra_unsol_event,
8820 .init_hook = alc262_ultra_automute,
8824 static int patch_alc262(struct hda_codec *codec)
8826 struct alc_spec *spec;
8830 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8836 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8841 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8842 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8843 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8844 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8848 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8852 if (board_config < 0) {
8853 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8854 "trying auto-probe from BIOS...\n");
8855 board_config = ALC262_AUTO;
8858 if (board_config == ALC262_AUTO) {
8859 /* automatic parse from the BIOS config */
8860 err = alc262_parse_auto_config(codec);
8866 "hda_codec: Cannot set up configuration "
8867 "from BIOS. Using base mode...\n");
8868 board_config = ALC262_BASIC;
8872 if (board_config != ALC262_AUTO)
8873 setup_preset(spec, &alc262_presets[board_config]);
8875 spec->stream_name_analog = "ALC262 Analog";
8876 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8877 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8879 spec->stream_name_digital = "ALC262 Digital";
8880 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8881 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8883 if (!spec->adc_nids && spec->input_mux) {
8884 /* check whether NID 0x07 is valid */
8885 unsigned int wcap = get_wcaps(codec, 0x07);
8888 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8889 if (wcap != AC_WID_AUD_IN) {
8890 spec->adc_nids = alc262_adc_nids_alt;
8891 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8892 spec->mixers[spec->num_mixers] =
8893 alc262_capture_alt_mixer;
8896 spec->adc_nids = alc262_adc_nids;
8897 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
8898 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
8903 codec->patch_ops = alc_patch_ops;
8904 if (board_config == ALC262_AUTO)
8905 spec->init_hook = alc262_auto_init;
8906 #ifdef CONFIG_SND_HDA_POWER_SAVE
8907 if (!spec->loopback.amplist)
8908 spec->loopback.amplist = alc262_loopbacks;
8915 * ALC268 channel source setting (2 channel)
8917 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8918 #define alc268_modes alc260_modes
8920 static hda_nid_t alc268_dac_nids[2] = {
8925 static hda_nid_t alc268_adc_nids[2] = {
8930 static hda_nid_t alc268_adc_nids_alt[1] = {
8935 static struct snd_kcontrol_new alc268_base_mixer[] = {
8936 /* output mixer control */
8937 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
8938 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
8940 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8942 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8943 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
8947 static struct hda_verb alc268_eapd_verbs[] = {
8948 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8949 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8953 /* Toshiba specific */
8954 #define alc268_toshiba_automute alc262_hippo_automute
8956 static struct hda_verb alc268_toshiba_verbs[] = {
8957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8962 /* bind volumes of both NID 0x02 and 0x03 */
8963 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
8964 .ops = &snd_hda_bind_vol,
8966 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
8967 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
8972 /* mute/unmute internal speaker according to the hp jack and mute state */
8973 static void alc268_acer_automute(struct hda_codec *codec, int force)
8975 struct alc_spec *spec = codec->spec;
8978 if (force || !spec->sense_updated) {
8979 unsigned int present;
8980 present = snd_hda_codec_read(codec, 0x14, 0,
8981 AC_VERB_GET_PIN_SENSE, 0);
8982 spec->jack_present = (present & 0x80000000) != 0;
8983 spec->sense_updated = 1;
8985 if (spec->jack_present)
8986 mute = HDA_AMP_MUTE; /* mute internal speaker */
8987 else /* unmute internal speaker if necessary */
8988 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
8989 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8990 HDA_AMP_MUTE, mute);
8994 /* bind hp and internal speaker mute (with plug check) */
8995 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
8996 struct snd_ctl_elem_value *ucontrol)
8998 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8999 long *valp = ucontrol->value.integer.value;
9002 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
9004 valp[0] ? 0 : HDA_AMP_MUTE);
9005 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
9007 valp[1] ? 0 : HDA_AMP_MUTE);
9009 alc268_acer_automute(codec, 0);
9013 static struct snd_kcontrol_new alc268_acer_mixer[] = {
9014 /* output mixer control */
9015 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
9017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9018 .name = "Master Playback Switch",
9019 .info = snd_hda_mixer_amp_switch_info,
9020 .get = snd_hda_mixer_amp_switch_get,
9021 .put = alc268_acer_master_sw_put,
9022 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
9024 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9025 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
9026 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
9030 static struct hda_verb alc268_acer_verbs[] = {
9031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9034 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9038 /* unsolicited event for HP jack sensing */
9039 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
9042 if ((res >> 26) != ALC880_HP_EVENT)
9044 alc268_toshiba_automute(codec);
9047 static void alc268_acer_unsol_event(struct hda_codec *codec,
9050 if ((res >> 26) != ALC880_HP_EVENT)
9052 alc268_acer_automute(codec, 1);
9055 static void alc268_acer_init_hook(struct hda_codec *codec)
9057 alc268_acer_automute(codec, 1);
9061 * generic initialization of ADC, input mixers and output mixers
9063 static struct hda_verb alc268_base_init_verbs[] = {
9064 /* Unmute DAC0-1 and set vol = 0 */
9065 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9067 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9068 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9070 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9073 * Set up output mixers (0x0c - 0x0e)
9075 /* set vol=0 to output mixers */
9076 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9077 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9079 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
9081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9082 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9084 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9085 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9089 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9090 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9091 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9096 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9098 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9099 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9100 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9102 /* FIXME: use matrix-type input source selection */
9103 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
9104 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9108 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
9114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
9119 * generic initialization of ADC, input mixers and output mixers
9121 static struct hda_verb alc268_volume_init_verbs[] = {
9122 /* set output DAC */
9123 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9124 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9125 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9126 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9128 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9130 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9131 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9132 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9134 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9135 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9136 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9137 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9138 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9142 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9143 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9145 /* set PCBEEP vol = 0 */
9146 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
9151 #define alc268_mux_enum_info alc_mux_enum_info
9152 #define alc268_mux_enum_get alc_mux_enum_get
9154 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
9155 struct snd_ctl_elem_value *ucontrol)
9157 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9158 struct alc_spec *spec = codec->spec;
9159 const struct hda_input_mux *imux = spec->input_mux;
9160 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9161 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
9162 hda_nid_t nid = capture_mixers[adc_idx];
9163 unsigned int *cur_val = &spec->cur_mux[adc_idx];
9164 unsigned int i, idx;
9166 idx = ucontrol->value.enumerated.item[0];
9167 if (idx >= imux->num_items)
9168 idx = imux->num_items - 1;
9169 if (*cur_val == idx)
9171 for (i = 0; i < imux->num_items; i++) {
9172 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
9173 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
9174 imux->items[i].index,
9176 snd_hda_codec_write_cache(codec, nid, 0,
9177 AC_VERB_SET_CONNECT_SEL,
9184 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
9185 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9186 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9189 /* The multiple "Capture Source" controls confuse alsamixer
9190 * So call somewhat different..
9191 * FIXME: the controls appear in the "playback" view!
9193 /* .name = "Capture Source", */
9194 .name = "Input Source",
9196 .info = alc268_mux_enum_info,
9197 .get = alc268_mux_enum_get,
9198 .put = alc268_mux_enum_put,
9203 static struct snd_kcontrol_new alc268_capture_mixer[] = {
9204 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
9205 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
9206 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
9207 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
9209 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9210 /* The multiple "Capture Source" controls confuse alsamixer
9211 * So call somewhat different..
9212 * FIXME: the controls appear in the "playback" view!
9214 /* .name = "Capture Source", */
9215 .name = "Input Source",
9217 .info = alc268_mux_enum_info,
9218 .get = alc268_mux_enum_get,
9219 .put = alc268_mux_enum_put,
9224 static struct hda_input_mux alc268_capture_source = {
9228 { "Front Mic", 0x1 },
9234 /* create input playback/capture controls for the given pin */
9235 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
9236 const char *ctlname, int idx)
9241 sprintf(name, "%s Playback Volume", ctlname);
9243 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9244 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
9248 } else if (nid == 0x15) {
9249 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
9250 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
9256 sprintf(name, "%s Playback Switch", ctlname);
9257 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
9258 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
9264 /* add playback controls from the parsed DAC table */
9265 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
9266 const struct auto_pin_cfg *cfg)
9271 spec->multiout.num_dacs = 2; /* only use one dac */
9272 spec->multiout.dac_nids = spec->private_dac_nids;
9273 spec->multiout.dac_nids[0] = 2;
9274 spec->multiout.dac_nids[1] = 3;
9276 nid = cfg->line_out_pins[0];
9278 alc268_new_analog_output(spec, nid, "Front", 0);
9280 nid = cfg->speaker_pins[0];
9282 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9283 "Speaker Playback Volume",
9284 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9288 nid = cfg->hp_pins[0];
9290 alc268_new_analog_output(spec, nid, "Headphone", 0);
9292 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
9294 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9295 "Mono Playback Switch",
9296 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
9303 /* create playback/capture controls for input pins */
9304 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
9305 const struct auto_pin_cfg *cfg)
9307 struct hda_input_mux *imux = &spec->private_imux;
9310 for (i = 0; i < AUTO_PIN_LAST; i++) {
9311 switch(cfg->input_pins[i]) {
9313 idx1 = 0; /* Mic 1 */
9316 idx1 = 1; /* Mic 2 */
9319 idx1 = 2; /* Line In */
9327 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9328 imux->items[imux->num_items].index = idx1;
9334 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
9336 struct alc_spec *spec = codec->spec;
9337 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9338 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9339 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9340 unsigned int dac_vol1, dac_vol2;
9343 snd_hda_codec_write(codec, speaker_nid, 0,
9344 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
9345 snd_hda_codec_write(codec, 0x0f, 0,
9346 AC_VERB_SET_AMP_GAIN_MUTE,
9348 snd_hda_codec_write(codec, 0x10, 0,
9349 AC_VERB_SET_AMP_GAIN_MUTE,
9352 snd_hda_codec_write(codec, 0x0f, 0,
9353 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9354 snd_hda_codec_write(codec, 0x10, 0,
9355 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
9358 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
9359 if (line_nid == 0x14)
9360 dac_vol2 = AMP_OUT_ZERO;
9361 else if (line_nid == 0x15)
9362 dac_vol1 = AMP_OUT_ZERO;
9364 dac_vol2 = AMP_OUT_ZERO;
9365 else if (hp_nid == 0x15)
9366 dac_vol1 = AMP_OUT_ZERO;
9367 if (line_nid != 0x16 || hp_nid != 0x16 ||
9368 spec->autocfg.line_out_pins[1] != 0x16 ||
9369 spec->autocfg.line_out_pins[2] != 0x16)
9370 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
9372 snd_hda_codec_write(codec, 0x02, 0,
9373 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
9374 snd_hda_codec_write(codec, 0x03, 0,
9375 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
9378 /* pcm configuration: identiacal with ALC880 */
9379 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9380 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9381 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9384 * BIOS auto configuration
9386 static int alc268_parse_auto_config(struct hda_codec *codec)
9388 struct alc_spec *spec = codec->spec;
9390 static hda_nid_t alc268_ignore[] = { 0 };
9392 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9396 if (!spec->autocfg.line_outs)
9397 return 0; /* can't find valid BIOS pin config */
9399 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
9402 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
9406 spec->multiout.max_channels = 2;
9408 /* digital only support output */
9409 if (spec->autocfg.dig_out_pin)
9410 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
9412 if (spec->kctl_alloc)
9413 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9415 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
9416 spec->num_mux_defs = 1;
9417 spec->input_mux = &spec->private_imux;
9419 err = alc_auto_add_mic_boost(codec);
9426 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9427 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9428 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9430 /* init callback for auto-configuration model -- overriding the default init */
9431 static void alc268_auto_init(struct hda_codec *codec)
9433 alc268_auto_init_multi_out(codec);
9434 alc268_auto_init_hp_out(codec);
9435 alc268_auto_init_mono_speaker_out(codec);
9436 alc268_auto_init_analog_input(codec);
9440 * configuration and preset
9442 static const char *alc268_models[ALC268_MODEL_LAST] = {
9443 [ALC268_3ST] = "3stack",
9444 [ALC268_TOSHIBA] = "toshiba",
9445 [ALC268_ACER] = "acer",
9446 [ALC268_AUTO] = "auto",
9449 static struct snd_pci_quirk alc268_cfg_tbl[] = {
9450 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
9451 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
9452 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
9453 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
9454 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
9455 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
9456 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
9460 static struct alc_config_preset alc268_presets[] = {
9462 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9463 .init_verbs = { alc268_base_init_verbs },
9464 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9465 .dac_nids = alc268_dac_nids,
9466 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9467 .adc_nids = alc268_adc_nids_alt,
9469 .dig_out_nid = ALC268_DIGOUT_NID,
9470 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9471 .channel_mode = alc268_modes,
9472 .input_mux = &alc268_capture_source,
9474 [ALC268_TOSHIBA] = {
9475 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
9476 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9477 alc268_toshiba_verbs },
9478 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9479 .dac_nids = alc268_dac_nids,
9480 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9481 .adc_nids = alc268_adc_nids_alt,
9483 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9484 .channel_mode = alc268_modes,
9485 .input_mux = &alc268_capture_source,
9486 .unsol_event = alc268_toshiba_unsol_event,
9487 .init_hook = alc268_toshiba_automute,
9490 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
9491 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
9492 alc268_acer_verbs },
9493 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
9494 .dac_nids = alc268_dac_nids,
9495 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
9496 .adc_nids = alc268_adc_nids_alt,
9498 .num_channel_mode = ARRAY_SIZE(alc268_modes),
9499 .channel_mode = alc268_modes,
9500 .input_mux = &alc268_capture_source,
9501 .unsol_event = alc268_acer_unsol_event,
9502 .init_hook = alc268_acer_init_hook,
9506 static int patch_alc268(struct hda_codec *codec)
9508 struct alc_spec *spec;
9512 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
9518 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
9522 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
9523 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
9524 "trying auto-probe from BIOS...\n");
9525 board_config = ALC268_AUTO;
9528 if (board_config == ALC268_AUTO) {
9529 /* automatic parse from the BIOS config */
9530 err = alc268_parse_auto_config(codec);
9536 "hda_codec: Cannot set up configuration "
9537 "from BIOS. Using base mode...\n");
9538 board_config = ALC268_3ST;
9542 if (board_config != ALC268_AUTO)
9543 setup_preset(spec, &alc268_presets[board_config]);
9545 spec->stream_name_analog = "ALC268 Analog";
9546 spec->stream_analog_playback = &alc268_pcm_analog_playback;
9547 spec->stream_analog_capture = &alc268_pcm_analog_capture;
9549 spec->stream_name_digital = "ALC268 Digital";
9550 spec->stream_digital_playback = &alc268_pcm_digital_playback;
9552 if (board_config == ALC268_AUTO) {
9553 if (!spec->adc_nids && spec->input_mux) {
9554 /* check whether NID 0x07 is valid */
9555 unsigned int wcap = get_wcaps(codec, 0x07);
9558 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9559 if (wcap != AC_WID_AUD_IN) {
9560 spec->adc_nids = alc268_adc_nids_alt;
9561 spec->num_adc_nids =
9562 ARRAY_SIZE(alc268_adc_nids_alt);
9563 spec->mixers[spec->num_mixers] =
9564 alc268_capture_alt_mixer;
9567 spec->adc_nids = alc268_adc_nids;
9568 spec->num_adc_nids =
9569 ARRAY_SIZE(alc268_adc_nids);
9570 spec->mixers[spec->num_mixers] =
9571 alc268_capture_mixer;
9576 codec->patch_ops = alc_patch_ops;
9577 if (board_config == ALC268_AUTO)
9578 spec->init_hook = alc268_auto_init;
9584 * ALC269 channel source setting (2 channel)
9586 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
9588 #define alc269_dac_nids alc260_dac_nids
9590 static hda_nid_t alc269_adc_nids[1] = {
9595 #define alc269_modes alc260_modes
9596 #define alc269_capture_source alc880_lg_lw_capture_source
9598 static struct snd_kcontrol_new alc269_base_mixer[] = {
9599 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9600 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9603 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9606 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9608 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9610 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9614 /* capture mixer elements */
9615 static struct snd_kcontrol_new alc269_capture_mixer[] = {
9616 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
9617 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
9619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9620 /* The multiple "Capture Source" controls confuse alsamixer
9621 * So call somewhat different..
9622 * FIXME: the controls appear in the "playback" view!
9624 /* .name = "Capture Source", */
9625 .name = "Input Source",
9627 .info = alc_mux_enum_info,
9628 .get = alc_mux_enum_get,
9629 .put = alc_mux_enum_put,
9635 * generic initialization of ADC, input mixers and output mixers
9637 static struct hda_verb alc269_init_verbs[] = {
9639 * Unmute ADC0 and set the default input to mic-in
9641 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9643 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
9644 * analog-loopback mixer widget
9645 * Note: PASD motherboards uses the Line In 2 as the input for
9646 * front panel mic (mic 2)
9648 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9656 * Set up output mixers (0x0c - 0x0e)
9658 /* set vol=0 to output mixers */
9659 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9660 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9662 /* set up input amps for analog loopback */
9663 /* Amp Indices: DAC = 0, mixer = 1 */
9664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9673 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9674 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
9676 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9677 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9681 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9687 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9688 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9690 /* FIXME: use matrix-type input source selection */
9691 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
9692 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9699 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9700 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9704 /* add playback controls from the parsed DAC table */
9705 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
9706 const struct auto_pin_cfg *cfg)
9711 spec->multiout.num_dacs = 1; /* only use one dac */
9712 spec->multiout.dac_nids = spec->private_dac_nids;
9713 spec->multiout.dac_nids[0] = 2;
9715 nid = cfg->line_out_pins[0];
9717 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9718 "Front Playback Volume",
9719 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
9722 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9723 "Front Playback Switch",
9724 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9729 nid = cfg->speaker_pins[0];
9731 if (!cfg->line_out_pins[0]) {
9732 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9733 "Speaker Playback Volume",
9734 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9740 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9741 "Speaker Playback Switch",
9742 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9747 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9748 "Speaker Playback Switch",
9749 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9755 nid = cfg->hp_pins[0];
9757 /* spec->multiout.hp_nid = 2; */
9758 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
9759 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9760 "Headphone Playback Volume",
9761 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
9767 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9768 "Headphone Playback Switch",
9769 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9774 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9775 "Headphone Playback Switch",
9776 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9785 #define alc269_auto_create_analog_input_ctls \
9786 alc880_auto_create_analog_input_ctls
9788 #ifdef CONFIG_SND_HDA_POWER_SAVE
9789 #define alc269_loopbacks alc880_loopbacks
9792 /* pcm configuration: identiacal with ALC880 */
9793 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
9794 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
9795 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
9796 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
9799 * BIOS auto configuration
9801 static int alc269_parse_auto_config(struct hda_codec *codec)
9803 struct alc_spec *spec = codec->spec;
9805 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
9807 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9812 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
9815 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
9819 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9821 if (spec->autocfg.dig_out_pin)
9822 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
9824 if (spec->kctl_alloc)
9825 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9827 spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
9828 spec->num_mux_defs = 1;
9829 spec->input_mux = &spec->private_imux;
9831 err = alc_auto_add_mic_boost(codec);
9838 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
9839 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
9840 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
9843 /* init callback for auto-configuration model -- overriding the default init */
9844 static void alc269_auto_init(struct hda_codec *codec)
9846 alc269_auto_init_multi_out(codec);
9847 alc269_auto_init_hp_out(codec);
9848 alc269_auto_init_analog_input(codec);
9852 * configuration and preset
9854 static const char *alc269_models[ALC269_MODEL_LAST] = {
9855 [ALC269_BASIC] = "basic",
9858 static struct snd_pci_quirk alc269_cfg_tbl[] = {
9862 static struct alc_config_preset alc269_presets[] = {
9864 .mixers = { alc269_base_mixer },
9865 .init_verbs = { alc269_init_verbs },
9866 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
9867 .dac_nids = alc269_dac_nids,
9869 .num_channel_mode = ARRAY_SIZE(alc269_modes),
9870 .channel_mode = alc269_modes,
9871 .input_mux = &alc269_capture_source,
9875 static int patch_alc269(struct hda_codec *codec)
9877 struct alc_spec *spec;
9881 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9887 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
9891 if (board_config < 0) {
9892 printk(KERN_INFO "hda_codec: Unknown model for ALC269, "
9893 "trying auto-probe from BIOS...\n");
9894 board_config = ALC269_AUTO;
9897 if (board_config == ALC269_AUTO) {
9898 /* automatic parse from the BIOS config */
9899 err = alc269_parse_auto_config(codec);
9905 "hda_codec: Cannot set up configuration "
9906 "from BIOS. Using base mode...\n");
9907 board_config = ALC269_BASIC;
9911 if (board_config != ALC269_AUTO)
9912 setup_preset(spec, &alc269_presets[board_config]);
9914 spec->stream_name_analog = "ALC269 Analog";
9915 spec->stream_analog_playback = &alc269_pcm_analog_playback;
9916 spec->stream_analog_capture = &alc269_pcm_analog_capture;
9918 spec->stream_name_digital = "ALC269 Digital";
9919 spec->stream_digital_playback = &alc269_pcm_digital_playback;
9920 spec->stream_digital_capture = &alc269_pcm_digital_capture;
9922 spec->adc_nids = alc269_adc_nids;
9923 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
9924 spec->mixers[spec->num_mixers] = alc269_capture_mixer;
9927 codec->patch_ops = alc_patch_ops;
9928 if (board_config == ALC269_AUTO)
9929 spec->init_hook = alc269_auto_init;
9930 #ifdef CONFIG_SND_HDA_POWER_SAVE
9931 if (!spec->loopback.amplist)
9932 spec->loopback.amplist = alc269_loopbacks;
9939 * ALC861 channel source setting (2/6 channel selection for 3-stack)
9943 * set the path ways for 2 channel output
9944 * need to set the codec line out and mic 1 pin widgets to inputs
9946 static struct hda_verb alc861_threestack_ch2_init[] = {
9947 /* set pin widget 1Ah (line in) for input */
9948 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9949 /* set pin widget 18h (mic1/2) for input, for mic also enable
9952 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9954 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
9956 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
9957 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
9963 * need to set the codec line out and mic 1 pin widgets to outputs
9965 static struct hda_verb alc861_threestack_ch6_init[] = {
9966 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9967 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9968 /* set pin widget 18h (mic1) for output (CLFE)*/
9969 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9971 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
9972 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
9974 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
9976 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
9977 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
9982 static struct hda_channel_mode alc861_threestack_modes[2] = {
9983 { 2, alc861_threestack_ch2_init },
9984 { 6, alc861_threestack_ch6_init },
9986 /* Set mic1 as input and unmute the mixer */
9987 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
9988 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9989 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
9992 /* Set mic1 as output and mute mixer */
9993 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
9994 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9995 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
9999 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
10000 { 2, alc861_uniwill_m31_ch2_init },
10001 { 4, alc861_uniwill_m31_ch4_init },
10004 /* Set mic1 and line-in as input and unmute the mixer */
10005 static struct hda_verb alc861_asus_ch2_init[] = {
10006 /* set pin widget 1Ah (line in) for input */
10007 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10008 /* set pin widget 18h (mic1/2) for input, for mic also enable
10011 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10013 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
10015 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
10016 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
10020 /* Set mic1 nad line-in as output and mute mixer */
10021 static struct hda_verb alc861_asus_ch6_init[] = {
10022 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10023 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10024 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10025 /* set pin widget 18h (mic1) for output (CLFE)*/
10026 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10027 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10028 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
10029 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
10031 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
10033 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
10034 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
10039 static struct hda_channel_mode alc861_asus_modes[2] = {
10040 { 2, alc861_asus_ch2_init },
10041 { 6, alc861_asus_ch6_init },
10046 static struct snd_kcontrol_new alc861_base_mixer[] = {
10047 /* output mixer control */
10048 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10049 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10050 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10051 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10052 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10054 /*Input mixer control */
10055 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10056 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10057 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10058 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10059 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10060 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10062 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10063 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10066 /* Capture mixer control */
10067 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10068 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10071 .name = "Capture Source",
10073 .info = alc_mux_enum_info,
10074 .get = alc_mux_enum_get,
10075 .put = alc_mux_enum_put,
10080 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
10081 /* output mixer control */
10082 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10083 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10084 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10085 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10086 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10088 /* Input mixer control */
10089 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10090 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10091 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10092 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10093 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10094 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10096 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10097 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10100 /* Capture mixer control */
10101 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10102 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10104 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10105 .name = "Capture Source",
10107 .info = alc_mux_enum_info,
10108 .get = alc_mux_enum_get,
10109 .put = alc_mux_enum_put,
10112 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10113 .name = "Channel Mode",
10114 .info = alc_ch_mode_info,
10115 .get = alc_ch_mode_get,
10116 .put = alc_ch_mode_put,
10117 .private_value = ARRAY_SIZE(alc861_threestack_modes),
10122 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
10123 /* output mixer control */
10124 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10126 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10128 /*Capture mixer control */
10129 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10130 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10133 .name = "Capture Source",
10135 .info = alc_mux_enum_info,
10136 .get = alc_mux_enum_get,
10137 .put = alc_mux_enum_put,
10143 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
10144 /* output mixer control */
10145 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10146 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10147 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10148 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10149 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10151 /* Input mixer control */
10152 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10153 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10154 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10155 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10156 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10157 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10159 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10160 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10161 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
10163 /* Capture mixer control */
10164 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10165 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10168 .name = "Capture Source",
10170 .info = alc_mux_enum_info,
10171 .get = alc_mux_enum_get,
10172 .put = alc_mux_enum_put,
10175 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10176 .name = "Channel Mode",
10177 .info = alc_ch_mode_info,
10178 .get = alc_ch_mode_get,
10179 .put = alc_ch_mode_put,
10180 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
10185 static struct snd_kcontrol_new alc861_asus_mixer[] = {
10186 /* output mixer control */
10187 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10188 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
10189 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
10190 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
10191 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
10193 /* Input mixer control */
10194 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10195 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10196 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10197 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10198 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
10199 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
10200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
10201 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
10202 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
10203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
10205 /* Capture mixer control */
10206 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10207 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10209 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10210 .name = "Capture Source",
10212 .info = alc_mux_enum_info,
10213 .get = alc_mux_enum_get,
10214 .put = alc_mux_enum_put,
10217 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10218 .name = "Channel Mode",
10219 .info = alc_ch_mode_info,
10220 .get = alc_ch_mode_get,
10221 .put = alc_ch_mode_put,
10222 .private_value = ARRAY_SIZE(alc861_asus_modes),
10227 /* additional mixer */
10228 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
10229 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
10230 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
10231 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
10232 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
10237 * generic initialization of ADC, input mixers and output mixers
10239 static struct hda_verb alc861_base_init_verbs[] = {
10241 * Unmute ADC0 and set the default input to mic-in
10243 /* port-A for surround (rear panel) */
10244 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10245 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
10246 /* port-B for mic-in (rear panel) with vref */
10247 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10248 /* port-C for line-in (rear panel) */
10249 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10250 /* port-D for Front */
10251 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10252 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10253 /* port-E for HP out (front panel) */
10254 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10255 /* route front PCM to HP */
10256 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10257 /* port-F for mic-in (front panel) with vref */
10258 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10259 /* port-G for CLFE (rear panel) */
10260 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10261 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10262 /* port-H for side (rear panel) */
10263 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10264 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
10266 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10267 /* route front mic to ADC1*/
10268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10271 /* Unmute DAC0~3 & spdif out*/
10272 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10273 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10274 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10275 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10278 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10279 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10280 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10281 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10282 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10284 /* Unmute Stereo Mixer 15 */
10285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10287 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10291 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10293 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10295 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10296 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10298 /* hp used DAC 3 (Front) */
10299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10305 static struct hda_verb alc861_threestack_init_verbs[] = {
10307 * Unmute ADC0 and set the default input to mic-in
10309 /* port-A for surround (rear panel) */
10310 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10311 /* port-B for mic-in (rear panel) with vref */
10312 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10313 /* port-C for line-in (rear panel) */
10314 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10315 /* port-D for Front */
10316 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10317 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10318 /* port-E for HP out (front panel) */
10319 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
10320 /* route front PCM to HP */
10321 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10322 /* port-F for mic-in (front panel) with vref */
10323 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10324 /* port-G for CLFE (rear panel) */
10325 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10326 /* port-H for side (rear panel) */
10327 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10329 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10330 /* route front mic to ADC1*/
10331 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10332 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10333 /* Unmute DAC0~3 & spdif out*/
10334 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10335 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10336 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10337 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10340 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10341 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10342 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10343 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10344 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10346 /* Unmute Stereo Mixer 15 */
10347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10348 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10352 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10353 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10354 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10355 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10359 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10360 /* hp used DAC 3 (Front) */
10361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10366 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
10368 * Unmute ADC0 and set the default input to mic-in
10370 /* port-A for surround (rear panel) */
10371 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10372 /* port-B for mic-in (rear panel) with vref */
10373 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10374 /* port-C for line-in (rear panel) */
10375 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10376 /* port-D for Front */
10377 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10378 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10379 /* port-E for HP out (front panel) */
10380 /* this has to be set to VREF80 */
10381 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10382 /* route front PCM to HP */
10383 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10384 /* port-F for mic-in (front panel) with vref */
10385 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10386 /* port-G for CLFE (rear panel) */
10387 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10388 /* port-H for side (rear panel) */
10389 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10391 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10392 /* route front mic to ADC1*/
10393 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10395 /* Unmute DAC0~3 & spdif out*/
10396 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10397 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10398 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10399 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10402 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10403 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10404 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10405 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10406 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10408 /* Unmute Stereo Mixer 15 */
10409 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10410 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10411 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10412 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10414 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10415 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10416 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10417 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10418 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10419 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10422 /* hp used DAC 3 (Front) */
10423 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10428 static struct hda_verb alc861_asus_init_verbs[] = {
10430 * Unmute ADC0 and set the default input to mic-in
10432 /* port-A for surround (rear panel)
10433 * according to codec#0 this is the HP jack
10435 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
10436 /* route front PCM to HP */
10437 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
10438 /* port-B for mic-in (rear panel) with vref */
10439 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10440 /* port-C for line-in (rear panel) */
10441 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10442 /* port-D for Front */
10443 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10444 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
10445 /* port-E for HP out (front panel) */
10446 /* this has to be set to VREF80 */
10447 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10448 /* route front PCM to HP */
10449 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
10450 /* port-F for mic-in (front panel) with vref */
10451 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
10452 /* port-G for CLFE (rear panel) */
10453 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10454 /* port-H for side (rear panel) */
10455 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
10457 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
10458 /* route front mic to ADC1*/
10459 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10461 /* Unmute DAC0~3 & spdif out*/
10462 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10463 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10464 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10465 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10466 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10467 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10468 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10469 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10470 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10471 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10473 /* Unmute Stereo Mixer 15 */
10474 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
10479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10481 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10482 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10485 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10487 /* hp used DAC 3 (Front) */
10488 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10493 /* additional init verbs for ASUS laptops */
10494 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
10495 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
10496 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
10501 * generic initialization of ADC, input mixers and output mixers
10503 static struct hda_verb alc861_auto_init_verbs[] = {
10505 * Unmute ADC0 and set the default input to mic-in
10507 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10510 /* Unmute DAC0~3 & spdif out*/
10511 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10513 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10514 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10517 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10518 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10519 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10520 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10521 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10523 /* Unmute Stereo Mixer 15 */
10524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10526 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
10529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10530 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10531 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10532 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10533 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10534 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10535 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10536 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10538 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10539 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10544 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10545 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10547 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
10552 static struct hda_verb alc861_toshiba_init_verbs[] = {
10553 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10558 /* toggle speaker-output according to the hp-jack state */
10559 static void alc861_toshiba_automute(struct hda_codec *codec)
10561 unsigned int present;
10563 present = snd_hda_codec_read(codec, 0x0f, 0,
10564 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10565 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
10566 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10567 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
10568 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
10571 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
10574 if ((res >> 26) == ALC880_HP_EVENT)
10575 alc861_toshiba_automute(codec);
10578 /* pcm configuration: identiacal with ALC880 */
10579 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10580 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10581 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10582 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10585 #define ALC861_DIGOUT_NID 0x07
10587 static struct hda_channel_mode alc861_8ch_modes[1] = {
10591 static hda_nid_t alc861_dac_nids[4] = {
10592 /* front, surround, clfe, side */
10593 0x03, 0x06, 0x05, 0x04
10596 static hda_nid_t alc660_dac_nids[3] = {
10597 /* front, clfe, surround */
10601 static hda_nid_t alc861_adc_nids[1] = {
10606 static struct hda_input_mux alc861_capture_source = {
10610 { "Front Mic", 0x3 },
10617 /* fill in the dac_nids table from the parsed pin configuration */
10618 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
10619 const struct auto_pin_cfg *cfg)
10624 spec->multiout.dac_nids = spec->private_dac_nids;
10625 for (i = 0; i < cfg->line_outs; i++) {
10626 nid = cfg->line_out_pins[i];
10628 if (i >= ARRAY_SIZE(alc861_dac_nids))
10630 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
10633 spec->multiout.num_dacs = cfg->line_outs;
10637 /* add playback controls from the parsed DAC table */
10638 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
10639 const struct auto_pin_cfg *cfg)
10642 static const char *chname[4] = {
10643 "Front", "Surround", NULL /*CLFE*/, "Side"
10648 for (i = 0; i < cfg->line_outs; i++) {
10649 nid = spec->multiout.dac_nids[i];
10654 err = add_control(spec, ALC_CTL_BIND_MUTE,
10655 "Center Playback Switch",
10656 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
10660 err = add_control(spec, ALC_CTL_BIND_MUTE,
10661 "LFE Playback Switch",
10662 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10667 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
10669 if (nid == alc861_dac_nids[idx])
10671 sprintf(name, "%s Playback Switch", chname[idx]);
10672 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10673 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10682 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
10690 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
10692 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10693 "Headphone Playback Switch",
10694 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10697 spec->multiout.hp_nid = nid;
10702 /* create playback/capture controls for input pins */
10703 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
10704 const struct auto_pin_cfg *cfg)
10706 struct hda_input_mux *imux = &spec->private_imux;
10707 int i, err, idx, idx1;
10709 for (i = 0; i < AUTO_PIN_LAST; i++) {
10710 switch (cfg->input_pins[i]) {
10713 idx = 2; /* Line In */
10717 idx = 2; /* Line In */
10721 idx = 1; /* Mic In */
10725 idx = 1; /* Mic In */
10735 err = new_analog_input(spec, cfg->input_pins[i],
10736 auto_pin_cfg_labels[i], idx, 0x15);
10740 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
10741 imux->items[imux->num_items].index = idx1;
10747 static struct snd_kcontrol_new alc861_capture_mixer[] = {
10748 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
10749 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
10752 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10753 /* The multiple "Capture Source" controls confuse alsamixer
10754 * So call somewhat different..
10755 *FIXME: the controls appear in the "playback" view!
10757 /* .name = "Capture Source", */
10758 .name = "Input Source",
10760 .info = alc_mux_enum_info,
10761 .get = alc_mux_enum_get,
10762 .put = alc_mux_enum_put,
10767 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
10769 int pin_type, int dac_idx)
10771 /* set as output */
10773 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10775 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
10780 static void alc861_auto_init_multi_out(struct hda_codec *codec)
10782 struct alc_spec *spec = codec->spec;
10785 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
10786 for (i = 0; i < spec->autocfg.line_outs; i++) {
10787 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10788 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10790 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
10791 spec->multiout.dac_nids[i]);
10795 static void alc861_auto_init_hp_out(struct hda_codec *codec)
10797 struct alc_spec *spec = codec->spec;
10800 pin = spec->autocfg.hp_pins[0];
10801 if (pin) /* connect to front */
10802 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
10803 spec->multiout.dac_nids[0]);
10806 static void alc861_auto_init_analog_input(struct hda_codec *codec)
10808 struct alc_spec *spec = codec->spec;
10811 for (i = 0; i < AUTO_PIN_LAST; i++) {
10812 hda_nid_t nid = spec->autocfg.input_pins[i];
10813 if (nid >= 0x0c && nid <= 0x11) {
10814 snd_hda_codec_write(codec, nid, 0,
10815 AC_VERB_SET_PIN_WIDGET_CONTROL,
10816 i <= AUTO_PIN_FRONT_MIC ?
10817 PIN_VREF80 : PIN_IN);
10822 /* parse the BIOS configuration and set up the alc_spec */
10823 /* return 1 if successful, 0 if the proper config is not found,
10824 * or a negative error code
10826 static int alc861_parse_auto_config(struct hda_codec *codec)
10828 struct alc_spec *spec = codec->spec;
10830 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10832 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10836 if (!spec->autocfg.line_outs)
10837 return 0; /* can't find valid BIOS pin config */
10839 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
10842 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
10845 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
10848 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
10852 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10854 if (spec->autocfg.dig_out_pin)
10855 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
10857 if (spec->kctl_alloc)
10858 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10860 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
10862 spec->num_mux_defs = 1;
10863 spec->input_mux = &spec->private_imux;
10865 spec->adc_nids = alc861_adc_nids;
10866 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
10867 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
10868 spec->num_mixers++;
10873 /* additional initialization for auto-configuration model */
10874 static void alc861_auto_init(struct hda_codec *codec)
10876 alc861_auto_init_multi_out(codec);
10877 alc861_auto_init_hp_out(codec);
10878 alc861_auto_init_analog_input(codec);
10881 #ifdef CONFIG_SND_HDA_POWER_SAVE
10882 static struct hda_amp_list alc861_loopbacks[] = {
10883 { 0x15, HDA_INPUT, 0 },
10884 { 0x15, HDA_INPUT, 1 },
10885 { 0x15, HDA_INPUT, 2 },
10886 { 0x15, HDA_INPUT, 3 },
10893 * configuration and preset
10895 static const char *alc861_models[ALC861_MODEL_LAST] = {
10896 [ALC861_3ST] = "3stack",
10897 [ALC660_3ST] = "3stack-660",
10898 [ALC861_3ST_DIG] = "3stack-dig",
10899 [ALC861_6ST_DIG] = "6stack-dig",
10900 [ALC861_UNIWILL_M31] = "uniwill-m31",
10901 [ALC861_TOSHIBA] = "toshiba",
10902 [ALC861_ASUS] = "asus",
10903 [ALC861_ASUS_LAPTOP] = "asus-laptop",
10904 [ALC861_AUTO] = "auto",
10907 static struct snd_pci_quirk alc861_cfg_tbl[] = {
10908 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
10909 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
10910 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
10911 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
10912 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
10913 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
10914 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
10915 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
10916 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
10917 * Any other models that need this preset?
10919 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
10920 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
10921 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
10922 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
10923 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
10924 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
10925 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
10926 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
10930 static struct alc_config_preset alc861_presets[] = {
10932 .mixers = { alc861_3ST_mixer },
10933 .init_verbs = { alc861_threestack_init_verbs },
10934 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10935 .dac_nids = alc861_dac_nids,
10936 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10937 .channel_mode = alc861_threestack_modes,
10939 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10940 .adc_nids = alc861_adc_nids,
10941 .input_mux = &alc861_capture_source,
10943 [ALC861_3ST_DIG] = {
10944 .mixers = { alc861_base_mixer },
10945 .init_verbs = { alc861_threestack_init_verbs },
10946 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10947 .dac_nids = alc861_dac_nids,
10948 .dig_out_nid = ALC861_DIGOUT_NID,
10949 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10950 .channel_mode = alc861_threestack_modes,
10952 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10953 .adc_nids = alc861_adc_nids,
10954 .input_mux = &alc861_capture_source,
10956 [ALC861_6ST_DIG] = {
10957 .mixers = { alc861_base_mixer },
10958 .init_verbs = { alc861_base_init_verbs },
10959 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10960 .dac_nids = alc861_dac_nids,
10961 .dig_out_nid = ALC861_DIGOUT_NID,
10962 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
10963 .channel_mode = alc861_8ch_modes,
10964 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10965 .adc_nids = alc861_adc_nids,
10966 .input_mux = &alc861_capture_source,
10969 .mixers = { alc861_3ST_mixer },
10970 .init_verbs = { alc861_threestack_init_verbs },
10971 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
10972 .dac_nids = alc660_dac_nids,
10973 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10974 .channel_mode = alc861_threestack_modes,
10976 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10977 .adc_nids = alc861_adc_nids,
10978 .input_mux = &alc861_capture_source,
10980 [ALC861_UNIWILL_M31] = {
10981 .mixers = { alc861_uniwill_m31_mixer },
10982 .init_verbs = { alc861_uniwill_m31_init_verbs },
10983 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10984 .dac_nids = alc861_dac_nids,
10985 .dig_out_nid = ALC861_DIGOUT_NID,
10986 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
10987 .channel_mode = alc861_uniwill_m31_modes,
10989 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10990 .adc_nids = alc861_adc_nids,
10991 .input_mux = &alc861_capture_source,
10993 [ALC861_TOSHIBA] = {
10994 .mixers = { alc861_toshiba_mixer },
10995 .init_verbs = { alc861_base_init_verbs,
10996 alc861_toshiba_init_verbs },
10997 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10998 .dac_nids = alc861_dac_nids,
10999 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11000 .channel_mode = alc883_3ST_2ch_modes,
11001 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11002 .adc_nids = alc861_adc_nids,
11003 .input_mux = &alc861_capture_source,
11004 .unsol_event = alc861_toshiba_unsol_event,
11005 .init_hook = alc861_toshiba_automute,
11008 .mixers = { alc861_asus_mixer },
11009 .init_verbs = { alc861_asus_init_verbs },
11010 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11011 .dac_nids = alc861_dac_nids,
11012 .dig_out_nid = ALC861_DIGOUT_NID,
11013 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
11014 .channel_mode = alc861_asus_modes,
11017 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11018 .adc_nids = alc861_adc_nids,
11019 .input_mux = &alc861_capture_source,
11021 [ALC861_ASUS_LAPTOP] = {
11022 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
11023 .init_verbs = { alc861_asus_init_verbs,
11024 alc861_asus_laptop_init_verbs },
11025 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
11026 .dac_nids = alc861_dac_nids,
11027 .dig_out_nid = ALC861_DIGOUT_NID,
11028 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
11029 .channel_mode = alc883_3ST_2ch_modes,
11031 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
11032 .adc_nids = alc861_adc_nids,
11033 .input_mux = &alc861_capture_source,
11038 static int patch_alc861(struct hda_codec *codec)
11040 struct alc_spec *spec;
11044 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11048 codec->spec = spec;
11050 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
11054 if (board_config < 0) {
11055 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
11056 "trying auto-probe from BIOS...\n");
11057 board_config = ALC861_AUTO;
11060 if (board_config == ALC861_AUTO) {
11061 /* automatic parse from the BIOS config */
11062 err = alc861_parse_auto_config(codec);
11068 "hda_codec: Cannot set up configuration "
11069 "from BIOS. Using base mode...\n");
11070 board_config = ALC861_3ST_DIG;
11074 if (board_config != ALC861_AUTO)
11075 setup_preset(spec, &alc861_presets[board_config]);
11077 spec->stream_name_analog = "ALC861 Analog";
11078 spec->stream_analog_playback = &alc861_pcm_analog_playback;
11079 spec->stream_analog_capture = &alc861_pcm_analog_capture;
11081 spec->stream_name_digital = "ALC861 Digital";
11082 spec->stream_digital_playback = &alc861_pcm_digital_playback;
11083 spec->stream_digital_capture = &alc861_pcm_digital_capture;
11085 codec->patch_ops = alc_patch_ops;
11086 if (board_config == ALC861_AUTO)
11087 spec->init_hook = alc861_auto_init;
11088 #ifdef CONFIG_SND_HDA_POWER_SAVE
11089 if (!spec->loopback.amplist)
11090 spec->loopback.amplist = alc861_loopbacks;
11097 * ALC861-VD support
11101 * In addition, an independent DAC
11103 #define ALC861VD_DIGOUT_NID 0x06
11105 static hda_nid_t alc861vd_dac_nids[4] = {
11106 /* front, surr, clfe, side surr */
11107 0x02, 0x03, 0x04, 0x05
11110 /* dac_nids for ALC660vd are in a different order - according to
11111 * Realtek's driver.
11112 * This should probably tesult in a different mixer for 6stack models
11113 * of ALC660vd codecs, but for now there is only 3stack mixer
11114 * - and it is the same as in 861vd.
11115 * adc_nids in ALC660vd are (is) the same as in 861vd
11117 static hda_nid_t alc660vd_dac_nids[3] = {
11118 /* front, rear, clfe, rear_surr */
11122 static hda_nid_t alc861vd_adc_nids[1] = {
11128 /* FIXME: should be a matrix-type input source selection */
11129 static struct hda_input_mux alc861vd_capture_source = {
11133 { "Front Mic", 0x1 },
11139 static struct hda_input_mux alc861vd_dallas_capture_source = {
11142 { "Front Mic", 0x0 },
11143 { "ATAPI Mic", 0x1 },
11144 { "Line In", 0x5 },
11148 static struct hda_input_mux alc861vd_hp_capture_source = {
11151 { "Front Mic", 0x0 },
11152 { "ATAPI Mic", 0x1 },
11156 #define alc861vd_mux_enum_info alc_mux_enum_info
11157 #define alc861vd_mux_enum_get alc_mux_enum_get
11159 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
11160 struct snd_ctl_elem_value *ucontrol)
11162 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11163 struct alc_spec *spec = codec->spec;
11164 const struct hda_input_mux *imux = spec->input_mux;
11165 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11166 static hda_nid_t capture_mixers[1] = { 0x22 };
11167 hda_nid_t nid = capture_mixers[adc_idx];
11168 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11169 unsigned int i, idx;
11171 idx = ucontrol->value.enumerated.item[0];
11172 if (idx >= imux->num_items)
11173 idx = imux->num_items - 1;
11174 if (*cur_val == idx)
11176 for (i = 0; i < imux->num_items; i++) {
11177 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11178 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11179 imux->items[i].index,
11189 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
11196 static struct hda_verb alc861vd_6stack_ch6_init[] = {
11197 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11198 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11199 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11200 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11207 static struct hda_verb alc861vd_6stack_ch8_init[] = {
11208 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11209 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11210 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11211 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11215 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
11216 { 6, alc861vd_6stack_ch6_init },
11217 { 8, alc861vd_6stack_ch8_init },
11220 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
11222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11223 .name = "Channel Mode",
11224 .info = alc_ch_mode_info,
11225 .get = alc_ch_mode_get,
11226 .put = alc_ch_mode_put,
11231 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
11232 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11233 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11236 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11237 /* The multiple "Capture Source" controls confuse alsamixer
11238 * So call somewhat different..
11239 *FIXME: the controls appear in the "playback" view!
11241 /* .name = "Capture Source", */
11242 .name = "Input Source",
11244 .info = alc861vd_mux_enum_info,
11245 .get = alc861vd_mux_enum_get,
11246 .put = alc861vd_mux_enum_put,
11251 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11252 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11254 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
11255 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11258 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11259 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
11261 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
11263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
11265 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11266 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
11268 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
11269 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
11271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11274 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11275 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11277 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11278 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11279 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11287 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11288 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11293 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
11294 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11299 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11303 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11304 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11305 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11308 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11310 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11311 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11313 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11314 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11319 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
11320 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11321 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
11322 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11330 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11331 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11332 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11334 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11335 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11340 /* Pin assignment: Front=0x14, HP = 0x15,
11341 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
11343 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
11344 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11347 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11348 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11350 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11351 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
11353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
11357 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
11358 * Front Mic=0x18, ATAPI Mic = 0x19,
11360 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
11361 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
11363 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11364 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
11365 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11366 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11367 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11368 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11374 * generic initialization of ADC, input mixers and output mixers
11376 static struct hda_verb alc861vd_volume_init_verbs[] = {
11378 * Unmute ADC0 and set the default input to mic-in
11380 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11383 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
11384 * the analog-loopback mixer widget
11386 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11393 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
11394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11400 * Set up output mixers (0x02 - 0x05)
11402 /* set vol=0 to output mixers */
11403 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11404 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11405 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11406 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11408 /* set up input amps for analog loopback */
11409 /* Amp Indices: DAC = 0, mixer = 1 */
11410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11411 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11413 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11416 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11423 * 3-stack pin configuration:
11424 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
11426 static struct hda_verb alc861vd_3stack_init_verbs[] = {
11428 * Set pin mode and muting
11430 /* set front pin widgets 0x14 for output */
11431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11432 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11433 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11435 /* Mic (rear) pin: input vref at 80% */
11436 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11437 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11438 /* Front Mic pin: input vref at 80% */
11439 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11440 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11441 /* Line In pin: input */
11442 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11443 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11444 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11445 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11446 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11447 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11448 /* CD pin widget for input */
11449 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11455 * 6-stack pin configuration:
11457 static struct hda_verb alc861vd_6stack_init_verbs[] = {
11459 * Set pin mode and muting
11461 /* set front pin widgets 0x14 for output */
11462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11464 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11466 /* Rear Pin: output 1 (0x0d) */
11467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11470 /* CLFE Pin: output 2 (0x0e) */
11471 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11472 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11473 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
11474 /* Side Pin: output 3 (0x0f) */
11475 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11476 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11477 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
11479 /* Mic (rear) pin: input vref at 80% */
11480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11481 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11482 /* Front Mic pin: input vref at 80% */
11483 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11484 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11485 /* Line In pin: input */
11486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11488 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11491 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11492 /* CD pin widget for input */
11493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11498 static struct hda_verb alc861vd_eapd_verbs[] = {
11499 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11503 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
11504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11507 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11508 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11512 /* toggle speaker-output according to the hp-jack state */
11513 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
11515 unsigned int present;
11516 unsigned char bits;
11518 present = snd_hda_codec_read(codec, 0x1b, 0,
11519 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11520 bits = present ? HDA_AMP_MUTE : 0;
11521 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11522 HDA_AMP_MUTE, bits);
11525 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
11527 unsigned int present;
11528 unsigned char bits;
11530 present = snd_hda_codec_read(codec, 0x18, 0,
11531 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11532 bits = present ? HDA_AMP_MUTE : 0;
11533 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
11534 HDA_AMP_MUTE, bits);
11537 static void alc861vd_lenovo_automute(struct hda_codec *codec)
11539 alc861vd_lenovo_hp_automute(codec);
11540 alc861vd_lenovo_mic_automute(codec);
11543 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
11546 switch (res >> 26) {
11547 case ALC880_HP_EVENT:
11548 alc861vd_lenovo_hp_automute(codec);
11550 case ALC880_MIC_EVENT:
11551 alc861vd_lenovo_mic_automute(codec);
11556 static struct hda_verb alc861vd_dallas_verbs[] = {
11557 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11558 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11559 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11560 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11568 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11569 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11575 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11576 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11577 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11578 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11581 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11584 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11586 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11587 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11595 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11601 /* toggle speaker-output according to the hp-jack state */
11602 static void alc861vd_dallas_automute(struct hda_codec *codec)
11604 unsigned int present;
11606 present = snd_hda_codec_read(codec, 0x15, 0,
11607 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11608 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11609 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
11612 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
11614 if ((res >> 26) == ALC880_HP_EVENT)
11615 alc861vd_dallas_automute(codec);
11618 #ifdef CONFIG_SND_HDA_POWER_SAVE
11619 #define alc861vd_loopbacks alc880_loopbacks
11622 /* pcm configuration: identiacal with ALC880 */
11623 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11624 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11625 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11626 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11629 * configuration and preset
11631 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
11632 [ALC660VD_3ST] = "3stack-660",
11633 [ALC660VD_3ST_DIG] = "3stack-660-digout",
11634 [ALC861VD_3ST] = "3stack",
11635 [ALC861VD_3ST_DIG] = "3stack-digout",
11636 [ALC861VD_6ST_DIG] = "6stack-digout",
11637 [ALC861VD_LENOVO] = "lenovo",
11638 [ALC861VD_DALLAS] = "dallas",
11639 [ALC861VD_HP] = "hp",
11640 [ALC861VD_AUTO] = "auto",
11643 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
11644 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
11645 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
11646 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
11647 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
11648 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
11650 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11651 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
11652 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
11653 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
11654 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
11655 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
11656 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
11657 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
11658 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
11662 static struct alc_config_preset alc861vd_presets[] = {
11664 .mixers = { alc861vd_3st_mixer },
11665 .init_verbs = { alc861vd_volume_init_verbs,
11666 alc861vd_3stack_init_verbs },
11667 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11668 .dac_nids = alc660vd_dac_nids,
11669 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11670 .adc_nids = alc861vd_adc_nids,
11671 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11672 .channel_mode = alc861vd_3stack_2ch_modes,
11673 .input_mux = &alc861vd_capture_source,
11675 [ALC660VD_3ST_DIG] = {
11676 .mixers = { alc861vd_3st_mixer },
11677 .init_verbs = { alc861vd_volume_init_verbs,
11678 alc861vd_3stack_init_verbs },
11679 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11680 .dac_nids = alc660vd_dac_nids,
11681 .dig_out_nid = ALC861VD_DIGOUT_NID,
11682 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11683 .adc_nids = alc861vd_adc_nids,
11684 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11685 .channel_mode = alc861vd_3stack_2ch_modes,
11686 .input_mux = &alc861vd_capture_source,
11689 .mixers = { alc861vd_3st_mixer },
11690 .init_verbs = { alc861vd_volume_init_verbs,
11691 alc861vd_3stack_init_verbs },
11692 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11693 .dac_nids = alc861vd_dac_nids,
11694 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11695 .channel_mode = alc861vd_3stack_2ch_modes,
11696 .input_mux = &alc861vd_capture_source,
11698 [ALC861VD_3ST_DIG] = {
11699 .mixers = { alc861vd_3st_mixer },
11700 .init_verbs = { alc861vd_volume_init_verbs,
11701 alc861vd_3stack_init_verbs },
11702 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11703 .dac_nids = alc861vd_dac_nids,
11704 .dig_out_nid = ALC861VD_DIGOUT_NID,
11705 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11706 .channel_mode = alc861vd_3stack_2ch_modes,
11707 .input_mux = &alc861vd_capture_source,
11709 [ALC861VD_6ST_DIG] = {
11710 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
11711 .init_verbs = { alc861vd_volume_init_verbs,
11712 alc861vd_6stack_init_verbs },
11713 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11714 .dac_nids = alc861vd_dac_nids,
11715 .dig_out_nid = ALC861VD_DIGOUT_NID,
11716 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
11717 .channel_mode = alc861vd_6stack_modes,
11718 .input_mux = &alc861vd_capture_source,
11720 [ALC861VD_LENOVO] = {
11721 .mixers = { alc861vd_lenovo_mixer },
11722 .init_verbs = { alc861vd_volume_init_verbs,
11723 alc861vd_3stack_init_verbs,
11724 alc861vd_eapd_verbs,
11725 alc861vd_lenovo_unsol_verbs },
11726 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
11727 .dac_nids = alc660vd_dac_nids,
11728 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11729 .adc_nids = alc861vd_adc_nids,
11730 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11731 .channel_mode = alc861vd_3stack_2ch_modes,
11732 .input_mux = &alc861vd_capture_source,
11733 .unsol_event = alc861vd_lenovo_unsol_event,
11734 .init_hook = alc861vd_lenovo_automute,
11736 [ALC861VD_DALLAS] = {
11737 .mixers = { alc861vd_dallas_mixer },
11738 .init_verbs = { alc861vd_dallas_verbs },
11739 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11740 .dac_nids = alc861vd_dac_nids,
11741 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11742 .adc_nids = alc861vd_adc_nids,
11743 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11744 .channel_mode = alc861vd_3stack_2ch_modes,
11745 .input_mux = &alc861vd_dallas_capture_source,
11746 .unsol_event = alc861vd_dallas_unsol_event,
11747 .init_hook = alc861vd_dallas_automute,
11750 .mixers = { alc861vd_hp_mixer },
11751 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
11752 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
11753 .dac_nids = alc861vd_dac_nids,
11754 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
11755 .dig_out_nid = ALC861VD_DIGOUT_NID,
11756 .adc_nids = alc861vd_adc_nids,
11757 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
11758 .channel_mode = alc861vd_3stack_2ch_modes,
11759 .input_mux = &alc861vd_hp_capture_source,
11760 .unsol_event = alc861vd_dallas_unsol_event,
11761 .init_hook = alc861vd_dallas_automute,
11766 * BIOS auto configuration
11768 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
11769 hda_nid_t nid, int pin_type, int dac_idx)
11771 /* set as output */
11772 snd_hda_codec_write(codec, nid, 0,
11773 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11774 snd_hda_codec_write(codec, nid, 0,
11775 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11778 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
11780 struct alc_spec *spec = codec->spec;
11783 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
11784 for (i = 0; i <= HDA_SIDE; i++) {
11785 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11786 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11788 alc861vd_auto_set_output_and_unmute(codec, nid,
11794 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
11796 struct alc_spec *spec = codec->spec;
11799 pin = spec->autocfg.hp_pins[0];
11800 if (pin) /* connect to front and use dac 0 */
11801 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11804 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
11805 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
11807 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
11809 struct alc_spec *spec = codec->spec;
11812 for (i = 0; i < AUTO_PIN_LAST; i++) {
11813 hda_nid_t nid = spec->autocfg.input_pins[i];
11814 if (alc861vd_is_input_pin(nid)) {
11815 snd_hda_codec_write(codec, nid, 0,
11816 AC_VERB_SET_PIN_WIDGET_CONTROL,
11817 i <= AUTO_PIN_FRONT_MIC ?
11818 PIN_VREF80 : PIN_IN);
11819 if (nid != ALC861VD_PIN_CD_NID)
11820 snd_hda_codec_write(codec, nid, 0,
11821 AC_VERB_SET_AMP_GAIN_MUTE,
11827 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
11828 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
11830 /* add playback controls from the parsed DAC table */
11831 /* Based on ALC880 version. But ALC861VD has separate,
11832 * different NIDs for mute/unmute switch and volume control */
11833 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
11834 const struct auto_pin_cfg *cfg)
11837 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
11838 hda_nid_t nid_v, nid_s;
11841 for (i = 0; i < cfg->line_outs; i++) {
11842 if (!spec->multiout.dac_nids[i])
11844 nid_v = alc861vd_idx_to_mixer_vol(
11846 spec->multiout.dac_nids[i]));
11847 nid_s = alc861vd_idx_to_mixer_switch(
11849 spec->multiout.dac_nids[i]));
11853 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11854 "Center Playback Volume",
11855 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
11859 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11860 "LFE Playback Volume",
11861 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
11865 err = add_control(spec, ALC_CTL_BIND_MUTE,
11866 "Center Playback Switch",
11867 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
11871 err = add_control(spec, ALC_CTL_BIND_MUTE,
11872 "LFE Playback Switch",
11873 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
11878 sprintf(name, "%s Playback Volume", chname[i]);
11879 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11880 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
11884 sprintf(name, "%s Playback Switch", chname[i]);
11885 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11886 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
11895 /* add playback controls for speaker and HP outputs */
11896 /* Based on ALC880 version. But ALC861VD has separate,
11897 * different NIDs for mute/unmute switch and volume control */
11898 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
11899 hda_nid_t pin, const char *pfx)
11901 hda_nid_t nid_v, nid_s;
11908 if (alc880_is_fixed_pin(pin)) {
11909 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11910 /* specify the DAC as the extra output */
11911 if (!spec->multiout.hp_nid)
11912 spec->multiout.hp_nid = nid_v;
11914 spec->multiout.extra_out_nid[0] = nid_v;
11915 /* control HP volume/switch on the output mixer amp */
11916 nid_v = alc861vd_idx_to_mixer_vol(
11917 alc880_fixed_pin_idx(pin));
11918 nid_s = alc861vd_idx_to_mixer_switch(
11919 alc880_fixed_pin_idx(pin));
11921 sprintf(name, "%s Playback Volume", pfx);
11922 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11923 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
11926 sprintf(name, "%s Playback Switch", pfx);
11927 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11928 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
11931 } else if (alc880_is_multi_pin(pin)) {
11932 /* set manual connection */
11933 /* we have only a switch on HP-out PIN */
11934 sprintf(name, "%s Playback Switch", pfx);
11935 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11936 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11943 /* parse the BIOS configuration and set up the alc_spec
11944 * return 1 if successful, 0 if the proper config is not found,
11945 * or a negative error code
11946 * Based on ALC880 version - had to change it to override
11947 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
11948 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11950 struct alc_spec *spec = codec->spec;
11952 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11954 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11958 if (!spec->autocfg.line_outs)
11959 return 0; /* can't find valid BIOS pin config */
11961 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11964 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
11967 err = alc861vd_auto_create_extra_out(spec,
11968 spec->autocfg.speaker_pins[0],
11972 err = alc861vd_auto_create_extra_out(spec,
11973 spec->autocfg.hp_pins[0],
11977 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
11981 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11983 if (spec->autocfg.dig_out_pin)
11984 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
11986 if (spec->kctl_alloc)
11987 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11989 spec->init_verbs[spec->num_init_verbs++]
11990 = alc861vd_volume_init_verbs;
11992 spec->num_mux_defs = 1;
11993 spec->input_mux = &spec->private_imux;
11995 err = alc_auto_add_mic_boost(codec);
12002 /* additional initialization for auto-configuration model */
12003 static void alc861vd_auto_init(struct hda_codec *codec)
12005 alc861vd_auto_init_multi_out(codec);
12006 alc861vd_auto_init_hp_out(codec);
12007 alc861vd_auto_init_analog_input(codec);
12010 static int patch_alc861vd(struct hda_codec *codec)
12012 struct alc_spec *spec;
12013 int err, board_config;
12015 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12019 codec->spec = spec;
12021 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
12025 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
12026 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
12027 "ALC861VD, trying auto-probe from BIOS...\n");
12028 board_config = ALC861VD_AUTO;
12031 if (board_config == ALC861VD_AUTO) {
12032 /* automatic parse from the BIOS config */
12033 err = alc861vd_parse_auto_config(codec);
12039 "hda_codec: Cannot set up configuration "
12040 "from BIOS. Using base mode...\n");
12041 board_config = ALC861VD_3ST;
12045 if (board_config != ALC861VD_AUTO)
12046 setup_preset(spec, &alc861vd_presets[board_config]);
12048 spec->stream_name_analog = "ALC861VD Analog";
12049 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
12050 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
12052 spec->stream_name_digital = "ALC861VD Digital";
12053 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
12054 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
12056 spec->adc_nids = alc861vd_adc_nids;
12057 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
12059 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
12060 spec->num_mixers++;
12062 codec->patch_ops = alc_patch_ops;
12064 if (board_config == ALC861VD_AUTO)
12065 spec->init_hook = alc861vd_auto_init;
12066 #ifdef CONFIG_SND_HDA_POWER_SAVE
12067 if (!spec->loopback.amplist)
12068 spec->loopback.amplist = alc861vd_loopbacks;
12077 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12078 * configuration. Each pin widget can choose any input DACs and a mixer.
12079 * Each ADC is connected from a mixer of all inputs. This makes possible
12080 * 6-channel independent captures.
12082 * In addition, an independent DAC for the multi-playback (not used in this
12085 #define ALC662_DIGOUT_NID 0x06
12086 #define ALC662_DIGIN_NID 0x0a
12088 static hda_nid_t alc662_dac_nids[4] = {
12089 /* front, rear, clfe, rear_surr */
12093 static hda_nid_t alc662_adc_nids[1] = {
12098 /* FIXME: should be a matrix-type input source selection */
12100 static struct hda_input_mux alc662_capture_source = {
12104 { "Front Mic", 0x1 },
12110 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
12118 static struct hda_input_mux alc662_eeepc_capture_source = {
12126 #define alc662_mux_enum_info alc_mux_enum_info
12127 #define alc662_mux_enum_get alc_mux_enum_get
12129 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
12130 struct snd_ctl_elem_value *ucontrol)
12132 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12133 struct alc_spec *spec = codec->spec;
12134 const struct hda_input_mux *imux = spec->input_mux;
12135 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
12136 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
12137 hda_nid_t nid = capture_mixers[adc_idx];
12138 unsigned int *cur_val = &spec->cur_mux[adc_idx];
12139 unsigned int i, idx;
12141 idx = ucontrol->value.enumerated.item[0];
12142 if (idx >= imux->num_items)
12143 idx = imux->num_items - 1;
12144 if (*cur_val == idx)
12146 for (i = 0; i < imux->num_items; i++) {
12147 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
12148 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
12149 imux->items[i].index,
12158 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
12165 static struct hda_verb alc662_3ST_ch2_init[] = {
12166 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
12167 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
12169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
12176 static struct hda_verb alc662_3ST_ch6_init[] = {
12177 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12178 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12179 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
12180 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12181 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12182 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
12186 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
12187 { 2, alc662_3ST_ch2_init },
12188 { 6, alc662_3ST_ch6_init },
12194 static struct hda_verb alc662_sixstack_ch6_init[] = {
12195 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12196 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
12197 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12204 static struct hda_verb alc662_sixstack_ch8_init[] = {
12205 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12206 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12207 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12211 static struct hda_channel_mode alc662_5stack_modes[2] = {
12212 { 2, alc662_sixstack_ch6_init },
12213 { 6, alc662_sixstack_ch8_init },
12216 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12217 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12220 static struct snd_kcontrol_new alc662_base_mixer[] = {
12221 /* output mixer control */
12222 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12223 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
12224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12225 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
12226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12232 /*Input mixer control */
12233 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
12234 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
12235 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
12236 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
12237 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
12238 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
12239 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
12240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
12242 /* Capture mixer control */
12243 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12244 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12247 .name = "Capture Source",
12249 .info = alc_mux_enum_info,
12250 .get = alc_mux_enum_get,
12251 .put = alc_mux_enum_put,
12256 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
12257 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12258 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12260 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12261 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12262 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12263 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12266 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12267 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12268 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12269 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12270 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12271 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12273 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12274 /* .name = "Capture Source", */
12275 .name = "Input Source",
12277 .info = alc662_mux_enum_info,
12278 .get = alc662_mux_enum_get,
12279 .put = alc662_mux_enum_put,
12284 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
12285 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12286 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12287 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12288 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
12289 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
12290 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
12291 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
12292 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
12293 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12294 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12295 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12296 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12297 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12299 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12300 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12301 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12302 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
12303 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
12304 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12305 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12307 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12308 /* .name = "Capture Source", */
12309 .name = "Input Source",
12311 .info = alc662_mux_enum_info,
12312 .get = alc662_mux_enum_get,
12313 .put = alc662_mux_enum_put,
12318 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
12319 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12320 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
12321 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12322 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
12323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12328 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12329 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12331 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12332 /* .name = "Capture Source", */
12333 .name = "Input Source",
12335 .info = alc662_mux_enum_info,
12336 .get = alc662_mux_enum_get,
12337 .put = alc662_mux_enum_put,
12342 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
12343 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12345 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12346 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
12348 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
12349 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12350 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12352 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
12353 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12354 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12358 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
12360 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12361 .name = "Channel Mode",
12362 .info = alc_ch_mode_info,
12363 .get = alc_ch_mode_get,
12364 .put = alc_ch_mode_put,
12369 static struct hda_verb alc662_init_verbs[] = {
12370 /* ADC: mute amp left and right */
12371 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12372 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12373 /* Front mixer: unmute input/output amp left and right (volume = 0) */
12375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12388 /* Front Pin: output 0 (0x0c) */
12389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12390 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12392 /* Rear Pin: output 1 (0x0d) */
12393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12396 /* CLFE Pin: output 2 (0x0e) */
12397 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12398 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12400 /* Mic (rear) pin: input vref at 80% */
12401 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12402 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12403 /* Front Mic pin: input vref at 80% */
12404 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12405 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12406 /* Line In pin: input */
12407 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12408 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12409 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12410 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12411 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12412 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12413 /* CD pin widget for input */
12414 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12416 /* FIXME: use matrix-type input source selection */
12417 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
12427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
12431 static struct hda_verb alc662_sue_init_verbs[] = {
12432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
12433 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
12437 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
12438 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12439 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12444 * generic initialization of ADC, input mixers and output mixers
12446 static struct hda_verb alc662_auto_init_verbs[] = {
12448 * Unmute ADC and set the default input to mic-in
12450 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12453 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12455 * Note: PASD motherboards uses the Line In 2 as the input for front
12456 * panel mic (mic 2)
12458 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12466 * Set up output mixers (0x0c - 0x0f)
12468 /* set vol=0 to output mixers */
12469 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12470 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12471 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12473 /* set up input amps for analog loopback */
12474 /* Amp Indices: DAC = 0, mixer = 1 */
12475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12483 /* FIXME: use matrix-type input source selection */
12484 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12486 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12491 /* capture mixer elements */
12492 static struct snd_kcontrol_new alc662_capture_mixer[] = {
12493 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
12494 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
12496 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12497 /* The multiple "Capture Source" controls confuse alsamixer
12498 * So call somewhat different..
12499 * FIXME: the controls appear in the "playback" view!
12501 /* .name = "Capture Source", */
12502 .name = "Input Source",
12504 .info = alc882_mux_enum_info,
12505 .get = alc882_mux_enum_get,
12506 .put = alc882_mux_enum_put,
12511 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
12513 unsigned int present;
12514 unsigned char bits;
12516 present = snd_hda_codec_read(codec, 0x14, 0,
12517 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12518 bits = present ? HDA_AMP_MUTE : 0;
12519 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12520 HDA_AMP_MUTE, bits);
12523 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
12525 unsigned int present;
12526 unsigned char bits;
12528 present = snd_hda_codec_read(codec, 0x1b, 0,
12529 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12530 bits = present ? HDA_AMP_MUTE : 0;
12531 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12532 HDA_AMP_MUTE, bits);
12533 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12534 HDA_AMP_MUTE, bits);
12537 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
12540 if ((res >> 26) == ALC880_HP_EVENT)
12541 alc662_lenovo_101e_all_automute(codec);
12542 if ((res >> 26) == ALC880_FRONT_EVENT)
12543 alc662_lenovo_101e_ispeaker_automute(codec);
12546 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
12548 unsigned int present;
12550 present = snd_hda_codec_read(codec, 0x18, 0,
12551 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12552 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12553 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12554 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12555 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12556 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12557 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12558 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12559 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12562 /* unsolicited event for HP jack sensing */
12563 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
12566 if ((res >> 26) == ALC880_HP_EVENT)
12567 alc262_hippo1_automute( codec );
12569 if ((res >> 26) == ALC880_MIC_EVENT)
12570 alc662_eeepc_mic_automute(codec);
12573 static void alc662_eeepc_inithook(struct hda_codec *codec)
12575 alc262_hippo1_automute( codec );
12576 alc662_eeepc_mic_automute(codec);
12579 #ifdef CONFIG_SND_HDA_POWER_SAVE
12580 #define alc662_loopbacks alc880_loopbacks
12584 /* pcm configuration: identiacal with ALC880 */
12585 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12586 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12587 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12588 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12591 * configuration and preset
12593 static const char *alc662_models[ALC662_MODEL_LAST] = {
12594 [ALC662_3ST_2ch_DIG] = "3stack-dig",
12595 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
12596 [ALC662_3ST_6ch] = "3stack-6ch",
12597 [ALC662_5ST_DIG] = "6stack-dig",
12598 [ALC662_LENOVO_101E] = "lenovo-101e",
12599 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
12600 [ALC662_AUTO] = "auto",
12603 static struct snd_pci_quirk alc662_cfg_tbl[] = {
12604 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
12605 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
12609 static struct alc_config_preset alc662_presets[] = {
12610 [ALC662_3ST_2ch_DIG] = {
12611 .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer },
12612 .init_verbs = { alc662_init_verbs },
12613 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12614 .dac_nids = alc662_dac_nids,
12615 .dig_out_nid = ALC662_DIGOUT_NID,
12616 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12617 .adc_nids = alc662_adc_nids,
12618 .dig_in_nid = ALC662_DIGIN_NID,
12619 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12620 .channel_mode = alc662_3ST_2ch_modes,
12621 .input_mux = &alc662_capture_source,
12623 [ALC662_3ST_6ch_DIG] = {
12624 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12625 alc662_capture_mixer },
12626 .init_verbs = { alc662_init_verbs },
12627 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12628 .dac_nids = alc662_dac_nids,
12629 .dig_out_nid = ALC662_DIGOUT_NID,
12630 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12631 .adc_nids = alc662_adc_nids,
12632 .dig_in_nid = ALC662_DIGIN_NID,
12633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12634 .channel_mode = alc662_3ST_6ch_modes,
12636 .input_mux = &alc662_capture_source,
12638 [ALC662_3ST_6ch] = {
12639 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer,
12640 alc662_capture_mixer },
12641 .init_verbs = { alc662_init_verbs },
12642 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12643 .dac_nids = alc662_dac_nids,
12644 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12645 .adc_nids = alc662_adc_nids,
12646 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
12647 .channel_mode = alc662_3ST_6ch_modes,
12649 .input_mux = &alc662_capture_source,
12651 [ALC662_5ST_DIG] = {
12652 .mixers = { alc662_base_mixer, alc662_chmode_mixer,
12653 alc662_capture_mixer },
12654 .init_verbs = { alc662_init_verbs },
12655 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12656 .dac_nids = alc662_dac_nids,
12657 .dig_out_nid = ALC662_DIGOUT_NID,
12658 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12659 .adc_nids = alc662_adc_nids,
12660 .dig_in_nid = ALC662_DIGIN_NID,
12661 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
12662 .channel_mode = alc662_5stack_modes,
12663 .input_mux = &alc662_capture_source,
12665 [ALC662_LENOVO_101E] = {
12666 .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer },
12667 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
12668 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12669 .dac_nids = alc662_dac_nids,
12670 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
12671 .adc_nids = alc662_adc_nids,
12672 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12673 .channel_mode = alc662_3ST_2ch_modes,
12674 .input_mux = &alc662_lenovo_101e_capture_source,
12675 .unsol_event = alc662_lenovo_101e_unsol_event,
12676 .init_hook = alc662_lenovo_101e_all_automute,
12678 [ALC662_ASUS_EEEPC_P701] = {
12679 .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer },
12680 .init_verbs = { alc662_init_verbs,
12681 alc662_eeepc_sue_init_verbs },
12682 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
12683 .dac_nids = alc662_dac_nids,
12684 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
12685 .adc_nids = alc662_adc_nids,
12686 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
12687 .channel_mode = alc662_3ST_2ch_modes,
12688 .input_mux = &alc662_eeepc_capture_source,
12689 .unsol_event = alc662_eeepc_unsol_event,
12690 .init_hook = alc662_eeepc_inithook,
12697 * BIOS auto configuration
12700 /* add playback controls from the parsed DAC table */
12701 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
12702 const struct auto_pin_cfg *cfg)
12705 static const char *chname[4] = {
12706 "Front", "Surround", NULL /*CLFE*/, "Side"
12711 for (i = 0; i < cfg->line_outs; i++) {
12712 if (!spec->multiout.dac_nids[i])
12714 nid = alc880_idx_to_dac(i);
12717 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12718 "Center Playback Volume",
12719 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
12723 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12724 "LFE Playback Volume",
12725 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12729 err = add_control(spec, ALC_CTL_BIND_MUTE,
12730 "Center Playback Switch",
12731 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
12735 err = add_control(spec, ALC_CTL_BIND_MUTE,
12736 "LFE Playback Switch",
12737 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
12742 sprintf(name, "%s Playback Volume", chname[i]);
12743 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12744 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12748 sprintf(name, "%s Playback Switch", chname[i]);
12749 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12750 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
12759 /* add playback controls for speaker and HP outputs */
12760 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
12770 if (alc880_is_fixed_pin(pin)) {
12771 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12772 /* printk("DAC nid=%x\n",nid); */
12773 /* specify the DAC as the extra output */
12774 if (!spec->multiout.hp_nid)
12775 spec->multiout.hp_nid = nid;
12777 spec->multiout.extra_out_nid[0] = nid;
12778 /* control HP volume/switch on the output mixer amp */
12779 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
12780 sprintf(name, "%s Playback Volume", pfx);
12781 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12782 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12785 sprintf(name, "%s Playback Switch", pfx);
12786 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
12787 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
12790 } else if (alc880_is_multi_pin(pin)) {
12791 /* set manual connection */
12792 /* we have only a switch on HP-out PIN */
12793 sprintf(name, "%s Playback Switch", pfx);
12794 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12795 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
12802 /* create playback/capture controls for input pins */
12803 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
12804 const struct auto_pin_cfg *cfg)
12806 struct hda_input_mux *imux = &spec->private_imux;
12809 for (i = 0; i < AUTO_PIN_LAST; i++) {
12810 if (alc880_is_input_pin(cfg->input_pins[i])) {
12811 idx = alc880_input_pin_idx(cfg->input_pins[i]);
12812 err = new_analog_input(spec, cfg->input_pins[i],
12813 auto_pin_cfg_labels[i],
12817 imux->items[imux->num_items].label =
12818 auto_pin_cfg_labels[i];
12819 imux->items[imux->num_items].index =
12820 alc880_input_pin_idx(cfg->input_pins[i]);
12827 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
12828 hda_nid_t nid, int pin_type,
12831 /* set as output */
12832 snd_hda_codec_write(codec, nid, 0,
12833 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
12834 snd_hda_codec_write(codec, nid, 0,
12835 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
12836 /* need the manual connection? */
12837 if (alc880_is_multi_pin(nid)) {
12838 struct alc_spec *spec = codec->spec;
12839 int idx = alc880_multi_pin_idx(nid);
12840 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
12841 AC_VERB_SET_CONNECT_SEL,
12842 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
12846 static void alc662_auto_init_multi_out(struct hda_codec *codec)
12848 struct alc_spec *spec = codec->spec;
12851 for (i = 0; i <= HDA_SIDE; i++) {
12852 hda_nid_t nid = spec->autocfg.line_out_pins[i];
12853 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12855 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
12860 static void alc662_auto_init_hp_out(struct hda_codec *codec)
12862 struct alc_spec *spec = codec->spec;
12865 pin = spec->autocfg.hp_pins[0];
12866 if (pin) /* connect to front */
12868 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
12871 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
12872 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
12874 static void alc662_auto_init_analog_input(struct hda_codec *codec)
12876 struct alc_spec *spec = codec->spec;
12879 for (i = 0; i < AUTO_PIN_LAST; i++) {
12880 hda_nid_t nid = spec->autocfg.input_pins[i];
12881 if (alc662_is_input_pin(nid)) {
12882 snd_hda_codec_write(codec, nid, 0,
12883 AC_VERB_SET_PIN_WIDGET_CONTROL,
12884 (i <= AUTO_PIN_FRONT_MIC ?
12885 PIN_VREF80 : PIN_IN));
12886 if (nid != ALC662_PIN_CD_NID)
12887 snd_hda_codec_write(codec, nid, 0,
12888 AC_VERB_SET_AMP_GAIN_MUTE,
12894 static int alc662_parse_auto_config(struct hda_codec *codec)
12896 struct alc_spec *spec = codec->spec;
12898 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12900 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12904 if (!spec->autocfg.line_outs)
12905 return 0; /* can't find valid BIOS pin config */
12907 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
12910 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
12913 err = alc662_auto_create_extra_out(spec,
12914 spec->autocfg.speaker_pins[0],
12918 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
12922 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
12926 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12928 if (spec->autocfg.dig_out_pin)
12929 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
12931 if (spec->kctl_alloc)
12932 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
12934 spec->num_mux_defs = 1;
12935 spec->input_mux = &spec->private_imux;
12937 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
12938 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
12939 spec->num_mixers++;
12943 /* additional initialization for auto-configuration model */
12944 static void alc662_auto_init(struct hda_codec *codec)
12946 alc662_auto_init_multi_out(codec);
12947 alc662_auto_init_hp_out(codec);
12948 alc662_auto_init_analog_input(codec);
12951 static int patch_alc662(struct hda_codec *codec)
12953 struct alc_spec *spec;
12954 int err, board_config;
12956 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12960 codec->spec = spec;
12962 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
12965 if (board_config < 0) {
12966 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
12967 "trying auto-probe from BIOS...\n");
12968 board_config = ALC662_AUTO;
12971 if (board_config == ALC662_AUTO) {
12972 /* automatic parse from the BIOS config */
12973 err = alc662_parse_auto_config(codec);
12979 "hda_codec: Cannot set up configuration "
12980 "from BIOS. Using base mode...\n");
12981 board_config = ALC662_3ST_2ch_DIG;
12985 if (board_config != ALC662_AUTO)
12986 setup_preset(spec, &alc662_presets[board_config]);
12988 spec->stream_name_analog = "ALC662 Analog";
12989 spec->stream_analog_playback = &alc662_pcm_analog_playback;
12990 spec->stream_analog_capture = &alc662_pcm_analog_capture;
12992 spec->stream_name_digital = "ALC662 Digital";
12993 spec->stream_digital_playback = &alc662_pcm_digital_playback;
12994 spec->stream_digital_capture = &alc662_pcm_digital_capture;
12996 if (!spec->adc_nids && spec->input_mux) {
12997 spec->adc_nids = alc662_adc_nids;
12998 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
13001 codec->patch_ops = alc_patch_ops;
13002 if (board_config == ALC662_AUTO)
13003 spec->init_hook = alc662_auto_init;
13004 #ifdef CONFIG_SND_HDA_POWER_SAVE
13005 if (!spec->loopback.amplist)
13006 spec->loopback.amplist = alc662_loopbacks;
13015 struct hda_codec_preset snd_hda_preset_realtek[] = {
13016 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
13017 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
13018 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
13019 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
13020 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
13021 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
13022 .patch = patch_alc861 },
13023 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
13024 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
13025 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
13026 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
13027 .patch = patch_alc883 },
13028 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
13029 .patch = patch_alc662 },
13030 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
13031 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
13032 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
13033 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
13034 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
13035 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
13036 {} /* terminator */