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,
99 ALC262_MODEL_LAST /* last tag */
108 ALC268_MODEL_LAST /* last tag */
125 /* ALC861-VD models */
172 ALC883_TARGA_2ch_DIG,
178 ALC883_LENOVO_101E_2ch,
179 ALC883_LENOVO_NB0763,
180 ALC888_LENOVO_MS7195_DIG,
189 #define GPIO_MASK 0x03
192 /* codec parameterization */
193 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
194 unsigned int num_mixers;
196 const struct hda_verb *init_verbs[5]; /* initialization verbs
200 unsigned int num_init_verbs;
202 char *stream_name_analog; /* analog PCM stream */
203 struct hda_pcm_stream *stream_analog_playback;
204 struct hda_pcm_stream *stream_analog_capture;
206 char *stream_name_digital; /* digital PCM stream */
207 struct hda_pcm_stream *stream_digital_playback;
208 struct hda_pcm_stream *stream_digital_capture;
211 struct hda_multi_out multiout; /* playback set-up
212 * max_channels, dacs must be set
213 * dig_out_nid and hp_nid are optional
217 unsigned int num_adc_nids;
219 hda_nid_t dig_in_nid; /* digital-in NID; optional */
222 unsigned int num_mux_defs;
223 const struct hda_input_mux *input_mux;
224 unsigned int cur_mux[3];
227 const struct hda_channel_mode *channel_mode;
228 int num_channel_mode;
231 /* PCM information */
232 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
234 /* dynamic controls, init_verbs and input_mux */
235 struct auto_pin_cfg autocfg;
236 unsigned int num_kctl_alloc, num_kctl_used;
237 struct snd_kcontrol_new *kctl_alloc;
238 struct hda_input_mux private_imux;
239 hda_nid_t private_dac_nids[5];
242 void (*init_hook)(struct hda_codec *codec);
243 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
245 /* for pin sensing */
246 unsigned int sense_updated: 1;
247 unsigned int jack_present: 1;
249 #ifdef CONFIG_SND_HDA_POWER_SAVE
250 struct hda_loopback_check loopback;
255 * configuration template - to be copied to the spec instance
257 struct alc_config_preset {
258 struct snd_kcontrol_new *mixers[5]; /* should be identical size
261 const struct hda_verb *init_verbs[5];
262 unsigned int num_dacs;
264 hda_nid_t dig_out_nid; /* optional */
265 hda_nid_t hp_nid; /* optional */
266 unsigned int num_adc_nids;
268 hda_nid_t dig_in_nid;
269 unsigned int num_channel_mode;
270 const struct hda_channel_mode *channel_mode;
272 unsigned int num_mux_defs;
273 const struct hda_input_mux *input_mux;
274 void (*unsol_event)(struct hda_codec *, unsigned int);
275 void (*init_hook)(struct hda_codec *);
276 #ifdef CONFIG_SND_HDA_POWER_SAVE
277 struct hda_amp_list *loopbacks;
285 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
286 struct snd_ctl_elem_info *uinfo)
288 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
289 struct alc_spec *spec = codec->spec;
290 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
291 if (mux_idx >= spec->num_mux_defs)
293 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
296 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
297 struct snd_ctl_elem_value *ucontrol)
299 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
300 struct alc_spec *spec = codec->spec;
301 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
303 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
307 static int alc_mux_enum_put(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);
313 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
314 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
315 spec->adc_nids[adc_idx],
316 &spec->cur_mux[adc_idx]);
321 * channel mode setting
323 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
324 struct snd_ctl_elem_info *uinfo)
326 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
327 struct alc_spec *spec = codec->spec;
328 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
329 spec->num_channel_mode);
332 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
333 struct snd_ctl_elem_value *ucontrol)
335 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
336 struct alc_spec *spec = codec->spec;
337 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
338 spec->num_channel_mode,
339 spec->multiout.max_channels);
342 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
343 struct snd_ctl_elem_value *ucontrol)
345 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
346 struct alc_spec *spec = codec->spec;
347 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
348 spec->num_channel_mode,
349 &spec->multiout.max_channels);
350 if (err >= 0 && spec->need_dac_fix)
351 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
356 * Control the mode of pin widget settings via the mixer. "pc" is used
357 * instead of "%" to avoid consequences of accidently treating the % as
358 * being part of a format specifier. Maximum allowed length of a value is
359 * 63 characters plus NULL terminator.
361 * Note: some retasking pin complexes seem to ignore requests for input
362 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
363 * are requested. Therefore order this list so that this behaviour will not
364 * cause problems when mixer clients move through the enum sequentially.
365 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
368 static char *alc_pin_mode_names[] = {
369 "Mic 50pc bias", "Mic 80pc bias",
370 "Line in", "Line out", "Headphone out",
372 static unsigned char alc_pin_mode_values[] = {
373 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
375 /* The control can present all 5 options, or it can limit the options based
376 * in the pin being assumed to be exclusively an input or an output pin. In
377 * addition, "input" pins may or may not process the mic bias option
378 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
379 * accept requests for bias as of chip versions up to March 2006) and/or
380 * wiring in the computer.
382 #define ALC_PIN_DIR_IN 0x00
383 #define ALC_PIN_DIR_OUT 0x01
384 #define ALC_PIN_DIR_INOUT 0x02
385 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
386 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
388 /* Info about the pin modes supported by the different pin direction modes.
389 * For each direction the minimum and maximum values are given.
391 static signed char alc_pin_mode_dir_info[5][2] = {
392 { 0, 2 }, /* ALC_PIN_DIR_IN */
393 { 3, 4 }, /* ALC_PIN_DIR_OUT */
394 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
395 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
396 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
398 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
399 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
400 #define alc_pin_mode_n_items(_dir) \
401 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
403 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_info *uinfo)
406 unsigned int item_num = uinfo->value.enumerated.item;
407 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
409 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
411 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
413 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
414 item_num = alc_pin_mode_min(dir);
415 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
419 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_value *ucontrol)
423 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
424 hda_nid_t nid = kcontrol->private_value & 0xffff;
425 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
426 long *valp = ucontrol->value.integer.value;
427 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
428 AC_VERB_GET_PIN_WIDGET_CONTROL,
431 /* Find enumerated value for current pinctl setting */
432 i = alc_pin_mode_min(dir);
433 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
435 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
439 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
440 struct snd_ctl_elem_value *ucontrol)
443 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
444 hda_nid_t nid = kcontrol->private_value & 0xffff;
445 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
446 long val = *ucontrol->value.integer.value;
447 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
448 AC_VERB_GET_PIN_WIDGET_CONTROL,
451 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
452 val = alc_pin_mode_min(dir);
454 change = pinctl != alc_pin_mode_values[val];
456 /* Set pin mode to that requested */
457 snd_hda_codec_write_cache(codec, nid, 0,
458 AC_VERB_SET_PIN_WIDGET_CONTROL,
459 alc_pin_mode_values[val]);
461 /* Also enable the retasking pin's input/output as required
462 * for the requested pin mode. Enum values of 2 or less are
465 * Dynamically switching the input/output buffers probably
466 * reduces noise slightly (particularly on input) so we'll
467 * do it. However, having both input and output buffers
468 * enabled simultaneously doesn't seem to be problematic if
469 * this turns out to be necessary in the future.
472 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
473 HDA_AMP_MUTE, HDA_AMP_MUTE);
474 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
477 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
478 HDA_AMP_MUTE, HDA_AMP_MUTE);
479 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
486 #define ALC_PIN_MODE(xname, nid, dir) \
487 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
488 .info = alc_pin_mode_info, \
489 .get = alc_pin_mode_get, \
490 .put = alc_pin_mode_put, \
491 .private_value = nid | (dir<<16) }
493 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
494 * together using a mask with more than one bit set. This control is
495 * currently used only by the ALC260 test model. At this stage they are not
496 * needed for any "production" models.
498 #ifdef CONFIG_SND_DEBUG
499 #define alc_gpio_data_info snd_ctl_boolean_mono_info
501 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
502 struct snd_ctl_elem_value *ucontrol)
504 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
505 hda_nid_t nid = kcontrol->private_value & 0xffff;
506 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
507 long *valp = ucontrol->value.integer.value;
508 unsigned int val = snd_hda_codec_read(codec, nid, 0,
509 AC_VERB_GET_GPIO_DATA, 0x00);
511 *valp = (val & mask) != 0;
514 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_value *ucontrol)
518 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
519 hda_nid_t nid = kcontrol->private_value & 0xffff;
520 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
521 long val = *ucontrol->value.integer.value;
522 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
523 AC_VERB_GET_GPIO_DATA,
526 /* Set/unset the masked GPIO bit(s) as needed */
527 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
532 snd_hda_codec_write_cache(codec, nid, 0,
533 AC_VERB_SET_GPIO_DATA, gpio_data);
537 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
538 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
539 .info = alc_gpio_data_info, \
540 .get = alc_gpio_data_get, \
541 .put = alc_gpio_data_put, \
542 .private_value = nid | (mask<<16) }
543 #endif /* CONFIG_SND_DEBUG */
545 /* A switch control to allow the enabling of the digital IO pins on the
546 * ALC260. This is incredibly simplistic; the intention of this control is
547 * to provide something in the test model allowing digital outputs to be
548 * identified if present. If models are found which can utilise these
549 * outputs a more complete mixer control can be devised for those models if
552 #ifdef CONFIG_SND_DEBUG
553 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
555 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
556 struct snd_ctl_elem_value *ucontrol)
558 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
559 hda_nid_t nid = kcontrol->private_value & 0xffff;
560 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
561 long *valp = ucontrol->value.integer.value;
562 unsigned int val = snd_hda_codec_read(codec, nid, 0,
563 AC_VERB_GET_DIGI_CONVERT, 0x00);
565 *valp = (val & mask) != 0;
568 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
569 struct snd_ctl_elem_value *ucontrol)
572 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
573 hda_nid_t nid = kcontrol->private_value & 0xffff;
574 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
575 long val = *ucontrol->value.integer.value;
576 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
577 AC_VERB_GET_DIGI_CONVERT,
580 /* Set/unset the masked control bit(s) as needed */
581 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
586 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
591 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
592 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
593 .info = alc_spdif_ctrl_info, \
594 .get = alc_spdif_ctrl_get, \
595 .put = alc_spdif_ctrl_put, \
596 .private_value = nid | (mask<<16) }
597 #endif /* CONFIG_SND_DEBUG */
600 * set up from the preset table
602 static void setup_preset(struct alc_spec *spec,
603 const struct alc_config_preset *preset)
607 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
608 spec->mixers[spec->num_mixers++] = preset->mixers[i];
609 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
611 spec->init_verbs[spec->num_init_verbs++] =
612 preset->init_verbs[i];
614 spec->channel_mode = preset->channel_mode;
615 spec->num_channel_mode = preset->num_channel_mode;
616 spec->need_dac_fix = preset->need_dac_fix;
618 spec->multiout.max_channels = spec->channel_mode[0].channels;
620 spec->multiout.num_dacs = preset->num_dacs;
621 spec->multiout.dac_nids = preset->dac_nids;
622 spec->multiout.dig_out_nid = preset->dig_out_nid;
623 spec->multiout.hp_nid = preset->hp_nid;
625 spec->num_mux_defs = preset->num_mux_defs;
626 if (!spec->num_mux_defs)
627 spec->num_mux_defs = 1;
628 spec->input_mux = preset->input_mux;
630 spec->num_adc_nids = preset->num_adc_nids;
631 spec->adc_nids = preset->adc_nids;
632 spec->dig_in_nid = preset->dig_in_nid;
634 spec->unsol_event = preset->unsol_event;
635 spec->init_hook = preset->init_hook;
636 #ifdef CONFIG_SND_HDA_POWER_SAVE
637 spec->loopback.amplist = preset->loopbacks;
641 /* Enable GPIO mask and set output */
642 static struct hda_verb alc_gpio1_init_verbs[] = {
643 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
644 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
645 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
649 static struct hda_verb alc_gpio2_init_verbs[] = {
650 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
651 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
652 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
656 static struct hda_verb alc_gpio3_init_verbs[] = {
657 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
658 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
659 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
663 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
664 * 31 ~ 16 : Manufacture ID
666 * 7 ~ 0 : Assembly ID
667 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
669 static void alc_subsystem_id(struct hda_codec *codec,
670 unsigned int porta, unsigned int porte,
673 unsigned int ass, tmp;
675 ass = codec->subsystem_id;
680 tmp = (ass & 0x38) >> 3; /* external Amp control */
683 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
686 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
689 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
692 switch (codec->vendor_id) {
698 snd_hda_codec_write(codec, 0x14, 0,
699 AC_VERB_SET_EAPD_BTLENABLE, 2);
700 snd_hda_codec_write(codec, 0x15, 0,
701 AC_VERB_SET_EAPD_BTLENABLE, 2);
705 if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */
707 tmp = (ass & 0x1800) >> 11;
709 case 0: port = porta; break;
710 case 1: port = porte; break;
711 case 2: port = portd; break;
714 snd_hda_codec_write(codec, port, 0,
715 AC_VERB_SET_EAPD_BTLENABLE,
718 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
719 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF,
720 (tmp == 5 ? 0x3040 : 0x3050));
726 * Fix-up pin default configurations
734 static void alc_fix_pincfg(struct hda_codec *codec,
735 const struct snd_pci_quirk *quirk,
736 const struct alc_pincfg **pinfix)
738 const struct alc_pincfg *cfg;
740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
744 cfg = pinfix[quirk->value];
745 for (; cfg->nid; cfg++) {
748 for (i = 0; i < 4; i++) {
749 snd_hda_codec_write(codec, cfg->nid, 0,
750 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
758 * ALC880 3-stack model
760 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
761 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
762 * F-Mic = 0x1b, HP = 0x19
765 static hda_nid_t alc880_dac_nids[4] = {
766 /* front, rear, clfe, rear_surr */
767 0x02, 0x05, 0x04, 0x03
770 static hda_nid_t alc880_adc_nids[3] = {
775 /* The datasheet says the node 0x07 is connected from inputs,
776 * but it shows zero connection in the real implementation on some devices.
777 * Note: this is a 915GAV bug, fixed on 915GLV
779 static hda_nid_t alc880_adc_nids_alt[2] = {
784 #define ALC880_DIGOUT_NID 0x06
785 #define ALC880_DIGIN_NID 0x0a
787 static struct hda_input_mux alc880_capture_source = {
791 { "Front Mic", 0x3 },
797 /* channel source setting (2/6 channel selection for 3-stack) */
799 static struct hda_verb alc880_threestack_ch2_init[] = {
800 /* set line-in to input, mute it */
801 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
802 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
803 /* set mic-in to input vref 80%, mute it */
804 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
805 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
810 static struct hda_verb alc880_threestack_ch6_init[] = {
811 /* set line-in to output, unmute it */
812 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
813 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
814 /* set mic-in to output, unmute it */
815 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
816 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
820 static struct hda_channel_mode alc880_threestack_modes[2] = {
821 { 2, alc880_threestack_ch2_init },
822 { 6, alc880_threestack_ch6_init },
825 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
826 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
827 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
828 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
829 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
830 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
831 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
832 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
833 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
834 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
835 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
840 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
842 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
843 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
846 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
847 .name = "Channel Mode",
848 .info = alc_ch_mode_info,
849 .get = alc_ch_mode_get,
850 .put = alc_ch_mode_put,
855 /* capture mixer elements */
856 static struct snd_kcontrol_new alc880_capture_mixer[] = {
857 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
858 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
859 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
860 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
861 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
862 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
864 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
865 /* The multiple "Capture Source" controls confuse alsamixer
866 * So call somewhat different..
867 * FIXME: the controls appear in the "playback" view!
869 /* .name = "Capture Source", */
870 .name = "Input Source",
872 .info = alc_mux_enum_info,
873 .get = alc_mux_enum_get,
874 .put = alc_mux_enum_put,
879 /* capture mixer elements (in case NID 0x07 not available) */
880 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
881 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
882 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
883 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
884 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
887 /* The multiple "Capture Source" controls confuse alsamixer
888 * So call somewhat different..
889 * FIXME: the controls appear in the "playback" view!
891 /* .name = "Capture Source", */
892 .name = "Input Source",
894 .info = alc_mux_enum_info,
895 .get = alc_mux_enum_get,
896 .put = alc_mux_enum_put,
904 * ALC880 5-stack model
906 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
908 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
909 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
912 /* additional mixers to alc880_three_stack_mixer */
913 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
914 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
915 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
919 /* channel source setting (6/8 channel selection for 5-stack) */
921 static struct hda_verb alc880_fivestack_ch6_init[] = {
922 /* set line-in to input, mute it */
923 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
924 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
929 static struct hda_verb alc880_fivestack_ch8_init[] = {
930 /* set line-in to output, unmute it */
931 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
932 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
936 static struct hda_channel_mode alc880_fivestack_modes[2] = {
937 { 6, alc880_fivestack_ch6_init },
938 { 8, alc880_fivestack_ch8_init },
943 * ALC880 6-stack model
945 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
947 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
948 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
951 static hda_nid_t alc880_6st_dac_nids[4] = {
952 /* front, rear, clfe, rear_surr */
953 0x02, 0x03, 0x04, 0x05
956 static struct hda_input_mux alc880_6stack_capture_source = {
960 { "Front Mic", 0x1 },
966 /* fixed 8-channels */
967 static struct hda_channel_mode alc880_sixstack_modes[1] = {
971 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
975 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
976 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
980 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
981 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
982 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
983 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
984 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
985 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
989 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
990 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
991 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
994 .name = "Channel Mode",
995 .info = alc_ch_mode_info,
996 .get = alc_ch_mode_get,
997 .put = alc_ch_mode_put,
1006 * W810 has rear IO for:
1009 * Center/LFE (DAC 04)
1012 * The system also has a pair of internal speakers, and a headphone jack.
1013 * These are both connected to Line2 on the codec, hence to DAC 02.
1015 * There is a variable resistor to control the speaker or headphone
1016 * volume. This is a hardware-only device without a software API.
1018 * Plugging headphones in will disable the internal speakers. This is
1019 * implemented in hardware, not via the driver using jack sense. In
1020 * a similar fashion, plugging into the rear socket marked "front" will
1021 * disable both the speakers and headphones.
1023 * For input, there's a microphone jack, and an "audio in" jack.
1024 * These may not do anything useful with this driver yet, because I
1025 * haven't setup any initialization verbs for these yet...
1028 static hda_nid_t alc880_w810_dac_nids[3] = {
1029 /* front, rear/surround, clfe */
1033 /* fixed 6 channels */
1034 static struct hda_channel_mode alc880_w810_modes[1] = {
1038 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1039 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1040 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1041 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1042 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1043 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1044 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1045 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1046 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1047 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1048 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1056 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1057 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1061 static hda_nid_t alc880_z71v_dac_nids[1] = {
1064 #define ALC880_Z71V_HP_DAC 0x03
1066 /* fixed 2 channels */
1067 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1071 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1073 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1074 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1075 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1086 * ALC880 F1734 model
1088 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1089 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1092 static hda_nid_t alc880_f1734_dac_nids[1] = {
1095 #define ALC880_F1734_HP_DAC 0x02
1097 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1100 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1101 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1114 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1115 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1116 * Mic = 0x18, Line = 0x1a
1119 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1120 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1122 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1125 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1126 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1127 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1128 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1129 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1130 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1134 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1138 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1139 .name = "Channel Mode",
1140 .info = alc_ch_mode_info,
1141 .get = alc_ch_mode_get,
1142 .put = alc_ch_mode_put,
1149 * ALC880 ASUS W1V model
1151 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1152 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1153 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1156 /* additional mixers to alc880_asus_mixer */
1157 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1158 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1159 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1163 /* additional mixers to alc880_asus_mixer */
1164 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1165 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1166 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1171 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1173 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1176 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1179 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1180 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1182 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1183 /* The multiple "Capture Source" controls confuse alsamixer
1184 * So call somewhat different..
1185 * FIXME: the controls appear in the "playback" view!
1187 /* .name = "Capture Source", */
1188 .name = "Input Source",
1190 .info = alc_mux_enum_info,
1191 .get = alc_mux_enum_get,
1192 .put = alc_mux_enum_put,
1198 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1199 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1200 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1201 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1202 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1203 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1204 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1205 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1206 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1209 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1210 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1213 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1214 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1215 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1216 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1219 .name = "Channel Mode",
1220 .info = alc_ch_mode_info,
1221 .get = alc_ch_mode_get,
1222 .put = alc_ch_mode_put,
1227 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1229 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1230 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1231 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1234 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1235 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1236 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1237 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1241 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1242 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1243 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1244 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1245 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1252 * build control elements
1254 static int alc_build_controls(struct hda_codec *codec)
1256 struct alc_spec *spec = codec->spec;
1260 for (i = 0; i < spec->num_mixers; i++) {
1261 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1266 if (spec->multiout.dig_out_nid) {
1267 err = snd_hda_create_spdif_out_ctls(codec,
1268 spec->multiout.dig_out_nid);
1272 if (spec->dig_in_nid) {
1273 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1282 * initialize the codec volumes, etc
1286 * generic initialization of ADC, input mixers and output mixers
1288 static struct hda_verb alc880_volume_init_verbs[] = {
1290 * Unmute ADC0-2 and set the default input to mic-in
1292 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1294 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1296 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1299 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1301 * Note: PASD motherboards uses the Line In 2 as the input for front
1304 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1314 * Set up output mixers (0x0c - 0x0f)
1316 /* set vol=0 to output mixers */
1317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1318 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1321 /* set up input amps for analog loopback */
1322 /* Amp Indices: DAC = 0, mixer = 1 */
1323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1336 * 3-stack pin configuration:
1337 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1339 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1341 * preset connection lists of input pins
1342 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1344 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1345 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1346 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1349 * Set pin mode and muting
1351 /* set front pin widgets 0x14 for output */
1352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1353 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1354 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1355 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1357 /* Mic2 (as headphone out) for HP output */
1358 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1359 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1360 /* Line In pin widget for input */
1361 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1363 /* Line2 (as front mic) pin widget for input and vref at 80% */
1364 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1365 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1366 /* CD pin widget for input */
1367 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1373 * 5-stack pin configuration:
1374 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1375 * line-in/side = 0x1a, f-mic = 0x1b
1377 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1379 * preset connection lists of input pins
1380 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1382 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1383 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1386 * Set pin mode and muting
1388 /* set pin widgets 0x14-0x17 for output */
1389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1390 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1391 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1392 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1393 /* unmute pins for output (no gain on this amp) */
1394 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1396 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1397 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1399 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1402 /* Mic2 (as headphone out) for HP output */
1403 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1405 /* Line In pin widget for input */
1406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1408 /* Line2 (as front mic) pin widget for input and vref at 80% */
1409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1410 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1411 /* CD pin widget for input */
1412 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1418 * W810 pin configuration:
1419 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1421 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1422 /* hphone/speaker input selector: front DAC */
1423 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1425 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1426 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1429 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1430 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1433 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1439 * Z71V pin configuration:
1440 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1442 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1448 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1449 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1450 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1451 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1457 * 6-stack pin configuration:
1458 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1459 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1461 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1462 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1469 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1470 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1471 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1478 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1480 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1481 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1487 * Uniwill pin configuration:
1488 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1491 static struct hda_verb alc880_uniwill_init_verbs[] = {
1492 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1499 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1500 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1510 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1513 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1514 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1515 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1516 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1517 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1519 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1520 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1527 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1529 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1530 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1532 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1536 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1537 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1543 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1547 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1548 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1549 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1550 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1552 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1553 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1558 static struct hda_verb alc880_beep_init_verbs[] = {
1559 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1563 /* toggle speaker-output according to the hp-jack state */
1564 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1566 unsigned int present;
1569 present = snd_hda_codec_read(codec, 0x14, 0,
1570 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1571 bits = present ? HDA_AMP_MUTE : 0;
1572 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1573 HDA_AMP_MUTE, bits);
1574 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1575 HDA_AMP_MUTE, bits);
1578 /* auto-toggle front mic */
1579 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1581 unsigned int present;
1584 present = snd_hda_codec_read(codec, 0x18, 0,
1585 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1586 bits = present ? HDA_AMP_MUTE : 0;
1587 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1590 static void alc880_uniwill_automute(struct hda_codec *codec)
1592 alc880_uniwill_hp_automute(codec);
1593 alc880_uniwill_mic_automute(codec);
1596 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1599 /* Looks like the unsol event is incompatible with the standard
1600 * definition. 4bit tag is placed at 28 bit!
1602 switch (res >> 28) {
1603 case ALC880_HP_EVENT:
1604 alc880_uniwill_hp_automute(codec);
1606 case ALC880_MIC_EVENT:
1607 alc880_uniwill_mic_automute(codec);
1612 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1614 unsigned int present;
1617 present = snd_hda_codec_read(codec, 0x14, 0,
1618 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1619 bits = present ? HDA_AMP_MUTE : 0;
1620 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1623 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1625 unsigned int present;
1627 present = snd_hda_codec_read(codec, 0x21, 0,
1628 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1629 present &= HDA_AMP_VOLMASK;
1630 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1631 HDA_AMP_VOLMASK, present);
1632 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1633 HDA_AMP_VOLMASK, present);
1636 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1639 /* Looks like the unsol event is incompatible with the standard
1640 * definition. 4bit tag is placed at 28 bit!
1642 if ((res >> 28) == ALC880_HP_EVENT)
1643 alc880_uniwill_p53_hp_automute(codec);
1644 if ((res >> 28) == ALC880_DCVOL_EVENT)
1645 alc880_uniwill_p53_dcvol_automute(codec);
1650 * F1734 pin configuration:
1651 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1653 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1654 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1655 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1656 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1657 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1667 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1670 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1671 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1679 * ASUS pin configuration:
1680 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1682 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1683 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1684 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1685 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1695 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1697 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1698 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1699 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1700 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1701 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1702 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1703 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1705 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1710 /* Enable GPIO mask and set output */
1711 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1712 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1714 /* Clevo m520g init */
1715 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1716 /* headphone output */
1717 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1720 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1723 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1725 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1726 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1727 /* Mic1 (rear panel) */
1728 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1730 /* Mic2 (front panel) */
1731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1734 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1735 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1736 /* change to EAPD mode */
1737 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1738 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1743 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1744 /* change to EAPD mode */
1745 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1746 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1748 /* Headphone output */
1749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1751 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1752 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1754 /* Line In pin widget for input */
1755 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1756 /* CD pin widget for input */
1757 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1758 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1761 /* change to EAPD mode */
1762 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1763 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1769 * LG m1 express dual
1772 * Rear Line-In/Out (blue): 0x14
1773 * Build-in Mic-In: 0x15
1775 * HP-Out (green): 0x1b
1776 * Mic-In/Out (red): 0x19
1780 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1781 static hda_nid_t alc880_lg_dac_nids[3] = {
1785 /* seems analog CD is not working */
1786 static struct hda_input_mux alc880_lg_capture_source = {
1791 { "Internal Mic", 0x6 },
1795 /* 2,4,6 channel modes */
1796 static struct hda_verb alc880_lg_ch2_init[] = {
1797 /* set line-in and mic-in to input */
1798 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1799 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1803 static struct hda_verb alc880_lg_ch4_init[] = {
1804 /* set line-in to out and mic-in to input */
1805 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1806 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1810 static struct hda_verb alc880_lg_ch6_init[] = {
1811 /* set line-in and mic-in to output */
1812 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1813 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1817 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
1818 { 2, alc880_lg_ch2_init },
1819 { 4, alc880_lg_ch4_init },
1820 { 6, alc880_lg_ch6_init },
1823 static struct snd_kcontrol_new alc880_lg_mixer[] = {
1824 /* FIXME: it's not really "master" but front channels */
1825 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1826 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
1827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1828 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
1829 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
1830 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
1831 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
1832 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
1833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1834 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1835 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
1836 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
1837 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
1838 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
1840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1841 .name = "Channel Mode",
1842 .info = alc_ch_mode_info,
1843 .get = alc_ch_mode_get,
1844 .put = alc_ch_mode_put,
1849 static struct hda_verb alc880_lg_init_verbs[] = {
1850 /* set capture source to mic-in */
1851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1853 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1854 /* mute all amp mixer inputs */
1855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
1856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1858 /* line-in to input */
1859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1865 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1866 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1867 /* mic-in to input */
1868 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1869 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1872 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
1873 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1874 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1876 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1880 /* toggle speaker-output according to the hp-jack state */
1881 static void alc880_lg_automute(struct hda_codec *codec)
1883 unsigned int present;
1886 present = snd_hda_codec_read(codec, 0x1b, 0,
1887 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1888 bits = present ? HDA_AMP_MUTE : 0;
1889 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
1890 HDA_AMP_MUTE, bits);
1893 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
1895 /* Looks like the unsol event is incompatible with the standard
1896 * definition. 4bit tag is placed at 28 bit!
1898 if ((res >> 28) == 0x01)
1899 alc880_lg_automute(codec);
1908 * Built-in Mic-In: 0x19
1914 static struct hda_input_mux alc880_lg_lw_capture_source = {
1918 { "Internal Mic", 0x1 },
1923 #define alc880_lg_lw_modes alc880_threestack_modes
1925 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
1926 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1927 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1929 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1930 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1931 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1932 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1933 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1934 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1935 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1938 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1939 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1941 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1942 .name = "Channel Mode",
1943 .info = alc_ch_mode_info,
1944 .get = alc_ch_mode_get,
1945 .put = alc_ch_mode_put,
1950 static struct hda_verb alc880_lg_lw_init_verbs[] = {
1951 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1952 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1953 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1955 /* set capture source to mic-in */
1956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1957 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1959 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1962 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1965 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1966 /* mic-in to input */
1967 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1968 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1970 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1971 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1973 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1977 /* toggle speaker-output according to the hp-jack state */
1978 static void alc880_lg_lw_automute(struct hda_codec *codec)
1980 unsigned int present;
1983 present = snd_hda_codec_read(codec, 0x1b, 0,
1984 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1985 bits = present ? HDA_AMP_MUTE : 0;
1986 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1987 HDA_AMP_MUTE, bits);
1990 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
1992 /* Looks like the unsol event is incompatible with the standard
1993 * definition. 4bit tag is placed at 28 bit!
1995 if ((res >> 28) == 0x01)
1996 alc880_lg_lw_automute(codec);
1999 #ifdef CONFIG_SND_HDA_POWER_SAVE
2000 static struct hda_amp_list alc880_loopbacks[] = {
2001 { 0x0b, HDA_INPUT, 0 },
2002 { 0x0b, HDA_INPUT, 1 },
2003 { 0x0b, HDA_INPUT, 2 },
2004 { 0x0b, HDA_INPUT, 3 },
2005 { 0x0b, HDA_INPUT, 4 },
2009 static struct hda_amp_list alc880_lg_loopbacks[] = {
2010 { 0x0b, HDA_INPUT, 1 },
2011 { 0x0b, HDA_INPUT, 6 },
2012 { 0x0b, HDA_INPUT, 7 },
2021 static int alc_init(struct hda_codec *codec)
2023 struct alc_spec *spec = codec->spec;
2026 for (i = 0; i < spec->num_init_verbs; i++)
2027 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2029 if (spec->init_hook)
2030 spec->init_hook(codec);
2035 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2037 struct alc_spec *spec = codec->spec;
2039 if (spec->unsol_event)
2040 spec->unsol_event(codec, res);
2043 #ifdef CONFIG_SND_HDA_POWER_SAVE
2044 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2046 struct alc_spec *spec = codec->spec;
2047 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2052 * Analog playback callbacks
2054 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2055 struct hda_codec *codec,
2056 struct snd_pcm_substream *substream)
2058 struct alc_spec *spec = codec->spec;
2059 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2062 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2063 struct hda_codec *codec,
2064 unsigned int stream_tag,
2065 unsigned int format,
2066 struct snd_pcm_substream *substream)
2068 struct alc_spec *spec = codec->spec;
2069 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2070 stream_tag, format, substream);
2073 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2074 struct hda_codec *codec,
2075 struct snd_pcm_substream *substream)
2077 struct alc_spec *spec = codec->spec;
2078 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2084 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2085 struct hda_codec *codec,
2086 struct snd_pcm_substream *substream)
2088 struct alc_spec *spec = codec->spec;
2089 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2092 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2093 struct hda_codec *codec,
2094 unsigned int stream_tag,
2095 unsigned int format,
2096 struct snd_pcm_substream *substream)
2098 struct alc_spec *spec = codec->spec;
2099 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2100 stream_tag, format, substream);
2103 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2104 struct hda_codec *codec,
2105 struct snd_pcm_substream *substream)
2107 struct alc_spec *spec = codec->spec;
2108 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2114 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2115 struct hda_codec *codec,
2116 unsigned int stream_tag,
2117 unsigned int format,
2118 struct snd_pcm_substream *substream)
2120 struct alc_spec *spec = codec->spec;
2122 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2123 stream_tag, 0, format);
2127 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2128 struct hda_codec *codec,
2129 struct snd_pcm_substream *substream)
2131 struct alc_spec *spec = codec->spec;
2133 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2141 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2145 /* NID is set in alc_build_pcms */
2147 .open = alc880_playback_pcm_open,
2148 .prepare = alc880_playback_pcm_prepare,
2149 .cleanup = alc880_playback_pcm_cleanup
2153 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2157 /* NID is set in alc_build_pcms */
2159 .prepare = alc880_capture_pcm_prepare,
2160 .cleanup = alc880_capture_pcm_cleanup
2164 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2168 /* NID is set in alc_build_pcms */
2170 .open = alc880_dig_playback_pcm_open,
2171 .close = alc880_dig_playback_pcm_close,
2172 .prepare = alc880_dig_playback_pcm_prepare
2176 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2180 /* NID is set in alc_build_pcms */
2183 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2184 static struct hda_pcm_stream alc_pcm_null_playback = {
2190 static int alc_build_pcms(struct hda_codec *codec)
2192 struct alc_spec *spec = codec->spec;
2193 struct hda_pcm *info = spec->pcm_rec;
2196 codec->num_pcms = 1;
2197 codec->pcm_info = info;
2199 info->name = spec->stream_name_analog;
2200 if (spec->stream_analog_playback) {
2201 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2202 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2203 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2205 if (spec->stream_analog_capture) {
2206 snd_assert(spec->adc_nids, return -EINVAL);
2207 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2208 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2211 if (spec->channel_mode) {
2212 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2213 for (i = 0; i < spec->num_channel_mode; i++) {
2214 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2215 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2220 /* SPDIF for stream index #1 */
2221 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2222 codec->num_pcms = 2;
2223 info = spec->pcm_rec + 1;
2224 info->name = spec->stream_name_digital;
2225 if (spec->multiout.dig_out_nid &&
2226 spec->stream_digital_playback) {
2227 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2228 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2230 if (spec->dig_in_nid &&
2231 spec->stream_digital_capture) {
2232 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2233 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2237 /* If the use of more than one ADC is requested for the current
2238 * model, configure a second analog capture-only PCM.
2240 /* Additional Analaog capture for index #2 */
2241 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2243 codec->num_pcms = 3;
2244 info = spec->pcm_rec + 2;
2245 info->name = spec->stream_name_analog;
2246 /* No playback stream for second PCM */
2247 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2248 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2249 if (spec->stream_analog_capture) {
2250 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2251 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2258 static void alc_free(struct hda_codec *codec)
2260 struct alc_spec *spec = codec->spec;
2266 if (spec->kctl_alloc) {
2267 for (i = 0; i < spec->num_kctl_used; i++)
2268 kfree(spec->kctl_alloc[i].name);
2269 kfree(spec->kctl_alloc);
2276 static struct hda_codec_ops alc_patch_ops = {
2277 .build_controls = alc_build_controls,
2278 .build_pcms = alc_build_pcms,
2281 .unsol_event = alc_unsol_event,
2282 #ifdef CONFIG_SND_HDA_POWER_SAVE
2283 .check_power_status = alc_check_power_status,
2289 * Test configuration for debugging
2291 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2294 #ifdef CONFIG_SND_DEBUG
2295 static hda_nid_t alc880_test_dac_nids[4] = {
2296 0x02, 0x03, 0x04, 0x05
2299 static struct hda_input_mux alc880_test_capture_source = {
2308 { "Surround", 0x6 },
2312 static struct hda_channel_mode alc880_test_modes[4] = {
2319 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2320 struct snd_ctl_elem_info *uinfo)
2322 static char *texts[] = {
2323 "N/A", "Line Out", "HP Out",
2324 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2326 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2328 uinfo->value.enumerated.items = 8;
2329 if (uinfo->value.enumerated.item >= 8)
2330 uinfo->value.enumerated.item = 7;
2331 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2335 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2336 struct snd_ctl_elem_value *ucontrol)
2338 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2339 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2340 unsigned int pin_ctl, item = 0;
2342 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2343 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2344 if (pin_ctl & AC_PINCTL_OUT_EN) {
2345 if (pin_ctl & AC_PINCTL_HP_EN)
2349 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2350 switch (pin_ctl & AC_PINCTL_VREFEN) {
2351 case AC_PINCTL_VREF_HIZ: item = 3; break;
2352 case AC_PINCTL_VREF_50: item = 4; break;
2353 case AC_PINCTL_VREF_GRD: item = 5; break;
2354 case AC_PINCTL_VREF_80: item = 6; break;
2355 case AC_PINCTL_VREF_100: item = 7; break;
2358 ucontrol->value.enumerated.item[0] = item;
2362 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2363 struct snd_ctl_elem_value *ucontrol)
2365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2366 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2367 static unsigned int ctls[] = {
2368 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2369 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2370 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2371 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2372 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2373 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2375 unsigned int old_ctl, new_ctl;
2377 old_ctl = snd_hda_codec_read(codec, nid, 0,
2378 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2379 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2380 if (old_ctl != new_ctl) {
2382 snd_hda_codec_write_cache(codec, nid, 0,
2383 AC_VERB_SET_PIN_WIDGET_CONTROL,
2385 val = ucontrol->value.enumerated.item[0] >= 3 ?
2387 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2394 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2395 struct snd_ctl_elem_info *uinfo)
2397 static char *texts[] = {
2398 "Front", "Surround", "CLFE", "Side"
2400 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2402 uinfo->value.enumerated.items = 4;
2403 if (uinfo->value.enumerated.item >= 4)
2404 uinfo->value.enumerated.item = 3;
2405 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2409 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2410 struct snd_ctl_elem_value *ucontrol)
2412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2413 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2416 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2417 ucontrol->value.enumerated.item[0] = sel & 3;
2421 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2422 struct snd_ctl_elem_value *ucontrol)
2424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2425 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2428 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2429 if (ucontrol->value.enumerated.item[0] != sel) {
2430 sel = ucontrol->value.enumerated.item[0] & 3;
2431 snd_hda_codec_write_cache(codec, nid, 0,
2432 AC_VERB_SET_CONNECT_SEL, sel);
2438 #define PIN_CTL_TEST(xname,nid) { \
2439 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2441 .info = alc_test_pin_ctl_info, \
2442 .get = alc_test_pin_ctl_get, \
2443 .put = alc_test_pin_ctl_put, \
2444 .private_value = nid \
2447 #define PIN_SRC_TEST(xname,nid) { \
2448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2450 .info = alc_test_pin_src_info, \
2451 .get = alc_test_pin_src_get, \
2452 .put = alc_test_pin_src_put, \
2453 .private_value = nid \
2456 static struct snd_kcontrol_new alc880_test_mixer[] = {
2457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2458 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2459 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2460 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2461 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2462 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2463 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2464 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2465 PIN_CTL_TEST("Front Pin Mode", 0x14),
2466 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2467 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2468 PIN_CTL_TEST("Side Pin Mode", 0x17),
2469 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2470 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2471 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2472 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2473 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2474 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2475 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2476 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2477 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2478 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2479 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2480 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2481 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2482 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2483 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2484 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2485 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2486 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2489 .name = "Channel Mode",
2490 .info = alc_ch_mode_info,
2491 .get = alc_ch_mode_get,
2492 .put = alc_ch_mode_put,
2497 static struct hda_verb alc880_test_init_verbs[] = {
2498 /* Unmute inputs of 0x0c - 0x0f */
2499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2507 /* Vol output for 0x0c-0x0f */
2508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2510 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2511 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2512 /* Set output pins 0x14-0x17 */
2513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2517 /* Unmute output pins 0x14-0x17 */
2518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2521 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2522 /* Set input pins 0x18-0x1c */
2523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2524 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2525 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2527 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2528 /* Mute input pins 0x18-0x1b */
2529 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2530 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2532 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2535 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2537 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2540 /* Analog input/passthru */
2541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2543 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2553 static const char *alc880_models[ALC880_MODEL_LAST] = {
2554 [ALC880_3ST] = "3stack",
2555 [ALC880_TCL_S700] = "tcl",
2556 [ALC880_3ST_DIG] = "3stack-digout",
2557 [ALC880_CLEVO] = "clevo",
2558 [ALC880_5ST] = "5stack",
2559 [ALC880_5ST_DIG] = "5stack-digout",
2560 [ALC880_W810] = "w810",
2561 [ALC880_Z71V] = "z71v",
2562 [ALC880_6ST] = "6stack",
2563 [ALC880_6ST_DIG] = "6stack-digout",
2564 [ALC880_ASUS] = "asus",
2565 [ALC880_ASUS_W1V] = "asus-w1v",
2566 [ALC880_ASUS_DIG] = "asus-dig",
2567 [ALC880_ASUS_DIG2] = "asus-dig2",
2568 [ALC880_UNIWILL_DIG] = "uniwill",
2569 [ALC880_UNIWILL_P53] = "uniwill-p53",
2570 [ALC880_FUJITSU] = "fujitsu",
2571 [ALC880_F1734] = "F1734",
2573 [ALC880_LG_LW] = "lg-lw",
2574 #ifdef CONFIG_SND_DEBUG
2575 [ALC880_TEST] = "test",
2577 [ALC880_AUTO] = "auto",
2580 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2581 /* Broken BIOS configuration */
2582 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2583 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2585 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2586 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2587 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2588 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2589 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2590 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2591 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2592 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2593 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2595 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2596 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2598 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2599 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2600 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2601 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2602 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2603 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2604 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2605 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2606 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2607 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2608 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2609 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2610 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2611 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2612 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2614 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2615 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2616 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2617 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2618 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2619 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2620 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2621 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2622 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2623 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2624 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2625 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2626 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2627 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2628 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2629 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2630 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2631 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2633 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2634 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2635 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2636 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2638 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2639 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2640 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2641 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2643 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2644 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2645 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2646 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2648 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2649 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2650 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2651 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2652 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2653 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2654 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2655 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2656 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2657 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2658 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2664 * ALC880 codec presets
2666 static struct alc_config_preset alc880_presets[] = {
2668 .mixers = { alc880_three_stack_mixer },
2669 .init_verbs = { alc880_volume_init_verbs,
2670 alc880_pin_3stack_init_verbs },
2671 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2672 .dac_nids = alc880_dac_nids,
2673 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2674 .channel_mode = alc880_threestack_modes,
2676 .input_mux = &alc880_capture_source,
2678 [ALC880_3ST_DIG] = {
2679 .mixers = { alc880_three_stack_mixer },
2680 .init_verbs = { alc880_volume_init_verbs,
2681 alc880_pin_3stack_init_verbs },
2682 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2683 .dac_nids = alc880_dac_nids,
2684 .dig_out_nid = ALC880_DIGOUT_NID,
2685 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2686 .channel_mode = alc880_threestack_modes,
2688 .input_mux = &alc880_capture_source,
2690 [ALC880_TCL_S700] = {
2691 .mixers = { alc880_tcl_s700_mixer },
2692 .init_verbs = { alc880_volume_init_verbs,
2693 alc880_pin_tcl_S700_init_verbs,
2694 alc880_gpio2_init_verbs },
2695 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2696 .dac_nids = alc880_dac_nids,
2698 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2699 .channel_mode = alc880_2_jack_modes,
2700 .input_mux = &alc880_capture_source,
2703 .mixers = { alc880_three_stack_mixer,
2704 alc880_five_stack_mixer},
2705 .init_verbs = { alc880_volume_init_verbs,
2706 alc880_pin_5stack_init_verbs },
2707 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2708 .dac_nids = alc880_dac_nids,
2709 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2710 .channel_mode = alc880_fivestack_modes,
2711 .input_mux = &alc880_capture_source,
2713 [ALC880_5ST_DIG] = {
2714 .mixers = { alc880_three_stack_mixer,
2715 alc880_five_stack_mixer },
2716 .init_verbs = { alc880_volume_init_verbs,
2717 alc880_pin_5stack_init_verbs },
2718 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2719 .dac_nids = alc880_dac_nids,
2720 .dig_out_nid = ALC880_DIGOUT_NID,
2721 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2722 .channel_mode = alc880_fivestack_modes,
2723 .input_mux = &alc880_capture_source,
2726 .mixers = { alc880_six_stack_mixer },
2727 .init_verbs = { alc880_volume_init_verbs,
2728 alc880_pin_6stack_init_verbs },
2729 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2730 .dac_nids = alc880_6st_dac_nids,
2731 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2732 .channel_mode = alc880_sixstack_modes,
2733 .input_mux = &alc880_6stack_capture_source,
2735 [ALC880_6ST_DIG] = {
2736 .mixers = { alc880_six_stack_mixer },
2737 .init_verbs = { alc880_volume_init_verbs,
2738 alc880_pin_6stack_init_verbs },
2739 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2740 .dac_nids = alc880_6st_dac_nids,
2741 .dig_out_nid = ALC880_DIGOUT_NID,
2742 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2743 .channel_mode = alc880_sixstack_modes,
2744 .input_mux = &alc880_6stack_capture_source,
2747 .mixers = { alc880_w810_base_mixer },
2748 .init_verbs = { alc880_volume_init_verbs,
2749 alc880_pin_w810_init_verbs,
2750 alc880_gpio2_init_verbs },
2751 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2752 .dac_nids = alc880_w810_dac_nids,
2753 .dig_out_nid = ALC880_DIGOUT_NID,
2754 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2755 .channel_mode = alc880_w810_modes,
2756 .input_mux = &alc880_capture_source,
2759 .mixers = { alc880_z71v_mixer },
2760 .init_verbs = { alc880_volume_init_verbs,
2761 alc880_pin_z71v_init_verbs },
2762 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2763 .dac_nids = alc880_z71v_dac_nids,
2764 .dig_out_nid = ALC880_DIGOUT_NID,
2766 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2767 .channel_mode = alc880_2_jack_modes,
2768 .input_mux = &alc880_capture_source,
2771 .mixers = { alc880_f1734_mixer },
2772 .init_verbs = { alc880_volume_init_verbs,
2773 alc880_pin_f1734_init_verbs },
2774 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2775 .dac_nids = alc880_f1734_dac_nids,
2777 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2778 .channel_mode = alc880_2_jack_modes,
2779 .input_mux = &alc880_capture_source,
2782 .mixers = { alc880_asus_mixer },
2783 .init_verbs = { alc880_volume_init_verbs,
2784 alc880_pin_asus_init_verbs,
2785 alc880_gpio1_init_verbs },
2786 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2787 .dac_nids = alc880_asus_dac_nids,
2788 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2789 .channel_mode = alc880_asus_modes,
2791 .input_mux = &alc880_capture_source,
2793 [ALC880_ASUS_DIG] = {
2794 .mixers = { alc880_asus_mixer },
2795 .init_verbs = { alc880_volume_init_verbs,
2796 alc880_pin_asus_init_verbs,
2797 alc880_gpio1_init_verbs },
2798 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2799 .dac_nids = alc880_asus_dac_nids,
2800 .dig_out_nid = ALC880_DIGOUT_NID,
2801 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2802 .channel_mode = alc880_asus_modes,
2804 .input_mux = &alc880_capture_source,
2806 [ALC880_ASUS_DIG2] = {
2807 .mixers = { alc880_asus_mixer },
2808 .init_verbs = { alc880_volume_init_verbs,
2809 alc880_pin_asus_init_verbs,
2810 alc880_gpio2_init_verbs }, /* use GPIO2 */
2811 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2812 .dac_nids = alc880_asus_dac_nids,
2813 .dig_out_nid = ALC880_DIGOUT_NID,
2814 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2815 .channel_mode = alc880_asus_modes,
2817 .input_mux = &alc880_capture_source,
2819 [ALC880_ASUS_W1V] = {
2820 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2821 .init_verbs = { alc880_volume_init_verbs,
2822 alc880_pin_asus_init_verbs,
2823 alc880_gpio1_init_verbs },
2824 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2825 .dac_nids = alc880_asus_dac_nids,
2826 .dig_out_nid = ALC880_DIGOUT_NID,
2827 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2828 .channel_mode = alc880_asus_modes,
2830 .input_mux = &alc880_capture_source,
2832 [ALC880_UNIWILL_DIG] = {
2833 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2834 .init_verbs = { alc880_volume_init_verbs,
2835 alc880_pin_asus_init_verbs },
2836 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2837 .dac_nids = alc880_asus_dac_nids,
2838 .dig_out_nid = ALC880_DIGOUT_NID,
2839 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2840 .channel_mode = alc880_asus_modes,
2842 .input_mux = &alc880_capture_source,
2844 [ALC880_UNIWILL] = {
2845 .mixers = { alc880_uniwill_mixer },
2846 .init_verbs = { alc880_volume_init_verbs,
2847 alc880_uniwill_init_verbs },
2848 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2849 .dac_nids = alc880_asus_dac_nids,
2850 .dig_out_nid = ALC880_DIGOUT_NID,
2851 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2852 .channel_mode = alc880_threestack_modes,
2854 .input_mux = &alc880_capture_source,
2855 .unsol_event = alc880_uniwill_unsol_event,
2856 .init_hook = alc880_uniwill_automute,
2858 [ALC880_UNIWILL_P53] = {
2859 .mixers = { alc880_uniwill_p53_mixer },
2860 .init_verbs = { alc880_volume_init_verbs,
2861 alc880_uniwill_p53_init_verbs },
2862 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2863 .dac_nids = alc880_asus_dac_nids,
2864 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2865 .channel_mode = alc880_threestack_modes,
2866 .input_mux = &alc880_capture_source,
2867 .unsol_event = alc880_uniwill_p53_unsol_event,
2868 .init_hook = alc880_uniwill_p53_hp_automute,
2870 [ALC880_FUJITSU] = {
2871 .mixers = { alc880_fujitsu_mixer,
2872 alc880_pcbeep_mixer, },
2873 .init_verbs = { alc880_volume_init_verbs,
2874 alc880_uniwill_p53_init_verbs,
2875 alc880_beep_init_verbs },
2876 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2877 .dac_nids = alc880_dac_nids,
2878 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2879 .channel_mode = alc880_2_jack_modes,
2880 .input_mux = &alc880_capture_source,
2881 .unsol_event = alc880_uniwill_p53_unsol_event,
2882 .init_hook = alc880_uniwill_p53_hp_automute,
2885 .mixers = { alc880_three_stack_mixer },
2886 .init_verbs = { alc880_volume_init_verbs,
2887 alc880_pin_clevo_init_verbs },
2888 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2889 .dac_nids = alc880_dac_nids,
2891 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2892 .channel_mode = alc880_threestack_modes,
2894 .input_mux = &alc880_capture_source,
2897 .mixers = { alc880_lg_mixer },
2898 .init_verbs = { alc880_volume_init_verbs,
2899 alc880_lg_init_verbs },
2900 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
2901 .dac_nids = alc880_lg_dac_nids,
2902 .dig_out_nid = ALC880_DIGOUT_NID,
2903 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
2904 .channel_mode = alc880_lg_ch_modes,
2906 .input_mux = &alc880_lg_capture_source,
2907 .unsol_event = alc880_lg_unsol_event,
2908 .init_hook = alc880_lg_automute,
2909 #ifdef CONFIG_SND_HDA_POWER_SAVE
2910 .loopbacks = alc880_lg_loopbacks,
2914 .mixers = { alc880_lg_lw_mixer },
2915 .init_verbs = { alc880_volume_init_verbs,
2916 alc880_lg_lw_init_verbs },
2917 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2918 .dac_nids = alc880_dac_nids,
2919 .dig_out_nid = ALC880_DIGOUT_NID,
2920 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
2921 .channel_mode = alc880_lg_lw_modes,
2922 .input_mux = &alc880_lg_lw_capture_source,
2923 .unsol_event = alc880_lg_lw_unsol_event,
2924 .init_hook = alc880_lg_lw_automute,
2926 #ifdef CONFIG_SND_DEBUG
2928 .mixers = { alc880_test_mixer },
2929 .init_verbs = { alc880_test_init_verbs },
2930 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
2931 .dac_nids = alc880_test_dac_nids,
2932 .dig_out_nid = ALC880_DIGOUT_NID,
2933 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
2934 .channel_mode = alc880_test_modes,
2935 .input_mux = &alc880_test_capture_source,
2941 * Automatic parse of I/O pins from the BIOS configuration
2944 #define NUM_CONTROL_ALLOC 32
2945 #define NUM_VERB_ALLOC 32
2949 ALC_CTL_WIDGET_MUTE,
2952 static struct snd_kcontrol_new alc880_control_templates[] = {
2953 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2954 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2955 HDA_BIND_MUTE(NULL, 0, 0, 0),
2958 /* add dynamic controls */
2959 static int add_control(struct alc_spec *spec, int type, const char *name,
2962 struct snd_kcontrol_new *knew;
2964 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2965 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2967 /* array + terminator */
2968 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
2971 if (spec->kctl_alloc) {
2972 memcpy(knew, spec->kctl_alloc,
2973 sizeof(*knew) * spec->num_kctl_alloc);
2974 kfree(spec->kctl_alloc);
2976 spec->kctl_alloc = knew;
2977 spec->num_kctl_alloc = num;
2980 knew = &spec->kctl_alloc[spec->num_kctl_used];
2981 *knew = alc880_control_templates[type];
2982 knew->name = kstrdup(name, GFP_KERNEL);
2985 knew->private_value = val;
2986 spec->num_kctl_used++;
2990 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2991 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2992 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2993 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2994 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
2995 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
2996 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
2997 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
2998 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
2999 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3000 #define ALC880_PIN_CD_NID 0x1c
3002 /* fill in the dac_nids table from the parsed pin configuration */
3003 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3004 const struct auto_pin_cfg *cfg)
3010 memset(assigned, 0, sizeof(assigned));
3011 spec->multiout.dac_nids = spec->private_dac_nids;
3013 /* check the pins hardwired to audio widget */
3014 for (i = 0; i < cfg->line_outs; i++) {
3015 nid = cfg->line_out_pins[i];
3016 if (alc880_is_fixed_pin(nid)) {
3017 int idx = alc880_fixed_pin_idx(nid);
3018 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3022 /* left pins can be connect to any audio widget */
3023 for (i = 0; i < cfg->line_outs; i++) {
3024 nid = cfg->line_out_pins[i];
3025 if (alc880_is_fixed_pin(nid))
3027 /* search for an empty channel */
3028 for (j = 0; j < cfg->line_outs; j++) {
3030 spec->multiout.dac_nids[i] =
3031 alc880_idx_to_dac(j);
3037 spec->multiout.num_dacs = cfg->line_outs;
3041 /* add playback controls from the parsed DAC table */
3042 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3043 const struct auto_pin_cfg *cfg)
3046 static const char *chname[4] = {
3047 "Front", "Surround", NULL /*CLFE*/, "Side"
3052 for (i = 0; i < cfg->line_outs; i++) {
3053 if (!spec->multiout.dac_nids[i])
3055 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3058 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3059 "Center Playback Volume",
3060 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3064 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3065 "LFE Playback Volume",
3066 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3070 err = add_control(spec, ALC_CTL_BIND_MUTE,
3071 "Center Playback Switch",
3072 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3076 err = add_control(spec, ALC_CTL_BIND_MUTE,
3077 "LFE Playback Switch",
3078 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3083 sprintf(name, "%s Playback Volume", chname[i]);
3084 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3085 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3089 sprintf(name, "%s Playback Switch", chname[i]);
3090 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3091 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3100 /* add playback controls for speaker and HP outputs */
3101 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3111 if (alc880_is_fixed_pin(pin)) {
3112 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3113 /* specify the DAC as the extra output */
3114 if (!spec->multiout.hp_nid)
3115 spec->multiout.hp_nid = nid;
3117 spec->multiout.extra_out_nid[0] = nid;
3118 /* control HP volume/switch on the output mixer amp */
3119 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3120 sprintf(name, "%s Playback Volume", pfx);
3121 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3122 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3125 sprintf(name, "%s Playback Switch", pfx);
3126 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3127 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3130 } else if (alc880_is_multi_pin(pin)) {
3131 /* set manual connection */
3132 /* we have only a switch on HP-out PIN */
3133 sprintf(name, "%s Playback Switch", pfx);
3134 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3135 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3142 /* create input playback/capture controls for the given pin */
3143 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3144 const char *ctlname,
3145 int idx, hda_nid_t mix_nid)
3150 sprintf(name, "%s Playback Volume", ctlname);
3151 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3152 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3155 sprintf(name, "%s Playback Switch", ctlname);
3156 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3157 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3163 /* create playback/capture controls for input pins */
3164 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3165 const struct auto_pin_cfg *cfg)
3167 struct hda_input_mux *imux = &spec->private_imux;
3170 for (i = 0; i < AUTO_PIN_LAST; i++) {
3171 if (alc880_is_input_pin(cfg->input_pins[i])) {
3172 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3173 err = new_analog_input(spec, cfg->input_pins[i],
3174 auto_pin_cfg_labels[i],
3178 imux->items[imux->num_items].label =
3179 auto_pin_cfg_labels[i];
3180 imux->items[imux->num_items].index =
3181 alc880_input_pin_idx(cfg->input_pins[i]);
3188 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3189 hda_nid_t nid, int pin_type,
3193 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3195 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3197 /* need the manual connection? */
3198 if (alc880_is_multi_pin(nid)) {
3199 struct alc_spec *spec = codec->spec;
3200 int idx = alc880_multi_pin_idx(nid);
3201 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3202 AC_VERB_SET_CONNECT_SEL,
3203 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3207 static int get_pin_type(int line_out_type)
3209 if (line_out_type == AUTO_PIN_HP_OUT)
3215 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3217 struct alc_spec *spec = codec->spec;
3220 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3221 for (i = 0; i < spec->autocfg.line_outs; i++) {
3222 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3223 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3224 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3228 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3230 struct alc_spec *spec = codec->spec;
3233 pin = spec->autocfg.speaker_pins[0];
3234 if (pin) /* connect to front */
3235 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3236 pin = spec->autocfg.hp_pins[0];
3237 if (pin) /* connect to front */
3238 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3241 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3243 struct alc_spec *spec = codec->spec;
3246 for (i = 0; i < AUTO_PIN_LAST; i++) {
3247 hda_nid_t nid = spec->autocfg.input_pins[i];
3248 if (alc880_is_input_pin(nid)) {
3249 snd_hda_codec_write(codec, nid, 0,
3250 AC_VERB_SET_PIN_WIDGET_CONTROL,
3251 i <= AUTO_PIN_FRONT_MIC ?
3252 PIN_VREF80 : PIN_IN);
3253 if (nid != ALC880_PIN_CD_NID)
3254 snd_hda_codec_write(codec, nid, 0,
3255 AC_VERB_SET_AMP_GAIN_MUTE,
3261 /* parse the BIOS configuration and set up the alc_spec */
3262 /* return 1 if successful, 0 if the proper config is not found,
3263 * or a negative error code
3265 static int alc880_parse_auto_config(struct hda_codec *codec)
3267 struct alc_spec *spec = codec->spec;
3269 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3271 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3275 if (!spec->autocfg.line_outs)
3276 return 0; /* can't find valid BIOS pin config */
3278 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3281 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3284 err = alc880_auto_create_extra_out(spec,
3285 spec->autocfg.speaker_pins[0],
3289 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3293 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3297 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3299 if (spec->autocfg.dig_out_pin)
3300 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3301 if (spec->autocfg.dig_in_pin)
3302 spec->dig_in_nid = ALC880_DIGIN_NID;
3304 if (spec->kctl_alloc)
3305 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3307 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3309 spec->num_mux_defs = 1;
3310 spec->input_mux = &spec->private_imux;
3315 /* additional initialization for auto-configuration model */
3316 static void alc880_auto_init(struct hda_codec *codec)
3318 alc880_auto_init_multi_out(codec);
3319 alc880_auto_init_extra_out(codec);
3320 alc880_auto_init_analog_input(codec);
3324 * OK, here we have finally the patch for ALC880
3327 static int patch_alc880(struct hda_codec *codec)
3329 struct alc_spec *spec;
3333 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3339 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3342 if (board_config < 0) {
3343 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3344 "trying auto-probe from BIOS...\n");
3345 board_config = ALC880_AUTO;
3348 if (board_config == ALC880_AUTO) {
3349 /* automatic parse from the BIOS config */
3350 err = alc880_parse_auto_config(codec);
3356 "hda_codec: Cannot set up configuration "
3357 "from BIOS. Using 3-stack mode...\n");
3358 board_config = ALC880_3ST;
3362 if (board_config != ALC880_AUTO)
3363 setup_preset(spec, &alc880_presets[board_config]);
3365 spec->stream_name_analog = "ALC880 Analog";
3366 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3367 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3369 spec->stream_name_digital = "ALC880 Digital";
3370 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3371 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3373 if (!spec->adc_nids && spec->input_mux) {
3374 /* check whether NID 0x07 is valid */
3375 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3377 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3378 if (wcap != AC_WID_AUD_IN) {
3379 spec->adc_nids = alc880_adc_nids_alt;
3380 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3381 spec->mixers[spec->num_mixers] =
3382 alc880_capture_alt_mixer;
3385 spec->adc_nids = alc880_adc_nids;
3386 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3387 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3392 codec->patch_ops = alc_patch_ops;
3393 if (board_config == ALC880_AUTO)
3394 spec->init_hook = alc880_auto_init;
3395 #ifdef CONFIG_SND_HDA_POWER_SAVE
3396 if (!spec->loopback.amplist)
3397 spec->loopback.amplist = alc880_loopbacks;
3408 static hda_nid_t alc260_dac_nids[1] = {
3413 static hda_nid_t alc260_adc_nids[1] = {
3418 static hda_nid_t alc260_adc_nids_alt[1] = {
3423 static hda_nid_t alc260_hp_adc_nids[2] = {
3428 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3429 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3431 static hda_nid_t alc260_dual_adc_nids[2] = {
3436 #define ALC260_DIGOUT_NID 0x03
3437 #define ALC260_DIGIN_NID 0x06
3439 static struct hda_input_mux alc260_capture_source = {
3443 { "Front Mic", 0x1 },
3449 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3450 * headphone jack and the internal CD lines since these are the only pins at
3451 * which audio can appear. For flexibility, also allow the option of
3452 * recording the mixer output on the second ADC (ADC0 doesn't have a
3453 * connection to the mixer output).
3455 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3459 { "Mic/Line", 0x0 },
3461 { "Headphone", 0x2 },
3467 { "Mic/Line", 0x0 },
3469 { "Headphone", 0x2 },
3476 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3477 * the Fujitsu S702x, but jacks are marked differently.
3479 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3486 { "Headphone", 0x5 },
3495 { "Headphone", 0x6 },
3501 * This is just place-holder, so there's something for alc_build_pcms to look
3502 * at when it calculates the maximum number of channels. ALC260 has no mixer
3503 * element which allows changing the channel mode, so the verb list is
3506 static struct hda_channel_mode alc260_modes[1] = {
3511 /* Mixer combinations
3513 * basic: base_output + input + pc_beep + capture
3514 * HP: base_output + input + capture_alt
3515 * HP_3013: hp_3013 + input + capture
3516 * fujitsu: fujitsu + capture
3517 * acer: acer + capture
3520 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3521 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3522 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3523 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3524 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3525 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3526 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3530 static struct snd_kcontrol_new alc260_input_mixer[] = {
3531 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3532 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3533 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3534 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3536 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3537 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3538 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3542 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3543 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3544 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3548 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3549 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3550 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3551 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3552 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3553 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3555 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3556 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3560 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3561 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3563 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3564 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3565 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3566 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3567 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3568 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3569 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3570 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3571 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3572 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3573 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3574 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3575 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3579 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3580 * versions of the ALC260 don't act on requests to enable mic bias from NID
3581 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3582 * datasheet doesn't mention this restriction. At this stage it's not clear
3583 * whether this behaviour is intentional or is a hardware bug in chip
3584 * revisions available in early 2006. Therefore for now allow the
3585 * "Headphone Jack Mode" control to span all choices, but if it turns out
3586 * that the lack of mic bias for this NID is intentional we could change the
3587 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3589 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3590 * don't appear to make the mic bias available from the "line" jack, even
3591 * though the NID used for this jack (0x14) can supply it. The theory is
3592 * that perhaps Acer have included blocking capacitors between the ALC260
3593 * and the output jack. If this turns out to be the case for all such
3594 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3595 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3597 * The C20x Tablet series have a mono internal speaker which is controlled
3598 * via the chip's Mono sum widget and pin complex, so include the necessary
3599 * controls for such models. On models without a "mono speaker" the control
3600 * won't do anything.
3602 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3603 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3604 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3605 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3606 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3608 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3610 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3611 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3613 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3614 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3615 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3616 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3617 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3618 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3619 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3623 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3624 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3626 static struct snd_kcontrol_new alc260_will_mixer[] = {
3627 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3628 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3630 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3631 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3632 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3633 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3634 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3635 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3636 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3637 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3638 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3642 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3643 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3645 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3646 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3647 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3649 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3650 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3651 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3652 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3653 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3654 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3655 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3659 /* capture mixer elements */
3660 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3661 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3662 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3663 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3664 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3667 /* The multiple "Capture Source" controls confuse alsamixer
3668 * So call somewhat different..
3669 * FIXME: the controls appear in the "playback" view!
3671 /* .name = "Capture Source", */
3672 .name = "Input Source",
3674 .info = alc_mux_enum_info,
3675 .get = alc_mux_enum_get,
3676 .put = alc_mux_enum_put,
3681 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3682 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3683 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3685 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3686 /* The multiple "Capture Source" controls confuse alsamixer
3687 * So call somewhat different..
3688 * FIXME: the controls appear in the "playback" view!
3690 /* .name = "Capture Source", */
3691 .name = "Input Source",
3693 .info = alc_mux_enum_info,
3694 .get = alc_mux_enum_get,
3695 .put = alc_mux_enum_put,
3701 * initialization verbs
3703 static struct hda_verb alc260_init_verbs[] = {
3704 /* Line In pin widget for input */
3705 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3706 /* CD pin widget for input */
3707 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3708 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3709 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3710 /* Mic2 (front panel) pin widget for input and vref at 80% */
3711 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3712 /* LINE-2 is used for line-out in rear */
3713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3714 /* select line-out */
3715 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3717 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3719 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3721 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3722 /* mute capture amp left and right */
3723 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3724 /* set connection select to line in (default select for this ADC) */
3725 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3726 /* mute capture amp left and right */
3727 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3728 /* set connection select to line in (default select for this ADC) */
3729 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3730 /* set vol=0 Line-Out mixer amp left and right */
3731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3732 /* unmute pin widget amp left and right (no gain on this amp) */
3733 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3734 /* set vol=0 HP mixer amp left and right */
3735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3736 /* unmute pin widget amp left and right (no gain on this amp) */
3737 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3738 /* set vol=0 Mono mixer amp left and right */
3739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3740 /* unmute pin widget amp left and right (no gain on this amp) */
3741 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3742 /* unmute LINE-2 out pin */
3743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3747 /* mute analog inputs */
3748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3753 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3754 /* mute Front out path */
3755 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3757 /* mute Headphone out path */
3758 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3760 /* mute Mono out path */
3761 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3762 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3766 #if 0 /* should be identical with alc260_init_verbs? */
3767 static struct hda_verb alc260_hp_init_verbs[] = {
3768 /* Headphone and output */
3769 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3771 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3772 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3773 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3774 /* Mic2 (front panel) pin widget for input and vref at 80% */
3775 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3776 /* Line In pin widget for input */
3777 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3778 /* Line-2 pin widget for output */
3779 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3780 /* CD pin widget for input */
3781 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3782 /* unmute amp left and right */
3783 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3784 /* set connection select to line in (default select for this ADC) */
3785 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3786 /* unmute Line-Out mixer amp left and right (volume = 0) */
3787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3788 /* mute pin widget amp left and right (no gain on this amp) */
3789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3790 /* unmute HP mixer amp left and right (volume = 0) */
3791 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3792 /* mute pin widget amp left and right (no gain on this amp) */
3793 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3794 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3797 /* mute analog inputs */
3798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3803 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3804 /* Unmute Front out path */
3805 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3807 /* Unmute Headphone out path */
3808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3810 /* Unmute Mono out path */
3811 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3812 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3817 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3818 /* Line out and output */
3819 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3821 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3822 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3824 /* Mic2 (front panel) pin widget for input and vref at 80% */
3825 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3826 /* Line In pin widget for input */
3827 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3828 /* Headphone pin widget for output */
3829 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3830 /* CD pin widget for input */
3831 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3832 /* unmute amp left and right */
3833 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3834 /* set connection select to line in (default select for this ADC) */
3835 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3836 /* unmute Line-Out mixer amp left and right (volume = 0) */
3837 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3838 /* mute pin widget amp left and right (no gain on this amp) */
3839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3840 /* unmute HP mixer amp left and right (volume = 0) */
3841 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3842 /* mute pin widget amp left and right (no gain on this amp) */
3843 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3844 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3847 /* mute analog inputs */
3848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3853 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3854 /* Unmute Front out path */
3855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3857 /* Unmute Headphone out path */
3858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3859 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3860 /* Unmute Mono out path */
3861 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3862 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3866 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3867 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3868 * audio = 0x16, internal speaker = 0x10.
3870 static struct hda_verb alc260_fujitsu_init_verbs[] = {
3871 /* Disable all GPIOs */
3872 {0x01, AC_VERB_SET_GPIO_MASK, 0},
3873 /* Internal speaker is connected to headphone pin */
3874 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3875 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3876 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3877 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3878 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3879 /* Ensure all other unused pins are disabled and muted. */
3880 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3882 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3883 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3884 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3885 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3886 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3889 /* Disable digital (SPDIF) pins */
3890 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3891 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3893 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3894 * when acting as an output.
3896 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3898 /* Start with output sum widgets muted and their output gains at min */
3899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3902 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3905 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3906 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3909 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3910 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3911 /* Unmute Line1 pin widget output buffer since it starts as an output.
3912 * If the pin mode is changed by the user the pin mode control will
3913 * take care of enabling the pin's input/output buffers as needed.
3914 * Therefore there's no need to enable the input buffer at this
3917 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3918 /* Unmute input buffer of pin widget used for Line-in (no equiv
3921 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3923 /* Mute capture amp left and right */
3924 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3925 /* Set ADC connection select to match default mixer setting - line
3928 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
3930 /* Do the same for the second ADC: mute capture input amp and
3931 * set ADC connection to line in (on mic1 pin)
3933 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3934 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
3936 /* Mute all inputs to mixer widget (even unconnected ones) */
3937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
3938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
3939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
3940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
3941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
3942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
3944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
3949 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3950 * similar laptops (adapted from Fujitsu init verbs).
3952 static struct hda_verb alc260_acer_init_verbs[] = {
3953 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3954 * the headphone jack. Turn this on and rely on the standard mute
3955 * methods whenever the user wants to turn these outputs off.
3957 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
3958 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
3959 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
3960 /* Internal speaker/Headphone jack is connected to Line-out pin */
3961 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3962 /* Internal microphone/Mic jack is connected to Mic1 pin */
3963 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3964 /* Line In jack is connected to Line1 pin */
3965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3966 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
3967 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3968 /* Ensure all other unused pins are disabled and muted. */
3969 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3970 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3971 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3972 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3973 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3975 /* Disable digital (SPDIF) pins */
3976 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3977 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3979 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3980 * bus when acting as outputs.
3982 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
3983 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3985 /* Start with output sum widgets muted and their output gains at min */
3986 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3991 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3992 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3993 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3994 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3996 /* Unmute Line-out pin widget amp left and right
3997 * (no equiv mixer ctrl)
3999 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4000 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4001 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4002 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4003 * inputs. If the pin mode is changed by the user the pin mode control
4004 * will take care of enabling the pin's input/output buffers as needed.
4005 * Therefore there's no need to enable the input buffer at this
4008 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4011 /* Mute capture amp left and right */
4012 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4013 /* Set ADC connection select to match default mixer setting - mic
4016 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4018 /* Do similar with the second ADC: mute capture input amp and
4019 * set ADC connection to mic to match ALSA's default state.
4021 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4022 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4024 /* Mute all inputs to mixer widget (even unconnected ones) */
4025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4037 static struct hda_verb alc260_will_verbs[] = {
4038 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4039 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4040 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4041 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4042 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4043 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4047 static struct hda_verb alc260_replacer_672v_verbs[] = {
4048 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4049 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4050 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4052 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4053 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4054 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4056 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4060 /* toggle speaker-output according to the hp-jack state */
4061 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4063 unsigned int present;
4065 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4066 present = snd_hda_codec_read(codec, 0x0f, 0,
4067 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4069 snd_hda_codec_write_cache(codec, 0x01, 0,
4070 AC_VERB_SET_GPIO_DATA, 1);
4071 snd_hda_codec_write_cache(codec, 0x0f, 0,
4072 AC_VERB_SET_PIN_WIDGET_CONTROL,
4075 snd_hda_codec_write_cache(codec, 0x01, 0,
4076 AC_VERB_SET_GPIO_DATA, 0);
4077 snd_hda_codec_write_cache(codec, 0x0f, 0,
4078 AC_VERB_SET_PIN_WIDGET_CONTROL,
4083 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4086 if ((res >> 26) == ALC880_HP_EVENT)
4087 alc260_replacer_672v_automute(codec);
4090 /* Test configuration for debugging, modelled after the ALC880 test
4093 #ifdef CONFIG_SND_DEBUG
4094 static hda_nid_t alc260_test_dac_nids[1] = {
4097 static hda_nid_t alc260_test_adc_nids[2] = {
4100 /* For testing the ALC260, each input MUX needs its own definition since
4101 * the signal assignments are different. This assumes that the first ADC
4104 static struct hda_input_mux alc260_test_capture_sources[2] = {
4108 { "MIC1 pin", 0x0 },
4109 { "MIC2 pin", 0x1 },
4110 { "LINE1 pin", 0x2 },
4111 { "LINE2 pin", 0x3 },
4113 { "LINE-OUT pin", 0x5 },
4114 { "HP-OUT pin", 0x6 },
4120 { "MIC1 pin", 0x0 },
4121 { "MIC2 pin", 0x1 },
4122 { "LINE1 pin", 0x2 },
4123 { "LINE2 pin", 0x3 },
4126 { "LINE-OUT pin", 0x6 },
4127 { "HP-OUT pin", 0x7 },
4131 static struct snd_kcontrol_new alc260_test_mixer[] = {
4132 /* Output driver widgets */
4133 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4134 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4135 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4136 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4137 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4138 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4140 /* Modes for retasking pin widgets
4141 * Note: the ALC260 doesn't seem to act on requests to enable mic
4142 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4143 * mention this restriction. At this stage it's not clear whether
4144 * this behaviour is intentional or is a hardware bug in chip
4145 * revisions available at least up until early 2006. Therefore for
4146 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4147 * choices, but if it turns out that the lack of mic bias for these
4148 * NIDs is intentional we could change their modes from
4149 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4151 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4152 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4153 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4154 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4155 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4156 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4158 /* Loopback mixer controls */
4159 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4160 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4161 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4162 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4163 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4164 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4165 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4166 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4167 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4168 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4169 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4170 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4171 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4172 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4173 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4174 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4176 /* Controls for GPIO pins, assuming they are configured as outputs */
4177 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4178 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4179 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4180 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4182 /* Switches to allow the digital IO pins to be enabled. The datasheet
4183 * is ambigious as to which NID is which; testing on laptops which
4184 * make this output available should provide clarification.
4186 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4187 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4191 static struct hda_verb alc260_test_init_verbs[] = {
4192 /* Enable all GPIOs as outputs with an initial value of 0 */
4193 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4194 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4195 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4197 /* Enable retasking pins as output, initially without power amp */
4198 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4199 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4201 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4202 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4203 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4205 /* Disable digital (SPDIF) pins initially, but users can enable
4206 * them via a mixer switch. In the case of SPDIF-out, this initverb
4207 * payload also sets the generation to 0, output to be in "consumer"
4208 * PCM format, copyright asserted, no pre-emphasis and no validity
4211 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4212 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4214 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4215 * OUT1 sum bus when acting as an output.
4217 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4218 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4219 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4220 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4222 /* Start with output sum widgets muted and their output gains at min */
4223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4224 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4225 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4227 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4228 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4229 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4230 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4231 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4233 /* Unmute retasking pin widget output buffers since the default
4234 * state appears to be output. As the pin mode is changed by the
4235 * user the pin mode control will take care of enabling the pin's
4236 * input/output buffers as needed.
4238 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4241 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4242 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4243 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4244 /* Also unmute the mono-out pin widget */
4245 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4247 /* Mute capture amp left and right */
4248 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4249 /* Set ADC connection select to match default mixer setting (mic1
4252 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4254 /* Do the same for the second ADC: mute capture input amp and
4255 * set ADC connection to mic1 pin
4257 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4258 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4260 /* Mute all inputs to mixer widget (even unconnected ones) */
4261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4263 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4274 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4280 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4286 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4287 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4290 * for BIOS auto-configuration
4293 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4297 unsigned long vol_val, sw_val;
4301 if (nid >= 0x0f && nid < 0x11) {
4302 nid_vol = nid - 0x7;
4303 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4304 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4305 } else if (nid == 0x11) {
4306 nid_vol = nid - 0x7;
4307 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4308 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4309 } else if (nid >= 0x12 && nid <= 0x15) {
4311 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4312 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4316 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4317 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4320 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4321 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4327 /* add playback controls from the parsed DAC table */
4328 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4329 const struct auto_pin_cfg *cfg)
4334 spec->multiout.num_dacs = 1;
4335 spec->multiout.dac_nids = spec->private_dac_nids;
4336 spec->multiout.dac_nids[0] = 0x02;
4338 nid = cfg->line_out_pins[0];
4340 err = alc260_add_playback_controls(spec, nid, "Front");
4345 nid = cfg->speaker_pins[0];
4347 err = alc260_add_playback_controls(spec, nid, "Speaker");
4352 nid = cfg->hp_pins[0];
4354 err = alc260_add_playback_controls(spec, nid, "Headphone");
4361 /* create playback/capture controls for input pins */
4362 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4363 const struct auto_pin_cfg *cfg)
4365 struct hda_input_mux *imux = &spec->private_imux;
4368 for (i = 0; i < AUTO_PIN_LAST; i++) {
4369 if (cfg->input_pins[i] >= 0x12) {
4370 idx = cfg->input_pins[i] - 0x12;
4371 err = new_analog_input(spec, cfg->input_pins[i],
4372 auto_pin_cfg_labels[i], idx,
4376 imux->items[imux->num_items].label =
4377 auto_pin_cfg_labels[i];
4378 imux->items[imux->num_items].index = idx;
4381 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4382 idx = cfg->input_pins[i] - 0x09;
4383 err = new_analog_input(spec, cfg->input_pins[i],
4384 auto_pin_cfg_labels[i], idx,
4388 imux->items[imux->num_items].label =
4389 auto_pin_cfg_labels[i];
4390 imux->items[imux->num_items].index = idx;
4397 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4398 hda_nid_t nid, int pin_type,
4402 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4404 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4406 /* need the manual connection? */
4408 int idx = nid - 0x12;
4409 snd_hda_codec_write(codec, idx + 0x0b, 0,
4410 AC_VERB_SET_CONNECT_SEL, sel_idx);
4414 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4416 struct alc_spec *spec = codec->spec;
4419 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4420 nid = spec->autocfg.line_out_pins[0];
4422 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4423 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4426 nid = spec->autocfg.speaker_pins[0];
4428 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4430 nid = spec->autocfg.hp_pins[0];
4432 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4435 #define ALC260_PIN_CD_NID 0x16
4436 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4438 struct alc_spec *spec = codec->spec;
4441 for (i = 0; i < AUTO_PIN_LAST; i++) {
4442 hda_nid_t nid = spec->autocfg.input_pins[i];
4444 snd_hda_codec_write(codec, nid, 0,
4445 AC_VERB_SET_PIN_WIDGET_CONTROL,
4446 i <= AUTO_PIN_FRONT_MIC ?
4447 PIN_VREF80 : PIN_IN);
4448 if (nid != ALC260_PIN_CD_NID)
4449 snd_hda_codec_write(codec, nid, 0,
4450 AC_VERB_SET_AMP_GAIN_MUTE,
4457 * generic initialization of ADC, input mixers and output mixers
4459 static struct hda_verb alc260_volume_init_verbs[] = {
4461 * Unmute ADC0-1 and set the default input to mic-in
4463 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4464 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4465 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4466 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4468 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4470 * Note: PASD motherboards uses the Line In 2 as the input for
4471 * front panel mic (mic 2)
4473 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4474 /* mute analog inputs */
4475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4478 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4482 * Set up output mixers (0x08 - 0x0a)
4484 /* set vol=0 to output mixers */
4485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4487 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4488 /* set up input amps for analog loopback */
4489 /* Amp Indices: DAC = 0, mixer = 1 */
4490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4494 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4495 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4500 static int alc260_parse_auto_config(struct hda_codec *codec)
4502 struct alc_spec *spec = codec->spec;
4505 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4507 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4511 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4514 if (!spec->kctl_alloc)
4515 return 0; /* can't find valid BIOS pin config */
4516 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4520 spec->multiout.max_channels = 2;
4522 if (spec->autocfg.dig_out_pin)
4523 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4524 if (spec->kctl_alloc)
4525 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4527 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4529 spec->num_mux_defs = 1;
4530 spec->input_mux = &spec->private_imux;
4532 /* check whether NID 0x04 is valid */
4533 wcap = get_wcaps(codec, 0x04);
4534 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4535 if (wcap != AC_WID_AUD_IN) {
4536 spec->adc_nids = alc260_adc_nids_alt;
4537 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4538 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4540 spec->adc_nids = alc260_adc_nids;
4541 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4542 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4549 /* additional initialization for auto-configuration model */
4550 static void alc260_auto_init(struct hda_codec *codec)
4552 alc260_auto_init_multi_out(codec);
4553 alc260_auto_init_analog_input(codec);
4556 #ifdef CONFIG_SND_HDA_POWER_SAVE
4557 static struct hda_amp_list alc260_loopbacks[] = {
4558 { 0x07, HDA_INPUT, 0 },
4559 { 0x07, HDA_INPUT, 1 },
4560 { 0x07, HDA_INPUT, 2 },
4561 { 0x07, HDA_INPUT, 3 },
4562 { 0x07, HDA_INPUT, 4 },
4568 * ALC260 configurations
4570 static const char *alc260_models[ALC260_MODEL_LAST] = {
4571 [ALC260_BASIC] = "basic",
4573 [ALC260_HP_3013] = "hp-3013",
4574 [ALC260_FUJITSU_S702X] = "fujitsu",
4575 [ALC260_ACER] = "acer",
4576 [ALC260_WILL] = "will",
4577 [ALC260_REPLACER_672V] = "replacer",
4578 #ifdef CONFIG_SND_DEBUG
4579 [ALC260_TEST] = "test",
4581 [ALC260_AUTO] = "auto",
4584 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4585 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4586 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4587 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4588 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4589 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4590 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4591 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4592 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4593 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4594 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4595 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4596 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4597 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4598 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4599 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4600 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4601 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4602 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4606 static struct alc_config_preset alc260_presets[] = {
4608 .mixers = { alc260_base_output_mixer,
4610 alc260_pc_beep_mixer,
4611 alc260_capture_mixer },
4612 .init_verbs = { alc260_init_verbs },
4613 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4614 .dac_nids = alc260_dac_nids,
4615 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4616 .adc_nids = alc260_adc_nids,
4617 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4618 .channel_mode = alc260_modes,
4619 .input_mux = &alc260_capture_source,
4622 .mixers = { alc260_base_output_mixer,
4624 alc260_capture_alt_mixer },
4625 .init_verbs = { alc260_init_verbs },
4626 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4627 .dac_nids = alc260_dac_nids,
4628 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4629 .adc_nids = alc260_hp_adc_nids,
4630 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4631 .channel_mode = alc260_modes,
4632 .input_mux = &alc260_capture_source,
4634 [ALC260_HP_3013] = {
4635 .mixers = { alc260_hp_3013_mixer,
4637 alc260_capture_alt_mixer },
4638 .init_verbs = { alc260_hp_3013_init_verbs },
4639 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4640 .dac_nids = alc260_dac_nids,
4641 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4642 .adc_nids = alc260_hp_adc_nids,
4643 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4644 .channel_mode = alc260_modes,
4645 .input_mux = &alc260_capture_source,
4647 [ALC260_FUJITSU_S702X] = {
4648 .mixers = { alc260_fujitsu_mixer,
4649 alc260_capture_mixer },
4650 .init_verbs = { alc260_fujitsu_init_verbs },
4651 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4652 .dac_nids = alc260_dac_nids,
4653 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4654 .adc_nids = alc260_dual_adc_nids,
4655 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4656 .channel_mode = alc260_modes,
4657 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4658 .input_mux = alc260_fujitsu_capture_sources,
4661 .mixers = { alc260_acer_mixer,
4662 alc260_capture_mixer },
4663 .init_verbs = { alc260_acer_init_verbs },
4664 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4665 .dac_nids = alc260_dac_nids,
4666 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4667 .adc_nids = alc260_dual_adc_nids,
4668 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4669 .channel_mode = alc260_modes,
4670 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4671 .input_mux = alc260_acer_capture_sources,
4674 .mixers = { alc260_will_mixer,
4675 alc260_capture_mixer },
4676 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4677 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4678 .dac_nids = alc260_dac_nids,
4679 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4680 .adc_nids = alc260_adc_nids,
4681 .dig_out_nid = ALC260_DIGOUT_NID,
4682 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4683 .channel_mode = alc260_modes,
4684 .input_mux = &alc260_capture_source,
4686 [ALC260_REPLACER_672V] = {
4687 .mixers = { alc260_replacer_672v_mixer,
4688 alc260_capture_mixer },
4689 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4690 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4691 .dac_nids = alc260_dac_nids,
4692 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4693 .adc_nids = alc260_adc_nids,
4694 .dig_out_nid = ALC260_DIGOUT_NID,
4695 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4696 .channel_mode = alc260_modes,
4697 .input_mux = &alc260_capture_source,
4698 .unsol_event = alc260_replacer_672v_unsol_event,
4699 .init_hook = alc260_replacer_672v_automute,
4701 #ifdef CONFIG_SND_DEBUG
4703 .mixers = { alc260_test_mixer,
4704 alc260_capture_mixer },
4705 .init_verbs = { alc260_test_init_verbs },
4706 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4707 .dac_nids = alc260_test_dac_nids,
4708 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4709 .adc_nids = alc260_test_adc_nids,
4710 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4711 .channel_mode = alc260_modes,
4712 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4713 .input_mux = alc260_test_capture_sources,
4718 static int patch_alc260(struct hda_codec *codec)
4720 struct alc_spec *spec;
4721 int err, board_config;
4723 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4729 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4732 if (board_config < 0) {
4733 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4734 "trying auto-probe from BIOS...\n");
4735 board_config = ALC260_AUTO;
4738 if (board_config == ALC260_AUTO) {
4739 /* automatic parse from the BIOS config */
4740 err = alc260_parse_auto_config(codec);
4746 "hda_codec: Cannot set up configuration "
4747 "from BIOS. Using base mode...\n");
4748 board_config = ALC260_BASIC;
4752 if (board_config != ALC260_AUTO)
4753 setup_preset(spec, &alc260_presets[board_config]);
4755 spec->stream_name_analog = "ALC260 Analog";
4756 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4757 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4759 spec->stream_name_digital = "ALC260 Digital";
4760 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4761 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4763 codec->patch_ops = alc_patch_ops;
4764 if (board_config == ALC260_AUTO)
4765 spec->init_hook = alc260_auto_init;
4766 #ifdef CONFIG_SND_HDA_POWER_SAVE
4767 if (!spec->loopback.amplist)
4768 spec->loopback.amplist = alc260_loopbacks;
4778 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4779 * configuration. Each pin widget can choose any input DACs and a mixer.
4780 * Each ADC is connected from a mixer of all inputs. This makes possible
4781 * 6-channel independent captures.
4783 * In addition, an independent DAC for the multi-playback (not used in this
4786 #define ALC882_DIGOUT_NID 0x06
4787 #define ALC882_DIGIN_NID 0x0a
4789 static struct hda_channel_mode alc882_ch_modes[1] = {
4793 static hda_nid_t alc882_dac_nids[4] = {
4794 /* front, rear, clfe, rear_surr */
4795 0x02, 0x03, 0x04, 0x05
4798 /* identical with ALC880 */
4799 #define alc882_adc_nids alc880_adc_nids
4800 #define alc882_adc_nids_alt alc880_adc_nids_alt
4803 /* FIXME: should be a matrix-type input source selection */
4805 static struct hda_input_mux alc882_capture_source = {
4809 { "Front Mic", 0x1 },
4814 #define alc882_mux_enum_info alc_mux_enum_info
4815 #define alc882_mux_enum_get alc_mux_enum_get
4817 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4818 struct snd_ctl_elem_value *ucontrol)
4820 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4821 struct alc_spec *spec = codec->spec;
4822 const struct hda_input_mux *imux = spec->input_mux;
4823 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4824 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4825 hda_nid_t nid = capture_mixers[adc_idx];
4826 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4827 unsigned int i, idx;
4829 idx = ucontrol->value.enumerated.item[0];
4830 if (idx >= imux->num_items)
4831 idx = imux->num_items - 1;
4832 if (*cur_val == idx)
4834 for (i = 0; i < imux->num_items; i++) {
4835 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4836 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4837 imux->items[i].index,
4847 static struct hda_verb alc882_3ST_ch2_init[] = {
4848 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
4849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4858 static struct hda_verb alc882_3ST_ch6_init[] = {
4859 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4860 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4861 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
4862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4864 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4868 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
4869 { 2, alc882_3ST_ch2_init },
4870 { 6, alc882_3ST_ch6_init },
4876 static struct hda_verb alc882_sixstack_ch6_init[] = {
4877 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
4878 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4879 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4880 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4887 static struct hda_verb alc882_sixstack_ch8_init[] = {
4888 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4889 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4890 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4895 static struct hda_channel_mode alc882_sixstack_modes[2] = {
4896 { 6, alc882_sixstack_ch6_init },
4897 { 8, alc882_sixstack_ch8_init },
4901 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
4907 static struct hda_verb alc885_mbp_ch2_init[] = {
4908 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4909 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4910 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4917 static struct hda_verb alc885_mbp_ch6_init[] = {
4918 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4919 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4920 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4921 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4922 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4926 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
4927 { 2, alc885_mbp_ch2_init },
4928 { 6, alc885_mbp_ch6_init },
4932 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4933 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4935 static struct snd_kcontrol_new alc882_base_mixer[] = {
4936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4939 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4940 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
4941 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
4942 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4943 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4944 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4945 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4954 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4955 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
4956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4957 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4958 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4962 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
4963 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT),
4964 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT),
4965 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT),
4966 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT),
4967 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT),
4968 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT),
4969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
4970 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
4971 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT),
4972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
4975 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
4976 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4977 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4979 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4983 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4985 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4986 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4990 static struct snd_kcontrol_new alc882_targa_mixer[] = {
4991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4994 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4995 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4996 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4997 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5000 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5001 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5005 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5006 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5008 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
5009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5010 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5012 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
5013 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5014 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5015 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5016 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5017 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
5018 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
5019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5024 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
5026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5027 .name = "Channel Mode",
5028 .info = alc_ch_mode_info,
5029 .get = alc_ch_mode_get,
5030 .put = alc_ch_mode_put,
5035 static struct hda_verb alc882_init_verbs[] = {
5036 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5041 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5042 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5046 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5047 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5049 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5051 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5053 /* Front Pin: output 0 (0x0c) */
5054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5056 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5057 /* Rear Pin: output 1 (0x0d) */
5058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5060 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5061 /* CLFE Pin: output 2 (0x0e) */
5062 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5063 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5064 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5065 /* Side Pin: output 3 (0x0f) */
5066 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5067 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5068 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5069 /* Mic (rear) pin: input vref at 80% */
5070 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5071 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5072 /* Front Mic pin: input vref at 80% */
5073 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5075 /* Line In pin: input */
5076 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5077 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5078 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5081 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5082 /* CD pin widget for input */
5083 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5085 /* FIXME: use matrix-type input source selection */
5086 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5087 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5090 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5102 /* ADC1: mute amp left and right */
5103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5104 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5105 /* ADC2: mute amp left and right */
5106 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5107 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5108 /* ADC3: mute amp left and right */
5109 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5110 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5115 static struct hda_verb alc882_eapd_verbs[] = {
5116 /* change to EAPD mode */
5117 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5118 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5123 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5129 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5130 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5134 static struct hda_verb alc882_macpro_init_verbs[] = {
5135 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5139 /* Front Pin: output 0 (0x0c) */
5140 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5143 /* Front Mic pin: input vref at 80% */
5144 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5146 /* Speaker: output */
5147 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5148 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5149 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5150 /* Headphone output (output 0 - 0x0c) */
5151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5152 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5153 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5155 /* FIXME: use matrix-type input source selection */
5156 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5157 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5161 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5164 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5166 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5172 /* ADC1: mute amp left and right */
5173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5174 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5175 /* ADC2: mute amp left and right */
5176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5177 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5178 /* ADC3: mute amp left and right */
5179 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5180 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5185 /* Macbook Pro rev3 */
5186 static struct hda_verb alc885_mbp3_init_verbs[] = {
5187 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5192 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5194 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5195 /* Front Pin: output 0 (0x0c) */
5196 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5198 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5199 /* HP Pin: output 0 (0x0d) */
5200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
5201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5202 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5203 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5204 /* Mic (rear) pin: input vref at 80% */
5205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5207 /* Front Mic pin: input vref at 80% */
5208 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5210 /* Line In pin: use output 1 when in LineOut mode */
5211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5213 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
5215 /* FIXME: use matrix-type input source selection */
5216 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5217 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5223 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5224 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5225 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5226 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5231 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5232 /* ADC1: mute amp left and right */
5233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5234 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5235 /* ADC2: mute amp left and right */
5236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5237 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5238 /* ADC3: mute amp left and right */
5239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5240 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5245 /* iMac 24 mixer. */
5246 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5247 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5248 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5252 /* iMac 24 init verbs. */
5253 static struct hda_verb alc885_imac24_init_verbs[] = {
5254 /* Internal speakers: output 0 (0x0c) */
5255 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5257 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5258 /* Internal speakers: output 0 (0x0c) */
5259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5260 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5261 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5262 /* Headphone: output 0 (0x0c) */
5263 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5264 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5265 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5266 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5267 /* Front Mic: input vref at 80% */
5268 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5269 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5273 /* Toggle speaker-output according to the hp-jack state */
5274 static void alc885_imac24_automute(struct hda_codec *codec)
5276 unsigned int present;
5278 present = snd_hda_codec_read(codec, 0x14, 0,
5279 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5280 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5281 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5282 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5283 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5286 /* Processes unsolicited events. */
5287 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5290 /* Headphone insertion or removal. */
5291 if ((res >> 26) == ALC880_HP_EVENT)
5292 alc885_imac24_automute(codec);
5295 static void alc885_mbp3_automute(struct hda_codec *codec)
5297 unsigned int present;
5299 present = snd_hda_codec_read(codec, 0x15, 0,
5300 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5301 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
5302 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5303 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
5304 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
5307 static void alc885_mbp3_unsol_event(struct hda_codec *codec,
5310 /* Headphone insertion or removal. */
5311 if ((res >> 26) == ALC880_HP_EVENT)
5312 alc885_mbp3_automute(codec);
5316 static struct hda_verb alc882_targa_verbs[] = {
5317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5321 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5323 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5324 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5325 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5327 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5328 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5329 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5330 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5334 /* toggle speaker-output according to the hp-jack state */
5335 static void alc882_targa_automute(struct hda_codec *codec)
5337 unsigned int present;
5339 present = snd_hda_codec_read(codec, 0x14, 0,
5340 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5341 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5342 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5343 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5347 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5349 /* Looks like the unsol event is incompatible with the standard
5350 * definition. 4bit tag is placed at 26 bit!
5352 if (((res >> 26) == ALC880_HP_EVENT)) {
5353 alc882_targa_automute(codec);
5357 static struct hda_verb alc882_asus_a7j_verbs[] = {
5358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5363 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5365 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5366 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5367 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5369 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5370 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5371 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5375 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5377 unsigned int gpiostate, gpiomask, gpiodir;
5379 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5380 AC_VERB_GET_GPIO_DATA, 0);
5383 gpiostate |= (1 << pin);
5385 gpiostate &= ~(1 << pin);
5387 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5388 AC_VERB_GET_GPIO_MASK, 0);
5389 gpiomask |= (1 << pin);
5391 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5392 AC_VERB_GET_GPIO_DIRECTION, 0);
5393 gpiodir |= (1 << pin);
5396 snd_hda_codec_write(codec, codec->afg, 0,
5397 AC_VERB_SET_GPIO_MASK, gpiomask);
5398 snd_hda_codec_write(codec, codec->afg, 0,
5399 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5403 snd_hda_codec_write(codec, codec->afg, 0,
5404 AC_VERB_SET_GPIO_DATA, gpiostate);
5407 /* set up GPIO at initialization */
5408 static void alc885_macpro_init_hook(struct hda_codec *codec)
5410 alc882_gpio_mute(codec, 0, 0);
5411 alc882_gpio_mute(codec, 1, 0);
5414 /* set up GPIO and update auto-muting at initialization */
5415 static void alc885_imac24_init_hook(struct hda_codec *codec)
5417 alc885_macpro_init_hook(codec);
5418 alc885_imac24_automute(codec);
5422 * generic initialization of ADC, input mixers and output mixers
5424 static struct hda_verb alc882_auto_init_verbs[] = {
5426 * Unmute ADC0-2 and set the default input to mic-in
5428 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5430 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5431 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5432 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5435 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5437 * Note: PASD motherboards uses the Line In 2 as the input for
5438 * front panel mic (mic 2)
5440 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5448 * Set up output mixers (0x0c - 0x0f)
5450 /* set vol=0 to output mixers */
5451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5452 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5453 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5454 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5455 /* set up input amps for analog loopback */
5456 /* Amp Indices: DAC = 0, mixer = 1 */
5457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5460 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5463 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5465 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5466 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5468 /* FIXME: use matrix-type input source selection */
5469 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5470 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5489 /* capture mixer elements */
5490 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5491 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5492 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5493 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5494 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5496 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5497 /* The multiple "Capture Source" controls confuse alsamixer
5498 * So call somewhat different..
5499 * FIXME: the controls appear in the "playback" view!
5501 /* .name = "Capture Source", */
5502 .name = "Input Source",
5504 .info = alc882_mux_enum_info,
5505 .get = alc882_mux_enum_get,
5506 .put = alc882_mux_enum_put,
5511 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5512 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5513 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5514 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5515 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5516 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5517 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5520 /* The multiple "Capture Source" controls confuse alsamixer
5521 * So call somewhat different..
5522 * FIXME: the controls appear in the "playback" view!
5524 /* .name = "Capture Source", */
5525 .name = "Input Source",
5527 .info = alc882_mux_enum_info,
5528 .get = alc882_mux_enum_get,
5529 .put = alc882_mux_enum_put,
5534 #ifdef CONFIG_SND_HDA_POWER_SAVE
5535 #define alc882_loopbacks alc880_loopbacks
5538 /* pcm configuration: identiacal with ALC880 */
5539 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5540 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5541 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5542 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5545 * configuration and preset
5547 static const char *alc882_models[ALC882_MODEL_LAST] = {
5548 [ALC882_3ST_DIG] = "3stack-dig",
5549 [ALC882_6ST_DIG] = "6stack-dig",
5550 [ALC882_ARIMA] = "arima",
5551 [ALC882_W2JC] = "w2jc",
5552 [ALC885_MACPRO] = "macpro",
5553 [ALC885_MBP3] = "mbp3",
5554 [ALC885_IMAC24] = "imac24",
5555 [ALC882_AUTO] = "auto",
5558 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5559 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5560 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5561 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5562 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5563 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5564 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5565 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5566 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5567 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5571 static struct alc_config_preset alc882_presets[] = {
5572 [ALC882_3ST_DIG] = {
5573 .mixers = { alc882_base_mixer },
5574 .init_verbs = { alc882_init_verbs },
5575 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5576 .dac_nids = alc882_dac_nids,
5577 .dig_out_nid = ALC882_DIGOUT_NID,
5578 .dig_in_nid = ALC882_DIGIN_NID,
5579 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5580 .channel_mode = alc882_ch_modes,
5582 .input_mux = &alc882_capture_source,
5584 [ALC882_6ST_DIG] = {
5585 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5586 .init_verbs = { alc882_init_verbs },
5587 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5588 .dac_nids = alc882_dac_nids,
5589 .dig_out_nid = ALC882_DIGOUT_NID,
5590 .dig_in_nid = ALC882_DIGIN_NID,
5591 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5592 .channel_mode = alc882_sixstack_modes,
5593 .input_mux = &alc882_capture_source,
5596 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5597 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5598 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5599 .dac_nids = alc882_dac_nids,
5600 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5601 .channel_mode = alc882_sixstack_modes,
5602 .input_mux = &alc882_capture_source,
5605 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5606 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5607 alc880_gpio1_init_verbs },
5608 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5609 .dac_nids = alc882_dac_nids,
5610 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5611 .channel_mode = alc880_threestack_modes,
5613 .input_mux = &alc882_capture_source,
5614 .dig_out_nid = ALC882_DIGOUT_NID,
5617 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
5618 .init_verbs = { alc885_mbp3_init_verbs,
5619 alc880_gpio1_init_verbs },
5620 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5621 .dac_nids = alc882_dac_nids,
5622 .channel_mode = alc885_mbp_6ch_modes,
5623 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
5624 .input_mux = &alc882_capture_source,
5625 .dig_out_nid = ALC882_DIGOUT_NID,
5626 .dig_in_nid = ALC882_DIGIN_NID,
5627 .unsol_event = alc885_mbp3_unsol_event,
5628 .init_hook = alc885_mbp3_automute,
5631 .mixers = { alc882_macpro_mixer },
5632 .init_verbs = { alc882_macpro_init_verbs },
5633 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5634 .dac_nids = alc882_dac_nids,
5635 .dig_out_nid = ALC882_DIGOUT_NID,
5636 .dig_in_nid = ALC882_DIGIN_NID,
5637 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5638 .channel_mode = alc882_ch_modes,
5639 .input_mux = &alc882_capture_source,
5640 .init_hook = alc885_macpro_init_hook,
5643 .mixers = { alc885_imac24_mixer },
5644 .init_verbs = { alc885_imac24_init_verbs },
5645 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5646 .dac_nids = alc882_dac_nids,
5647 .dig_out_nid = ALC882_DIGOUT_NID,
5648 .dig_in_nid = ALC882_DIGIN_NID,
5649 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5650 .channel_mode = alc882_ch_modes,
5651 .input_mux = &alc882_capture_source,
5652 .unsol_event = alc885_imac24_unsol_event,
5653 .init_hook = alc885_imac24_init_hook,
5656 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5657 alc882_capture_mixer },
5658 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5659 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5660 .dac_nids = alc882_dac_nids,
5661 .dig_out_nid = ALC882_DIGOUT_NID,
5662 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5663 .adc_nids = alc882_adc_nids,
5664 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5665 .channel_mode = alc882_3ST_6ch_modes,
5667 .input_mux = &alc882_capture_source,
5668 .unsol_event = alc882_targa_unsol_event,
5669 .init_hook = alc882_targa_automute,
5671 [ALC882_ASUS_A7J] = {
5672 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5673 alc882_capture_mixer },
5674 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5675 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5676 .dac_nids = alc882_dac_nids,
5677 .dig_out_nid = ALC882_DIGOUT_NID,
5678 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5679 .adc_nids = alc882_adc_nids,
5680 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5681 .channel_mode = alc882_3ST_6ch_modes,
5683 .input_mux = &alc882_capture_source,
5692 PINFIX_ABIT_AW9D_MAX
5695 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5696 { 0x15, 0x01080104 }, /* side */
5697 { 0x16, 0x01011012 }, /* rear */
5698 { 0x17, 0x01016011 }, /* clfe */
5702 static const struct alc_pincfg *alc882_pin_fixes[] = {
5703 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5706 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5707 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5712 * BIOS auto configuration
5714 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5715 hda_nid_t nid, int pin_type,
5719 struct alc_spec *spec = codec->spec;
5722 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5725 idx = spec->multiout.dac_nids[dac_idx] - 2;
5727 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5729 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5731 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5735 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5737 struct alc_spec *spec = codec->spec;
5740 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5741 for (i = 0; i <= HDA_SIDE; i++) {
5742 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5743 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5745 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5750 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5752 struct alc_spec *spec = codec->spec;
5755 pin = spec->autocfg.hp_pins[0];
5756 if (pin) /* connect to front */
5758 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5761 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5762 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5764 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5766 struct alc_spec *spec = codec->spec;
5769 for (i = 0; i < AUTO_PIN_LAST; i++) {
5770 hda_nid_t nid = spec->autocfg.input_pins[i];
5771 if (alc882_is_input_pin(nid)) {
5772 snd_hda_codec_write(codec, nid, 0,
5773 AC_VERB_SET_PIN_WIDGET_CONTROL,
5774 i <= AUTO_PIN_FRONT_MIC ?
5775 PIN_VREF80 : PIN_IN);
5776 if (nid != ALC882_PIN_CD_NID)
5777 snd_hda_codec_write(codec, nid, 0,
5778 AC_VERB_SET_AMP_GAIN_MUTE,
5784 /* almost identical with ALC880 parser... */
5785 static int alc882_parse_auto_config(struct hda_codec *codec)
5787 struct alc_spec *spec = codec->spec;
5788 int err = alc880_parse_auto_config(codec);
5793 /* hack - override the init verbs */
5794 spec->init_verbs[0] = alc882_auto_init_verbs;
5798 /* additional initialization for auto-configuration model */
5799 static void alc882_auto_init(struct hda_codec *codec)
5801 alc882_auto_init_multi_out(codec);
5802 alc882_auto_init_hp_out(codec);
5803 alc882_auto_init_analog_input(codec);
5806 static int patch_alc882(struct hda_codec *codec)
5808 struct alc_spec *spec;
5809 int err, board_config;
5811 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5817 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
5821 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
5822 /* Pick up systems that don't supply PCI SSID */
5823 switch (codec->subsystem_id) {
5824 case 0x106b0c00: /* Mac Pro */
5825 board_config = ALC885_MACPRO;
5827 case 0x106b1000: /* iMac 24 */
5828 board_config = ALC885_IMAC24;
5830 case 0x106b2c00: /* Macbook Pro rev3 */
5831 board_config = ALC885_MBP3;
5834 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
5835 "trying auto-probe from BIOS...\n");
5836 board_config = ALC882_AUTO;
5840 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
5842 if (board_config == ALC882_AUTO) {
5843 /* automatic parse from the BIOS config */
5844 err = alc882_parse_auto_config(codec);
5850 "hda_codec: Cannot set up configuration "
5851 "from BIOS. Using base mode...\n");
5852 board_config = ALC882_3ST_DIG;
5856 if (board_config != ALC882_AUTO)
5857 setup_preset(spec, &alc882_presets[board_config]);
5859 spec->stream_name_analog = "ALC882 Analog";
5860 spec->stream_analog_playback = &alc882_pcm_analog_playback;
5861 spec->stream_analog_capture = &alc882_pcm_analog_capture;
5863 spec->stream_name_digital = "ALC882 Digital";
5864 spec->stream_digital_playback = &alc882_pcm_digital_playback;
5865 spec->stream_digital_capture = &alc882_pcm_digital_capture;
5867 if (!spec->adc_nids && spec->input_mux) {
5868 /* check whether NID 0x07 is valid */
5869 unsigned int wcap = get_wcaps(codec, 0x07);
5871 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5872 if (wcap != AC_WID_AUD_IN) {
5873 spec->adc_nids = alc882_adc_nids_alt;
5874 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
5875 spec->mixers[spec->num_mixers] =
5876 alc882_capture_alt_mixer;
5879 spec->adc_nids = alc882_adc_nids;
5880 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
5881 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
5886 codec->patch_ops = alc_patch_ops;
5887 if (board_config == ALC882_AUTO)
5888 spec->init_hook = alc882_auto_init;
5889 #ifdef CONFIG_SND_HDA_POWER_SAVE
5890 if (!spec->loopback.amplist)
5891 spec->loopback.amplist = alc882_loopbacks;
5900 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
5901 * configuration. Each pin widget can choose any input DACs and a mixer.
5902 * Each ADC is connected from a mixer of all inputs. This makes possible
5903 * 6-channel independent captures.
5905 * In addition, an independent DAC for the multi-playback (not used in this
5908 #define ALC883_DIGOUT_NID 0x06
5909 #define ALC883_DIGIN_NID 0x0a
5911 static hda_nid_t alc883_dac_nids[4] = {
5912 /* front, rear, clfe, rear_surr */
5913 0x02, 0x04, 0x03, 0x05
5916 static hda_nid_t alc883_adc_nids[2] = {
5922 /* FIXME: should be a matrix-type input source selection */
5924 static struct hda_input_mux alc883_capture_source = {
5928 { "Front Mic", 0x1 },
5934 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
5942 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
5952 #define alc883_mux_enum_info alc_mux_enum_info
5953 #define alc883_mux_enum_get alc_mux_enum_get
5955 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5956 struct snd_ctl_elem_value *ucontrol)
5958 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5959 struct alc_spec *spec = codec->spec;
5960 const struct hda_input_mux *imux = spec->input_mux;
5961 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5962 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5963 hda_nid_t nid = capture_mixers[adc_idx];
5964 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5965 unsigned int i, idx;
5967 idx = ucontrol->value.enumerated.item[0];
5968 if (idx >= imux->num_items)
5969 idx = imux->num_items - 1;
5970 if (*cur_val == idx)
5972 for (i = 0; i < imux->num_items; i++) {
5973 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5974 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5975 imux->items[i].index,
5985 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
5992 static struct hda_verb alc883_3ST_ch2_init[] = {
5993 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5994 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5995 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5996 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6003 static struct hda_verb alc883_3ST_ch6_init[] = {
6004 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6005 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6006 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6007 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6008 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6009 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6013 static struct hda_channel_mode alc883_3ST_6ch_modes[2] = {
6014 { 2, alc883_3ST_ch2_init },
6015 { 6, alc883_3ST_ch6_init },
6021 static struct hda_verb alc883_sixstack_ch6_init[] = {
6022 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6023 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6024 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6025 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6032 static struct hda_verb alc883_sixstack_ch8_init[] = {
6033 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6034 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6035 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6036 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6040 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6041 { 6, alc883_sixstack_ch6_init },
6042 { 8, alc883_sixstack_ch8_init },
6045 static struct hda_verb alc883_medion_eapd_verbs[] = {
6046 /* eanable EAPD on medion laptop */
6047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6048 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
6052 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6053 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6056 static struct snd_kcontrol_new alc883_base_mixer[] = {
6057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6059 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6060 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6063 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6064 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6065 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6066 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6068 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6069 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6071 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6076 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6078 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6079 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6080 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6081 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6082 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6083 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6086 /* .name = "Capture Source", */
6087 .name = "Input Source",
6089 .info = alc883_mux_enum_info,
6090 .get = alc883_mux_enum_get,
6091 .put = alc883_mux_enum_put,
6096 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
6097 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6098 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6105 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6107 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6108 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6109 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6110 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6111 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6112 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6113 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6114 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6115 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6118 /* .name = "Capture Source", */
6119 .name = "Input Source",
6121 .info = alc883_mux_enum_info,
6122 .get = alc883_mux_enum_get,
6123 .put = alc883_mux_enum_put,
6128 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
6129 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6130 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6131 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6132 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6133 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6134 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6135 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6136 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6148 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6149 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6150 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6151 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6152 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6153 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6156 /* .name = "Capture Source", */
6157 .name = "Input Source",
6159 .info = alc883_mux_enum_info,
6160 .get = alc883_mux_enum_get,
6161 .put = alc883_mux_enum_put,
6166 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6167 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6168 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6169 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6170 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6171 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6172 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6173 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6174 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6183 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6184 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6185 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6186 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6187 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6188 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6189 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6192 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6193 /* .name = "Capture Source", */
6194 .name = "Input Source",
6196 .info = alc883_mux_enum_info,
6197 .get = alc883_mux_enum_get,
6198 .put = alc883_mux_enum_put,
6203 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6206 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6210 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6211 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6212 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6213 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6214 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6220 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6221 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6222 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6223 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6225 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6226 /* .name = "Capture Source", */
6227 .name = "Input Source",
6229 .info = alc883_mux_enum_info,
6230 .get = alc883_mux_enum_get,
6231 .put = alc883_mux_enum_put,
6236 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6239 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6245 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6246 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6247 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6248 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6250 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6251 /* .name = "Capture Source", */
6252 .name = "Input Source",
6254 .info = alc883_mux_enum_info,
6255 .get = alc883_mux_enum_get,
6256 .put = alc883_mux_enum_put,
6261 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6263 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6264 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6265 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6270 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6271 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6273 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6274 /* .name = "Capture Source", */
6275 .name = "Input Source",
6277 .info = alc883_mux_enum_info,
6278 .get = alc883_mux_enum_get,
6279 .put = alc883_mux_enum_put,
6284 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6285 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6286 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6287 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6288 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6289 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6292 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6293 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6294 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6295 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6296 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6297 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6299 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6300 /* .name = "Capture Source", */
6301 .name = "Input Source",
6303 .info = alc883_mux_enum_info,
6304 .get = alc883_mux_enum_get,
6305 .put = alc883_mux_enum_put,
6310 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6313 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6314 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6315 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6322 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6323 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6325 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6326 /* .name = "Capture Source", */
6327 .name = "Input Source",
6329 .info = alc883_mux_enum_info,
6330 .get = alc883_mux_enum_get,
6331 .put = alc883_mux_enum_put,
6336 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6340 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6341 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6342 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6343 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6344 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6345 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6346 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6355 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6356 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6357 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6358 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6359 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6360 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6361 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6362 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6363 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6365 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6366 /* .name = "Capture Source", */
6367 .name = "Input Source",
6369 .info = alc883_mux_enum_info,
6370 .get = alc883_mux_enum_get,
6371 .put = alc883_mux_enum_put,
6376 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6378 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6380 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6381 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6382 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6383 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6384 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6388 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6389 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6390 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6394 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6396 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6397 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6398 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6399 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6400 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6401 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6404 /* .name = "Capture Source", */
6405 .name = "Input Source",
6407 .info = alc883_mux_enum_info,
6408 .get = alc883_mux_enum_get,
6409 .put = alc883_mux_enum_put,
6414 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6422 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6423 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6424 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6425 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6426 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6428 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6429 /* .name = "Capture Source", */
6430 .name = "Input Source",
6432 .info = alc883_mux_enum_info,
6433 .get = alc883_mux_enum_get,
6434 .put = alc883_mux_enum_put,
6439 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6442 .name = "Channel Mode",
6443 .info = alc_ch_mode_info,
6444 .get = alc_ch_mode_get,
6445 .put = alc_ch_mode_put,
6450 static struct hda_verb alc883_init_verbs[] = {
6451 /* ADC1: mute amp left and right */
6452 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6453 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6454 /* ADC2: mute amp left and right */
6455 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6456 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6457 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6458 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6459 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6462 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6474 /* mute analog input loopbacks */
6475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6477 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6478 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6481 /* Front Pin: output 0 (0x0c) */
6482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6485 /* Rear Pin: output 1 (0x0d) */
6486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6488 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6489 /* CLFE Pin: output 2 (0x0e) */
6490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6491 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6492 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6493 /* Side Pin: output 3 (0x0f) */
6494 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6495 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6496 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6497 /* Mic (rear) pin: input vref at 80% */
6498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6500 /* Front Mic pin: input vref at 80% */
6501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6503 /* Line In pin: input */
6504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6506 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6510 /* CD pin widget for input */
6511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6513 /* FIXME: use matrix-type input source selection */
6514 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6521 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6522 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6528 static struct hda_verb alc883_tagra_verbs[] = {
6529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6532 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6535 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6536 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6540 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6541 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6542 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6547 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6550 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6554 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6555 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6556 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6557 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6558 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6562 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6566 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6567 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6571 static struct hda_verb alc883_haier_w66_verbs[] = {
6572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6577 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6578 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6579 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6580 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6584 static struct hda_verb alc888_6st_hp_verbs[] = {
6585 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6586 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6587 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6588 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6592 static struct hda_verb alc888_3st_hp_verbs[] = {
6593 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6594 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6595 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6599 static struct hda_verb alc888_3st_hp_2ch_init[] = {
6600 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6601 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6602 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6603 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6607 static struct hda_verb alc888_3st_hp_6ch_init[] = {
6608 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6609 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6610 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6611 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6615 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
6616 { 2, alc888_3st_hp_2ch_init },
6617 { 6, alc888_3st_hp_6ch_init },
6620 /* toggle front-jack and RCA according to the hp-jack state */
6621 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6623 unsigned int present;
6625 present = snd_hda_codec_read(codec, 0x1b, 0,
6626 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6627 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6628 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6629 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6630 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6633 /* toggle RCA according to the front-jack state */
6634 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6636 unsigned int present;
6638 present = snd_hda_codec_read(codec, 0x14, 0,
6639 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6640 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6641 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6644 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6647 if ((res >> 26) == ALC880_HP_EVENT)
6648 alc888_lenovo_ms7195_front_automute(codec);
6649 if ((res >> 26) == ALC880_FRONT_EVENT)
6650 alc888_lenovo_ms7195_rca_automute(codec);
6653 static struct hda_verb alc883_medion_md2_verbs[] = {
6654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6657 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6663 /* toggle speaker-output according to the hp-jack state */
6664 static void alc883_medion_md2_automute(struct hda_codec *codec)
6666 unsigned int present;
6668 present = snd_hda_codec_read(codec, 0x14, 0,
6669 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6670 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6671 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6674 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
6677 if ((res >> 26) == ALC880_HP_EVENT)
6678 alc883_medion_md2_automute(codec);
6681 /* toggle speaker-output according to the hp-jack state */
6682 static void alc883_tagra_automute(struct hda_codec *codec)
6684 unsigned int present;
6687 present = snd_hda_codec_read(codec, 0x14, 0,
6688 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6689 bits = present ? HDA_AMP_MUTE : 0;
6690 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6691 HDA_AMP_MUTE, bits);
6692 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6696 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
6698 if ((res >> 26) == ALC880_HP_EVENT)
6699 alc883_tagra_automute(codec);
6702 static void alc883_haier_w66_automute(struct hda_codec *codec)
6704 unsigned int present;
6707 present = snd_hda_codec_read(codec, 0x1b, 0,
6708 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6709 bits = present ? 0x80 : 0;
6710 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6714 static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
6717 if ((res >> 26) == ALC880_HP_EVENT)
6718 alc883_haier_w66_automute(codec);
6721 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6723 unsigned int present;
6726 present = snd_hda_codec_read(codec, 0x14, 0,
6727 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6728 bits = present ? HDA_AMP_MUTE : 0;
6729 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6730 HDA_AMP_MUTE, bits);
6733 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6735 unsigned int present;
6738 present = snd_hda_codec_read(codec, 0x1b, 0,
6739 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6740 bits = present ? HDA_AMP_MUTE : 0;
6741 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6742 HDA_AMP_MUTE, bits);
6743 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6744 HDA_AMP_MUTE, bits);
6747 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
6750 if ((res >> 26) == ALC880_HP_EVENT)
6751 alc883_lenovo_101e_all_automute(codec);
6752 if ((res >> 26) == ALC880_FRONT_EVENT)
6753 alc883_lenovo_101e_ispeaker_automute(codec);
6756 /* toggle speaker-output according to the hp-jack state */
6757 static void alc883_acer_aspire_automute(struct hda_codec *codec)
6759 unsigned int present;
6761 present = snd_hda_codec_read(codec, 0x14, 0,
6762 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6763 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6764 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6765 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
6766 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6769 static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
6772 if ((res >> 26) == ALC880_HP_EVENT)
6773 alc883_acer_aspire_automute(codec);
6776 static struct hda_verb alc883_acer_eapd_verbs[] = {
6777 /* HP Pin: output 0 (0x0c) */
6778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6780 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6781 /* Front Pin: output 0 (0x0c) */
6782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6783 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6784 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6785 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
6786 /* eanable EAPD on medion laptop */
6787 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6788 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
6789 /* enable unsolicited event */
6790 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6795 * generic initialization of ADC, input mixers and output mixers
6797 static struct hda_verb alc883_auto_init_verbs[] = {
6799 * Unmute ADC0-2 and set the default input to mic-in
6801 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6803 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6804 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6806 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6808 * Note: PASD motherboards uses the Line In 2 as the input for
6809 * front panel mic (mic 2)
6811 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6814 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6819 * Set up output mixers (0x0c - 0x0f)
6821 /* set vol=0 to output mixers */
6822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6823 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6825 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6826 /* set up input amps for analog loopback */
6827 /* Amp Indices: DAC = 0, mixer = 1 */
6828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6830 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6835 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6836 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6837 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6839 /* FIXME: use matrix-type input source selection */
6840 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6845 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6850 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6851 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6857 /* capture mixer elements */
6858 static struct snd_kcontrol_new alc883_capture_mixer[] = {
6859 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6860 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6861 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6862 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6864 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6865 /* The multiple "Capture Source" controls confuse alsamixer
6866 * So call somewhat different..
6867 * FIXME: the controls appear in the "playback" view!
6869 /* .name = "Capture Source", */
6870 .name = "Input Source",
6872 .info = alc882_mux_enum_info,
6873 .get = alc882_mux_enum_get,
6874 .put = alc882_mux_enum_put,
6879 #ifdef CONFIG_SND_HDA_POWER_SAVE
6880 #define alc883_loopbacks alc880_loopbacks
6883 /* pcm configuration: identiacal with ALC880 */
6884 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
6885 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
6886 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
6887 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
6890 * configuration and preset
6892 static const char *alc883_models[ALC883_MODEL_LAST] = {
6893 [ALC883_3ST_2ch_DIG] = "3stack-dig",
6894 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
6895 [ALC883_3ST_6ch] = "3stack-6ch",
6896 [ALC883_6ST_DIG] = "6stack-dig",
6897 [ALC883_TARGA_DIG] = "targa-dig",
6898 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
6899 [ALC883_ACER] = "acer",
6900 [ALC883_ACER_ASPIRE] = "acer-aspire",
6901 [ALC883_MEDION] = "medion",
6902 [ALC883_MEDION_MD2] = "medion-md2",
6903 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
6904 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
6905 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
6906 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
6907 [ALC883_HAIER_W66] = "haier-w66",
6908 [ALC888_6ST_HP] = "6stack-hp",
6909 [ALC888_3ST_HP] = "3stack-hp",
6910 [ALC883_AUTO] = "auto",
6913 static struct snd_pci_quirk alc883_cfg_tbl[] = {
6914 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
6915 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
6916 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
6917 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
6918 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
6919 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
6920 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
6921 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
6922 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
6923 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
6924 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
6925 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
6926 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
6927 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
6928 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
6929 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
6930 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
6931 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
6932 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
6933 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
6934 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
6935 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
6936 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
6937 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
6938 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
6939 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
6940 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
6941 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
6942 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
6943 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
6944 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
6945 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
6946 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6947 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6948 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
6949 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
6950 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
6951 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
6952 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
6953 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6957 static struct alc_config_preset alc883_presets[] = {
6958 [ALC883_3ST_2ch_DIG] = {
6959 .mixers = { alc883_3ST_2ch_mixer },
6960 .init_verbs = { alc883_init_verbs },
6961 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6962 .dac_nids = alc883_dac_nids,
6963 .dig_out_nid = ALC883_DIGOUT_NID,
6964 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6965 .adc_nids = alc883_adc_nids,
6966 .dig_in_nid = ALC883_DIGIN_NID,
6967 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6968 .channel_mode = alc883_3ST_2ch_modes,
6969 .input_mux = &alc883_capture_source,
6971 [ALC883_3ST_6ch_DIG] = {
6972 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6973 .init_verbs = { alc883_init_verbs },
6974 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6975 .dac_nids = alc883_dac_nids,
6976 .dig_out_nid = ALC883_DIGOUT_NID,
6977 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6978 .adc_nids = alc883_adc_nids,
6979 .dig_in_nid = ALC883_DIGIN_NID,
6980 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6981 .channel_mode = alc883_3ST_6ch_modes,
6983 .input_mux = &alc883_capture_source,
6985 [ALC883_3ST_6ch] = {
6986 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6987 .init_verbs = { alc883_init_verbs },
6988 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6989 .dac_nids = alc883_dac_nids,
6990 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6991 .adc_nids = alc883_adc_nids,
6992 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6993 .channel_mode = alc883_3ST_6ch_modes,
6995 .input_mux = &alc883_capture_source,
6997 [ALC883_6ST_DIG] = {
6998 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
6999 .init_verbs = { alc883_init_verbs },
7000 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7001 .dac_nids = alc883_dac_nids,
7002 .dig_out_nid = ALC883_DIGOUT_NID,
7003 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7004 .adc_nids = alc883_adc_nids,
7005 .dig_in_nid = ALC883_DIGIN_NID,
7006 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7007 .channel_mode = alc883_sixstack_modes,
7008 .input_mux = &alc883_capture_source,
7010 [ALC883_TARGA_DIG] = {
7011 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
7012 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7013 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7014 .dac_nids = alc883_dac_nids,
7015 .dig_out_nid = ALC883_DIGOUT_NID,
7016 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7017 .adc_nids = alc883_adc_nids,
7018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7019 .channel_mode = alc883_3ST_6ch_modes,
7021 .input_mux = &alc883_capture_source,
7022 .unsol_event = alc883_tagra_unsol_event,
7023 .init_hook = alc883_tagra_automute,
7025 [ALC883_TARGA_2ch_DIG] = {
7026 .mixers = { alc883_tagra_2ch_mixer},
7027 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
7028 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7029 .dac_nids = alc883_dac_nids,
7030 .dig_out_nid = ALC883_DIGOUT_NID,
7031 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7032 .adc_nids = alc883_adc_nids,
7033 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7034 .channel_mode = alc883_3ST_2ch_modes,
7035 .input_mux = &alc883_capture_source,
7036 .unsol_event = alc883_tagra_unsol_event,
7037 .init_hook = alc883_tagra_automute,
7040 .mixers = { alc883_base_mixer },
7041 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7042 * and the headphone jack. Turn this on and rely on the
7043 * standard mute methods whenever the user wants to turn
7044 * these outputs off.
7046 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
7047 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7048 .dac_nids = alc883_dac_nids,
7049 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7050 .adc_nids = alc883_adc_nids,
7051 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7052 .channel_mode = alc883_3ST_2ch_modes,
7053 .input_mux = &alc883_capture_source,
7055 [ALC883_ACER_ASPIRE] = {
7056 .mixers = { alc883_acer_aspire_mixer },
7057 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
7058 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7059 .dac_nids = alc883_dac_nids,
7060 .dig_out_nid = ALC883_DIGOUT_NID,
7061 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7062 .adc_nids = alc883_adc_nids,
7063 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7064 .channel_mode = alc883_3ST_2ch_modes,
7065 .input_mux = &alc883_capture_source,
7066 .unsol_event = alc883_acer_aspire_unsol_event,
7067 .init_hook = alc883_acer_aspire_automute,
7070 .mixers = { alc883_fivestack_mixer,
7071 alc883_chmode_mixer },
7072 .init_verbs = { alc883_init_verbs,
7073 alc883_medion_eapd_verbs },
7074 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7075 .dac_nids = alc883_dac_nids,
7076 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7077 .adc_nids = alc883_adc_nids,
7078 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7079 .channel_mode = alc883_sixstack_modes,
7080 .input_mux = &alc883_capture_source,
7082 [ALC883_MEDION_MD2] = {
7083 .mixers = { alc883_medion_md2_mixer},
7084 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
7085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7086 .dac_nids = alc883_dac_nids,
7087 .dig_out_nid = ALC883_DIGOUT_NID,
7088 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7089 .adc_nids = alc883_adc_nids,
7090 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7091 .channel_mode = alc883_3ST_2ch_modes,
7092 .input_mux = &alc883_capture_source,
7093 .unsol_event = alc883_medion_md2_unsol_event,
7094 .init_hook = alc883_medion_md2_automute,
7096 [ALC883_LAPTOP_EAPD] = {
7097 .mixers = { alc883_base_mixer },
7098 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
7099 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7100 .dac_nids = alc883_dac_nids,
7101 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7102 .adc_nids = alc883_adc_nids,
7103 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7104 .channel_mode = alc883_3ST_2ch_modes,
7105 .input_mux = &alc883_capture_source,
7107 [ALC883_LENOVO_101E_2ch] = {
7108 .mixers = { alc883_lenovo_101e_2ch_mixer},
7109 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
7110 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7111 .dac_nids = alc883_dac_nids,
7112 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7113 .adc_nids = alc883_adc_nids,
7114 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7115 .channel_mode = alc883_3ST_2ch_modes,
7116 .input_mux = &alc883_lenovo_101e_capture_source,
7117 .unsol_event = alc883_lenovo_101e_unsol_event,
7118 .init_hook = alc883_lenovo_101e_all_automute,
7120 [ALC883_LENOVO_NB0763] = {
7121 .mixers = { alc883_lenovo_nb0763_mixer },
7122 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
7123 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7124 .dac_nids = alc883_dac_nids,
7125 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7126 .adc_nids = alc883_adc_nids,
7127 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7128 .channel_mode = alc883_3ST_2ch_modes,
7130 .input_mux = &alc883_lenovo_nb0763_capture_source,
7131 .unsol_event = alc883_medion_md2_unsol_event,
7132 .init_hook = alc883_medion_md2_automute,
7134 [ALC888_LENOVO_MS7195_DIG] = {
7135 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
7136 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
7137 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7138 .dac_nids = alc883_dac_nids,
7139 .dig_out_nid = ALC883_DIGOUT_NID,
7140 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7141 .adc_nids = alc883_adc_nids,
7142 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
7143 .channel_mode = alc883_3ST_6ch_modes,
7145 .input_mux = &alc883_capture_source,
7146 .unsol_event = alc883_lenovo_ms7195_unsol_event,
7147 .init_hook = alc888_lenovo_ms7195_front_automute,
7149 [ALC883_HAIER_W66] = {
7150 .mixers = { alc883_tagra_2ch_mixer},
7151 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
7152 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7153 .dac_nids = alc883_dac_nids,
7154 .dig_out_nid = ALC883_DIGOUT_NID,
7155 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7156 .adc_nids = alc883_adc_nids,
7157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
7158 .channel_mode = alc883_3ST_2ch_modes,
7159 .input_mux = &alc883_capture_source,
7160 .unsol_event = alc883_haier_w66_unsol_event,
7161 .init_hook = alc883_haier_w66_automute,
7164 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
7165 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
7166 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7167 .dac_nids = alc883_dac_nids,
7168 .dig_out_nid = ALC883_DIGOUT_NID,
7169 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7170 .adc_nids = alc883_adc_nids,
7171 .dig_in_nid = ALC883_DIGIN_NID,
7172 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
7173 .channel_mode = alc883_sixstack_modes,
7174 .input_mux = &alc883_capture_source,
7177 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
7178 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
7179 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
7180 .dac_nids = alc883_dac_nids,
7181 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
7182 .adc_nids = alc883_adc_nids,
7183 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
7184 .channel_mode = alc888_3st_hp_modes,
7186 .input_mux = &alc883_capture_source,
7192 * BIOS auto configuration
7194 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
7195 hda_nid_t nid, int pin_type,
7199 struct alc_spec *spec = codec->spec;
7202 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7205 idx = spec->multiout.dac_nids[dac_idx] - 2;
7207 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7209 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7211 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7215 static void alc883_auto_init_multi_out(struct hda_codec *codec)
7217 struct alc_spec *spec = codec->spec;
7220 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7221 for (i = 0; i <= HDA_SIDE; i++) {
7222 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7223 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7225 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7230 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7232 struct alc_spec *spec = codec->spec;
7235 pin = spec->autocfg.hp_pins[0];
7236 if (pin) /* connect to front */
7238 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7241 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7242 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7244 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7246 struct alc_spec *spec = codec->spec;
7249 for (i = 0; i < AUTO_PIN_LAST; i++) {
7250 hda_nid_t nid = spec->autocfg.input_pins[i];
7251 if (alc883_is_input_pin(nid)) {
7252 snd_hda_codec_write(codec, nid, 0,
7253 AC_VERB_SET_PIN_WIDGET_CONTROL,
7254 (i <= AUTO_PIN_FRONT_MIC ?
7255 PIN_VREF80 : PIN_IN));
7256 if (nid != ALC883_PIN_CD_NID)
7257 snd_hda_codec_write(codec, nid, 0,
7258 AC_VERB_SET_AMP_GAIN_MUTE,
7264 /* almost identical with ALC880 parser... */
7265 static int alc883_parse_auto_config(struct hda_codec *codec)
7267 struct alc_spec *spec = codec->spec;
7268 int err = alc880_parse_auto_config(codec);
7273 /* hack - override the init verbs */
7274 spec->init_verbs[0] = alc883_auto_init_verbs;
7275 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7280 /* additional initialization for auto-configuration model */
7281 static void alc883_auto_init(struct hda_codec *codec)
7283 alc883_auto_init_multi_out(codec);
7284 alc883_auto_init_hp_out(codec);
7285 alc883_auto_init_analog_input(codec);
7288 static int patch_alc883(struct hda_codec *codec)
7290 struct alc_spec *spec;
7291 int err, board_config;
7293 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7299 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7302 if (board_config < 0) {
7303 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7304 "trying auto-probe from BIOS...\n");
7305 board_config = ALC883_AUTO;
7308 if (board_config == ALC883_AUTO) {
7309 /* automatic parse from the BIOS config */
7310 err = alc883_parse_auto_config(codec);
7316 "hda_codec: Cannot set up configuration "
7317 "from BIOS. Using base mode...\n");
7318 board_config = ALC883_3ST_2ch_DIG;
7322 if (board_config != ALC883_AUTO)
7323 setup_preset(spec, &alc883_presets[board_config]);
7325 spec->stream_name_analog = "ALC883 Analog";
7326 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7327 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7329 spec->stream_name_digital = "ALC883 Digital";
7330 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7331 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7333 if (!spec->adc_nids && spec->input_mux) {
7334 spec->adc_nids = alc883_adc_nids;
7335 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7338 codec->patch_ops = alc_patch_ops;
7339 if (board_config == ALC883_AUTO)
7340 spec->init_hook = alc883_auto_init;
7341 #ifdef CONFIG_SND_HDA_POWER_SAVE
7342 if (!spec->loopback.amplist)
7343 spec->loopback.amplist = alc883_loopbacks;
7353 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7354 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7356 #define alc262_dac_nids alc260_dac_nids
7357 #define alc262_adc_nids alc882_adc_nids
7358 #define alc262_adc_nids_alt alc882_adc_nids_alt
7360 #define alc262_modes alc260_modes
7361 #define alc262_capture_source alc882_capture_source
7363 static struct snd_kcontrol_new alc262_base_mixer[] = {
7364 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7365 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7366 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7367 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7369 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7372 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7375 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7376 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7377 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7378 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7380 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7381 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7385 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7387 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7388 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7389 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7390 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7391 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7395 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7396 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7397 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7398 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7399 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7400 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7405 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7407 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7408 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7409 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7410 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7416 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7422 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7423 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7424 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7425 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7429 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7430 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7431 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7434 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7435 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7436 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7438 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7439 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7440 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7441 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7442 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7443 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7444 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7448 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7449 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7455 static struct hda_bind_ctls alc262_sony_bind_sw = {
7456 .ops = &snd_hda_bind_sw,
7458 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7459 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7464 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7466 HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw),
7467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7469 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7470 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7474 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7476 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7480 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7481 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7485 #define alc262_capture_mixer alc882_capture_mixer
7486 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7489 * generic initialization of ADC, input mixers and output mixers
7491 static struct hda_verb alc262_init_verbs[] = {
7493 * Unmute ADC0-2 and set the default input to mic-in
7495 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7497 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7498 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7499 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7500 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7502 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7504 * Note: PASD motherboards uses the Line In 2 as the input for
7505 * front panel mic (mic 2)
7507 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7512 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7515 * Set up output mixers (0x0c - 0x0e)
7517 /* set vol=0 to output mixers */
7518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7519 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7520 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7521 /* set up input amps for analog loopback */
7522 /* Amp Indices: DAC = 0, mixer = 1 */
7523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7527 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7534 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7537 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7539 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7540 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7543 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7546 /* FIXME: use matrix-type input source selection */
7547 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7548 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7567 static struct hda_verb alc262_hippo_unsol_verbs[] = {
7568 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7573 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
7574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7575 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7576 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7578 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7579 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7583 static struct hda_verb alc262_sony_unsol_verbs[] = {
7584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
7588 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7592 /* mute/unmute internal speaker according to the hp jack and mute state */
7593 static void alc262_hippo_automute(struct hda_codec *codec)
7595 struct alc_spec *spec = codec->spec;
7597 unsigned int present;
7599 /* need to execute and sync at first */
7600 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7601 present = snd_hda_codec_read(codec, 0x15, 0,
7602 AC_VERB_GET_PIN_SENSE, 0);
7603 spec->jack_present = (present & 0x80000000) != 0;
7604 if (spec->jack_present) {
7605 /* mute internal speaker */
7606 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7607 HDA_AMP_MUTE, HDA_AMP_MUTE);
7609 /* unmute internal speaker if necessary */
7610 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7611 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7612 HDA_AMP_MUTE, mute);
7616 /* unsolicited event for HP jack sensing */
7617 static void alc262_hippo_unsol_event(struct hda_codec *codec,
7620 if ((res >> 26) != ALC880_HP_EVENT)
7622 alc262_hippo_automute(codec);
7625 static void alc262_hippo1_automute(struct hda_codec *codec)
7628 unsigned int present;
7630 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7631 present = snd_hda_codec_read(codec, 0x1b, 0,
7632 AC_VERB_GET_PIN_SENSE, 0);
7633 present = (present & 0x80000000) != 0;
7635 /* mute internal speaker */
7636 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7637 HDA_AMP_MUTE, HDA_AMP_MUTE);
7639 /* unmute internal speaker if necessary */
7640 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7641 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7642 HDA_AMP_MUTE, mute);
7646 /* unsolicited event for HP jack sensing */
7647 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
7650 if ((res >> 26) != ALC880_HP_EVENT)
7652 alc262_hippo1_automute(codec);
7657 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7660 #define ALC_HP_EVENT 0x37
7662 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
7663 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
7664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7668 static struct hda_input_mux alc262_fujitsu_capture_source = {
7676 static struct hda_input_mux alc262_HP_capture_source = {
7680 { "Front Mic", 0x3 },
7687 /* mute/unmute internal speaker according to the hp jack and mute state */
7688 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7690 struct alc_spec *spec = codec->spec;
7693 if (force || !spec->sense_updated) {
7694 unsigned int present;
7695 /* need to execute and sync at first */
7696 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
7697 present = snd_hda_codec_read(codec, 0x14, 0,
7698 AC_VERB_GET_PIN_SENSE, 0);
7699 spec->jack_present = (present & 0x80000000) != 0;
7700 spec->sense_updated = 1;
7702 if (spec->jack_present) {
7703 /* mute internal speaker */
7704 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7705 HDA_AMP_MUTE, HDA_AMP_MUTE);
7707 /* unmute internal speaker if necessary */
7708 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7709 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7710 HDA_AMP_MUTE, mute);
7714 /* unsolicited event for HP jack sensing */
7715 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
7718 if ((res >> 26) != ALC_HP_EVENT)
7720 alc262_fujitsu_automute(codec, 1);
7723 /* bind volumes of both NID 0x0c and 0x0d */
7724 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
7725 .ops = &snd_hda_bind_vol,
7727 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7728 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7733 /* bind hp and internal speaker mute (with plug check) */
7734 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7735 struct snd_ctl_elem_value *ucontrol)
7737 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7738 long *valp = ucontrol->value.integer.value;
7741 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7743 valp[0] ? 0 : HDA_AMP_MUTE);
7744 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7746 valp[1] ? 0 : HDA_AMP_MUTE);
7748 alc262_fujitsu_automute(codec, 0);
7752 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
7753 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
7755 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7756 .name = "Master Playback Switch",
7757 .info = snd_hda_mixer_amp_switch_info,
7758 .get = snd_hda_mixer_amp_switch_get,
7759 .put = alc262_fujitsu_master_sw_put,
7760 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7762 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7763 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7764 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7770 /* additional init verbs for Benq laptops */
7771 static struct hda_verb alc262_EAPD_verbs[] = {
7772 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7773 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7777 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
7778 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7779 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7781 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7782 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7786 /* add playback controls from the parsed DAC table */
7787 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
7788 const struct auto_pin_cfg *cfg)
7793 spec->multiout.num_dacs = 1; /* only use one dac */
7794 spec->multiout.dac_nids = spec->private_dac_nids;
7795 spec->multiout.dac_nids[0] = 2;
7797 nid = cfg->line_out_pins[0];
7799 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7800 "Front Playback Volume",
7801 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
7804 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7805 "Front Playback Switch",
7806 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
7811 nid = cfg->speaker_pins[0];
7814 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7815 "Speaker Playback Volume",
7816 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7820 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7821 "Speaker Playback Switch",
7822 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7827 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7828 "Speaker Playback Switch",
7829 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7835 nid = cfg->hp_pins[0];
7837 /* spec->multiout.hp_nid = 2; */
7839 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7840 "Headphone Playback Volume",
7841 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7845 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7846 "Headphone Playback Switch",
7847 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7852 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7853 "Headphone Playback Switch",
7854 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7863 /* identical with ALC880 */
7864 #define alc262_auto_create_analog_input_ctls \
7865 alc880_auto_create_analog_input_ctls
7868 * generic initialization of ADC, input mixers and output mixers
7870 static struct hda_verb alc262_volume_init_verbs[] = {
7872 * Unmute ADC0-2 and set the default input to mic-in
7874 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7876 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7879 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7881 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7883 * Note: PASD motherboards uses the Line In 2 as the input for
7884 * front panel mic (mic 2)
7886 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7887 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7888 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7889 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7890 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7891 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7894 * Set up output mixers (0x0c - 0x0f)
7896 /* set vol=0 to output mixers */
7897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7898 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7901 /* set up input amps for analog loopback */
7902 /* Amp Indices: DAC = 0, mixer = 1 */
7903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7906 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7908 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7910 /* FIXME: use matrix-type input source selection */
7911 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7912 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7914 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7918 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7919 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7924 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7931 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
7933 * Unmute ADC0-2 and set the default input to mic-in
7935 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7937 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7938 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7939 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7940 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7942 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7944 * Note: PASD motherboards uses the Line In 2 as the input for
7945 * front panel mic (mic 2)
7947 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
7954 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
7957 * Set up output mixers (0x0c - 0x0e)
7959 /* set vol=0 to output mixers */
7960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7964 /* set up input amps for analog loopback */
7965 /* Amp Indices: DAC = 0, mixer = 1 */
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7968 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7969 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7970 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7971 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7975 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7977 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7980 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7983 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7984 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7987 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7990 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7991 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7992 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7993 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7994 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7997 /* FIXME: use matrix-type input source selection */
7998 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7999 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8003 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8018 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
8020 * Unmute ADC0-2 and set the default input to mic-in
8022 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8024 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8026 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8029 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8031 * Note: PASD motherboards uses the Line In 2 as the input for front
8034 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
8041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
8042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
8044 * Set up output mixers (0x0c - 0x0e)
8046 /* set vol=0 to output mixers */
8047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8051 /* set up input amps for analog loopback */
8052 /* Amp Indices: DAC = 0, mixer = 1 */
8053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
8062 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
8063 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
8064 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
8065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
8066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
8067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
8069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8072 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8075 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
8079 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8080 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
8082 /* FIXME: use matrix-type input source selection */
8083 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8084 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
8087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
8088 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
8089 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
8090 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8091 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
8093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8096 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8098 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
8106 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
8112 #ifdef CONFIG_SND_HDA_POWER_SAVE
8113 #define alc262_loopbacks alc880_loopbacks
8116 /* pcm configuration: identiacal with ALC880 */
8117 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8118 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8119 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8120 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8123 * BIOS auto configuration
8125 static int alc262_parse_auto_config(struct hda_codec *codec)
8127 struct alc_spec *spec = codec->spec;
8129 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
8131 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8135 if (!spec->autocfg.line_outs)
8136 return 0; /* can't find valid BIOS pin config */
8137 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
8140 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
8144 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
8146 if (spec->autocfg.dig_out_pin)
8147 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
8148 if (spec->autocfg.dig_in_pin)
8149 spec->dig_in_nid = ALC262_DIGIN_NID;
8151 if (spec->kctl_alloc)
8152 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8154 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
8155 spec->num_mux_defs = 1;
8156 spec->input_mux = &spec->private_imux;
8161 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8162 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8163 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8166 /* init callback for auto-configuration model -- overriding the default init */
8167 static void alc262_auto_init(struct hda_codec *codec)
8169 alc262_auto_init_multi_out(codec);
8170 alc262_auto_init_hp_out(codec);
8171 alc262_auto_init_analog_input(codec);
8175 * configuration and preset
8177 static const char *alc262_models[ALC262_MODEL_LAST] = {
8178 [ALC262_BASIC] = "basic",
8179 [ALC262_HIPPO] = "hippo",
8180 [ALC262_HIPPO_1] = "hippo_1",
8181 [ALC262_FUJITSU] = "fujitsu",
8182 [ALC262_HP_BPC] = "hp-bpc",
8183 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
8184 [ALC262_BENQ_ED8] = "benq",
8185 [ALC262_BENQ_T31] = "benq-t31",
8186 [ALC262_SONY_ASSAMD] = "sony-assamd",
8187 [ALC262_AUTO] = "auto",
8190 static struct snd_pci_quirk alc262_cfg_tbl[] = {
8191 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
8192 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
8193 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
8194 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
8195 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
8196 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
8197 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
8198 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
8199 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
8200 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
8201 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
8202 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
8203 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
8204 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
8205 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
8206 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
8207 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
8208 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
8209 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
8210 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
8211 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
8212 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
8213 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8214 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
8215 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8216 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
8220 static struct alc_config_preset alc262_presets[] = {
8222 .mixers = { alc262_base_mixer },
8223 .init_verbs = { alc262_init_verbs },
8224 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8225 .dac_nids = alc262_dac_nids,
8227 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8228 .channel_mode = alc262_modes,
8229 .input_mux = &alc262_capture_source,
8232 .mixers = { alc262_base_mixer },
8233 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8234 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8235 .dac_nids = alc262_dac_nids,
8237 .dig_out_nid = ALC262_DIGOUT_NID,
8238 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8239 .channel_mode = alc262_modes,
8240 .input_mux = &alc262_capture_source,
8241 .unsol_event = alc262_hippo_unsol_event,
8242 .init_hook = alc262_hippo_automute,
8244 [ALC262_HIPPO_1] = {
8245 .mixers = { alc262_hippo1_mixer },
8246 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8247 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8248 .dac_nids = alc262_dac_nids,
8250 .dig_out_nid = ALC262_DIGOUT_NID,
8251 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8252 .channel_mode = alc262_modes,
8253 .input_mux = &alc262_capture_source,
8254 .unsol_event = alc262_hippo1_unsol_event,
8255 .init_hook = alc262_hippo1_automute,
8257 [ALC262_FUJITSU] = {
8258 .mixers = { alc262_fujitsu_mixer },
8259 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs },
8260 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8261 .dac_nids = alc262_dac_nids,
8263 .dig_out_nid = ALC262_DIGOUT_NID,
8264 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8265 .channel_mode = alc262_modes,
8266 .input_mux = &alc262_fujitsu_capture_source,
8267 .unsol_event = alc262_fujitsu_unsol_event,
8270 .mixers = { alc262_HP_BPC_mixer },
8271 .init_verbs = { alc262_HP_BPC_init_verbs },
8272 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8273 .dac_nids = alc262_dac_nids,
8275 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8276 .channel_mode = alc262_modes,
8277 .input_mux = &alc262_HP_capture_source,
8279 [ALC262_HP_BPC_D7000_WF] = {
8280 .mixers = { alc262_HP_BPC_WildWest_mixer },
8281 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8282 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8283 .dac_nids = alc262_dac_nids,
8285 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8286 .channel_mode = alc262_modes,
8287 .input_mux = &alc262_HP_capture_source,
8289 [ALC262_HP_BPC_D7000_WL] = {
8290 .mixers = { alc262_HP_BPC_WildWest_mixer,
8291 alc262_HP_BPC_WildWest_option_mixer },
8292 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8293 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8294 .dac_nids = alc262_dac_nids,
8296 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8297 .channel_mode = alc262_modes,
8298 .input_mux = &alc262_HP_capture_source,
8300 [ALC262_BENQ_ED8] = {
8301 .mixers = { alc262_base_mixer },
8302 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
8303 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8304 .dac_nids = alc262_dac_nids,
8306 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8307 .channel_mode = alc262_modes,
8308 .input_mux = &alc262_capture_source,
8310 [ALC262_SONY_ASSAMD] = {
8311 .mixers = { alc262_sony_mixer },
8312 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
8313 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8314 .dac_nids = alc262_dac_nids,
8316 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8317 .channel_mode = alc262_modes,
8318 .input_mux = &alc262_capture_source,
8319 .unsol_event = alc262_hippo_unsol_event,
8320 .init_hook = alc262_hippo_automute,
8322 [ALC262_BENQ_T31] = {
8323 .mixers = { alc262_benq_t31_mixer },
8324 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
8325 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8326 .dac_nids = alc262_dac_nids,
8328 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8329 .channel_mode = alc262_modes,
8330 .input_mux = &alc262_capture_source,
8331 .unsol_event = alc262_hippo_unsol_event,
8332 .init_hook = alc262_hippo_automute,
8336 static int patch_alc262(struct hda_codec *codec)
8338 struct alc_spec *spec;
8342 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8348 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8353 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8354 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8355 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8356 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8360 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8364 if (board_config < 0) {
8365 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8366 "trying auto-probe from BIOS...\n");
8367 board_config = ALC262_AUTO;
8370 if (board_config == ALC262_AUTO) {
8371 /* automatic parse from the BIOS config */
8372 err = alc262_parse_auto_config(codec);
8378 "hda_codec: Cannot set up configuration "
8379 "from BIOS. Using base mode...\n");
8380 board_config = ALC262_BASIC;
8384 if (board_config != ALC262_AUTO)
8385 setup_preset(spec, &alc262_presets[board_config]);
8387 spec->stream_name_analog = "ALC262 Analog";
8388 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8389 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8391 spec->stream_name_digital = "ALC262 Digital";
8392 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8393 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8395 if (!spec->adc_nids && spec->input_mux) {
8396 /* check whether NID 0x07 is valid */
8397 unsigned int wcap = get_wcaps(codec, 0x07);
8400 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8401 if (wcap != AC_WID_AUD_IN) {
8402 spec->adc_nids = alc262_adc_nids_alt;
8403 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8404 spec->mixers[spec->num_mixers] =
8405 alc262_capture_alt_mixer;
8408 spec->adc_nids = alc262_adc_nids;
8409 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
8410 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
8415 codec->patch_ops = alc_patch_ops;
8416 if (board_config == ALC262_AUTO)
8417 spec->init_hook = alc262_auto_init;
8418 #ifdef CONFIG_SND_HDA_POWER_SAVE
8419 if (!spec->loopback.amplist)
8420 spec->loopback.amplist = alc262_loopbacks;
8427 * ALC268 channel source setting (2 channel)
8429 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8430 #define alc268_modes alc260_modes
8432 static hda_nid_t alc268_dac_nids[2] = {
8437 static hda_nid_t alc268_adc_nids[2] = {
8442 static hda_nid_t alc268_adc_nids_alt[1] = {
8447 static struct snd_kcontrol_new alc268_base_mixer[] = {
8448 /* output mixer control */
8449 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
8450 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
8452 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8456 static struct hda_verb alc268_eapd_verbs[] = {
8457 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8458 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8462 /* Toshiba specific */
8463 #define alc268_toshiba_automute alc262_hippo_automute
8465 static struct hda_verb alc268_toshiba_verbs[] = {
8466 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8471 /* bind volumes of both NID 0x0c and 0x0d */
8472 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
8473 .ops = &snd_hda_bind_vol,
8475 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
8476 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
8481 #define alc268_acer_master_sw_put alc262_fujitsu_master_sw_put
8482 #define alc268_acer_automute alc262_fujitsu_automute
8484 static struct snd_kcontrol_new alc268_acer_mixer[] = {
8485 /* output mixer control */
8486 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
8488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8489 .name = "Master Playback Switch",
8490 .info = snd_hda_mixer_amp_switch_info,
8491 .get = snd_hda_mixer_amp_switch_get,
8492 .put = alc268_acer_master_sw_put,
8493 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
8498 static struct hda_verb alc268_acer_verbs[] = {
8499 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8502 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8506 /* unsolicited event for HP jack sensing */
8507 static void alc268_toshiba_unsol_event(struct hda_codec *codec,
8510 if ((res >> 28) != ALC880_HP_EVENT)
8512 alc268_toshiba_automute(codec);
8515 static void alc268_acer_unsol_event(struct hda_codec *codec,
8518 if ((res >> 28) != ALC880_HP_EVENT)
8520 alc268_acer_automute(codec, 1);
8524 * generic initialization of ADC, input mixers and output mixers
8526 static struct hda_verb alc268_base_init_verbs[] = {
8527 /* Unmute DAC0-1 and set vol = 0 */
8528 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8529 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8530 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8532 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8533 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8536 * Set up output mixers (0x0c - 0x0e)
8538 /* set vol=0 to output mixers */
8539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8542 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
8544 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8545 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8548 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8549 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8553 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8554 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8558 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8559 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8560 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8561 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8562 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8563 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8565 /* FIXME: use matrix-type input source selection */
8566 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
8567 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8570 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8572 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8582 * generic initialization of ADC, input mixers and output mixers
8584 static struct hda_verb alc268_volume_init_verbs[] = {
8585 /* set output DAC */
8586 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8587 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8588 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8589 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8592 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8593 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8594 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8595 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8600 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8601 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8603 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8604 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8605 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8606 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8608 /* set PCBEEP vol = 0 */
8609 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
8614 #define alc268_mux_enum_info alc_mux_enum_info
8615 #define alc268_mux_enum_get alc_mux_enum_get
8617 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8618 struct snd_ctl_elem_value *ucontrol)
8620 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8621 struct alc_spec *spec = codec->spec;
8622 const struct hda_input_mux *imux = spec->input_mux;
8623 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
8624 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
8625 hda_nid_t nid = capture_mixers[adc_idx];
8626 unsigned int *cur_val = &spec->cur_mux[adc_idx];
8627 unsigned int i, idx;
8629 idx = ucontrol->value.enumerated.item[0];
8630 if (idx >= imux->num_items)
8631 idx = imux->num_items - 1;
8632 if (*cur_val == idx)
8634 for (i = 0; i < imux->num_items; i++) {
8635 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
8636 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
8637 imux->items[i].index,
8639 snd_hda_codec_write_cache(codec, nid, 0,
8640 AC_VERB_SET_CONNECT_SEL,
8647 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
8648 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8649 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8652 /* The multiple "Capture Source" controls confuse alsamixer
8653 * So call somewhat different..
8654 * FIXME: the controls appear in the "playback" view!
8656 /* .name = "Capture Source", */
8657 .name = "Input Source",
8659 .info = alc268_mux_enum_info,
8660 .get = alc268_mux_enum_get,
8661 .put = alc268_mux_enum_put,
8666 static struct snd_kcontrol_new alc268_capture_mixer[] = {
8667 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8668 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8669 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
8670 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
8672 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8673 /* The multiple "Capture Source" controls confuse alsamixer
8674 * So call somewhat different..
8675 * FIXME: the controls appear in the "playback" view!
8677 /* .name = "Capture Source", */
8678 .name = "Input Source",
8680 .info = alc268_mux_enum_info,
8681 .get = alc268_mux_enum_get,
8682 .put = alc268_mux_enum_put,
8687 static struct hda_input_mux alc268_capture_source = {
8691 { "Front Mic", 0x1 },
8697 /* create input playback/capture controls for the given pin */
8698 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
8699 const char *ctlname, int idx)
8704 sprintf(name, "%s Playback Volume", ctlname);
8706 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8707 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
8711 } else if (nid == 0x15) {
8712 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8713 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
8719 sprintf(name, "%s Playback Switch", ctlname);
8720 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
8721 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
8727 /* add playback controls from the parsed DAC table */
8728 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
8729 const struct auto_pin_cfg *cfg)
8734 spec->multiout.num_dacs = 2; /* only use one dac */
8735 spec->multiout.dac_nids = spec->private_dac_nids;
8736 spec->multiout.dac_nids[0] = 2;
8737 spec->multiout.dac_nids[1] = 3;
8739 nid = cfg->line_out_pins[0];
8741 alc268_new_analog_output(spec, nid, "Front", 0);
8743 nid = cfg->speaker_pins[0];
8745 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8746 "Speaker Playback Volume",
8747 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
8751 nid = cfg->hp_pins[0];
8753 alc268_new_analog_output(spec, nid, "Headphone", 0);
8755 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
8757 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8758 "Mono Playback Switch",
8759 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
8766 /* create playback/capture controls for input pins */
8767 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
8768 const struct auto_pin_cfg *cfg)
8770 struct hda_input_mux *imux = &spec->private_imux;
8773 for (i = 0; i < AUTO_PIN_LAST; i++) {
8774 switch(cfg->input_pins[i]) {
8776 idx1 = 0; /* Mic 1 */
8779 idx1 = 1; /* Mic 2 */
8782 idx1 = 2; /* Line In */
8790 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
8791 imux->items[imux->num_items].index = idx1;
8797 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
8799 struct alc_spec *spec = codec->spec;
8800 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
8801 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
8802 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
8803 unsigned int dac_vol1, dac_vol2;
8806 snd_hda_codec_write(codec, speaker_nid, 0,
8807 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
8808 snd_hda_codec_write(codec, 0x0f, 0,
8809 AC_VERB_SET_AMP_GAIN_MUTE,
8811 snd_hda_codec_write(codec, 0x10, 0,
8812 AC_VERB_SET_AMP_GAIN_MUTE,
8815 snd_hda_codec_write(codec, 0x0f, 0,
8816 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8817 snd_hda_codec_write(codec, 0x10, 0,
8818 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8821 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
8822 if (line_nid == 0x14)
8823 dac_vol2 = AMP_OUT_ZERO;
8824 else if (line_nid == 0x15)
8825 dac_vol1 = AMP_OUT_ZERO;
8827 dac_vol2 = AMP_OUT_ZERO;
8828 else if (hp_nid == 0x15)
8829 dac_vol1 = AMP_OUT_ZERO;
8830 if (line_nid != 0x16 || hp_nid != 0x16 ||
8831 spec->autocfg.line_out_pins[1] != 0x16 ||
8832 spec->autocfg.line_out_pins[2] != 0x16)
8833 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
8835 snd_hda_codec_write(codec, 0x02, 0,
8836 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
8837 snd_hda_codec_write(codec, 0x03, 0,
8838 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
8841 /* pcm configuration: identiacal with ALC880 */
8842 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
8843 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
8844 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
8847 * BIOS auto configuration
8849 static int alc268_parse_auto_config(struct hda_codec *codec)
8851 struct alc_spec *spec = codec->spec;
8853 static hda_nid_t alc268_ignore[] = { 0 };
8855 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8859 if (!spec->autocfg.line_outs)
8860 return 0; /* can't find valid BIOS pin config */
8862 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
8865 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
8869 spec->multiout.max_channels = 2;
8871 /* digital only support output */
8872 if (spec->autocfg.dig_out_pin)
8873 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
8875 if (spec->kctl_alloc)
8876 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8878 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
8879 spec->num_mux_defs = 1;
8880 spec->input_mux = &spec->private_imux;
8885 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
8886 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
8887 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
8889 /* init callback for auto-configuration model -- overriding the default init */
8890 static void alc268_auto_init(struct hda_codec *codec)
8892 alc268_auto_init_multi_out(codec);
8893 alc268_auto_init_hp_out(codec);
8894 alc268_auto_init_mono_speaker_out(codec);
8895 alc268_auto_init_analog_input(codec);
8899 * configuration and preset
8901 static const char *alc268_models[ALC268_MODEL_LAST] = {
8902 [ALC268_3ST] = "3stack",
8903 [ALC268_TOSHIBA] = "toshiba",
8904 [ALC268_ACER] = "acer",
8905 [ALC268_AUTO] = "auto",
8908 static struct snd_pci_quirk alc268_cfg_tbl[] = {
8909 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
8910 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
8911 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
8912 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
8916 static struct alc_config_preset alc268_presets[] = {
8918 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8919 .init_verbs = { alc268_base_init_verbs },
8920 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8921 .dac_nids = alc268_dac_nids,
8922 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8923 .adc_nids = alc268_adc_nids_alt,
8925 .dig_out_nid = ALC268_DIGOUT_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8927 .channel_mode = alc268_modes,
8928 .input_mux = &alc268_capture_source,
8930 [ALC268_TOSHIBA] = {
8931 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8932 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
8933 alc268_toshiba_verbs },
8934 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8935 .dac_nids = alc268_dac_nids,
8936 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8937 .adc_nids = alc268_adc_nids_alt,
8939 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8940 .channel_mode = alc268_modes,
8941 .input_mux = &alc268_capture_source,
8942 .input_mux = &alc268_capture_source,
8943 .unsol_event = alc268_toshiba_unsol_event,
8944 .init_hook = alc268_toshiba_automute,
8947 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer },
8948 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
8949 alc268_acer_verbs },
8950 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8951 .dac_nids = alc268_dac_nids,
8952 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8953 .adc_nids = alc268_adc_nids_alt,
8955 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8956 .channel_mode = alc268_modes,
8957 .input_mux = &alc268_capture_source,
8958 .unsol_event = alc268_acer_unsol_event,
8962 static int patch_alc268(struct hda_codec *codec)
8964 struct alc_spec *spec;
8968 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
8974 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
8978 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
8979 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
8980 "trying auto-probe from BIOS...\n");
8981 board_config = ALC268_AUTO;
8984 if (board_config == ALC268_AUTO) {
8985 /* automatic parse from the BIOS config */
8986 err = alc268_parse_auto_config(codec);
8992 "hda_codec: Cannot set up configuration "
8993 "from BIOS. Using base mode...\n");
8994 board_config = ALC268_3ST;
8998 if (board_config != ALC268_AUTO)
8999 setup_preset(spec, &alc268_presets[board_config]);
9001 spec->stream_name_analog = "ALC268 Analog";
9002 spec->stream_analog_playback = &alc268_pcm_analog_playback;
9003 spec->stream_analog_capture = &alc268_pcm_analog_capture;
9005 spec->stream_name_digital = "ALC268 Digital";
9006 spec->stream_digital_playback = &alc268_pcm_digital_playback;
9008 if (board_config == ALC268_AUTO) {
9009 if (!spec->adc_nids && spec->input_mux) {
9010 /* check whether NID 0x07 is valid */
9011 unsigned int wcap = get_wcaps(codec, 0x07);
9014 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9015 if (wcap != AC_WID_AUD_IN) {
9016 spec->adc_nids = alc268_adc_nids_alt;
9017 spec->num_adc_nids =
9018 ARRAY_SIZE(alc268_adc_nids_alt);
9019 spec->mixers[spec->num_mixers] =
9020 alc268_capture_alt_mixer;
9023 spec->adc_nids = alc268_adc_nids;
9024 spec->num_adc_nids =
9025 ARRAY_SIZE(alc268_adc_nids);
9026 spec->mixers[spec->num_mixers] =
9027 alc268_capture_mixer;
9032 codec->patch_ops = alc_patch_ops;
9033 if (board_config == ALC268_AUTO)
9034 spec->init_hook = alc268_auto_init;
9040 * ALC861 channel source setting (2/6 channel selection for 3-stack)
9044 * set the path ways for 2 channel output
9045 * need to set the codec line out and mic 1 pin widgets to inputs
9047 static struct hda_verb alc861_threestack_ch2_init[] = {
9048 /* set pin widget 1Ah (line in) for input */
9049 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9050 /* set pin widget 18h (mic1/2) for input, for mic also enable
9053 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9055 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
9057 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
9058 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
9064 * need to set the codec line out and mic 1 pin widgets to outputs
9066 static struct hda_verb alc861_threestack_ch6_init[] = {
9067 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9068 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9069 /* set pin widget 18h (mic1) for output (CLFE)*/
9070 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9072 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
9073 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
9075 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
9077 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
9078 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
9083 static struct hda_channel_mode alc861_threestack_modes[2] = {
9084 { 2, alc861_threestack_ch2_init },
9085 { 6, alc861_threestack_ch6_init },
9087 /* Set mic1 as input and unmute the mixer */
9088 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
9089 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9090 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
9093 /* Set mic1 as output and mute mixer */
9094 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
9095 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9096 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
9100 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
9101 { 2, alc861_uniwill_m31_ch2_init },
9102 { 4, alc861_uniwill_m31_ch4_init },
9105 /* Set mic1 and line-in as input and unmute the mixer */
9106 static struct hda_verb alc861_asus_ch2_init[] = {
9107 /* set pin widget 1Ah (line in) for input */
9108 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9109 /* set pin widget 18h (mic1/2) for input, for mic also enable
9112 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9114 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
9116 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
9117 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
9121 /* Set mic1 nad line-in as output and mute mixer */
9122 static struct hda_verb alc861_asus_ch6_init[] = {
9123 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9124 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9125 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9126 /* set pin widget 18h (mic1) for output (CLFE)*/
9127 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9128 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9129 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
9130 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
9132 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
9134 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
9135 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
9140 static struct hda_channel_mode alc861_asus_modes[2] = {
9141 { 2, alc861_asus_ch2_init },
9142 { 6, alc861_asus_ch6_init },
9147 static struct snd_kcontrol_new alc861_base_mixer[] = {
9148 /* output mixer control */
9149 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
9150 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
9151 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
9152 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
9153 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
9155 /*Input mixer control */
9156 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9157 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9158 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9159 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9160 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
9161 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
9162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
9163 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
9164 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
9165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
9167 /* Capture mixer control */
9168 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9169 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9171 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9172 .name = "Capture Source",
9174 .info = alc_mux_enum_info,
9175 .get = alc_mux_enum_get,
9176 .put = alc_mux_enum_put,
9181 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
9182 /* output mixer control */
9183 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
9184 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
9185 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
9186 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
9187 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9189 /* Input mixer control */
9190 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9191 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9192 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9193 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9194 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
9195 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
9196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
9197 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
9198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
9199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
9201 /* Capture mixer control */
9202 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9203 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9206 .name = "Capture Source",
9208 .info = alc_mux_enum_info,
9209 .get = alc_mux_enum_get,
9210 .put = alc_mux_enum_put,
9213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9214 .name = "Channel Mode",
9215 .info = alc_ch_mode_info,
9216 .get = alc_ch_mode_get,
9217 .put = alc_ch_mode_put,
9218 .private_value = ARRAY_SIZE(alc861_threestack_modes),
9223 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
9224 /* output mixer control */
9225 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
9226 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
9227 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
9229 /*Capture mixer control */
9230 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9231 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9234 .name = "Capture Source",
9236 .info = alc_mux_enum_info,
9237 .get = alc_mux_enum_get,
9238 .put = alc_mux_enum_put,
9244 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
9245 /* output mixer control */
9246 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
9247 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
9248 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
9249 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
9250 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9252 /* Input mixer control */
9253 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9254 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9255 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9256 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9257 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
9258 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
9259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
9260 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
9261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
9262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
9264 /* Capture mixer control */
9265 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9266 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9268 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9269 .name = "Capture Source",
9271 .info = alc_mux_enum_info,
9272 .get = alc_mux_enum_get,
9273 .put = alc_mux_enum_put,
9276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9277 .name = "Channel Mode",
9278 .info = alc_ch_mode_info,
9279 .get = alc_ch_mode_get,
9280 .put = alc_ch_mode_put,
9281 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
9286 static struct snd_kcontrol_new alc861_asus_mixer[] = {
9287 /* output mixer control */
9288 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
9289 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
9290 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
9291 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
9292 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
9294 /* Input mixer control */
9295 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9296 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9297 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9298 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9299 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
9300 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
9301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
9302 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
9303 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
9304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
9306 /* Capture mixer control */
9307 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9308 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9311 .name = "Capture Source",
9313 .info = alc_mux_enum_info,
9314 .get = alc_mux_enum_get,
9315 .put = alc_mux_enum_put,
9318 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9319 .name = "Channel Mode",
9320 .info = alc_ch_mode_info,
9321 .get = alc_ch_mode_get,
9322 .put = alc_ch_mode_put,
9323 .private_value = ARRAY_SIZE(alc861_asus_modes),
9328 /* additional mixer */
9329 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
9330 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9331 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9332 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
9333 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
9338 * generic initialization of ADC, input mixers and output mixers
9340 static struct hda_verb alc861_base_init_verbs[] = {
9342 * Unmute ADC0 and set the default input to mic-in
9344 /* port-A for surround (rear panel) */
9345 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9346 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
9347 /* port-B for mic-in (rear panel) with vref */
9348 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9349 /* port-C for line-in (rear panel) */
9350 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9351 /* port-D for Front */
9352 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9353 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9354 /* port-E for HP out (front panel) */
9355 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9356 /* route front PCM to HP */
9357 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9358 /* port-F for mic-in (front panel) with vref */
9359 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9360 /* port-G for CLFE (rear panel) */
9361 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9362 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9363 /* port-H for side (rear panel) */
9364 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9365 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
9367 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9368 /* route front mic to ADC1*/
9369 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9372 /* Unmute DAC0~3 & spdif out*/
9373 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9374 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9375 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9376 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9379 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9380 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9381 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9382 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9383 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9385 /* Unmute Stereo Mixer 15 */
9386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9388 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9391 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9392 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9393 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9394 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9396 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9397 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9398 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9399 /* hp used DAC 3 (Front) */
9400 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9401 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9406 static struct hda_verb alc861_threestack_init_verbs[] = {
9408 * Unmute ADC0 and set the default input to mic-in
9410 /* port-A for surround (rear panel) */
9411 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9412 /* port-B for mic-in (rear panel) with vref */
9413 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9414 /* port-C for line-in (rear panel) */
9415 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9416 /* port-D for Front */
9417 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9418 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9419 /* port-E for HP out (front panel) */
9420 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9421 /* route front PCM to HP */
9422 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9423 /* port-F for mic-in (front panel) with vref */
9424 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9425 /* port-G for CLFE (rear panel) */
9426 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9427 /* port-H for side (rear panel) */
9428 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9430 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9431 /* route front mic to ADC1*/
9432 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9434 /* Unmute DAC0~3 & spdif out*/
9435 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9436 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9437 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9438 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9441 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9442 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9443 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9444 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9445 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9447 /* Unmute Stereo Mixer 15 */
9448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9450 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9454 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9455 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9456 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9457 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9458 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9460 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9461 /* hp used DAC 3 (Front) */
9462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9463 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9467 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
9469 * Unmute ADC0 and set the default input to mic-in
9471 /* port-A for surround (rear panel) */
9472 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9473 /* port-B for mic-in (rear panel) with vref */
9474 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9475 /* port-C for line-in (rear panel) */
9476 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9477 /* port-D for Front */
9478 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9479 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9480 /* port-E for HP out (front panel) */
9481 /* this has to be set to VREF80 */
9482 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9483 /* route front PCM to HP */
9484 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9485 /* port-F for mic-in (front panel) with vref */
9486 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9487 /* port-G for CLFE (rear panel) */
9488 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9489 /* port-H for side (rear panel) */
9490 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9492 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9493 /* route front mic to ADC1*/
9494 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9496 /* Unmute DAC0~3 & spdif out*/
9497 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9498 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9499 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9500 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9503 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9504 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9505 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9506 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9507 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9509 /* Unmute Stereo Mixer 15 */
9510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9512 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9515 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9518 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9523 /* hp used DAC 3 (Front) */
9524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9529 static struct hda_verb alc861_asus_init_verbs[] = {
9531 * Unmute ADC0 and set the default input to mic-in
9533 /* port-A for surround (rear panel)
9534 * according to codec#0 this is the HP jack
9536 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
9537 /* route front PCM to HP */
9538 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
9539 /* port-B for mic-in (rear panel) with vref */
9540 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9541 /* port-C for line-in (rear panel) */
9542 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9543 /* port-D for Front */
9544 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9545 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9546 /* port-E for HP out (front panel) */
9547 /* this has to be set to VREF80 */
9548 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9549 /* route front PCM to HP */
9550 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9551 /* port-F for mic-in (front panel) with vref */
9552 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9553 /* port-G for CLFE (rear panel) */
9554 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9555 /* port-H for side (rear panel) */
9556 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9558 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9559 /* route front mic to ADC1*/
9560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9562 /* Unmute DAC0~3 & spdif out*/
9563 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9564 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9565 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9566 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9568 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9569 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9570 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9571 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9572 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9574 /* Unmute Stereo Mixer 15 */
9575 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9578 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9580 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9581 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9582 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9583 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9584 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9585 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9586 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9587 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9588 /* hp used DAC 3 (Front) */
9589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9590 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9594 /* additional init verbs for ASUS laptops */
9595 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
9596 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
9597 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
9602 * generic initialization of ADC, input mixers and output mixers
9604 static struct hda_verb alc861_auto_init_verbs[] = {
9606 * Unmute ADC0 and set the default input to mic-in
9608 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
9609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9611 /* Unmute DAC0~3 & spdif out*/
9612 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9613 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9614 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9615 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9618 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9619 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9620 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9621 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9622 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9624 /* Unmute Stereo Mixer 15 */
9625 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9627 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
9630 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9631 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9635 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9637 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9640 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9641 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9643 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9644 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9645 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9646 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9648 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
9653 static struct hda_verb alc861_toshiba_init_verbs[] = {
9654 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9659 /* toggle speaker-output according to the hp-jack state */
9660 static void alc861_toshiba_automute(struct hda_codec *codec)
9662 unsigned int present;
9664 present = snd_hda_codec_read(codec, 0x0f, 0,
9665 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9666 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
9667 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9668 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
9669 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
9672 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
9675 if ((res >> 26) == ALC880_HP_EVENT)
9676 alc861_toshiba_automute(codec);
9679 /* pcm configuration: identiacal with ALC880 */
9680 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
9681 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
9682 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
9683 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
9686 #define ALC861_DIGOUT_NID 0x07
9688 static struct hda_channel_mode alc861_8ch_modes[1] = {
9692 static hda_nid_t alc861_dac_nids[4] = {
9693 /* front, surround, clfe, side */
9694 0x03, 0x06, 0x05, 0x04
9697 static hda_nid_t alc660_dac_nids[3] = {
9698 /* front, clfe, surround */
9702 static hda_nid_t alc861_adc_nids[1] = {
9707 static struct hda_input_mux alc861_capture_source = {
9711 { "Front Mic", 0x3 },
9718 /* fill in the dac_nids table from the parsed pin configuration */
9719 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
9720 const struct auto_pin_cfg *cfg)
9725 spec->multiout.dac_nids = spec->private_dac_nids;
9726 for (i = 0; i < cfg->line_outs; i++) {
9727 nid = cfg->line_out_pins[i];
9729 if (i >= ARRAY_SIZE(alc861_dac_nids))
9731 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
9734 spec->multiout.num_dacs = cfg->line_outs;
9738 /* add playback controls from the parsed DAC table */
9739 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
9740 const struct auto_pin_cfg *cfg)
9743 static const char *chname[4] = {
9744 "Front", "Surround", NULL /*CLFE*/, "Side"
9749 for (i = 0; i < cfg->line_outs; i++) {
9750 nid = spec->multiout.dac_nids[i];
9755 err = add_control(spec, ALC_CTL_BIND_MUTE,
9756 "Center Playback Switch",
9757 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
9761 err = add_control(spec, ALC_CTL_BIND_MUTE,
9762 "LFE Playback Switch",
9763 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9768 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
9770 if (nid == alc861_dac_nids[idx])
9772 sprintf(name, "%s Playback Switch", chname[idx]);
9773 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
9774 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9783 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
9791 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
9793 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9794 "Headphone Playback Switch",
9795 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9798 spec->multiout.hp_nid = nid;
9803 /* create playback/capture controls for input pins */
9804 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
9805 const struct auto_pin_cfg *cfg)
9807 struct hda_input_mux *imux = &spec->private_imux;
9808 int i, err, idx, idx1;
9810 for (i = 0; i < AUTO_PIN_LAST; i++) {
9811 switch (cfg->input_pins[i]) {
9814 idx = 2; /* Line In */
9818 idx = 2; /* Line In */
9822 idx = 1; /* Mic In */
9826 idx = 1; /* Mic In */
9836 err = new_analog_input(spec, cfg->input_pins[i],
9837 auto_pin_cfg_labels[i], idx, 0x15);
9841 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9842 imux->items[imux->num_items].index = idx1;
9848 static struct snd_kcontrol_new alc861_capture_mixer[] = {
9849 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9850 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9854 /* The multiple "Capture Source" controls confuse alsamixer
9855 * So call somewhat different..
9856 *FIXME: the controls appear in the "playback" view!
9858 /* .name = "Capture Source", */
9859 .name = "Input Source",
9861 .info = alc_mux_enum_info,
9862 .get = alc_mux_enum_get,
9863 .put = alc_mux_enum_put,
9868 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
9870 int pin_type, int dac_idx)
9874 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9876 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9881 static void alc861_auto_init_multi_out(struct hda_codec *codec)
9883 struct alc_spec *spec = codec->spec;
9886 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
9887 for (i = 0; i < spec->autocfg.line_outs; i++) {
9888 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9889 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9891 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
9892 spec->multiout.dac_nids[i]);
9896 static void alc861_auto_init_hp_out(struct hda_codec *codec)
9898 struct alc_spec *spec = codec->spec;
9901 pin = spec->autocfg.hp_pins[0];
9902 if (pin) /* connect to front */
9903 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
9904 spec->multiout.dac_nids[0]);
9907 static void alc861_auto_init_analog_input(struct hda_codec *codec)
9909 struct alc_spec *spec = codec->spec;
9912 for (i = 0; i < AUTO_PIN_LAST; i++) {
9913 hda_nid_t nid = spec->autocfg.input_pins[i];
9914 if (nid >= 0x0c && nid <= 0x11) {
9915 snd_hda_codec_write(codec, nid, 0,
9916 AC_VERB_SET_PIN_WIDGET_CONTROL,
9917 i <= AUTO_PIN_FRONT_MIC ?
9918 PIN_VREF80 : PIN_IN);
9923 /* parse the BIOS configuration and set up the alc_spec */
9924 /* return 1 if successful, 0 if the proper config is not found,
9925 * or a negative error code
9927 static int alc861_parse_auto_config(struct hda_codec *codec)
9929 struct alc_spec *spec = codec->spec;
9931 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9933 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9937 if (!spec->autocfg.line_outs)
9938 return 0; /* can't find valid BIOS pin config */
9940 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
9943 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
9946 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
9949 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
9953 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9955 if (spec->autocfg.dig_out_pin)
9956 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
9958 if (spec->kctl_alloc)
9959 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9961 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
9963 spec->num_mux_defs = 1;
9964 spec->input_mux = &spec->private_imux;
9966 spec->adc_nids = alc861_adc_nids;
9967 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
9968 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
9974 /* additional initialization for auto-configuration model */
9975 static void alc861_auto_init(struct hda_codec *codec)
9977 alc861_auto_init_multi_out(codec);
9978 alc861_auto_init_hp_out(codec);
9979 alc861_auto_init_analog_input(codec);
9982 #ifdef CONFIG_SND_HDA_POWER_SAVE
9983 static struct hda_amp_list alc861_loopbacks[] = {
9984 { 0x15, HDA_INPUT, 0 },
9985 { 0x15, HDA_INPUT, 1 },
9986 { 0x15, HDA_INPUT, 2 },
9987 { 0x15, HDA_INPUT, 3 },
9994 * configuration and preset
9996 static const char *alc861_models[ALC861_MODEL_LAST] = {
9997 [ALC861_3ST] = "3stack",
9998 [ALC660_3ST] = "3stack-660",
9999 [ALC861_3ST_DIG] = "3stack-dig",
10000 [ALC861_6ST_DIG] = "6stack-dig",
10001 [ALC861_UNIWILL_M31] = "uniwill-m31",
10002 [ALC861_TOSHIBA] = "toshiba",
10003 [ALC861_ASUS] = "asus",
10004 [ALC861_ASUS_LAPTOP] = "asus-laptop",
10005 [ALC861_AUTO] = "auto",
10008 static struct snd_pci_quirk alc861_cfg_tbl[] = {
10009 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
10010 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
10011 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
10012 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
10013 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
10014 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
10015 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
10016 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
10017 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
10018 * Any other models that need this preset?
10020 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
10021 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
10022 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
10023 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
10024 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
10025 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
10026 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
10027 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
10031 static struct alc_config_preset alc861_presets[] = {
10033 .mixers = { alc861_3ST_mixer },
10034 .init_verbs = { alc861_threestack_init_verbs },
10035 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10036 .dac_nids = alc861_dac_nids,
10037 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10038 .channel_mode = alc861_threestack_modes,
10040 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10041 .adc_nids = alc861_adc_nids,
10042 .input_mux = &alc861_capture_source,
10044 [ALC861_3ST_DIG] = {
10045 .mixers = { alc861_base_mixer },
10046 .init_verbs = { alc861_threestack_init_verbs },
10047 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10048 .dac_nids = alc861_dac_nids,
10049 .dig_out_nid = ALC861_DIGOUT_NID,
10050 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10051 .channel_mode = alc861_threestack_modes,
10053 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10054 .adc_nids = alc861_adc_nids,
10055 .input_mux = &alc861_capture_source,
10057 [ALC861_6ST_DIG] = {
10058 .mixers = { alc861_base_mixer },
10059 .init_verbs = { alc861_base_init_verbs },
10060 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10061 .dac_nids = alc861_dac_nids,
10062 .dig_out_nid = ALC861_DIGOUT_NID,
10063 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
10064 .channel_mode = alc861_8ch_modes,
10065 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10066 .adc_nids = alc861_adc_nids,
10067 .input_mux = &alc861_capture_source,
10070 .mixers = { alc861_3ST_mixer },
10071 .init_verbs = { alc861_threestack_init_verbs },
10072 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
10073 .dac_nids = alc660_dac_nids,
10074 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
10075 .channel_mode = alc861_threestack_modes,
10077 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10078 .adc_nids = alc861_adc_nids,
10079 .input_mux = &alc861_capture_source,
10081 [ALC861_UNIWILL_M31] = {
10082 .mixers = { alc861_uniwill_m31_mixer },
10083 .init_verbs = { alc861_uniwill_m31_init_verbs },
10084 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10085 .dac_nids = alc861_dac_nids,
10086 .dig_out_nid = ALC861_DIGOUT_NID,
10087 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
10088 .channel_mode = alc861_uniwill_m31_modes,
10090 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10091 .adc_nids = alc861_adc_nids,
10092 .input_mux = &alc861_capture_source,
10094 [ALC861_TOSHIBA] = {
10095 .mixers = { alc861_toshiba_mixer },
10096 .init_verbs = { alc861_base_init_verbs,
10097 alc861_toshiba_init_verbs },
10098 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10099 .dac_nids = alc861_dac_nids,
10100 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10101 .channel_mode = alc883_3ST_2ch_modes,
10102 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10103 .adc_nids = alc861_adc_nids,
10104 .input_mux = &alc861_capture_source,
10105 .unsol_event = alc861_toshiba_unsol_event,
10106 .init_hook = alc861_toshiba_automute,
10109 .mixers = { alc861_asus_mixer },
10110 .init_verbs = { alc861_asus_init_verbs },
10111 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10112 .dac_nids = alc861_dac_nids,
10113 .dig_out_nid = ALC861_DIGOUT_NID,
10114 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
10115 .channel_mode = alc861_asus_modes,
10118 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10119 .adc_nids = alc861_adc_nids,
10120 .input_mux = &alc861_capture_source,
10122 [ALC861_ASUS_LAPTOP] = {
10123 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
10124 .init_verbs = { alc861_asus_init_verbs,
10125 alc861_asus_laptop_init_verbs },
10126 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
10127 .dac_nids = alc861_dac_nids,
10128 .dig_out_nid = ALC861_DIGOUT_NID,
10129 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10130 .channel_mode = alc883_3ST_2ch_modes,
10132 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
10133 .adc_nids = alc861_adc_nids,
10134 .input_mux = &alc861_capture_source,
10139 static int patch_alc861(struct hda_codec *codec)
10141 struct alc_spec *spec;
10145 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10149 codec->spec = spec;
10151 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
10155 if (board_config < 0) {
10156 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
10157 "trying auto-probe from BIOS...\n");
10158 board_config = ALC861_AUTO;
10161 if (board_config == ALC861_AUTO) {
10162 /* automatic parse from the BIOS config */
10163 err = alc861_parse_auto_config(codec);
10169 "hda_codec: Cannot set up configuration "
10170 "from BIOS. Using base mode...\n");
10171 board_config = ALC861_3ST_DIG;
10175 if (board_config != ALC861_AUTO)
10176 setup_preset(spec, &alc861_presets[board_config]);
10178 spec->stream_name_analog = "ALC861 Analog";
10179 spec->stream_analog_playback = &alc861_pcm_analog_playback;
10180 spec->stream_analog_capture = &alc861_pcm_analog_capture;
10182 spec->stream_name_digital = "ALC861 Digital";
10183 spec->stream_digital_playback = &alc861_pcm_digital_playback;
10184 spec->stream_digital_capture = &alc861_pcm_digital_capture;
10186 codec->patch_ops = alc_patch_ops;
10187 if (board_config == ALC861_AUTO)
10188 spec->init_hook = alc861_auto_init;
10189 #ifdef CONFIG_SND_HDA_POWER_SAVE
10190 if (!spec->loopback.amplist)
10191 spec->loopback.amplist = alc861_loopbacks;
10198 * ALC861-VD support
10202 * In addition, an independent DAC
10204 #define ALC861VD_DIGOUT_NID 0x06
10206 static hda_nid_t alc861vd_dac_nids[4] = {
10207 /* front, surr, clfe, side surr */
10208 0x02, 0x03, 0x04, 0x05
10211 /* dac_nids for ALC660vd are in a different order - according to
10212 * Realtek's driver.
10213 * This should probably tesult in a different mixer for 6stack models
10214 * of ALC660vd codecs, but for now there is only 3stack mixer
10215 * - and it is the same as in 861vd.
10216 * adc_nids in ALC660vd are (is) the same as in 861vd
10218 static hda_nid_t alc660vd_dac_nids[3] = {
10219 /* front, rear, clfe, rear_surr */
10223 static hda_nid_t alc861vd_adc_nids[1] = {
10229 /* FIXME: should be a matrix-type input source selection */
10230 static struct hda_input_mux alc861vd_capture_source = {
10234 { "Front Mic", 0x1 },
10240 static struct hda_input_mux alc861vd_dallas_capture_source = {
10243 { "Front Mic", 0x0 },
10244 { "ATAPI Mic", 0x1 },
10245 { "Line In", 0x5 },
10249 static struct hda_input_mux alc861vd_hp_capture_source = {
10252 { "Front Mic", 0x0 },
10253 { "ATAPI Mic", 0x1 },
10257 #define alc861vd_mux_enum_info alc_mux_enum_info
10258 #define alc861vd_mux_enum_get alc_mux_enum_get
10260 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
10261 struct snd_ctl_elem_value *ucontrol)
10263 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10264 struct alc_spec *spec = codec->spec;
10265 const struct hda_input_mux *imux = spec->input_mux;
10266 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
10267 static hda_nid_t capture_mixers[1] = { 0x22 };
10268 hda_nid_t nid = capture_mixers[adc_idx];
10269 unsigned int *cur_val = &spec->cur_mux[adc_idx];
10270 unsigned int i, idx;
10272 idx = ucontrol->value.enumerated.item[0];
10273 if (idx >= imux->num_items)
10274 idx = imux->num_items - 1;
10275 if (*cur_val == idx)
10277 for (i = 0; i < imux->num_items; i++) {
10278 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
10279 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
10280 imux->items[i].index,
10290 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
10297 static struct hda_verb alc861vd_6stack_ch6_init[] = {
10298 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10299 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10300 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10301 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10308 static struct hda_verb alc861vd_6stack_ch8_init[] = {
10309 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10310 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10311 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10312 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10316 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
10317 { 6, alc861vd_6stack_ch6_init },
10318 { 8, alc861vd_6stack_ch8_init },
10321 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
10323 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10324 .name = "Channel Mode",
10325 .info = alc_ch_mode_info,
10326 .get = alc_ch_mode_get,
10327 .put = alc_ch_mode_put,
10332 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
10333 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10334 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10337 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10338 /* The multiple "Capture Source" controls confuse alsamixer
10339 * So call somewhat different..
10340 *FIXME: the controls appear in the "playback" view!
10342 /* .name = "Capture Source", */
10343 .name = "Input Source",
10345 .info = alc861vd_mux_enum_info,
10346 .get = alc861vd_mux_enum_get,
10347 .put = alc861vd_mux_enum_put,
10352 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10353 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10355 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
10356 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10357 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10359 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10360 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
10362 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
10364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
10366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
10369 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
10370 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
10372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10378 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10388 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10389 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10394 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
10395 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10396 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10404 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10405 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10406 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10408 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10409 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10411 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10412 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10414 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10415 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10420 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
10421 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10422 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
10423 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10431 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10441 /* Pin assignment: Front=0x14, HP = 0x15,
10442 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
10444 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
10445 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10446 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10448 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
10449 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10450 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10451 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10452 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10453 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
10454 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
10458 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
10459 * Front Mic=0x18, ATAPI Mic = 0x19,
10461 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
10462 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10463 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10464 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10465 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
10466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10468 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10469 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10475 * generic initialization of ADC, input mixers and output mixers
10477 static struct hda_verb alc861vd_volume_init_verbs[] = {
10479 * Unmute ADC0 and set the default input to mic-in
10481 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10482 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10484 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
10485 * the analog-loopback mixer widget
10487 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10494 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10497 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10498 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10501 * Set up output mixers (0x02 - 0x05)
10503 /* set vol=0 to output mixers */
10504 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10505 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10506 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10507 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10509 /* set up input amps for analog loopback */
10510 /* Amp Indices: DAC = 0, mixer = 1 */
10511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10524 * 3-stack pin configuration:
10525 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10527 static struct hda_verb alc861vd_3stack_init_verbs[] = {
10529 * Set pin mode and muting
10531 /* set front pin widgets 0x14 for output */
10532 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10534 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10536 /* Mic (rear) pin: input vref at 80% */
10537 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10539 /* Front Mic pin: input vref at 80% */
10540 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10541 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10542 /* Line In pin: input */
10543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10545 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10547 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10548 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10549 /* CD pin widget for input */
10550 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10556 * 6-stack pin configuration:
10558 static struct hda_verb alc861vd_6stack_init_verbs[] = {
10560 * Set pin mode and muting
10562 /* set front pin widgets 0x14 for output */
10563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10567 /* Rear Pin: output 1 (0x0d) */
10568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10569 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10570 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10571 /* CLFE Pin: output 2 (0x0e) */
10572 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10573 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10574 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
10575 /* Side Pin: output 3 (0x0f) */
10576 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10577 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10578 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
10580 /* Mic (rear) pin: input vref at 80% */
10581 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10582 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10583 /* Front Mic pin: input vref at 80% */
10584 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10585 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10586 /* Line In pin: input */
10587 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10588 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10589 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10593 /* CD pin widget for input */
10594 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10599 static struct hda_verb alc861vd_eapd_verbs[] = {
10600 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10604 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
10605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10608 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10609 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10613 /* toggle speaker-output according to the hp-jack state */
10614 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10616 unsigned int present;
10617 unsigned char bits;
10619 present = snd_hda_codec_read(codec, 0x1b, 0,
10620 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10621 bits = present ? HDA_AMP_MUTE : 0;
10622 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10623 HDA_AMP_MUTE, bits);
10626 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10628 unsigned int present;
10629 unsigned char bits;
10631 present = snd_hda_codec_read(codec, 0x18, 0,
10632 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10633 bits = present ? HDA_AMP_MUTE : 0;
10634 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
10635 HDA_AMP_MUTE, bits);
10638 static void alc861vd_lenovo_automute(struct hda_codec *codec)
10640 alc861vd_lenovo_hp_automute(codec);
10641 alc861vd_lenovo_mic_automute(codec);
10644 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
10647 switch (res >> 26) {
10648 case ALC880_HP_EVENT:
10649 alc861vd_lenovo_hp_automute(codec);
10651 case ALC880_MIC_EVENT:
10652 alc861vd_lenovo_mic_automute(codec);
10657 static struct hda_verb alc861vd_dallas_verbs[] = {
10658 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10659 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10660 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10661 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10664 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10667 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10668 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10669 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10670 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10673 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10676 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10677 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10678 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10679 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10686 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10687 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10688 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10690 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10691 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10695 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10696 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10697 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10702 /* toggle speaker-output according to the hp-jack state */
10703 static void alc861vd_dallas_automute(struct hda_codec *codec)
10705 unsigned int present;
10707 present = snd_hda_codec_read(codec, 0x15, 0,
10708 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10709 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10710 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10713 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
10715 if ((res >> 26) == ALC880_HP_EVENT)
10716 alc861vd_dallas_automute(codec);
10719 #ifdef CONFIG_SND_HDA_POWER_SAVE
10720 #define alc861vd_loopbacks alc880_loopbacks
10723 /* pcm configuration: identiacal with ALC880 */
10724 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
10725 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
10726 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
10727 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
10730 * configuration and preset
10732 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
10733 [ALC660VD_3ST] = "3stack-660",
10734 [ALC660VD_3ST_DIG] = "3stack-660-digout",
10735 [ALC861VD_3ST] = "3stack",
10736 [ALC861VD_3ST_DIG] = "3stack-digout",
10737 [ALC861VD_6ST_DIG] = "6stack-digout",
10738 [ALC861VD_LENOVO] = "lenovo",
10739 [ALC861VD_DALLAS] = "dallas",
10740 [ALC861VD_HP] = "hp",
10741 [ALC861VD_AUTO] = "auto",
10744 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
10745 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
10746 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
10747 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
10748 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
10749 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
10751 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
10752 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
10753 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
10754 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
10755 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
10756 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
10757 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
10758 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
10759 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
10763 static struct alc_config_preset alc861vd_presets[] = {
10765 .mixers = { alc861vd_3st_mixer },
10766 .init_verbs = { alc861vd_volume_init_verbs,
10767 alc861vd_3stack_init_verbs },
10768 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10769 .dac_nids = alc660vd_dac_nids,
10770 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10771 .adc_nids = alc861vd_adc_nids,
10772 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10773 .channel_mode = alc861vd_3stack_2ch_modes,
10774 .input_mux = &alc861vd_capture_source,
10776 [ALC660VD_3ST_DIG] = {
10777 .mixers = { alc861vd_3st_mixer },
10778 .init_verbs = { alc861vd_volume_init_verbs,
10779 alc861vd_3stack_init_verbs },
10780 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10781 .dac_nids = alc660vd_dac_nids,
10782 .dig_out_nid = ALC861VD_DIGOUT_NID,
10783 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10784 .adc_nids = alc861vd_adc_nids,
10785 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10786 .channel_mode = alc861vd_3stack_2ch_modes,
10787 .input_mux = &alc861vd_capture_source,
10790 .mixers = { alc861vd_3st_mixer },
10791 .init_verbs = { alc861vd_volume_init_verbs,
10792 alc861vd_3stack_init_verbs },
10793 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10794 .dac_nids = alc861vd_dac_nids,
10795 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10796 .channel_mode = alc861vd_3stack_2ch_modes,
10797 .input_mux = &alc861vd_capture_source,
10799 [ALC861VD_3ST_DIG] = {
10800 .mixers = { alc861vd_3st_mixer },
10801 .init_verbs = { alc861vd_volume_init_verbs,
10802 alc861vd_3stack_init_verbs },
10803 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10804 .dac_nids = alc861vd_dac_nids,
10805 .dig_out_nid = ALC861VD_DIGOUT_NID,
10806 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10807 .channel_mode = alc861vd_3stack_2ch_modes,
10808 .input_mux = &alc861vd_capture_source,
10810 [ALC861VD_6ST_DIG] = {
10811 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
10812 .init_verbs = { alc861vd_volume_init_verbs,
10813 alc861vd_6stack_init_verbs },
10814 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10815 .dac_nids = alc861vd_dac_nids,
10816 .dig_out_nid = ALC861VD_DIGOUT_NID,
10817 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
10818 .channel_mode = alc861vd_6stack_modes,
10819 .input_mux = &alc861vd_capture_source,
10821 [ALC861VD_LENOVO] = {
10822 .mixers = { alc861vd_lenovo_mixer },
10823 .init_verbs = { alc861vd_volume_init_verbs,
10824 alc861vd_3stack_init_verbs,
10825 alc861vd_eapd_verbs,
10826 alc861vd_lenovo_unsol_verbs },
10827 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10828 .dac_nids = alc660vd_dac_nids,
10829 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10830 .adc_nids = alc861vd_adc_nids,
10831 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10832 .channel_mode = alc861vd_3stack_2ch_modes,
10833 .input_mux = &alc861vd_capture_source,
10834 .unsol_event = alc861vd_lenovo_unsol_event,
10835 .init_hook = alc861vd_lenovo_automute,
10837 [ALC861VD_DALLAS] = {
10838 .mixers = { alc861vd_dallas_mixer },
10839 .init_verbs = { alc861vd_dallas_verbs },
10840 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10841 .dac_nids = alc861vd_dac_nids,
10842 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10843 .adc_nids = alc861vd_adc_nids,
10844 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10845 .channel_mode = alc861vd_3stack_2ch_modes,
10846 .input_mux = &alc861vd_dallas_capture_source,
10847 .unsol_event = alc861vd_dallas_unsol_event,
10848 .init_hook = alc861vd_dallas_automute,
10851 .mixers = { alc861vd_hp_mixer },
10852 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
10853 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10854 .dac_nids = alc861vd_dac_nids,
10855 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10856 .dig_out_nid = ALC861VD_DIGOUT_NID,
10857 .adc_nids = alc861vd_adc_nids,
10858 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10859 .channel_mode = alc861vd_3stack_2ch_modes,
10860 .input_mux = &alc861vd_hp_capture_source,
10861 .unsol_event = alc861vd_dallas_unsol_event,
10862 .init_hook = alc861vd_dallas_automute,
10867 * BIOS auto configuration
10869 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
10870 hda_nid_t nid, int pin_type, int dac_idx)
10872 /* set as output */
10873 snd_hda_codec_write(codec, nid, 0,
10874 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
10875 snd_hda_codec_write(codec, nid, 0,
10876 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
10879 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
10881 struct alc_spec *spec = codec->spec;
10884 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
10885 for (i = 0; i <= HDA_SIDE; i++) {
10886 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10887 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10889 alc861vd_auto_set_output_and_unmute(codec, nid,
10895 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
10897 struct alc_spec *spec = codec->spec;
10900 pin = spec->autocfg.hp_pins[0];
10901 if (pin) /* connect to front and use dac 0 */
10902 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10905 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
10906 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
10908 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
10910 struct alc_spec *spec = codec->spec;
10913 for (i = 0; i < AUTO_PIN_LAST; i++) {
10914 hda_nid_t nid = spec->autocfg.input_pins[i];
10915 if (alc861vd_is_input_pin(nid)) {
10916 snd_hda_codec_write(codec, nid, 0,
10917 AC_VERB_SET_PIN_WIDGET_CONTROL,
10918 i <= AUTO_PIN_FRONT_MIC ?
10919 PIN_VREF80 : PIN_IN);
10920 if (nid != ALC861VD_PIN_CD_NID)
10921 snd_hda_codec_write(codec, nid, 0,
10922 AC_VERB_SET_AMP_GAIN_MUTE,
10928 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
10929 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
10931 /* add playback controls from the parsed DAC table */
10932 /* Based on ALC880 version. But ALC861VD has separate,
10933 * different NIDs for mute/unmute switch and volume control */
10934 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10935 const struct auto_pin_cfg *cfg)
10938 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
10939 hda_nid_t nid_v, nid_s;
10942 for (i = 0; i < cfg->line_outs; i++) {
10943 if (!spec->multiout.dac_nids[i])
10945 nid_v = alc861vd_idx_to_mixer_vol(
10947 spec->multiout.dac_nids[i]));
10948 nid_s = alc861vd_idx_to_mixer_switch(
10950 spec->multiout.dac_nids[i]));
10954 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10955 "Center Playback Volume",
10956 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
10960 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10961 "LFE Playback Volume",
10962 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
10966 err = add_control(spec, ALC_CTL_BIND_MUTE,
10967 "Center Playback Switch",
10968 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
10972 err = add_control(spec, ALC_CTL_BIND_MUTE,
10973 "LFE Playback Switch",
10974 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
10979 sprintf(name, "%s Playback Volume", chname[i]);
10980 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10981 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
10985 sprintf(name, "%s Playback Switch", chname[i]);
10986 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10987 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
10996 /* add playback controls for speaker and HP outputs */
10997 /* Based on ALC880 version. But ALC861VD has separate,
10998 * different NIDs for mute/unmute switch and volume control */
10999 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
11000 hda_nid_t pin, const char *pfx)
11002 hda_nid_t nid_v, nid_s;
11009 if (alc880_is_fixed_pin(pin)) {
11010 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11011 /* specify the DAC as the extra output */
11012 if (!spec->multiout.hp_nid)
11013 spec->multiout.hp_nid = nid_v;
11015 spec->multiout.extra_out_nid[0] = nid_v;
11016 /* control HP volume/switch on the output mixer amp */
11017 nid_v = alc861vd_idx_to_mixer_vol(
11018 alc880_fixed_pin_idx(pin));
11019 nid_s = alc861vd_idx_to_mixer_switch(
11020 alc880_fixed_pin_idx(pin));
11022 sprintf(name, "%s Playback Volume", pfx);
11023 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11024 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
11027 sprintf(name, "%s Playback Switch", pfx);
11028 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11029 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
11032 } else if (alc880_is_multi_pin(pin)) {
11033 /* set manual connection */
11034 /* we have only a switch on HP-out PIN */
11035 sprintf(name, "%s Playback Switch", pfx);
11036 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11037 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11044 /* parse the BIOS configuration and set up the alc_spec
11045 * return 1 if successful, 0 if the proper config is not found,
11046 * or a negative error code
11047 * Based on ALC880 version - had to change it to override
11048 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
11049 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11051 struct alc_spec *spec = codec->spec;
11053 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11055 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11059 if (!spec->autocfg.line_outs)
11060 return 0; /* can't find valid BIOS pin config */
11062 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11065 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
11068 err = alc861vd_auto_create_extra_out(spec,
11069 spec->autocfg.speaker_pins[0],
11073 err = alc861vd_auto_create_extra_out(spec,
11074 spec->autocfg.hp_pins[0],
11078 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
11082 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11084 if (spec->autocfg.dig_out_pin)
11085 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
11087 if (spec->kctl_alloc)
11088 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11090 spec->init_verbs[spec->num_init_verbs++]
11091 = alc861vd_volume_init_verbs;
11093 spec->num_mux_defs = 1;
11094 spec->input_mux = &spec->private_imux;
11099 /* additional initialization for auto-configuration model */
11100 static void alc861vd_auto_init(struct hda_codec *codec)
11102 alc861vd_auto_init_multi_out(codec);
11103 alc861vd_auto_init_hp_out(codec);
11104 alc861vd_auto_init_analog_input(codec);
11107 static int patch_alc861vd(struct hda_codec *codec)
11109 struct alc_spec *spec;
11110 int err, board_config;
11112 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11116 codec->spec = spec;
11118 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
11122 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
11123 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
11124 "ALC861VD, trying auto-probe from BIOS...\n");
11125 board_config = ALC861VD_AUTO;
11128 if (board_config == ALC861VD_AUTO) {
11129 /* automatic parse from the BIOS config */
11130 err = alc861vd_parse_auto_config(codec);
11136 "hda_codec: Cannot set up configuration "
11137 "from BIOS. Using base mode...\n");
11138 board_config = ALC861VD_3ST;
11142 if (board_config != ALC861VD_AUTO)
11143 setup_preset(spec, &alc861vd_presets[board_config]);
11145 spec->stream_name_analog = "ALC861VD Analog";
11146 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
11147 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
11149 spec->stream_name_digital = "ALC861VD Digital";
11150 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
11151 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
11153 spec->adc_nids = alc861vd_adc_nids;
11154 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
11156 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
11157 spec->num_mixers++;
11159 codec->patch_ops = alc_patch_ops;
11161 if (board_config == ALC861VD_AUTO)
11162 spec->init_hook = alc861vd_auto_init;
11163 #ifdef CONFIG_SND_HDA_POWER_SAVE
11164 if (!spec->loopback.amplist)
11165 spec->loopback.amplist = alc861vd_loopbacks;
11174 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11175 * configuration. Each pin widget can choose any input DACs and a mixer.
11176 * Each ADC is connected from a mixer of all inputs. This makes possible
11177 * 6-channel independent captures.
11179 * In addition, an independent DAC for the multi-playback (not used in this
11182 #define ALC662_DIGOUT_NID 0x06
11183 #define ALC662_DIGIN_NID 0x0a
11185 static hda_nid_t alc662_dac_nids[4] = {
11186 /* front, rear, clfe, rear_surr */
11190 static hda_nid_t alc662_adc_nids[1] = {
11195 /* FIXME: should be a matrix-type input source selection */
11197 static struct hda_input_mux alc662_capture_source = {
11201 { "Front Mic", 0x1 },
11207 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
11214 #define alc662_mux_enum_info alc_mux_enum_info
11215 #define alc662_mux_enum_get alc_mux_enum_get
11217 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
11218 struct snd_ctl_elem_value *ucontrol)
11220 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11221 struct alc_spec *spec = codec->spec;
11222 const struct hda_input_mux *imux = spec->input_mux;
11223 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
11224 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
11225 hda_nid_t nid = capture_mixers[adc_idx];
11226 unsigned int *cur_val = &spec->cur_mux[adc_idx];
11227 unsigned int i, idx;
11229 idx = ucontrol->value.enumerated.item[0];
11230 if (idx >= imux->num_items)
11231 idx = imux->num_items - 1;
11232 if (*cur_val == idx)
11234 for (i = 0; i < imux->num_items; i++) {
11235 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
11236 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
11237 imux->items[i].index,
11246 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
11253 static struct hda_verb alc662_3ST_ch2_init[] = {
11254 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
11255 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
11256 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
11257 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
11264 static struct hda_verb alc662_3ST_ch6_init[] = {
11265 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11266 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11267 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
11268 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11269 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11270 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
11274 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
11275 { 2, alc662_3ST_ch2_init },
11276 { 6, alc662_3ST_ch6_init },
11282 static struct hda_verb alc662_sixstack_ch6_init[] = {
11283 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11284 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
11285 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11292 static struct hda_verb alc662_sixstack_ch8_init[] = {
11293 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11294 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11295 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11299 static struct hda_channel_mode alc662_5stack_modes[2] = {
11300 { 2, alc662_sixstack_ch6_init },
11301 { 6, alc662_sixstack_ch8_init },
11304 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11305 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11308 static struct snd_kcontrol_new alc662_base_mixer[] = {
11309 /* output mixer control */
11310 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11311 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
11312 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11313 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11314 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
11315 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
11316 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
11317 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
11318 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11320 /*Input mixer control */
11321 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
11322 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
11323 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
11324 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
11325 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
11326 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
11328 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
11330 /* Capture mixer control */
11331 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11332 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11335 .name = "Capture Source",
11337 .info = alc_mux_enum_info,
11338 .get = alc_mux_enum_get,
11339 .put = alc_mux_enum_put,
11344 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
11345 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11346 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11356 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11357 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11358 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11359 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11362 /* .name = "Capture Source", */
11363 .name = "Input Source",
11365 .info = alc662_mux_enum_info,
11366 .get = alc662_mux_enum_get,
11367 .put = alc662_mux_enum_put,
11372 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
11373 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11374 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11375 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11376 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
11377 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
11378 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
11379 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
11380 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
11381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11383 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11388 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11389 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11390 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11391 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11392 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11393 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11396 /* .name = "Capture Source", */
11397 .name = "Input Source",
11399 .info = alc662_mux_enum_info,
11400 .get = alc662_mux_enum_get,
11401 .put = alc662_mux_enum_put,
11406 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
11407 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11408 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11409 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11410 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
11411 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11413 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11414 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11415 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11416 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11417 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11420 /* .name = "Capture Source", */
11421 .name = "Input Source",
11423 .info = alc662_mux_enum_info,
11424 .get = alc662_mux_enum_get,
11425 .put = alc662_mux_enum_put,
11430 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
11432 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11433 .name = "Channel Mode",
11434 .info = alc_ch_mode_info,
11435 .get = alc_ch_mode_get,
11436 .put = alc_ch_mode_put,
11441 static struct hda_verb alc662_init_verbs[] = {
11442 /* ADC: mute amp left and right */
11443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11444 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11445 /* Front mixer: unmute input/output amp left and right (volume = 0) */
11447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11453 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11454 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11455 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11456 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11457 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11458 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11460 /* Front Pin: output 0 (0x0c) */
11461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11462 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11464 /* Rear Pin: output 1 (0x0d) */
11465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11468 /* CLFE Pin: output 2 (0x0e) */
11469 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11470 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11472 /* Mic (rear) pin: input vref at 80% */
11473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11475 /* Front Mic pin: input vref at 80% */
11476 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11478 /* Line In pin: input */
11479 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11480 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11481 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11482 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11484 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11485 /* CD pin widget for input */
11486 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11488 /* FIXME: use matrix-type input source selection */
11489 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11498 static struct hda_verb alc662_sue_init_verbs[] = {
11499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
11500 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
11505 * generic initialization of ADC, input mixers and output mixers
11507 static struct hda_verb alc662_auto_init_verbs[] = {
11509 * Unmute ADC and set the default input to mic-in
11511 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11514 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11516 * Note: PASD motherboards uses the Line In 2 as the input for front
11517 * panel mic (mic 2)
11519 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11527 * Set up output mixers (0x0c - 0x0f)
11529 /* set vol=0 to output mixers */
11530 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11532 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11534 /* set up input amps for analog loopback */
11535 /* Amp Indices: DAC = 0, mixer = 1 */
11536 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11537 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11538 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11539 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11540 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11541 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11544 /* FIXME: use matrix-type input source selection */
11545 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11552 /* capture mixer elements */
11553 static struct snd_kcontrol_new alc662_capture_mixer[] = {
11554 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11555 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11557 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11558 /* The multiple "Capture Source" controls confuse alsamixer
11559 * So call somewhat different..
11560 * FIXME: the controls appear in the "playback" view!
11562 /* .name = "Capture Source", */
11563 .name = "Input Source",
11565 .info = alc882_mux_enum_info,
11566 .get = alc882_mux_enum_get,
11567 .put = alc882_mux_enum_put,
11572 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11574 unsigned int present;
11575 unsigned char bits;
11577 present = snd_hda_codec_read(codec, 0x14, 0,
11578 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11579 bits = present ? HDA_AMP_MUTE : 0;
11580 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11581 HDA_AMP_MUTE, bits);
11584 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11586 unsigned int present;
11587 unsigned char bits;
11589 present = snd_hda_codec_read(codec, 0x1b, 0,
11590 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11591 bits = present ? HDA_AMP_MUTE : 0;
11592 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11593 HDA_AMP_MUTE, bits);
11594 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11595 HDA_AMP_MUTE, bits);
11598 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
11601 if ((res >> 26) == ALC880_HP_EVENT)
11602 alc662_lenovo_101e_all_automute(codec);
11603 if ((res >> 26) == ALC880_FRONT_EVENT)
11604 alc662_lenovo_101e_ispeaker_automute(codec);
11607 #ifdef CONFIG_SND_HDA_POWER_SAVE
11608 #define alc662_loopbacks alc880_loopbacks
11612 /* pcm configuration: identiacal with ALC880 */
11613 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
11614 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
11615 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
11616 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
11619 * configuration and preset
11621 static const char *alc662_models[ALC662_MODEL_LAST] = {
11622 [ALC662_3ST_2ch_DIG] = "3stack-dig",
11623 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
11624 [ALC662_3ST_6ch] = "3stack-6ch",
11625 [ALC662_5ST_DIG] = "6stack-dig",
11626 [ALC662_LENOVO_101E] = "lenovo-101e",
11627 [ALC662_AUTO] = "auto",
11630 static struct snd_pci_quirk alc662_cfg_tbl[] = {
11631 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
11635 static struct alc_config_preset alc662_presets[] = {
11636 [ALC662_3ST_2ch_DIG] = {
11637 .mixers = { alc662_3ST_2ch_mixer },
11638 .init_verbs = { alc662_init_verbs },
11639 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11640 .dac_nids = alc662_dac_nids,
11641 .dig_out_nid = ALC662_DIGOUT_NID,
11642 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11643 .adc_nids = alc662_adc_nids,
11644 .dig_in_nid = ALC662_DIGIN_NID,
11645 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11646 .channel_mode = alc662_3ST_2ch_modes,
11647 .input_mux = &alc662_capture_source,
11649 [ALC662_3ST_6ch_DIG] = {
11650 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11651 .init_verbs = { alc662_init_verbs },
11652 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11653 .dac_nids = alc662_dac_nids,
11654 .dig_out_nid = ALC662_DIGOUT_NID,
11655 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11656 .adc_nids = alc662_adc_nids,
11657 .dig_in_nid = ALC662_DIGIN_NID,
11658 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11659 .channel_mode = alc662_3ST_6ch_modes,
11661 .input_mux = &alc662_capture_source,
11663 [ALC662_3ST_6ch] = {
11664 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11665 .init_verbs = { alc662_init_verbs },
11666 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11667 .dac_nids = alc662_dac_nids,
11668 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11669 .adc_nids = alc662_adc_nids,
11670 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11671 .channel_mode = alc662_3ST_6ch_modes,
11673 .input_mux = &alc662_capture_source,
11675 [ALC662_5ST_DIG] = {
11676 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
11677 .init_verbs = { alc662_init_verbs },
11678 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11679 .dac_nids = alc662_dac_nids,
11680 .dig_out_nid = ALC662_DIGOUT_NID,
11681 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11682 .adc_nids = alc662_adc_nids,
11683 .dig_in_nid = ALC662_DIGIN_NID,
11684 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
11685 .channel_mode = alc662_5stack_modes,
11686 .input_mux = &alc662_capture_source,
11688 [ALC662_LENOVO_101E] = {
11689 .mixers = { alc662_lenovo_101e_mixer },
11690 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
11691 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11692 .dac_nids = alc662_dac_nids,
11693 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11694 .adc_nids = alc662_adc_nids,
11695 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11696 .channel_mode = alc662_3ST_2ch_modes,
11697 .input_mux = &alc662_lenovo_101e_capture_source,
11698 .unsol_event = alc662_lenovo_101e_unsol_event,
11699 .init_hook = alc662_lenovo_101e_all_automute,
11706 * BIOS auto configuration
11709 /* add playback controls from the parsed DAC table */
11710 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
11711 const struct auto_pin_cfg *cfg)
11714 static const char *chname[4] = {
11715 "Front", "Surround", NULL /*CLFE*/, "Side"
11720 for (i = 0; i < cfg->line_outs; i++) {
11721 if (!spec->multiout.dac_nids[i])
11723 nid = alc880_idx_to_mixer(i);
11726 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11727 "Center Playback Volume",
11728 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11732 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11733 "LFE Playback Volume",
11734 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11738 err = add_control(spec, ALC_CTL_BIND_MUTE,
11739 "Center Playback Switch",
11740 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
11744 err = add_control(spec, ALC_CTL_BIND_MUTE,
11745 "LFE Playback Switch",
11746 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
11751 sprintf(name, "%s Playback Volume", chname[i]);
11752 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11753 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11757 sprintf(name, "%s Playback Switch", chname[i]);
11758 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11759 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
11768 /* add playback controls for speaker and HP outputs */
11769 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
11779 if (alc880_is_fixed_pin(pin)) {
11780 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11781 /* printk("DAC nid=%x\n",nid); */
11782 /* specify the DAC as the extra output */
11783 if (!spec->multiout.hp_nid)
11784 spec->multiout.hp_nid = nid;
11786 spec->multiout.extra_out_nid[0] = nid;
11787 /* control HP volume/switch on the output mixer amp */
11788 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11789 sprintf(name, "%s Playback Volume", pfx);
11790 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11791 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11794 sprintf(name, "%s Playback Switch", pfx);
11795 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11796 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
11799 } else if (alc880_is_multi_pin(pin)) {
11800 /* set manual connection */
11801 /* we have only a switch on HP-out PIN */
11802 sprintf(name, "%s Playback Switch", pfx);
11803 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11804 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11811 /* create playback/capture controls for input pins */
11812 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
11813 const struct auto_pin_cfg *cfg)
11815 struct hda_input_mux *imux = &spec->private_imux;
11818 for (i = 0; i < AUTO_PIN_LAST; i++) {
11819 if (alc880_is_input_pin(cfg->input_pins[i])) {
11820 idx = alc880_input_pin_idx(cfg->input_pins[i]);
11821 err = new_analog_input(spec, cfg->input_pins[i],
11822 auto_pin_cfg_labels[i],
11826 imux->items[imux->num_items].label =
11827 auto_pin_cfg_labels[i];
11828 imux->items[imux->num_items].index =
11829 alc880_input_pin_idx(cfg->input_pins[i]);
11836 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
11837 hda_nid_t nid, int pin_type,
11840 /* set as output */
11841 snd_hda_codec_write(codec, nid, 0,
11842 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11843 snd_hda_codec_write(codec, nid, 0,
11844 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11845 /* need the manual connection? */
11846 if (alc880_is_multi_pin(nid)) {
11847 struct alc_spec *spec = codec->spec;
11848 int idx = alc880_multi_pin_idx(nid);
11849 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
11850 AC_VERB_SET_CONNECT_SEL,
11851 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
11855 static void alc662_auto_init_multi_out(struct hda_codec *codec)
11857 struct alc_spec *spec = codec->spec;
11860 for (i = 0; i <= HDA_SIDE; i++) {
11861 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11862 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11864 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
11869 static void alc662_auto_init_hp_out(struct hda_codec *codec)
11871 struct alc_spec *spec = codec->spec;
11874 pin = spec->autocfg.hp_pins[0];
11875 if (pin) /* connect to front */
11877 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11880 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
11881 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
11883 static void alc662_auto_init_analog_input(struct hda_codec *codec)
11885 struct alc_spec *spec = codec->spec;
11888 for (i = 0; i < AUTO_PIN_LAST; i++) {
11889 hda_nid_t nid = spec->autocfg.input_pins[i];
11890 if (alc662_is_input_pin(nid)) {
11891 snd_hda_codec_write(codec, nid, 0,
11892 AC_VERB_SET_PIN_WIDGET_CONTROL,
11893 (i <= AUTO_PIN_FRONT_MIC ?
11894 PIN_VREF80 : PIN_IN));
11895 if (nid != ALC662_PIN_CD_NID)
11896 snd_hda_codec_write(codec, nid, 0,
11897 AC_VERB_SET_AMP_GAIN_MUTE,
11903 static int alc662_parse_auto_config(struct hda_codec *codec)
11905 struct alc_spec *spec = codec->spec;
11907 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11909 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11913 if (!spec->autocfg.line_outs)
11914 return 0; /* can't find valid BIOS pin config */
11916 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11919 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
11922 err = alc662_auto_create_extra_out(spec,
11923 spec->autocfg.speaker_pins[0],
11927 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11931 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
11935 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11937 if (spec->autocfg.dig_out_pin)
11938 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
11940 if (spec->kctl_alloc)
11941 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11943 spec->num_mux_defs = 1;
11944 spec->input_mux = &spec->private_imux;
11946 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
11947 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
11948 spec->num_mixers++;
11952 /* additional initialization for auto-configuration model */
11953 static void alc662_auto_init(struct hda_codec *codec)
11955 alc662_auto_init_multi_out(codec);
11956 alc662_auto_init_hp_out(codec);
11957 alc662_auto_init_analog_input(codec);
11960 static int patch_alc662(struct hda_codec *codec)
11962 struct alc_spec *spec;
11963 int err, board_config;
11965 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11969 codec->spec = spec;
11971 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
11974 if (board_config < 0) {
11975 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
11976 "trying auto-probe from BIOS...\n");
11977 board_config = ALC662_AUTO;
11980 if (board_config == ALC662_AUTO) {
11981 /* automatic parse from the BIOS config */
11982 err = alc662_parse_auto_config(codec);
11988 "hda_codec: Cannot set up configuration "
11989 "from BIOS. Using base mode...\n");
11990 board_config = ALC662_3ST_2ch_DIG;
11994 if (board_config != ALC662_AUTO)
11995 setup_preset(spec, &alc662_presets[board_config]);
11997 spec->stream_name_analog = "ALC662 Analog";
11998 spec->stream_analog_playback = &alc662_pcm_analog_playback;
11999 spec->stream_analog_capture = &alc662_pcm_analog_capture;
12001 spec->stream_name_digital = "ALC662 Digital";
12002 spec->stream_digital_playback = &alc662_pcm_digital_playback;
12003 spec->stream_digital_capture = &alc662_pcm_digital_capture;
12005 if (!spec->adc_nids && spec->input_mux) {
12006 spec->adc_nids = alc662_adc_nids;
12007 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
12010 codec->patch_ops = alc_patch_ops;
12011 if (board_config == ALC662_AUTO)
12012 spec->init_hook = alc662_auto_init;
12013 #ifdef CONFIG_SND_HDA_POWER_SAVE
12014 if (!spec->loopback.amplist)
12015 spec->loopback.amplist = alc662_loopbacks;
12024 struct hda_codec_preset snd_hda_preset_realtek[] = {
12025 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
12026 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
12027 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
12028 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
12029 .patch = patch_alc861 },
12030 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
12031 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
12032 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
12033 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
12034 .patch = patch_alc883 },
12035 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
12036 .patch = patch_alc662 },
12037 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
12038 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
12039 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
12040 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
12041 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
12042 {} /* terminator */