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 */
106 ALC268_MODEL_LAST /* last tag */
123 /* ALC861-VD models */
167 ALC883_TARGA_2ch_DIG,
172 ALC883_LENOVO_101E_2ch,
173 ALC883_LENOVO_NB0763,
174 ALC888_LENOVO_MS7195_DIG,
182 #define GPIO_MASK 0x03
185 /* codec parameterization */
186 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
187 unsigned int num_mixers;
189 const struct hda_verb *init_verbs[5]; /* initialization verbs
193 unsigned int num_init_verbs;
195 char *stream_name_analog; /* analog PCM stream */
196 struct hda_pcm_stream *stream_analog_playback;
197 struct hda_pcm_stream *stream_analog_capture;
199 char *stream_name_digital; /* digital PCM stream */
200 struct hda_pcm_stream *stream_digital_playback;
201 struct hda_pcm_stream *stream_digital_capture;
204 struct hda_multi_out multiout; /* playback set-up
205 * max_channels, dacs must be set
206 * dig_out_nid and hp_nid are optional
210 unsigned int num_adc_nids;
212 hda_nid_t dig_in_nid; /* digital-in NID; optional */
215 unsigned int num_mux_defs;
216 const struct hda_input_mux *input_mux;
217 unsigned int cur_mux[3];
220 const struct hda_channel_mode *channel_mode;
221 int num_channel_mode;
224 /* PCM information */
225 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
227 /* dynamic controls, init_verbs and input_mux */
228 struct auto_pin_cfg autocfg;
229 unsigned int num_kctl_alloc, num_kctl_used;
230 struct snd_kcontrol_new *kctl_alloc;
231 struct hda_input_mux private_imux;
232 hda_nid_t private_dac_nids[5];
235 void (*init_hook)(struct hda_codec *codec);
236 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
238 /* for pin sensing */
239 unsigned int sense_updated: 1;
240 unsigned int jack_present: 1;
244 * configuration template - to be copied to the spec instance
246 struct alc_config_preset {
247 struct snd_kcontrol_new *mixers[5]; /* should be identical size
250 const struct hda_verb *init_verbs[5];
251 unsigned int num_dacs;
253 hda_nid_t dig_out_nid; /* optional */
254 hda_nid_t hp_nid; /* optional */
255 unsigned int num_adc_nids;
257 hda_nid_t dig_in_nid;
258 unsigned int num_channel_mode;
259 const struct hda_channel_mode *channel_mode;
261 unsigned int num_mux_defs;
262 const struct hda_input_mux *input_mux;
263 void (*unsol_event)(struct hda_codec *, unsigned int);
264 void (*init_hook)(struct hda_codec *);
271 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
272 struct snd_ctl_elem_info *uinfo)
274 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
275 struct alc_spec *spec = codec->spec;
276 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
277 if (mux_idx >= spec->num_mux_defs)
279 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
282 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
283 struct snd_ctl_elem_value *ucontrol)
285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
286 struct alc_spec *spec = codec->spec;
287 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
289 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
293 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
294 struct snd_ctl_elem_value *ucontrol)
296 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
297 struct alc_spec *spec = codec->spec;
298 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
299 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
300 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
301 spec->adc_nids[adc_idx],
302 &spec->cur_mux[adc_idx]);
307 * channel mode setting
309 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
310 struct snd_ctl_elem_info *uinfo)
312 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
313 struct alc_spec *spec = codec->spec;
314 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
315 spec->num_channel_mode);
318 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
319 struct snd_ctl_elem_value *ucontrol)
321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
322 struct alc_spec *spec = codec->spec;
323 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
324 spec->num_channel_mode,
325 spec->multiout.max_channels);
328 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
329 struct snd_ctl_elem_value *ucontrol)
331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
332 struct alc_spec *spec = codec->spec;
333 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
334 spec->num_channel_mode,
335 &spec->multiout.max_channels);
336 if (err >= 0 && spec->need_dac_fix)
337 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
342 * Control the mode of pin widget settings via the mixer. "pc" is used
343 * instead of "%" to avoid consequences of accidently treating the % as
344 * being part of a format specifier. Maximum allowed length of a value is
345 * 63 characters plus NULL terminator.
347 * Note: some retasking pin complexes seem to ignore requests for input
348 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
349 * are requested. Therefore order this list so that this behaviour will not
350 * cause problems when mixer clients move through the enum sequentially.
351 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
354 static char *alc_pin_mode_names[] = {
355 "Mic 50pc bias", "Mic 80pc bias",
356 "Line in", "Line out", "Headphone out",
358 static unsigned char alc_pin_mode_values[] = {
359 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
361 /* The control can present all 5 options, or it can limit the options based
362 * in the pin being assumed to be exclusively an input or an output pin. In
363 * addition, "input" pins may or may not process the mic bias option
364 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
365 * accept requests for bias as of chip versions up to March 2006) and/or
366 * wiring in the computer.
368 #define ALC_PIN_DIR_IN 0x00
369 #define ALC_PIN_DIR_OUT 0x01
370 #define ALC_PIN_DIR_INOUT 0x02
371 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
372 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
374 /* Info about the pin modes supported by the different pin direction modes.
375 * For each direction the minimum and maximum values are given.
377 static signed char alc_pin_mode_dir_info[5][2] = {
378 { 0, 2 }, /* ALC_PIN_DIR_IN */
379 { 3, 4 }, /* ALC_PIN_DIR_OUT */
380 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
381 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
382 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
384 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
385 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
386 #define alc_pin_mode_n_items(_dir) \
387 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
389 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
390 struct snd_ctl_elem_info *uinfo)
392 unsigned int item_num = uinfo->value.enumerated.item;
393 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
395 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
397 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
399 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
400 item_num = alc_pin_mode_min(dir);
401 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
405 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
406 struct snd_ctl_elem_value *ucontrol)
409 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
410 hda_nid_t nid = kcontrol->private_value & 0xffff;
411 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
412 long *valp = ucontrol->value.integer.value;
413 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
414 AC_VERB_GET_PIN_WIDGET_CONTROL,
417 /* Find enumerated value for current pinctl setting */
418 i = alc_pin_mode_min(dir);
419 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
421 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
425 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
426 struct snd_ctl_elem_value *ucontrol)
429 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
430 hda_nid_t nid = kcontrol->private_value & 0xffff;
431 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
432 long val = *ucontrol->value.integer.value;
433 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
434 AC_VERB_GET_PIN_WIDGET_CONTROL,
437 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
438 val = alc_pin_mode_min(dir);
440 change = pinctl != alc_pin_mode_values[val];
442 /* Set pin mode to that requested */
443 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL,
444 alc_pin_mode_values[val]);
446 /* Also enable the retasking pin's input/output as required
447 * for the requested pin mode. Enum values of 2 or less are
450 * Dynamically switching the input/output buffers probably
451 * reduces noise slightly (particularly on input) so we'll
452 * do it. However, having both input and output buffers
453 * enabled simultaneously doesn't seem to be problematic if
454 * this turns out to be necessary in the future.
457 snd_hda_codec_write(codec, nid, 0,
458 AC_VERB_SET_AMP_GAIN_MUTE,
460 snd_hda_codec_write(codec, nid, 0,
461 AC_VERB_SET_AMP_GAIN_MUTE,
464 snd_hda_codec_write(codec, nid, 0,
465 AC_VERB_SET_AMP_GAIN_MUTE,
467 snd_hda_codec_write(codec, nid, 0,
468 AC_VERB_SET_AMP_GAIN_MUTE,
475 #define ALC_PIN_MODE(xname, nid, dir) \
476 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
477 .info = alc_pin_mode_info, \
478 .get = alc_pin_mode_get, \
479 .put = alc_pin_mode_put, \
480 .private_value = nid | (dir<<16) }
482 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
483 * together using a mask with more than one bit set. This control is
484 * currently used only by the ALC260 test model. At this stage they are not
485 * needed for any "production" models.
487 #ifdef CONFIG_SND_DEBUG
488 static int alc_gpio_data_info(struct snd_kcontrol *kcontrol,
489 struct snd_ctl_elem_info *uinfo)
491 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
493 uinfo->value.integer.min = 0;
494 uinfo->value.integer.max = 1;
498 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_value *ucontrol)
501 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
502 hda_nid_t nid = kcontrol->private_value & 0xffff;
503 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
504 long *valp = ucontrol->value.integer.value;
505 unsigned int val = snd_hda_codec_read(codec, nid, 0,
506 AC_VERB_GET_GPIO_DATA, 0x00);
508 *valp = (val & mask) != 0;
511 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
512 struct snd_ctl_elem_value *ucontrol)
515 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
516 hda_nid_t nid = kcontrol->private_value & 0xffff;
517 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
518 long val = *ucontrol->value.integer.value;
519 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
520 AC_VERB_GET_GPIO_DATA,
523 /* Set/unset the masked GPIO bit(s) as needed */
524 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
529 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_GPIO_DATA, gpio_data);
533 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
534 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
535 .info = alc_gpio_data_info, \
536 .get = alc_gpio_data_get, \
537 .put = alc_gpio_data_put, \
538 .private_value = nid | (mask<<16) }
539 #endif /* CONFIG_SND_DEBUG */
541 /* A switch control to allow the enabling of the digital IO pins on the
542 * ALC260. This is incredibly simplistic; the intention of this control is
543 * to provide something in the test model allowing digital outputs to be
544 * identified if present. If models are found which can utilise these
545 * outputs a more complete mixer control can be devised for those models if
548 #ifdef CONFIG_SND_DEBUG
549 static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol,
550 struct snd_ctl_elem_info *uinfo)
552 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
554 uinfo->value.integer.min = 0;
555 uinfo->value.integer.max = 1;
559 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
560 struct snd_ctl_elem_value *ucontrol)
562 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
563 hda_nid_t nid = kcontrol->private_value & 0xffff;
564 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
565 long *valp = ucontrol->value.integer.value;
566 unsigned int val = snd_hda_codec_read(codec, nid, 0,
567 AC_VERB_GET_DIGI_CONVERT, 0x00);
569 *valp = (val & mask) != 0;
572 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
573 struct snd_ctl_elem_value *ucontrol)
576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
577 hda_nid_t nid = kcontrol->private_value & 0xffff;
578 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
579 long val = *ucontrol->value.integer.value;
580 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
581 AC_VERB_GET_DIGI_CONVERT,
584 /* Set/unset the masked control bit(s) as needed */
585 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
590 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
595 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
596 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
597 .info = alc_spdif_ctrl_info, \
598 .get = alc_spdif_ctrl_get, \
599 .put = alc_spdif_ctrl_put, \
600 .private_value = nid | (mask<<16) }
601 #endif /* CONFIG_SND_DEBUG */
604 * set up from the preset table
606 static void setup_preset(struct alc_spec *spec,
607 const struct alc_config_preset *preset)
611 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
612 spec->mixers[spec->num_mixers++] = preset->mixers[i];
613 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
615 spec->init_verbs[spec->num_init_verbs++] =
616 preset->init_verbs[i];
618 spec->channel_mode = preset->channel_mode;
619 spec->num_channel_mode = preset->num_channel_mode;
620 spec->need_dac_fix = preset->need_dac_fix;
622 spec->multiout.max_channels = spec->channel_mode[0].channels;
624 spec->multiout.num_dacs = preset->num_dacs;
625 spec->multiout.dac_nids = preset->dac_nids;
626 spec->multiout.dig_out_nid = preset->dig_out_nid;
627 spec->multiout.hp_nid = preset->hp_nid;
629 spec->num_mux_defs = preset->num_mux_defs;
630 if (!spec->num_mux_defs)
631 spec->num_mux_defs = 1;
632 spec->input_mux = preset->input_mux;
634 spec->num_adc_nids = preset->num_adc_nids;
635 spec->adc_nids = preset->adc_nids;
636 spec->dig_in_nid = preset->dig_in_nid;
638 spec->unsol_event = preset->unsol_event;
639 spec->init_hook = preset->init_hook;
642 /* Enable GPIO mask and set output */
643 static struct hda_verb alc_gpio1_init_verbs[] = {
644 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
645 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
646 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
650 static struct hda_verb alc_gpio2_init_verbs[] = {
651 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
652 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
653 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
657 static struct hda_verb alc_gpio3_init_verbs[] = {
658 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
659 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
660 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
664 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
665 * 31 ~ 16 : Manufacture ID
667 * 7 ~ 0 : Assembly ID
668 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
670 static void alc_subsystem_id(struct hda_codec *codec,
671 unsigned int porta, unsigned int porte,
674 unsigned int ass, tmp;
676 ass = codec->subsystem_id;
681 tmp = (ass & 0x38) >> 3; /* external Amp control */
684 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
687 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
690 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
693 switch (codec->vendor_id) {
699 snd_hda_codec_write(codec, 0x14, 0,
700 AC_VERB_SET_EAPD_BTLENABLE, 2);
701 snd_hda_codec_write(codec, 0x15, 0,
702 AC_VERB_SET_EAPD_BTLENABLE, 2);
706 if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */
708 tmp = (ass & 0x1800) >> 11;
710 case 0: port = porta; break;
711 case 1: port = porte; break;
712 case 2: port = portd; break;
715 snd_hda_codec_write(codec, port, 0,
716 AC_VERB_SET_EAPD_BTLENABLE,
719 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
720 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF,
721 (tmp == 5 ? 0x3040 : 0x3050));
727 * Fix-up pin default configurations
735 static void alc_fix_pincfg(struct hda_codec *codec,
736 const struct snd_pci_quirk *quirk,
737 const struct alc_pincfg **pinfix)
739 const struct alc_pincfg *cfg;
741 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
745 cfg = pinfix[quirk->value];
746 for (; cfg->nid; cfg++) {
749 for (i = 0; i < 4; i++) {
750 snd_hda_codec_write(codec, cfg->nid, 0,
751 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
759 * ALC880 3-stack model
761 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
762 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
763 * F-Mic = 0x1b, HP = 0x19
766 static hda_nid_t alc880_dac_nids[4] = {
767 /* front, rear, clfe, rear_surr */
768 0x02, 0x05, 0x04, 0x03
771 static hda_nid_t alc880_adc_nids[3] = {
776 /* The datasheet says the node 0x07 is connected from inputs,
777 * but it shows zero connection in the real implementation on some devices.
778 * Note: this is a 915GAV bug, fixed on 915GLV
780 static hda_nid_t alc880_adc_nids_alt[2] = {
785 #define ALC880_DIGOUT_NID 0x06
786 #define ALC880_DIGIN_NID 0x0a
788 static struct hda_input_mux alc880_capture_source = {
792 { "Front Mic", 0x3 },
798 /* channel source setting (2/6 channel selection for 3-stack) */
800 static struct hda_verb alc880_threestack_ch2_init[] = {
801 /* set line-in to input, mute it */
802 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
803 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
804 /* set mic-in to input vref 80%, mute it */
805 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
806 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
811 static struct hda_verb alc880_threestack_ch6_init[] = {
812 /* set line-in to output, unmute it */
813 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
814 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
815 /* set mic-in to output, unmute it */
816 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
817 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
821 static struct hda_channel_mode alc880_threestack_modes[2] = {
822 { 2, alc880_threestack_ch2_init },
823 { 6, alc880_threestack_ch6_init },
826 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
827 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
828 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
829 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
830 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
831 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
832 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
833 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
834 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
835 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
836 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
841 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
843 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
844 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
848 .name = "Channel Mode",
849 .info = alc_ch_mode_info,
850 .get = alc_ch_mode_get,
851 .put = alc_ch_mode_put,
856 /* capture mixer elements */
857 static struct snd_kcontrol_new alc880_capture_mixer[] = {
858 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
859 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
860 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
861 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
862 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
863 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
865 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
866 /* The multiple "Capture Source" controls confuse alsamixer
867 * So call somewhat different..
868 * FIXME: the controls appear in the "playback" view!
870 /* .name = "Capture Source", */
871 .name = "Input Source",
873 .info = alc_mux_enum_info,
874 .get = alc_mux_enum_get,
875 .put = alc_mux_enum_put,
880 /* capture mixer elements (in case NID 0x07 not available) */
881 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
882 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
883 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
884 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
885 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
888 /* The multiple "Capture Source" controls confuse alsamixer
889 * So call somewhat different..
890 * FIXME: the controls appear in the "playback" view!
892 /* .name = "Capture Source", */
893 .name = "Input Source",
895 .info = alc_mux_enum_info,
896 .get = alc_mux_enum_get,
897 .put = alc_mux_enum_put,
905 * ALC880 5-stack model
907 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
909 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
910 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
913 /* additional mixers to alc880_three_stack_mixer */
914 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
915 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
916 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
920 /* channel source setting (6/8 channel selection for 5-stack) */
922 static struct hda_verb alc880_fivestack_ch6_init[] = {
923 /* set line-in to input, mute it */
924 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
925 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
930 static struct hda_verb alc880_fivestack_ch8_init[] = {
931 /* set line-in to output, unmute it */
932 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
933 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
937 static struct hda_channel_mode alc880_fivestack_modes[2] = {
938 { 6, alc880_fivestack_ch6_init },
939 { 8, alc880_fivestack_ch8_init },
944 * ALC880 6-stack model
946 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
948 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
949 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
952 static hda_nid_t alc880_6st_dac_nids[4] = {
953 /* front, rear, clfe, rear_surr */
954 0x02, 0x03, 0x04, 0x05
957 static struct hda_input_mux alc880_6stack_capture_source = {
961 { "Front Mic", 0x1 },
967 /* fixed 8-channels */
968 static struct hda_channel_mode alc880_sixstack_modes[1] = {
972 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
973 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
974 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
975 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
976 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
977 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
978 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
979 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
980 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
981 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
982 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
986 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
989 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
991 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
992 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
995 .name = "Channel Mode",
996 .info = alc_ch_mode_info,
997 .get = alc_ch_mode_get,
998 .put = alc_ch_mode_put,
1007 * W810 has rear IO for:
1010 * Center/LFE (DAC 04)
1013 * The system also has a pair of internal speakers, and a headphone jack.
1014 * These are both connected to Line2 on the codec, hence to DAC 02.
1016 * There is a variable resistor to control the speaker or headphone
1017 * volume. This is a hardware-only device without a software API.
1019 * Plugging headphones in will disable the internal speakers. This is
1020 * implemented in hardware, not via the driver using jack sense. In
1021 * a similar fashion, plugging into the rear socket marked "front" will
1022 * disable both the speakers and headphones.
1024 * For input, there's a microphone jack, and an "audio in" jack.
1025 * These may not do anything useful with this driver yet, because I
1026 * haven't setup any initialization verbs for these yet...
1029 static hda_nid_t alc880_w810_dac_nids[3] = {
1030 /* front, rear/surround, clfe */
1034 /* fixed 6 channels */
1035 static struct hda_channel_mode alc880_w810_modes[1] = {
1039 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1040 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1044 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1057 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1058 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1062 static hda_nid_t alc880_z71v_dac_nids[1] = {
1065 #define ALC880_Z71V_HP_DAC 0x03
1067 /* fixed 2 channels */
1068 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1072 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1075 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1076 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1087 * ALC880 F1734 model
1089 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1090 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1093 static hda_nid_t alc880_f1734_dac_nids[1] = {
1096 #define ALC880_F1734_HP_DAC 0x02
1098 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1100 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1101 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1102 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1106 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1115 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1116 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1117 * Mic = 0x18, Line = 0x1a
1120 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1121 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1123 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1124 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1126 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1127 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1128 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1129 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1130 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1131 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1132 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1133 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1134 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1135 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1137 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1140 .name = "Channel Mode",
1141 .info = alc_ch_mode_info,
1142 .get = alc_ch_mode_get,
1143 .put = alc_ch_mode_put,
1150 * ALC880 ASUS W1V model
1152 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1153 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1154 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1157 /* additional mixers to alc880_asus_mixer */
1158 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1159 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1160 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1164 /* additional mixers to alc880_asus_mixer */
1165 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1166 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1167 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1172 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1173 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1174 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1177 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1180 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1181 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1183 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1184 /* The multiple "Capture Source" controls confuse alsamixer
1185 * So call somewhat different..
1186 * FIXME: the controls appear in the "playback" view!
1188 /* .name = "Capture Source", */
1189 .name = "Input Source",
1191 .info = alc_mux_enum_info,
1192 .get = alc_mux_enum_get,
1193 .put = alc_mux_enum_put,
1199 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1200 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1201 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1202 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1203 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1204 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1205 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1206 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1207 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1208 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1209 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1210 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1211 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1215 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1216 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1217 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1220 .name = "Channel Mode",
1221 .info = alc_ch_mode_info,
1222 .get = alc_ch_mode_get,
1223 .put = alc_ch_mode_put,
1228 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1230 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1233 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1234 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1235 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1236 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1237 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1238 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1242 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1243 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1244 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1245 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1246 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1248 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1253 * build control elements
1255 static int alc_build_controls(struct hda_codec *codec)
1257 struct alc_spec *spec = codec->spec;
1261 for (i = 0; i < spec->num_mixers; i++) {
1262 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1267 if (spec->multiout.dig_out_nid) {
1268 err = snd_hda_create_spdif_out_ctls(codec,
1269 spec->multiout.dig_out_nid);
1273 if (spec->dig_in_nid) {
1274 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1283 * initialize the codec volumes, etc
1287 * generic initialization of ADC, input mixers and output mixers
1289 static struct hda_verb alc880_volume_init_verbs[] = {
1291 * Unmute ADC0-2 and set the default input to mic-in
1293 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1295 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1296 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1297 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1300 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1302 * Note: PASD motherboards uses the Line In 2 as the input for front
1305 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
1310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
1313 * Set up output mixers (0x0c - 0x0f)
1315 /* set vol=0 to output mixers */
1316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1319 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1320 /* set up input amps for analog loopback */
1321 /* Amp Indices: DAC = 0, mixer = 1 */
1322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1328 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1335 * 3-stack pin configuration:
1336 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1338 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1340 * preset connection lists of input pins
1341 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1343 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1344 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1345 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1348 * Set pin mode and muting
1350 /* set front pin widgets 0x14 for output */
1351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1353 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1354 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1356 /* Mic2 (as headphone out) for HP output */
1357 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1359 /* Line In pin widget for input */
1360 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1362 /* Line2 (as front mic) pin widget for input and vref at 80% */
1363 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1364 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1365 /* CD pin widget for input */
1366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1372 * 5-stack pin configuration:
1373 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1374 * line-in/side = 0x1a, f-mic = 0x1b
1376 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1378 * preset connection lists of input pins
1379 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1381 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1382 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1385 * Set pin mode and muting
1387 /* set pin widgets 0x14-0x17 for output */
1388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1391 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1392 /* unmute pins for output (no gain on this amp) */
1393 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1395 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1396 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1398 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1399 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1401 /* Mic2 (as headphone out) for HP output */
1402 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1403 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1404 /* Line In pin widget for input */
1405 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1407 /* Line2 (as front mic) pin widget for input and vref at 80% */
1408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1409 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1410 /* CD pin widget for input */
1411 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1417 * W810 pin configuration:
1418 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1420 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1421 /* hphone/speaker input selector: front DAC */
1422 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1425 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1426 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1428 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1429 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1431 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1432 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1438 * Z71V pin configuration:
1439 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1441 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1445 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1447 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1448 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1449 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1450 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1456 * 6-stack pin configuration:
1457 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1458 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1460 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1461 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1467 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1468 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1469 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1470 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1473 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1474 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1475 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1480 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1486 * Uniwill pin configuration:
1487 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1490 static struct hda_verb alc880_uniwill_init_verbs[] = {
1491 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1496 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1499 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1505 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1511 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1513 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1514 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1515 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1516 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1518 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1519 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1526 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1528 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1529 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1532 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1535 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1536 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1544 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1545 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1551 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1552 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1557 static struct hda_verb alc880_beep_init_verbs[] = {
1558 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1562 /* toggle speaker-output according to the hp-jack state */
1563 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1565 unsigned int present;
1568 present = snd_hda_codec_read(codec, 0x14, 0,
1569 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1570 bits = present ? 0x80 : 0;
1571 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
1573 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
1575 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0,
1577 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0,
1581 /* auto-toggle front mic */
1582 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1584 unsigned int present;
1587 present = snd_hda_codec_read(codec, 0x18, 0,
1588 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1589 bits = present ? 0x80 : 0;
1590 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1,
1592 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
1596 static void alc880_uniwill_automute(struct hda_codec *codec)
1598 alc880_uniwill_hp_automute(codec);
1599 alc880_uniwill_mic_automute(codec);
1602 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1605 /* Looks like the unsol event is incompatible with the standard
1606 * definition. 4bit tag is placed at 28 bit!
1608 switch (res >> 28) {
1609 case ALC880_HP_EVENT:
1610 alc880_uniwill_hp_automute(codec);
1612 case ALC880_MIC_EVENT:
1613 alc880_uniwill_mic_automute(codec);
1618 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1620 unsigned int present;
1623 present = snd_hda_codec_read(codec, 0x14, 0,
1624 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1625 bits = present ? 0x80 : 0;
1626 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0,
1628 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0,
1632 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1634 unsigned int present;
1636 present = snd_hda_codec_read(codec, 0x21, 0,
1637 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f;
1639 snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0,
1641 snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0,
1644 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
1646 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
1650 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1653 /* Looks like the unsol event is incompatible with the standard
1654 * definition. 4bit tag is placed at 28 bit!
1656 if ((res >> 28) == ALC880_HP_EVENT)
1657 alc880_uniwill_p53_hp_automute(codec);
1658 if ((res >> 28) == ALC880_DCVOL_EVENT)
1659 alc880_uniwill_p53_dcvol_automute(codec);
1664 * F1734 pin configuration:
1665 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1667 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1668 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1669 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1670 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1671 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1673 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1674 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1678 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1679 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1680 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1681 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1682 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1684 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1686 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1693 * ASUS pin configuration:
1694 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1696 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1697 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1698 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1699 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1700 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1705 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1707 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1708 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1709 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1712 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1713 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1714 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1715 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1717 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1719 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1724 /* Enable GPIO mask and set output */
1725 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1726 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1728 /* Clevo m520g init */
1729 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1730 /* headphone output */
1731 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1736 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1737 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1740 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1741 /* Mic1 (rear panel) */
1742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1743 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1744 /* Mic2 (front panel) */
1745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1746 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1750 /* change to EAPD mode */
1751 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1752 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1757 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1758 /* change to EAPD mode */
1759 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1760 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1762 /* Headphone output */
1763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1765 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1768 /* Line In pin widget for input */
1769 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1770 /* CD pin widget for input */
1771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1772 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1775 /* change to EAPD mode */
1776 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1777 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1783 * LG m1 express dual
1786 * Rear Line-In/Out (blue): 0x14
1787 * Build-in Mic-In: 0x15
1789 * HP-Out (green): 0x1b
1790 * Mic-In/Out (red): 0x19
1794 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1795 static hda_nid_t alc880_lg_dac_nids[3] = {
1799 /* seems analog CD is not working */
1800 static struct hda_input_mux alc880_lg_capture_source = {
1805 { "Internal Mic", 0x6 },
1809 /* 2,4,6 channel modes */
1810 static struct hda_verb alc880_lg_ch2_init[] = {
1811 /* set line-in and mic-in to input */
1812 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1813 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1817 static struct hda_verb alc880_lg_ch4_init[] = {
1818 /* set line-in to out and mic-in to input */
1819 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1820 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1824 static struct hda_verb alc880_lg_ch6_init[] = {
1825 /* set line-in and mic-in to output */
1826 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1827 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1831 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
1832 { 2, alc880_lg_ch2_init },
1833 { 4, alc880_lg_ch4_init },
1834 { 6, alc880_lg_ch6_init },
1837 static struct snd_kcontrol_new alc880_lg_mixer[] = {
1838 /* FIXME: it's not really "master" but front channels */
1839 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1840 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
1841 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1842 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
1843 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
1844 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
1845 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
1846 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
1847 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1848 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1849 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
1850 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
1851 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
1852 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
1854 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1855 .name = "Channel Mode",
1856 .info = alc_ch_mode_info,
1857 .get = alc_ch_mode_get,
1858 .put = alc_ch_mode_put,
1863 static struct hda_verb alc880_lg_init_verbs[] = {
1864 /* set capture source to mic-in */
1865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1867 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1868 /* mute all amp mixer inputs */
1869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
1870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},
1871 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)},
1872 /* line-in to input */
1873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1877 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1879 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1880 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1881 /* mic-in to input */
1882 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1883 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1886 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
1887 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1888 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1890 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1894 /* toggle speaker-output according to the hp-jack state */
1895 static void alc880_lg_automute(struct hda_codec *codec)
1897 unsigned int present;
1900 present = snd_hda_codec_read(codec, 0x1b, 0,
1901 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1902 bits = present ? 0x80 : 0;
1903 snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0,
1905 snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0,
1909 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
1911 /* Looks like the unsol event is incompatible with the standard
1912 * definition. 4bit tag is placed at 28 bit!
1914 if ((res >> 28) == 0x01)
1915 alc880_lg_automute(codec);
1924 * Built-in Mic-In: 0x19
1930 static struct hda_input_mux alc880_lg_lw_capture_source = {
1934 { "Internal Mic", 0x1 },
1939 #define alc880_lg_lw_modes alc880_threestack_modes
1941 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
1942 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1943 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1945 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1946 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1947 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1948 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1949 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1950 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1951 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1953 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1954 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1955 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1957 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1958 .name = "Channel Mode",
1959 .info = alc_ch_mode_info,
1960 .get = alc_ch_mode_get,
1961 .put = alc_ch_mode_put,
1966 static struct hda_verb alc880_lg_lw_init_verbs[] = {
1967 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1968 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1969 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1971 /* set capture source to mic-in */
1972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1975 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)},
1977 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1982 /* mic-in to input */
1983 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1986 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1989 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1993 /* toggle speaker-output according to the hp-jack state */
1994 static void alc880_lg_lw_automute(struct hda_codec *codec)
1996 unsigned int present;
1999 present = snd_hda_codec_read(codec, 0x1b, 0,
2000 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2001 bits = present ? 0x80 : 0;
2002 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
2004 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
2008 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2010 /* Looks like the unsol event is incompatible with the standard
2011 * definition. 4bit tag is placed at 28 bit!
2013 if ((res >> 28) == 0x01)
2014 alc880_lg_lw_automute(codec);
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);
2047 static int alc_resume(struct hda_codec *codec)
2049 struct alc_spec *spec = codec->spec;
2053 for (i = 0; i < spec->num_mixers; i++)
2054 snd_hda_resume_ctls(codec, spec->mixers[i]);
2055 if (spec->multiout.dig_out_nid)
2056 snd_hda_resume_spdif_out(codec);
2057 if (spec->dig_in_nid)
2058 snd_hda_resume_spdif_in(codec);
2065 * Analog playback callbacks
2067 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2068 struct hda_codec *codec,
2069 struct snd_pcm_substream *substream)
2071 struct alc_spec *spec = codec->spec;
2072 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2075 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2076 struct hda_codec *codec,
2077 unsigned int stream_tag,
2078 unsigned int format,
2079 struct snd_pcm_substream *substream)
2081 struct alc_spec *spec = codec->spec;
2082 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2083 stream_tag, format, substream);
2086 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2087 struct hda_codec *codec,
2088 struct snd_pcm_substream *substream)
2090 struct alc_spec *spec = codec->spec;
2091 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2097 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2098 struct hda_codec *codec,
2099 struct snd_pcm_substream *substream)
2101 struct alc_spec *spec = codec->spec;
2102 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2105 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2106 struct hda_codec *codec,
2107 unsigned int stream_tag,
2108 unsigned int format,
2109 struct snd_pcm_substream *substream)
2111 struct alc_spec *spec = codec->spec;
2112 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2113 stream_tag, format, substream);
2116 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2117 struct hda_codec *codec,
2118 struct snd_pcm_substream *substream)
2120 struct alc_spec *spec = codec->spec;
2121 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2127 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2128 struct hda_codec *codec,
2129 unsigned int stream_tag,
2130 unsigned int format,
2131 struct snd_pcm_substream *substream)
2133 struct alc_spec *spec = codec->spec;
2135 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2136 stream_tag, 0, format);
2140 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2141 struct hda_codec *codec,
2142 struct snd_pcm_substream *substream)
2144 struct alc_spec *spec = codec->spec;
2146 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2154 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2158 /* NID is set in alc_build_pcms */
2160 .open = alc880_playback_pcm_open,
2161 .prepare = alc880_playback_pcm_prepare,
2162 .cleanup = alc880_playback_pcm_cleanup
2166 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2170 /* NID is set in alc_build_pcms */
2172 .prepare = alc880_capture_pcm_prepare,
2173 .cleanup = alc880_capture_pcm_cleanup
2177 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2181 /* NID is set in alc_build_pcms */
2183 .open = alc880_dig_playback_pcm_open,
2184 .close = alc880_dig_playback_pcm_close,
2185 .prepare = alc880_dig_playback_pcm_prepare
2189 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2193 /* NID is set in alc_build_pcms */
2196 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2197 static struct hda_pcm_stream alc_pcm_null_playback = {
2203 static int alc_build_pcms(struct hda_codec *codec)
2205 struct alc_spec *spec = codec->spec;
2206 struct hda_pcm *info = spec->pcm_rec;
2209 codec->num_pcms = 1;
2210 codec->pcm_info = info;
2212 info->name = spec->stream_name_analog;
2213 if (spec->stream_analog_playback) {
2214 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2216 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2218 if (spec->stream_analog_capture) {
2219 snd_assert(spec->adc_nids, return -EINVAL);
2220 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2221 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2224 if (spec->channel_mode) {
2225 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2226 for (i = 0; i < spec->num_channel_mode; i++) {
2227 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2228 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2233 /* SPDIF for stream index #1 */
2234 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2235 codec->num_pcms = 2;
2236 info = spec->pcm_rec + 1;
2237 info->name = spec->stream_name_digital;
2238 if (spec->multiout.dig_out_nid &&
2239 spec->stream_digital_playback) {
2240 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2241 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2243 if (spec->dig_in_nid &&
2244 spec->stream_digital_capture) {
2245 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2246 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2250 /* If the use of more than one ADC is requested for the current
2251 * model, configure a second analog capture-only PCM.
2253 /* Additional Analaog capture for index #2 */
2254 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2256 codec->num_pcms = 3;
2257 info = spec->pcm_rec + 2;
2258 info->name = spec->stream_name_analog;
2259 /* No playback stream for second PCM */
2260 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2261 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2262 if (spec->stream_analog_capture) {
2263 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2264 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2271 static void alc_free(struct hda_codec *codec)
2273 struct alc_spec *spec = codec->spec;
2279 if (spec->kctl_alloc) {
2280 for (i = 0; i < spec->num_kctl_used; i++)
2281 kfree(spec->kctl_alloc[i].name);
2282 kfree(spec->kctl_alloc);
2289 static struct hda_codec_ops alc_patch_ops = {
2290 .build_controls = alc_build_controls,
2291 .build_pcms = alc_build_pcms,
2294 .unsol_event = alc_unsol_event,
2296 .resume = alc_resume,
2302 * Test configuration for debugging
2304 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2307 #ifdef CONFIG_SND_DEBUG
2308 static hda_nid_t alc880_test_dac_nids[4] = {
2309 0x02, 0x03, 0x04, 0x05
2312 static struct hda_input_mux alc880_test_capture_source = {
2321 { "Surround", 0x6 },
2325 static struct hda_channel_mode alc880_test_modes[4] = {
2332 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2333 struct snd_ctl_elem_info *uinfo)
2335 static char *texts[] = {
2336 "N/A", "Line Out", "HP Out",
2337 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2339 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2341 uinfo->value.enumerated.items = 8;
2342 if (uinfo->value.enumerated.item >= 8)
2343 uinfo->value.enumerated.item = 7;
2344 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2348 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2349 struct snd_ctl_elem_value *ucontrol)
2351 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2352 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2353 unsigned int pin_ctl, item = 0;
2355 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2356 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2357 if (pin_ctl & AC_PINCTL_OUT_EN) {
2358 if (pin_ctl & AC_PINCTL_HP_EN)
2362 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2363 switch (pin_ctl & AC_PINCTL_VREFEN) {
2364 case AC_PINCTL_VREF_HIZ: item = 3; break;
2365 case AC_PINCTL_VREF_50: item = 4; break;
2366 case AC_PINCTL_VREF_GRD: item = 5; break;
2367 case AC_PINCTL_VREF_80: item = 6; break;
2368 case AC_PINCTL_VREF_100: item = 7; break;
2371 ucontrol->value.enumerated.item[0] = item;
2375 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2376 struct snd_ctl_elem_value *ucontrol)
2378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2379 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2380 static unsigned int ctls[] = {
2381 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2382 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2383 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2384 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2385 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2386 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2388 unsigned int old_ctl, new_ctl;
2390 old_ctl = snd_hda_codec_read(codec, nid, 0,
2391 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2392 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2393 if (old_ctl != new_ctl) {
2394 snd_hda_codec_write(codec, nid, 0,
2395 AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl);
2396 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
2397 (ucontrol->value.enumerated.item[0] >= 3 ?
2404 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2405 struct snd_ctl_elem_info *uinfo)
2407 static char *texts[] = {
2408 "Front", "Surround", "CLFE", "Side"
2410 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2412 uinfo->value.enumerated.items = 4;
2413 if (uinfo->value.enumerated.item >= 4)
2414 uinfo->value.enumerated.item = 3;
2415 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2419 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2420 struct snd_ctl_elem_value *ucontrol)
2422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2423 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2426 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2427 ucontrol->value.enumerated.item[0] = sel & 3;
2431 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2432 struct snd_ctl_elem_value *ucontrol)
2434 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2435 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2438 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2439 if (ucontrol->value.enumerated.item[0] != sel) {
2440 sel = ucontrol->value.enumerated.item[0] & 3;
2441 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel);
2447 #define PIN_CTL_TEST(xname,nid) { \
2448 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2450 .info = alc_test_pin_ctl_info, \
2451 .get = alc_test_pin_ctl_get, \
2452 .put = alc_test_pin_ctl_put, \
2453 .private_value = nid \
2456 #define PIN_SRC_TEST(xname,nid) { \
2457 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2459 .info = alc_test_pin_src_info, \
2460 .get = alc_test_pin_src_get, \
2461 .put = alc_test_pin_src_put, \
2462 .private_value = nid \
2465 static struct snd_kcontrol_new alc880_test_mixer[] = {
2466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2467 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2468 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2469 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2471 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2472 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2473 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2474 PIN_CTL_TEST("Front Pin Mode", 0x14),
2475 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2476 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2477 PIN_CTL_TEST("Side Pin Mode", 0x17),
2478 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2479 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2480 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2481 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2482 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2483 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2484 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2485 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2486 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2487 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2488 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2489 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2490 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2491 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2492 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2493 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2497 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2498 .name = "Channel Mode",
2499 .info = alc_ch_mode_info,
2500 .get = alc_ch_mode_get,
2501 .put = alc_ch_mode_put,
2506 static struct hda_verb alc880_test_init_verbs[] = {
2507 /* Unmute inputs of 0x0c - 0x0f */
2508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2513 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2515 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2516 /* Vol output for 0x0c-0x0f */
2517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2518 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2519 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2521 /* Set output pins 0x14-0x17 */
2522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2525 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2526 /* Unmute output pins 0x14-0x17 */
2527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2529 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2531 /* Set input pins 0x18-0x1c */
2532 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2534 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2535 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2537 /* Mute input pins 0x18-0x1b */
2538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2544 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2545 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2546 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2548 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2549 /* Analog input/passthru */
2550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2562 static const char *alc880_models[ALC880_MODEL_LAST] = {
2563 [ALC880_3ST] = "3stack",
2564 [ALC880_TCL_S700] = "tcl",
2565 [ALC880_3ST_DIG] = "3stack-digout",
2566 [ALC880_CLEVO] = "clevo",
2567 [ALC880_5ST] = "5stack",
2568 [ALC880_5ST_DIG] = "5stack-digout",
2569 [ALC880_W810] = "w810",
2570 [ALC880_Z71V] = "z71v",
2571 [ALC880_6ST] = "6stack",
2572 [ALC880_6ST_DIG] = "6stack-digout",
2573 [ALC880_ASUS] = "asus",
2574 [ALC880_ASUS_W1V] = "asus-w1v",
2575 [ALC880_ASUS_DIG] = "asus-dig",
2576 [ALC880_ASUS_DIG2] = "asus-dig2",
2577 [ALC880_UNIWILL_DIG] = "uniwill",
2578 [ALC880_UNIWILL_P53] = "uniwill-p53",
2579 [ALC880_FUJITSU] = "fujitsu",
2580 [ALC880_F1734] = "F1734",
2582 [ALC880_LG_LW] = "lg-lw",
2583 #ifdef CONFIG_SND_DEBUG
2584 [ALC880_TEST] = "test",
2586 [ALC880_AUTO] = "auto",
2589 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2590 /* Broken BIOS configuration */
2591 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2592 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2594 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2595 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2596 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2597 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2598 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2599 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2600 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2601 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2602 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2604 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2605 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2607 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2608 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2609 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2610 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2611 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2612 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2613 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2614 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2615 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2616 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2617 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2618 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2619 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2620 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2621 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2623 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2624 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2625 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2626 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2627 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2628 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2629 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2630 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2631 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2632 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2633 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2634 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2635 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2636 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2637 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2638 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2639 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2640 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2642 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2643 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2644 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2645 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2647 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2648 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2649 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2650 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2652 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2653 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2654 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2655 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2657 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2658 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2659 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2660 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2661 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2662 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2663 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2664 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2665 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2666 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2667 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2673 * ALC880 codec presets
2675 static struct alc_config_preset alc880_presets[] = {
2677 .mixers = { alc880_three_stack_mixer },
2678 .init_verbs = { alc880_volume_init_verbs,
2679 alc880_pin_3stack_init_verbs },
2680 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2681 .dac_nids = alc880_dac_nids,
2682 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2683 .channel_mode = alc880_threestack_modes,
2685 .input_mux = &alc880_capture_source,
2687 [ALC880_3ST_DIG] = {
2688 .mixers = { alc880_three_stack_mixer },
2689 .init_verbs = { alc880_volume_init_verbs,
2690 alc880_pin_3stack_init_verbs },
2691 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2692 .dac_nids = alc880_dac_nids,
2693 .dig_out_nid = ALC880_DIGOUT_NID,
2694 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2695 .channel_mode = alc880_threestack_modes,
2697 .input_mux = &alc880_capture_source,
2699 [ALC880_TCL_S700] = {
2700 .mixers = { alc880_tcl_s700_mixer },
2701 .init_verbs = { alc880_volume_init_verbs,
2702 alc880_pin_tcl_S700_init_verbs,
2703 alc880_gpio2_init_verbs },
2704 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2705 .dac_nids = alc880_dac_nids,
2707 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2708 .channel_mode = alc880_2_jack_modes,
2709 .input_mux = &alc880_capture_source,
2712 .mixers = { alc880_three_stack_mixer,
2713 alc880_five_stack_mixer},
2714 .init_verbs = { alc880_volume_init_verbs,
2715 alc880_pin_5stack_init_verbs },
2716 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2717 .dac_nids = alc880_dac_nids,
2718 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2719 .channel_mode = alc880_fivestack_modes,
2720 .input_mux = &alc880_capture_source,
2722 [ALC880_5ST_DIG] = {
2723 .mixers = { alc880_three_stack_mixer,
2724 alc880_five_stack_mixer },
2725 .init_verbs = { alc880_volume_init_verbs,
2726 alc880_pin_5stack_init_verbs },
2727 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2728 .dac_nids = alc880_dac_nids,
2729 .dig_out_nid = ALC880_DIGOUT_NID,
2730 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2731 .channel_mode = alc880_fivestack_modes,
2732 .input_mux = &alc880_capture_source,
2735 .mixers = { alc880_six_stack_mixer },
2736 .init_verbs = { alc880_volume_init_verbs,
2737 alc880_pin_6stack_init_verbs },
2738 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2739 .dac_nids = alc880_6st_dac_nids,
2740 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2741 .channel_mode = alc880_sixstack_modes,
2742 .input_mux = &alc880_6stack_capture_source,
2744 [ALC880_6ST_DIG] = {
2745 .mixers = { alc880_six_stack_mixer },
2746 .init_verbs = { alc880_volume_init_verbs,
2747 alc880_pin_6stack_init_verbs },
2748 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2749 .dac_nids = alc880_6st_dac_nids,
2750 .dig_out_nid = ALC880_DIGOUT_NID,
2751 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2752 .channel_mode = alc880_sixstack_modes,
2753 .input_mux = &alc880_6stack_capture_source,
2756 .mixers = { alc880_w810_base_mixer },
2757 .init_verbs = { alc880_volume_init_verbs,
2758 alc880_pin_w810_init_verbs,
2759 alc880_gpio2_init_verbs },
2760 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2761 .dac_nids = alc880_w810_dac_nids,
2762 .dig_out_nid = ALC880_DIGOUT_NID,
2763 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2764 .channel_mode = alc880_w810_modes,
2765 .input_mux = &alc880_capture_source,
2768 .mixers = { alc880_z71v_mixer },
2769 .init_verbs = { alc880_volume_init_verbs,
2770 alc880_pin_z71v_init_verbs },
2771 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2772 .dac_nids = alc880_z71v_dac_nids,
2773 .dig_out_nid = ALC880_DIGOUT_NID,
2775 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2776 .channel_mode = alc880_2_jack_modes,
2777 .input_mux = &alc880_capture_source,
2780 .mixers = { alc880_f1734_mixer },
2781 .init_verbs = { alc880_volume_init_verbs,
2782 alc880_pin_f1734_init_verbs },
2783 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2784 .dac_nids = alc880_f1734_dac_nids,
2786 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2787 .channel_mode = alc880_2_jack_modes,
2788 .input_mux = &alc880_capture_source,
2791 .mixers = { alc880_asus_mixer },
2792 .init_verbs = { alc880_volume_init_verbs,
2793 alc880_pin_asus_init_verbs,
2794 alc880_gpio1_init_verbs },
2795 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2796 .dac_nids = alc880_asus_dac_nids,
2797 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2798 .channel_mode = alc880_asus_modes,
2800 .input_mux = &alc880_capture_source,
2802 [ALC880_ASUS_DIG] = {
2803 .mixers = { alc880_asus_mixer },
2804 .init_verbs = { alc880_volume_init_verbs,
2805 alc880_pin_asus_init_verbs,
2806 alc880_gpio1_init_verbs },
2807 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2808 .dac_nids = alc880_asus_dac_nids,
2809 .dig_out_nid = ALC880_DIGOUT_NID,
2810 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2811 .channel_mode = alc880_asus_modes,
2813 .input_mux = &alc880_capture_source,
2815 [ALC880_ASUS_DIG2] = {
2816 .mixers = { alc880_asus_mixer },
2817 .init_verbs = { alc880_volume_init_verbs,
2818 alc880_pin_asus_init_verbs,
2819 alc880_gpio2_init_verbs }, /* use GPIO2 */
2820 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2821 .dac_nids = alc880_asus_dac_nids,
2822 .dig_out_nid = ALC880_DIGOUT_NID,
2823 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2824 .channel_mode = alc880_asus_modes,
2826 .input_mux = &alc880_capture_source,
2828 [ALC880_ASUS_W1V] = {
2829 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2830 .init_verbs = { alc880_volume_init_verbs,
2831 alc880_pin_asus_init_verbs,
2832 alc880_gpio1_init_verbs },
2833 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2834 .dac_nids = alc880_asus_dac_nids,
2835 .dig_out_nid = ALC880_DIGOUT_NID,
2836 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2837 .channel_mode = alc880_asus_modes,
2839 .input_mux = &alc880_capture_source,
2841 [ALC880_UNIWILL_DIG] = {
2842 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2843 .init_verbs = { alc880_volume_init_verbs,
2844 alc880_pin_asus_init_verbs },
2845 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2846 .dac_nids = alc880_asus_dac_nids,
2847 .dig_out_nid = ALC880_DIGOUT_NID,
2848 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2849 .channel_mode = alc880_asus_modes,
2851 .input_mux = &alc880_capture_source,
2853 [ALC880_UNIWILL] = {
2854 .mixers = { alc880_uniwill_mixer },
2855 .init_verbs = { alc880_volume_init_verbs,
2856 alc880_uniwill_init_verbs },
2857 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2858 .dac_nids = alc880_asus_dac_nids,
2859 .dig_out_nid = ALC880_DIGOUT_NID,
2860 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2861 .channel_mode = alc880_threestack_modes,
2863 .input_mux = &alc880_capture_source,
2864 .unsol_event = alc880_uniwill_unsol_event,
2865 .init_hook = alc880_uniwill_automute,
2867 [ALC880_UNIWILL_P53] = {
2868 .mixers = { alc880_uniwill_p53_mixer },
2869 .init_verbs = { alc880_volume_init_verbs,
2870 alc880_uniwill_p53_init_verbs },
2871 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2872 .dac_nids = alc880_asus_dac_nids,
2873 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2874 .channel_mode = alc880_threestack_modes,
2875 .input_mux = &alc880_capture_source,
2876 .unsol_event = alc880_uniwill_p53_unsol_event,
2877 .init_hook = alc880_uniwill_p53_hp_automute,
2879 [ALC880_FUJITSU] = {
2880 .mixers = { alc880_fujitsu_mixer,
2881 alc880_pcbeep_mixer, },
2882 .init_verbs = { alc880_volume_init_verbs,
2883 alc880_uniwill_p53_init_verbs,
2884 alc880_beep_init_verbs },
2885 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2886 .dac_nids = alc880_dac_nids,
2887 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2888 .channel_mode = alc880_2_jack_modes,
2889 .input_mux = &alc880_capture_source,
2890 .unsol_event = alc880_uniwill_p53_unsol_event,
2891 .init_hook = alc880_uniwill_p53_hp_automute,
2894 .mixers = { alc880_three_stack_mixer },
2895 .init_verbs = { alc880_volume_init_verbs,
2896 alc880_pin_clevo_init_verbs },
2897 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2898 .dac_nids = alc880_dac_nids,
2900 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2901 .channel_mode = alc880_threestack_modes,
2903 .input_mux = &alc880_capture_source,
2906 .mixers = { alc880_lg_mixer },
2907 .init_verbs = { alc880_volume_init_verbs,
2908 alc880_lg_init_verbs },
2909 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
2910 .dac_nids = alc880_lg_dac_nids,
2911 .dig_out_nid = ALC880_DIGOUT_NID,
2912 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
2913 .channel_mode = alc880_lg_ch_modes,
2915 .input_mux = &alc880_lg_capture_source,
2916 .unsol_event = alc880_lg_unsol_event,
2917 .init_hook = alc880_lg_automute,
2920 .mixers = { alc880_lg_lw_mixer },
2921 .init_verbs = { alc880_volume_init_verbs,
2922 alc880_lg_lw_init_verbs },
2923 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2924 .dac_nids = alc880_dac_nids,
2925 .dig_out_nid = ALC880_DIGOUT_NID,
2926 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
2927 .channel_mode = alc880_lg_lw_modes,
2928 .input_mux = &alc880_lg_lw_capture_source,
2929 .unsol_event = alc880_lg_lw_unsol_event,
2930 .init_hook = alc880_lg_lw_automute,
2932 #ifdef CONFIG_SND_DEBUG
2934 .mixers = { alc880_test_mixer },
2935 .init_verbs = { alc880_test_init_verbs },
2936 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
2937 .dac_nids = alc880_test_dac_nids,
2938 .dig_out_nid = ALC880_DIGOUT_NID,
2939 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
2940 .channel_mode = alc880_test_modes,
2941 .input_mux = &alc880_test_capture_source,
2947 * Automatic parse of I/O pins from the BIOS configuration
2950 #define NUM_CONTROL_ALLOC 32
2951 #define NUM_VERB_ALLOC 32
2955 ALC_CTL_WIDGET_MUTE,
2958 static struct snd_kcontrol_new alc880_control_templates[] = {
2959 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2960 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2961 HDA_BIND_MUTE(NULL, 0, 0, 0),
2964 /* add dynamic controls */
2965 static int add_control(struct alc_spec *spec, int type, const char *name,
2968 struct snd_kcontrol_new *knew;
2970 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2971 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2973 /* array + terminator */
2974 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
2977 if (spec->kctl_alloc) {
2978 memcpy(knew, spec->kctl_alloc,
2979 sizeof(*knew) * spec->num_kctl_alloc);
2980 kfree(spec->kctl_alloc);
2982 spec->kctl_alloc = knew;
2983 spec->num_kctl_alloc = num;
2986 knew = &spec->kctl_alloc[spec->num_kctl_used];
2987 *knew = alc880_control_templates[type];
2988 knew->name = kstrdup(name, GFP_KERNEL);
2991 knew->private_value = val;
2992 spec->num_kctl_used++;
2996 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2997 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2998 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2999 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3000 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3001 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3002 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3003 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3004 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3005 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3006 #define ALC880_PIN_CD_NID 0x1c
3008 /* fill in the dac_nids table from the parsed pin configuration */
3009 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3010 const struct auto_pin_cfg *cfg)
3016 memset(assigned, 0, sizeof(assigned));
3017 spec->multiout.dac_nids = spec->private_dac_nids;
3019 /* check the pins hardwired to audio widget */
3020 for (i = 0; i < cfg->line_outs; i++) {
3021 nid = cfg->line_out_pins[i];
3022 if (alc880_is_fixed_pin(nid)) {
3023 int idx = alc880_fixed_pin_idx(nid);
3024 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3028 /* left pins can be connect to any audio widget */
3029 for (i = 0; i < cfg->line_outs; i++) {
3030 nid = cfg->line_out_pins[i];
3031 if (alc880_is_fixed_pin(nid))
3033 /* search for an empty channel */
3034 for (j = 0; j < cfg->line_outs; j++) {
3036 spec->multiout.dac_nids[i] =
3037 alc880_idx_to_dac(j);
3043 spec->multiout.num_dacs = cfg->line_outs;
3047 /* add playback controls from the parsed DAC table */
3048 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3049 const struct auto_pin_cfg *cfg)
3052 static const char *chname[4] = {
3053 "Front", "Surround", NULL /*CLFE*/, "Side"
3058 for (i = 0; i < cfg->line_outs; i++) {
3059 if (!spec->multiout.dac_nids[i])
3061 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3064 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3065 "Center Playback Volume",
3066 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3070 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3071 "LFE Playback Volume",
3072 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3076 err = add_control(spec, ALC_CTL_BIND_MUTE,
3077 "Center Playback Switch",
3078 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3082 err = add_control(spec, ALC_CTL_BIND_MUTE,
3083 "LFE Playback Switch",
3084 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3089 sprintf(name, "%s Playback Volume", chname[i]);
3090 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3091 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3095 sprintf(name, "%s Playback Switch", chname[i]);
3096 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3097 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3106 /* add playback controls for speaker and HP outputs */
3107 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3117 if (alc880_is_fixed_pin(pin)) {
3118 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3119 /* specify the DAC as the extra output */
3120 if (!spec->multiout.hp_nid)
3121 spec->multiout.hp_nid = nid;
3123 spec->multiout.extra_out_nid[0] = nid;
3124 /* control HP volume/switch on the output mixer amp */
3125 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3126 sprintf(name, "%s Playback Volume", pfx);
3127 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3128 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3131 sprintf(name, "%s Playback Switch", pfx);
3132 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3133 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3136 } else if (alc880_is_multi_pin(pin)) {
3137 /* set manual connection */
3138 /* we have only a switch on HP-out PIN */
3139 sprintf(name, "%s Playback Switch", pfx);
3140 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3141 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3148 /* create input playback/capture controls for the given pin */
3149 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3150 const char *ctlname,
3151 int idx, hda_nid_t mix_nid)
3156 sprintf(name, "%s Playback Volume", ctlname);
3157 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3158 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3161 sprintf(name, "%s Playback Switch", ctlname);
3162 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3163 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3169 /* create playback/capture controls for input pins */
3170 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3171 const struct auto_pin_cfg *cfg)
3173 struct hda_input_mux *imux = &spec->private_imux;
3176 for (i = 0; i < AUTO_PIN_LAST; i++) {
3177 if (alc880_is_input_pin(cfg->input_pins[i])) {
3178 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3179 err = new_analog_input(spec, cfg->input_pins[i],
3180 auto_pin_cfg_labels[i],
3184 imux->items[imux->num_items].label =
3185 auto_pin_cfg_labels[i];
3186 imux->items[imux->num_items].index =
3187 alc880_input_pin_idx(cfg->input_pins[i]);
3194 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3195 hda_nid_t nid, int pin_type,
3199 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3201 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3203 /* need the manual connection? */
3204 if (alc880_is_multi_pin(nid)) {
3205 struct alc_spec *spec = codec->spec;
3206 int idx = alc880_multi_pin_idx(nid);
3207 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3208 AC_VERB_SET_CONNECT_SEL,
3209 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3213 static int get_pin_type(int line_out_type)
3215 if (line_out_type == AUTO_PIN_HP_OUT)
3221 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3223 struct alc_spec *spec = codec->spec;
3226 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3227 for (i = 0; i < spec->autocfg.line_outs; i++) {
3228 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3229 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3230 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3234 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3236 struct alc_spec *spec = codec->spec;
3239 pin = spec->autocfg.speaker_pins[0];
3240 if (pin) /* connect to front */
3241 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3242 pin = spec->autocfg.hp_pins[0];
3243 if (pin) /* connect to front */
3244 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3247 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3249 struct alc_spec *spec = codec->spec;
3252 for (i = 0; i < AUTO_PIN_LAST; i++) {
3253 hda_nid_t nid = spec->autocfg.input_pins[i];
3254 if (alc880_is_input_pin(nid)) {
3255 snd_hda_codec_write(codec, nid, 0,
3256 AC_VERB_SET_PIN_WIDGET_CONTROL,
3257 i <= AUTO_PIN_FRONT_MIC ?
3258 PIN_VREF80 : PIN_IN);
3259 if (nid != ALC880_PIN_CD_NID)
3260 snd_hda_codec_write(codec, nid, 0,
3261 AC_VERB_SET_AMP_GAIN_MUTE,
3267 /* parse the BIOS configuration and set up the alc_spec */
3268 /* return 1 if successful, 0 if the proper config is not found,
3269 * or a negative error code
3271 static int alc880_parse_auto_config(struct hda_codec *codec)
3273 struct alc_spec *spec = codec->spec;
3275 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3277 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3281 if (!spec->autocfg.line_outs)
3282 return 0; /* can't find valid BIOS pin config */
3284 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3287 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3290 err = alc880_auto_create_extra_out(spec,
3291 spec->autocfg.speaker_pins[0],
3295 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3299 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3303 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3305 if (spec->autocfg.dig_out_pin)
3306 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3307 if (spec->autocfg.dig_in_pin)
3308 spec->dig_in_nid = ALC880_DIGIN_NID;
3310 if (spec->kctl_alloc)
3311 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3313 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3315 spec->num_mux_defs = 1;
3316 spec->input_mux = &spec->private_imux;
3321 /* additional initialization for auto-configuration model */
3322 static void alc880_auto_init(struct hda_codec *codec)
3324 alc880_auto_init_multi_out(codec);
3325 alc880_auto_init_extra_out(codec);
3326 alc880_auto_init_analog_input(codec);
3330 * OK, here we have finally the patch for ALC880
3333 static int patch_alc880(struct hda_codec *codec)
3335 struct alc_spec *spec;
3339 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3345 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3348 if (board_config < 0) {
3349 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3350 "trying auto-probe from BIOS...\n");
3351 board_config = ALC880_AUTO;
3354 if (board_config == ALC880_AUTO) {
3355 /* automatic parse from the BIOS config */
3356 err = alc880_parse_auto_config(codec);
3362 "hda_codec: Cannot set up configuration "
3363 "from BIOS. Using 3-stack mode...\n");
3364 board_config = ALC880_3ST;
3368 if (board_config != ALC880_AUTO)
3369 setup_preset(spec, &alc880_presets[board_config]);
3371 spec->stream_name_analog = "ALC880 Analog";
3372 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3373 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3375 spec->stream_name_digital = "ALC880 Digital";
3376 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3377 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3379 if (!spec->adc_nids && spec->input_mux) {
3380 /* check whether NID 0x07 is valid */
3381 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3383 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3384 if (wcap != AC_WID_AUD_IN) {
3385 spec->adc_nids = alc880_adc_nids_alt;
3386 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3387 spec->mixers[spec->num_mixers] =
3388 alc880_capture_alt_mixer;
3391 spec->adc_nids = alc880_adc_nids;
3392 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3393 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3398 codec->patch_ops = alc_patch_ops;
3399 if (board_config == ALC880_AUTO)
3400 spec->init_hook = alc880_auto_init;
3410 static hda_nid_t alc260_dac_nids[1] = {
3415 static hda_nid_t alc260_adc_nids[1] = {
3420 static hda_nid_t alc260_adc_nids_alt[1] = {
3425 static hda_nid_t alc260_hp_adc_nids[2] = {
3430 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3431 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3433 static hda_nid_t alc260_dual_adc_nids[2] = {
3438 #define ALC260_DIGOUT_NID 0x03
3439 #define ALC260_DIGIN_NID 0x06
3441 static struct hda_input_mux alc260_capture_source = {
3445 { "Front Mic", 0x1 },
3451 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3452 * headphone jack and the internal CD lines since these are the only pins at
3453 * which audio can appear. For flexibility, also allow the option of
3454 * recording the mixer output on the second ADC (ADC0 doesn't have a
3455 * connection to the mixer output).
3457 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3461 { "Mic/Line", 0x0 },
3463 { "Headphone", 0x2 },
3469 { "Mic/Line", 0x0 },
3471 { "Headphone", 0x2 },
3478 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3479 * the Fujitsu S702x, but jacks are marked differently.
3481 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3488 { "Headphone", 0x5 },
3497 { "Headphone", 0x6 },
3503 * This is just place-holder, so there's something for alc_build_pcms to look
3504 * at when it calculates the maximum number of channels. ALC260 has no mixer
3505 * element which allows changing the channel mode, so the verb list is
3508 static struct hda_channel_mode alc260_modes[1] = {
3513 /* Mixer combinations
3515 * basic: base_output + input + pc_beep + capture
3516 * HP: base_output + input + capture_alt
3517 * HP_3013: hp_3013 + input + capture
3518 * fujitsu: fujitsu + capture
3519 * acer: acer + capture
3522 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3523 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3524 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3525 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3526 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3527 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3528 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3532 static struct snd_kcontrol_new alc260_input_mixer[] = {
3533 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3534 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3535 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3536 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3538 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3539 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3540 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3544 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3545 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3546 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3550 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3551 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3552 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3553 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3554 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3555 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3556 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3557 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3558 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3562 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3563 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3565 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3566 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3567 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3568 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3569 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3570 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3571 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3572 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3573 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3574 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3575 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3576 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3577 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3581 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3582 * versions of the ALC260 don't act on requests to enable mic bias from NID
3583 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3584 * datasheet doesn't mention this restriction. At this stage it's not clear
3585 * whether this behaviour is intentional or is a hardware bug in chip
3586 * revisions available in early 2006. Therefore for now allow the
3587 * "Headphone Jack Mode" control to span all choices, but if it turns out
3588 * that the lack of mic bias for this NID is intentional we could change the
3589 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3591 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3592 * don't appear to make the mic bias available from the "line" jack, even
3593 * though the NID used for this jack (0x14) can supply it. The theory is
3594 * that perhaps Acer have included blocking capacitors between the ALC260
3595 * and the output jack. If this turns out to be the case for all such
3596 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3597 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3599 * The C20x Tablet series have a mono internal speaker which is controlled
3600 * via the chip's Mono sum widget and pin complex, so include the necessary
3601 * controls for such models. On models without a "mono speaker" the control
3602 * won't do anything.
3604 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3605 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3606 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3607 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3608 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3610 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3612 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3613 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3615 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3616 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3617 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3618 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3619 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3620 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3621 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3625 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3626 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3628 static struct snd_kcontrol_new alc260_will_mixer[] = {
3629 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3630 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3632 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3633 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3634 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3635 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3636 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3637 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3638 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3639 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3640 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3644 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3645 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3647 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3648 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3649 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3651 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3652 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3653 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3654 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3655 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3656 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3657 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3661 /* capture mixer elements */
3662 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3663 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3664 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3665 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3666 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3668 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3669 /* The multiple "Capture Source" controls confuse alsamixer
3670 * So call somewhat different..
3671 * FIXME: the controls appear in the "playback" view!
3673 /* .name = "Capture Source", */
3674 .name = "Input Source",
3676 .info = alc_mux_enum_info,
3677 .get = alc_mux_enum_get,
3678 .put = alc_mux_enum_put,
3683 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3684 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3685 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3688 /* The multiple "Capture Source" controls confuse alsamixer
3689 * So call somewhat different..
3690 * FIXME: the controls appear in the "playback" view!
3692 /* .name = "Capture Source", */
3693 .name = "Input Source",
3695 .info = alc_mux_enum_info,
3696 .get = alc_mux_enum_get,
3697 .put = alc_mux_enum_put,
3703 * initialization verbs
3705 static struct hda_verb alc260_init_verbs[] = {
3706 /* Line In pin widget for input */
3707 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3708 /* CD pin widget for input */
3709 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3710 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3712 /* Mic2 (front panel) pin widget for input and vref at 80% */
3713 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3714 /* LINE-2 is used for line-out in rear */
3715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3716 /* select line-out */
3717 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3719 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3721 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3723 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3724 /* mute capture amp left and right */
3725 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3726 /* set connection select to line in (default select for this ADC) */
3727 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3728 /* mute capture amp left and right */
3729 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3730 /* set connection select to line in (default select for this ADC) */
3731 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3732 /* set vol=0 Line-Out mixer amp left and right */
3733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3734 /* unmute pin widget amp left and right (no gain on this amp) */
3735 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3736 /* set vol=0 HP mixer amp left and right */
3737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3738 /* unmute pin widget amp left and right (no gain on this amp) */
3739 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3740 /* set vol=0 Mono mixer amp left and right */
3741 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3742 /* unmute pin widget amp left and right (no gain on this amp) */
3743 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 /* unmute LINE-2 out pin */
3745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3746 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
3752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
3754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3755 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3756 /* mute Front out path */
3757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3758 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3759 /* mute Headphone out path */
3760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3761 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3762 /* mute Mono out path */
3763 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3764 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3768 #if 0 /* should be identical with alc260_init_verbs? */
3769 static struct hda_verb alc260_hp_init_verbs[] = {
3770 /* Headphone and output */
3771 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3773 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3774 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3775 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3776 /* Mic2 (front panel) pin widget for input and vref at 80% */
3777 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3778 /* Line In pin widget for input */
3779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3780 /* Line-2 pin widget for output */
3781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3782 /* CD pin widget for input */
3783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3784 /* unmute amp left and right */
3785 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3786 /* set connection select to line in (default select for this ADC) */
3787 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3788 /* unmute Line-Out mixer amp left and right (volume = 0) */
3789 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3790 /* mute pin widget amp left and right (no gain on this amp) */
3791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3792 /* unmute HP mixer amp left and right (volume = 0) */
3793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3794 /* mute pin widget amp left and right (no gain on this amp) */
3795 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3796 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3800 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
3801 /* unmute Line In */
3802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
3804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3805 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3806 /* Unmute Front out path */
3807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3808 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3809 /* Unmute Headphone out path */
3810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3811 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3812 /* Unmute Mono out path */
3813 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3814 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3819 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3820 /* Line out and output */
3821 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3823 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3824 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3825 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3826 /* Mic2 (front panel) pin widget for input and vref at 80% */
3827 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3828 /* Line In pin widget for input */
3829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3830 /* Headphone pin widget for output */
3831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3832 /* CD pin widget for input */
3833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3834 /* unmute amp left and right */
3835 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3836 /* set connection select to line in (default select for this ADC) */
3837 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3838 /* unmute Line-Out mixer amp left and right (volume = 0) */
3839 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3840 /* mute pin widget amp left and right (no gain on this amp) */
3841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3842 /* unmute HP mixer amp left and right (volume = 0) */
3843 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3844 /* mute pin widget amp left and right (no gain on this amp) */
3845 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3846 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
3851 /* unmute Line In */
3852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
3854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3855 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3856 /* Unmute Front out path */
3857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3858 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3859 /* Unmute Headphone out path */
3860 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3861 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3862 /* Unmute Mono out path */
3863 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3864 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3868 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3869 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3870 * audio = 0x16, internal speaker = 0x10.
3872 static struct hda_verb alc260_fujitsu_init_verbs[] = {
3873 /* Disable all GPIOs */
3874 {0x01, AC_VERB_SET_GPIO_MASK, 0},
3875 /* Internal speaker is connected to headphone pin */
3876 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3877 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3879 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3880 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3881 /* Ensure all other unused pins are disabled and muted. */
3882 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3884 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3885 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3886 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3887 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3891 /* Disable digital (SPDIF) pins */
3892 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3893 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3895 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3896 * when acting as an output.
3898 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3900 /* Start with output sum widgets muted and their output gains at min */
3901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3906 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3909 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3911 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3912 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3913 /* Unmute Line1 pin widget output buffer since it starts as an output.
3914 * If the pin mode is changed by the user the pin mode control will
3915 * take care of enabling the pin's input/output buffers as needed.
3916 * Therefore there's no need to enable the input buffer at this
3919 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3920 /* Unmute input buffer of pin widget used for Line-in (no equiv
3923 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3925 /* Mute capture amp left and right */
3926 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3927 /* Set ADC connection select to match default mixer setting - line
3930 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
3932 /* Do the same for the second ADC: mute capture input amp and
3933 * set ADC connection to line in (on mic1 pin)
3935 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3936 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
3938 /* Mute all inputs to mixer widget (even unconnected ones) */
3939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
3940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
3941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
3942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
3943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
3944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
3946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
3951 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3952 * similar laptops (adapted from Fujitsu init verbs).
3954 static struct hda_verb alc260_acer_init_verbs[] = {
3955 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3956 * the headphone jack. Turn this on and rely on the standard mute
3957 * methods whenever the user wants to turn these outputs off.
3959 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
3960 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
3961 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
3962 /* Internal speaker/Headphone jack is connected to Line-out pin */
3963 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3964 /* Internal microphone/Mic jack is connected to Mic1 pin */
3965 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3966 /* Line In jack is connected to Line1 pin */
3967 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3968 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
3969 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3970 /* Ensure all other unused pins are disabled and muted. */
3971 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3972 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3973 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3974 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3977 /* Disable digital (SPDIF) pins */
3978 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3979 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3981 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3982 * bus when acting as outputs.
3984 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
3985 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3987 /* Start with output sum widgets muted and their output gains at min */
3988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3991 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3994 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3995 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3996 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3998 /* Unmute Line-out pin widget amp left and right
3999 * (no equiv mixer ctrl)
4001 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4002 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4003 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4004 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4005 * inputs. If the pin mode is changed by the user the pin mode control
4006 * will take care of enabling the pin's input/output buffers as needed.
4007 * Therefore there's no need to enable the input buffer at this
4010 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4013 /* Mute capture amp left and right */
4014 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4015 /* Set ADC connection select to match default mixer setting - mic
4018 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4020 /* Do similar with the second ADC: mute capture input amp and
4021 * set ADC connection to mic to match ALSA's default state.
4023 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4024 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4026 /* Mute all inputs to mixer widget (even unconnected ones) */
4027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4039 static struct hda_verb alc260_will_verbs[] = {
4040 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4041 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4042 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4043 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4044 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4045 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4049 static struct hda_verb alc260_replacer_672v_verbs[] = {
4050 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4051 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4052 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4054 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4055 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4056 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4058 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4062 /* toggle speaker-output according to the hp-jack state */
4063 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4065 unsigned int present;
4067 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4068 present = snd_hda_codec_read(codec, 0x0f, 0,
4069 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4071 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 1);
4072 snd_hda_codec_write(codec, 0x0f, 0,
4073 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4075 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
4076 snd_hda_codec_write(codec, 0x0f, 0,
4077 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4081 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4084 if ((res >> 26) == ALC880_HP_EVENT)
4085 alc260_replacer_672v_automute(codec);
4088 /* Test configuration for debugging, modelled after the ALC880 test
4091 #ifdef CONFIG_SND_DEBUG
4092 static hda_nid_t alc260_test_dac_nids[1] = {
4095 static hda_nid_t alc260_test_adc_nids[2] = {
4098 /* For testing the ALC260, each input MUX needs its own definition since
4099 * the signal assignments are different. This assumes that the first ADC
4102 static struct hda_input_mux alc260_test_capture_sources[2] = {
4106 { "MIC1 pin", 0x0 },
4107 { "MIC2 pin", 0x1 },
4108 { "LINE1 pin", 0x2 },
4109 { "LINE2 pin", 0x3 },
4111 { "LINE-OUT pin", 0x5 },
4112 { "HP-OUT pin", 0x6 },
4118 { "MIC1 pin", 0x0 },
4119 { "MIC2 pin", 0x1 },
4120 { "LINE1 pin", 0x2 },
4121 { "LINE2 pin", 0x3 },
4124 { "LINE-OUT pin", 0x6 },
4125 { "HP-OUT pin", 0x7 },
4129 static struct snd_kcontrol_new alc260_test_mixer[] = {
4130 /* Output driver widgets */
4131 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4132 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4133 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4134 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4135 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4136 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4138 /* Modes for retasking pin widgets
4139 * Note: the ALC260 doesn't seem to act on requests to enable mic
4140 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4141 * mention this restriction. At this stage it's not clear whether
4142 * this behaviour is intentional or is a hardware bug in chip
4143 * revisions available at least up until early 2006. Therefore for
4144 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4145 * choices, but if it turns out that the lack of mic bias for these
4146 * NIDs is intentional we could change their modes from
4147 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4149 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4150 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4151 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4152 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4153 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4154 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4156 /* Loopback mixer controls */
4157 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4158 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4159 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4160 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4161 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4162 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4163 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4164 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4165 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4166 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4167 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4168 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4169 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4170 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4171 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4172 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4174 /* Controls for GPIO pins, assuming they are configured as outputs */
4175 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4176 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4177 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4178 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4180 /* Switches to allow the digital IO pins to be enabled. The datasheet
4181 * is ambigious as to which NID is which; testing on laptops which
4182 * make this output available should provide clarification.
4184 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4185 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4189 static struct hda_verb alc260_test_init_verbs[] = {
4190 /* Enable all GPIOs as outputs with an initial value of 0 */
4191 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4192 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4193 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4195 /* Enable retasking pins as output, initially without power amp */
4196 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4197 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4199 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4200 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4203 /* Disable digital (SPDIF) pins initially, but users can enable
4204 * them via a mixer switch. In the case of SPDIF-out, this initverb
4205 * payload also sets the generation to 0, output to be in "consumer"
4206 * PCM format, copyright asserted, no pre-emphasis and no validity
4209 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4210 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4212 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4213 * OUT1 sum bus when acting as an output.
4215 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4216 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4217 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4218 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4220 /* Start with output sum widgets muted and their output gains at min */
4221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4224 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4225 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4226 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4227 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4228 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4229 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4231 /* Unmute retasking pin widget output buffers since the default
4232 * state appears to be output. As the pin mode is changed by the
4233 * user the pin mode control will take care of enabling the pin's
4234 * input/output buffers as needed.
4236 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4237 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4240 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4241 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4242 /* Also unmute the mono-out pin widget */
4243 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4245 /* Mute capture amp left and right */
4246 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4247 /* Set ADC connection select to match default mixer setting (mic1
4250 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4252 /* Do the same for the second ADC: mute capture input amp and
4253 * set ADC connection to mic1 pin
4255 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4256 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4258 /* Mute all inputs to mixer widget (even unconnected ones) */
4259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4263 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4272 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4278 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4284 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4285 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4288 * for BIOS auto-configuration
4291 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4295 unsigned long vol_val, sw_val;
4299 if (nid >= 0x0f && nid < 0x11) {
4300 nid_vol = nid - 0x7;
4301 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4302 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4303 } else if (nid == 0x11) {
4304 nid_vol = nid - 0x7;
4305 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4306 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4307 } else if (nid >= 0x12 && nid <= 0x15) {
4309 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4310 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4314 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4315 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4318 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4319 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4325 /* add playback controls from the parsed DAC table */
4326 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4327 const struct auto_pin_cfg *cfg)
4332 spec->multiout.num_dacs = 1;
4333 spec->multiout.dac_nids = spec->private_dac_nids;
4334 spec->multiout.dac_nids[0] = 0x02;
4336 nid = cfg->line_out_pins[0];
4338 err = alc260_add_playback_controls(spec, nid, "Front");
4343 nid = cfg->speaker_pins[0];
4345 err = alc260_add_playback_controls(spec, nid, "Speaker");
4350 nid = cfg->hp_pins[0];
4352 err = alc260_add_playback_controls(spec, nid, "Headphone");
4359 /* create playback/capture controls for input pins */
4360 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4361 const struct auto_pin_cfg *cfg)
4363 struct hda_input_mux *imux = &spec->private_imux;
4366 for (i = 0; i < AUTO_PIN_LAST; i++) {
4367 if (cfg->input_pins[i] >= 0x12) {
4368 idx = cfg->input_pins[i] - 0x12;
4369 err = new_analog_input(spec, cfg->input_pins[i],
4370 auto_pin_cfg_labels[i], idx,
4374 imux->items[imux->num_items].label =
4375 auto_pin_cfg_labels[i];
4376 imux->items[imux->num_items].index = idx;
4379 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4380 idx = cfg->input_pins[i] - 0x09;
4381 err = new_analog_input(spec, cfg->input_pins[i],
4382 auto_pin_cfg_labels[i], idx,
4386 imux->items[imux->num_items].label =
4387 auto_pin_cfg_labels[i];
4388 imux->items[imux->num_items].index = idx;
4395 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4396 hda_nid_t nid, int pin_type,
4400 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4402 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4404 /* need the manual connection? */
4406 int idx = nid - 0x12;
4407 snd_hda_codec_write(codec, idx + 0x0b, 0,
4408 AC_VERB_SET_CONNECT_SEL, sel_idx);
4412 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4414 struct alc_spec *spec = codec->spec;
4417 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4418 nid = spec->autocfg.line_out_pins[0];
4420 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4421 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4424 nid = spec->autocfg.speaker_pins[0];
4426 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4428 nid = spec->autocfg.hp_pins[0];
4430 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4433 #define ALC260_PIN_CD_NID 0x16
4434 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4436 struct alc_spec *spec = codec->spec;
4439 for (i = 0; i < AUTO_PIN_LAST; i++) {
4440 hda_nid_t nid = spec->autocfg.input_pins[i];
4442 snd_hda_codec_write(codec, nid, 0,
4443 AC_VERB_SET_PIN_WIDGET_CONTROL,
4444 i <= AUTO_PIN_FRONT_MIC ?
4445 PIN_VREF80 : PIN_IN);
4446 if (nid != ALC260_PIN_CD_NID)
4447 snd_hda_codec_write(codec, nid, 0,
4448 AC_VERB_SET_AMP_GAIN_MUTE,
4455 * generic initialization of ADC, input mixers and output mixers
4457 static struct hda_verb alc260_volume_init_verbs[] = {
4459 * Unmute ADC0-1 and set the default input to mic-in
4461 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4462 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4463 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4464 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4466 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4468 * Note: PASD motherboards uses the Line In 2 as the input for
4469 * front panel mic (mic 2)
4471 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
4475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
4476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
4479 * Set up output mixers (0x08 - 0x0a)
4481 /* set vol=0 to output mixers */
4482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4484 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4485 /* set up input amps for analog loopback */
4486 /* Amp Indices: DAC = 0, mixer = 1 */
4487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4489 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4490 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4492 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4497 static int alc260_parse_auto_config(struct hda_codec *codec)
4499 struct alc_spec *spec = codec->spec;
4502 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4504 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4508 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4511 if (!spec->kctl_alloc)
4512 return 0; /* can't find valid BIOS pin config */
4513 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4517 spec->multiout.max_channels = 2;
4519 if (spec->autocfg.dig_out_pin)
4520 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4521 if (spec->kctl_alloc)
4522 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4524 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4526 spec->num_mux_defs = 1;
4527 spec->input_mux = &spec->private_imux;
4529 /* check whether NID 0x04 is valid */
4530 wcap = get_wcaps(codec, 0x04);
4531 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4532 if (wcap != AC_WID_AUD_IN) {
4533 spec->adc_nids = alc260_adc_nids_alt;
4534 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4535 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4537 spec->adc_nids = alc260_adc_nids;
4538 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4539 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4546 /* additional initialization for auto-configuration model */
4547 static void alc260_auto_init(struct hda_codec *codec)
4549 alc260_auto_init_multi_out(codec);
4550 alc260_auto_init_analog_input(codec);
4554 * ALC260 configurations
4556 static const char *alc260_models[ALC260_MODEL_LAST] = {
4557 [ALC260_BASIC] = "basic",
4559 [ALC260_HP_3013] = "hp-3013",
4560 [ALC260_FUJITSU_S702X] = "fujitsu",
4561 [ALC260_ACER] = "acer",
4562 [ALC260_WILL] = "will",
4563 [ALC260_REPLACER_672V] = "replacer",
4564 #ifdef CONFIG_SND_DEBUG
4565 [ALC260_TEST] = "test",
4567 [ALC260_AUTO] = "auto",
4570 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4571 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4572 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4573 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4574 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4575 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4576 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4577 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4578 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4579 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4580 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4581 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4582 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4583 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4584 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4585 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4586 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4587 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4588 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4592 static struct alc_config_preset alc260_presets[] = {
4594 .mixers = { alc260_base_output_mixer,
4596 alc260_pc_beep_mixer,
4597 alc260_capture_mixer },
4598 .init_verbs = { alc260_init_verbs },
4599 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4600 .dac_nids = alc260_dac_nids,
4601 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4602 .adc_nids = alc260_adc_nids,
4603 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4604 .channel_mode = alc260_modes,
4605 .input_mux = &alc260_capture_source,
4608 .mixers = { alc260_base_output_mixer,
4610 alc260_capture_alt_mixer },
4611 .init_verbs = { alc260_init_verbs },
4612 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4613 .dac_nids = alc260_dac_nids,
4614 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4615 .adc_nids = alc260_hp_adc_nids,
4616 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4617 .channel_mode = alc260_modes,
4618 .input_mux = &alc260_capture_source,
4620 [ALC260_HP_3013] = {
4621 .mixers = { alc260_hp_3013_mixer,
4623 alc260_capture_alt_mixer },
4624 .init_verbs = { alc260_hp_3013_init_verbs },
4625 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4626 .dac_nids = alc260_dac_nids,
4627 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4628 .adc_nids = alc260_hp_adc_nids,
4629 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4630 .channel_mode = alc260_modes,
4631 .input_mux = &alc260_capture_source,
4633 [ALC260_FUJITSU_S702X] = {
4634 .mixers = { alc260_fujitsu_mixer,
4635 alc260_capture_mixer },
4636 .init_verbs = { alc260_fujitsu_init_verbs },
4637 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4638 .dac_nids = alc260_dac_nids,
4639 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4640 .adc_nids = alc260_dual_adc_nids,
4641 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4642 .channel_mode = alc260_modes,
4643 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4644 .input_mux = alc260_fujitsu_capture_sources,
4647 .mixers = { alc260_acer_mixer,
4648 alc260_capture_mixer },
4649 .init_verbs = { alc260_acer_init_verbs },
4650 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4651 .dac_nids = alc260_dac_nids,
4652 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4653 .adc_nids = alc260_dual_adc_nids,
4654 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4655 .channel_mode = alc260_modes,
4656 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4657 .input_mux = alc260_acer_capture_sources,
4660 .mixers = { alc260_will_mixer,
4661 alc260_capture_mixer },
4662 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4663 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4664 .dac_nids = alc260_dac_nids,
4665 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4666 .adc_nids = alc260_adc_nids,
4667 .dig_out_nid = ALC260_DIGOUT_NID,
4668 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4669 .channel_mode = alc260_modes,
4670 .input_mux = &alc260_capture_source,
4672 [ALC260_REPLACER_672V] = {
4673 .mixers = { alc260_replacer_672v_mixer,
4674 alc260_capture_mixer },
4675 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4676 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4677 .dac_nids = alc260_dac_nids,
4678 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4679 .adc_nids = alc260_adc_nids,
4680 .dig_out_nid = ALC260_DIGOUT_NID,
4681 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4682 .channel_mode = alc260_modes,
4683 .input_mux = &alc260_capture_source,
4684 .unsol_event = alc260_replacer_672v_unsol_event,
4685 .init_hook = alc260_replacer_672v_automute,
4687 #ifdef CONFIG_SND_DEBUG
4689 .mixers = { alc260_test_mixer,
4690 alc260_capture_mixer },
4691 .init_verbs = { alc260_test_init_verbs },
4692 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4693 .dac_nids = alc260_test_dac_nids,
4694 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4695 .adc_nids = alc260_test_adc_nids,
4696 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4697 .channel_mode = alc260_modes,
4698 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4699 .input_mux = alc260_test_capture_sources,
4704 static int patch_alc260(struct hda_codec *codec)
4706 struct alc_spec *spec;
4707 int err, board_config;
4709 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4715 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4718 if (board_config < 0) {
4719 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4720 "trying auto-probe from BIOS...\n");
4721 board_config = ALC260_AUTO;
4724 if (board_config == ALC260_AUTO) {
4725 /* automatic parse from the BIOS config */
4726 err = alc260_parse_auto_config(codec);
4732 "hda_codec: Cannot set up configuration "
4733 "from BIOS. Using base mode...\n");
4734 board_config = ALC260_BASIC;
4738 if (board_config != ALC260_AUTO)
4739 setup_preset(spec, &alc260_presets[board_config]);
4741 spec->stream_name_analog = "ALC260 Analog";
4742 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4743 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4745 spec->stream_name_digital = "ALC260 Digital";
4746 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4747 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4749 codec->patch_ops = alc_patch_ops;
4750 if (board_config == ALC260_AUTO)
4751 spec->init_hook = alc260_auto_init;
4760 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4761 * configuration. Each pin widget can choose any input DACs and a mixer.
4762 * Each ADC is connected from a mixer of all inputs. This makes possible
4763 * 6-channel independent captures.
4765 * In addition, an independent DAC for the multi-playback (not used in this
4768 #define ALC882_DIGOUT_NID 0x06
4769 #define ALC882_DIGIN_NID 0x0a
4771 static struct hda_channel_mode alc882_ch_modes[1] = {
4775 static hda_nid_t alc882_dac_nids[4] = {
4776 /* front, rear, clfe, rear_surr */
4777 0x02, 0x03, 0x04, 0x05
4780 /* identical with ALC880 */
4781 #define alc882_adc_nids alc880_adc_nids
4782 #define alc882_adc_nids_alt alc880_adc_nids_alt
4785 /* FIXME: should be a matrix-type input source selection */
4787 static struct hda_input_mux alc882_capture_source = {
4791 { "Front Mic", 0x1 },
4796 #define alc882_mux_enum_info alc_mux_enum_info
4797 #define alc882_mux_enum_get alc_mux_enum_get
4799 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4800 struct snd_ctl_elem_value *ucontrol)
4802 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4803 struct alc_spec *spec = codec->spec;
4804 const struct hda_input_mux *imux = spec->input_mux;
4805 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4806 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4807 hda_nid_t nid = capture_mixers[adc_idx];
4808 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4809 unsigned int i, idx;
4811 idx = ucontrol->value.enumerated.item[0];
4812 if (idx >= imux->num_items)
4813 idx = imux->num_items - 1;
4814 if (*cur_val == idx && !codec->in_resume)
4816 for (i = 0; i < imux->num_items; i++) {
4817 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
4818 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4819 v | (imux->items[i].index << 8));
4828 static struct hda_verb alc882_3ST_ch2_init[] = {
4829 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
4830 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4831 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4832 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4839 static struct hda_verb alc882_3ST_ch6_init[] = {
4840 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4841 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4842 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
4843 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4844 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4845 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4849 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
4850 { 2, alc882_3ST_ch2_init },
4851 { 6, alc882_3ST_ch6_init },
4857 static struct hda_verb alc882_sixstack_ch6_init[] = {
4858 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
4859 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4860 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4861 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4868 static struct hda_verb alc882_sixstack_ch8_init[] = {
4869 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4870 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4871 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4872 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4876 static struct hda_channel_mode alc882_sixstack_modes[2] = {
4877 { 6, alc882_sixstack_ch6_init },
4878 { 8, alc882_sixstack_ch8_init },
4881 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4882 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4884 static struct snd_kcontrol_new alc882_base_mixer[] = {
4885 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4886 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4887 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4888 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4889 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
4890 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
4891 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4892 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4893 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4894 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4898 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4899 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4901 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4903 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4904 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
4905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4906 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4907 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4911 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
4912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4914 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4915 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4916 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4917 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4919 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4921 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4922 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4926 static struct snd_kcontrol_new alc882_targa_mixer[] = {
4927 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4928 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4936 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4941 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
4942 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
4944 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
4945 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4946 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
4947 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4948 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4949 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4950 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4951 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4952 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4953 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
4954 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
4955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4960 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
4962 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4963 .name = "Channel Mode",
4964 .info = alc_ch_mode_info,
4965 .get = alc_ch_mode_get,
4966 .put = alc_ch_mode_put,
4971 static struct hda_verb alc882_init_verbs[] = {
4972 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4974 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4975 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4979 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4985 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4986 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4989 /* Front Pin: output 0 (0x0c) */
4990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4992 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
4993 /* Rear Pin: output 1 (0x0d) */
4994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4996 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4997 /* CLFE Pin: output 2 (0x0e) */
4998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4999 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5000 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5001 /* Side Pin: output 3 (0x0f) */
5002 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5003 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5004 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5005 /* Mic (rear) pin: input vref at 80% */
5006 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5008 /* Front Mic pin: input vref at 80% */
5009 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5011 /* Line In pin: input */
5012 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5013 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5014 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5016 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5017 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5018 /* CD pin widget for input */
5019 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5021 /* FIXME: use matrix-type input source selection */
5022 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5023 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5038 /* ADC1: mute amp left and right */
5039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5040 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5041 /* ADC2: mute amp left and right */
5042 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5043 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5044 /* ADC3: mute amp left and right */
5045 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5046 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5051 static struct hda_verb alc882_eapd_verbs[] = {
5052 /* change to EAPD mode */
5053 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5054 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5059 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5061 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5062 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5065 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5066 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5070 static struct hda_verb alc882_macpro_init_verbs[] = {
5071 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5075 /* Front Pin: output 0 (0x0c) */
5076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5079 /* Front Mic pin: input vref at 80% */
5080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5081 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5082 /* Speaker: output */
5083 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5084 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5085 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5086 /* Headphone output (output 0 - 0x0c) */
5087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5089 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5091 /* FIXME: use matrix-type input source selection */
5092 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5093 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5108 /* ADC1: mute amp left and right */
5109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5110 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5111 /* ADC2: mute amp left and right */
5112 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5114 /* ADC3: mute amp left and right */
5115 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5116 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5121 static struct hda_verb alc882_targa_verbs[] = {
5122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5126 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5128 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5129 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5130 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5132 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5133 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5134 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5135 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5139 /* toggle speaker-output according to the hp-jack state */
5140 static void alc882_targa_automute(struct hda_codec *codec)
5142 unsigned int present;
5144 present = snd_hda_codec_read(codec, 0x14, 0,
5145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5146 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
5147 0x80, present ? 0x80 : 0);
5148 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
5149 0x80, present ? 0x80 : 0);
5150 snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3);
5153 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5155 /* Looks like the unsol event is incompatible with the standard
5156 * definition. 4bit tag is placed at 26 bit!
5158 if (((res >> 26) == ALC880_HP_EVENT)) {
5159 alc882_targa_automute(codec);
5163 static struct hda_verb alc882_asus_a7j_verbs[] = {
5164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5165 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5167 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5171 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5173 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5175 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5176 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5177 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5181 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5183 unsigned int gpiostate, gpiomask, gpiodir;
5185 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5186 AC_VERB_GET_GPIO_DATA, 0);
5189 gpiostate |= (1 << pin);
5191 gpiostate &= ~(1 << pin);
5193 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5194 AC_VERB_GET_GPIO_MASK, 0);
5195 gpiomask |= (1 << pin);
5197 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5198 AC_VERB_GET_GPIO_DIRECTION, 0);
5199 gpiodir |= (1 << pin);
5202 snd_hda_codec_write(codec, codec->afg, 0,
5203 AC_VERB_SET_GPIO_MASK, gpiomask);
5204 snd_hda_codec_write(codec, codec->afg, 0,
5205 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5209 snd_hda_codec_write(codec, codec->afg, 0,
5210 AC_VERB_SET_GPIO_DATA, gpiostate);
5214 * generic initialization of ADC, input mixers and output mixers
5216 static struct hda_verb alc882_auto_init_verbs[] = {
5218 * Unmute ADC0-2 and set the default input to mic-in
5220 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5222 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5224 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5225 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5227 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5229 * Note: PASD motherboards uses the Line In 2 as the input for
5230 * front panel mic (mic 2)
5232 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
5236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
5240 * Set up output mixers (0x0c - 0x0f)
5242 /* set vol=0 to output mixers */
5243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5244 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5247 /* set up input amps for analog loopback */
5248 /* Amp Indices: DAC = 0, mixer = 1 */
5249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5256 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5257 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5258 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5260 /* FIXME: use matrix-type input source selection */
5261 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5262 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5281 /* capture mixer elements */
5282 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5283 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5284 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5285 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5286 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5289 /* The multiple "Capture Source" controls confuse alsamixer
5290 * So call somewhat different..
5291 * FIXME: the controls appear in the "playback" view!
5293 /* .name = "Capture Source", */
5294 .name = "Input Source",
5296 .info = alc882_mux_enum_info,
5297 .get = alc882_mux_enum_get,
5298 .put = alc882_mux_enum_put,
5303 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5304 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5305 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5306 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5307 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5308 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5309 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5311 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5312 /* The multiple "Capture Source" controls confuse alsamixer
5313 * So call somewhat different..
5314 * FIXME: the controls appear in the "playback" view!
5316 /* .name = "Capture Source", */
5317 .name = "Input Source",
5319 .info = alc882_mux_enum_info,
5320 .get = alc882_mux_enum_get,
5321 .put = alc882_mux_enum_put,
5326 /* pcm configuration: identiacal with ALC880 */
5327 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5328 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5329 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5330 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5333 * configuration and preset
5335 static const char *alc882_models[ALC882_MODEL_LAST] = {
5336 [ALC882_3ST_DIG] = "3stack-dig",
5337 [ALC882_6ST_DIG] = "6stack-dig",
5338 [ALC882_ARIMA] = "arima",
5339 [ALC882_W2JC] = "w2jc",
5340 [ALC885_MACPRO] = "macpro",
5341 [ALC882_AUTO] = "auto",
5344 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5345 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5346 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5347 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5348 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5349 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5350 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5351 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5352 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5353 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5357 static struct alc_config_preset alc882_presets[] = {
5358 [ALC882_3ST_DIG] = {
5359 .mixers = { alc882_base_mixer },
5360 .init_verbs = { alc882_init_verbs },
5361 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5362 .dac_nids = alc882_dac_nids,
5363 .dig_out_nid = ALC882_DIGOUT_NID,
5364 .dig_in_nid = ALC882_DIGIN_NID,
5365 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5366 .channel_mode = alc882_ch_modes,
5368 .input_mux = &alc882_capture_source,
5370 [ALC882_6ST_DIG] = {
5371 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5372 .init_verbs = { alc882_init_verbs },
5373 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5374 .dac_nids = alc882_dac_nids,
5375 .dig_out_nid = ALC882_DIGOUT_NID,
5376 .dig_in_nid = ALC882_DIGIN_NID,
5377 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5378 .channel_mode = alc882_sixstack_modes,
5379 .input_mux = &alc882_capture_source,
5382 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5383 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5384 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5385 .dac_nids = alc882_dac_nids,
5386 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5387 .channel_mode = alc882_sixstack_modes,
5388 .input_mux = &alc882_capture_source,
5391 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5392 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5393 alc880_gpio1_init_verbs },
5394 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5395 .dac_nids = alc882_dac_nids,
5396 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5397 .channel_mode = alc880_threestack_modes,
5399 .input_mux = &alc882_capture_source,
5400 .dig_out_nid = ALC882_DIGOUT_NID,
5403 .mixers = { alc882_macpro_mixer },
5404 .init_verbs = { alc882_macpro_init_verbs },
5405 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5406 .dac_nids = alc882_dac_nids,
5407 .dig_out_nid = ALC882_DIGOUT_NID,
5408 .dig_in_nid = ALC882_DIGIN_NID,
5409 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5410 .channel_mode = alc882_ch_modes,
5411 .input_mux = &alc882_capture_source,
5414 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5415 alc882_capture_mixer },
5416 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5417 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5418 .dac_nids = alc882_dac_nids,
5419 .dig_out_nid = ALC882_DIGOUT_NID,
5420 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5421 .adc_nids = alc882_adc_nids,
5422 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5423 .channel_mode = alc882_3ST_6ch_modes,
5425 .input_mux = &alc882_capture_source,
5426 .unsol_event = alc882_targa_unsol_event,
5427 .init_hook = alc882_targa_automute,
5429 [ALC882_ASUS_A7J] = {
5430 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5431 alc882_capture_mixer },
5432 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5433 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5434 .dac_nids = alc882_dac_nids,
5435 .dig_out_nid = ALC882_DIGOUT_NID,
5436 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5437 .adc_nids = alc882_adc_nids,
5438 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5439 .channel_mode = alc882_3ST_6ch_modes,
5441 .input_mux = &alc882_capture_source,
5450 PINFIX_ABIT_AW9D_MAX
5453 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5454 { 0x15, 0x01080104 }, /* side */
5455 { 0x16, 0x01011012 }, /* rear */
5456 { 0x17, 0x01016011 }, /* clfe */
5460 static const struct alc_pincfg *alc882_pin_fixes[] = {
5461 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5464 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5465 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5470 * BIOS auto configuration
5472 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5473 hda_nid_t nid, int pin_type,
5477 struct alc_spec *spec = codec->spec;
5480 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5483 idx = spec->multiout.dac_nids[dac_idx] - 2;
5485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5487 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5489 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5493 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5495 struct alc_spec *spec = codec->spec;
5498 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5499 for (i = 0; i <= HDA_SIDE; i++) {
5500 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5501 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5503 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5508 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5510 struct alc_spec *spec = codec->spec;
5513 pin = spec->autocfg.hp_pins[0];
5514 if (pin) /* connect to front */
5516 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5519 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5520 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5522 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5524 struct alc_spec *spec = codec->spec;
5527 for (i = 0; i < AUTO_PIN_LAST; i++) {
5528 hda_nid_t nid = spec->autocfg.input_pins[i];
5529 if (alc882_is_input_pin(nid)) {
5530 snd_hda_codec_write(codec, nid, 0,
5531 AC_VERB_SET_PIN_WIDGET_CONTROL,
5532 i <= AUTO_PIN_FRONT_MIC ?
5533 PIN_VREF80 : PIN_IN);
5534 if (nid != ALC882_PIN_CD_NID)
5535 snd_hda_codec_write(codec, nid, 0,
5536 AC_VERB_SET_AMP_GAIN_MUTE,
5542 /* almost identical with ALC880 parser... */
5543 static int alc882_parse_auto_config(struct hda_codec *codec)
5545 struct alc_spec *spec = codec->spec;
5546 int err = alc880_parse_auto_config(codec);
5551 /* hack - override the init verbs */
5552 spec->init_verbs[0] = alc882_auto_init_verbs;
5556 /* additional initialization for auto-configuration model */
5557 static void alc882_auto_init(struct hda_codec *codec)
5559 alc882_auto_init_multi_out(codec);
5560 alc882_auto_init_hp_out(codec);
5561 alc882_auto_init_analog_input(codec);
5564 static int patch_alc882(struct hda_codec *codec)
5566 struct alc_spec *spec;
5567 int err, board_config;
5569 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5575 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
5579 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
5580 /* Pick up systems that don't supply PCI SSID */
5581 switch (codec->subsystem_id) {
5582 case 0x106b0c00: /* Mac Pro */
5583 board_config = ALC885_MACPRO;
5586 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
5587 "trying auto-probe from BIOS...\n");
5588 board_config = ALC882_AUTO;
5592 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
5594 if (board_config == ALC882_AUTO) {
5595 /* automatic parse from the BIOS config */
5596 err = alc882_parse_auto_config(codec);
5602 "hda_codec: Cannot set up configuration "
5603 "from BIOS. Using base mode...\n");
5604 board_config = ALC882_3ST_DIG;
5608 if (board_config != ALC882_AUTO)
5609 setup_preset(spec, &alc882_presets[board_config]);
5611 if (board_config == ALC885_MACPRO) {
5612 alc882_gpio_mute(codec, 0, 0);
5613 alc882_gpio_mute(codec, 1, 0);
5616 spec->stream_name_analog = "ALC882 Analog";
5617 spec->stream_analog_playback = &alc882_pcm_analog_playback;
5618 spec->stream_analog_capture = &alc882_pcm_analog_capture;
5620 spec->stream_name_digital = "ALC882 Digital";
5621 spec->stream_digital_playback = &alc882_pcm_digital_playback;
5622 spec->stream_digital_capture = &alc882_pcm_digital_capture;
5624 if (!spec->adc_nids && spec->input_mux) {
5625 /* check whether NID 0x07 is valid */
5626 unsigned int wcap = get_wcaps(codec, 0x07);
5628 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5629 if (wcap != AC_WID_AUD_IN) {
5630 spec->adc_nids = alc882_adc_nids_alt;
5631 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
5632 spec->mixers[spec->num_mixers] =
5633 alc882_capture_alt_mixer;
5636 spec->adc_nids = alc882_adc_nids;
5637 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
5638 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
5643 codec->patch_ops = alc_patch_ops;
5644 if (board_config == ALC882_AUTO)
5645 spec->init_hook = alc882_auto_init;
5653 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
5654 * configuration. Each pin widget can choose any input DACs and a mixer.
5655 * Each ADC is connected from a mixer of all inputs. This makes possible
5656 * 6-channel independent captures.
5658 * In addition, an independent DAC for the multi-playback (not used in this
5661 #define ALC883_DIGOUT_NID 0x06
5662 #define ALC883_DIGIN_NID 0x0a
5664 static hda_nid_t alc883_dac_nids[4] = {
5665 /* front, rear, clfe, rear_surr */
5666 0x02, 0x04, 0x03, 0x05
5669 static hda_nid_t alc883_adc_nids[2] = {
5675 /* FIXME: should be a matrix-type input source selection */
5677 static struct hda_input_mux alc883_capture_source = {
5681 { "Front Mic", 0x1 },
5687 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
5695 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
5705 #define alc883_mux_enum_info alc_mux_enum_info
5706 #define alc883_mux_enum_get alc_mux_enum_get
5708 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5709 struct snd_ctl_elem_value *ucontrol)
5711 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5712 struct alc_spec *spec = codec->spec;
5713 const struct hda_input_mux *imux = spec->input_mux;
5714 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5715 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5716 hda_nid_t nid = capture_mixers[adc_idx];
5717 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5718 unsigned int i, idx;
5720 idx = ucontrol->value.enumerated.item[0];
5721 if (idx >= imux->num_items)
5722 idx = imux->num_items - 1;
5723 if (*cur_val == idx && !codec->in_resume)
5725 for (i = 0; i < imux->num_items; i++) {
5726 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
5727 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5728 v | (imux->items[i].index << 8));
5737 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
5744 static struct hda_verb alc883_3ST_ch2_init[] = {
5745 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5746 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5747 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5748 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5755 static struct hda_verb alc883_3ST_ch6_init[] = {
5756 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5757 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5758 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5759 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5760 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5761 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5765 static struct hda_channel_mode alc883_3ST_6ch_modes[2] = {
5766 { 2, alc883_3ST_ch2_init },
5767 { 6, alc883_3ST_ch6_init },
5773 static struct hda_verb alc883_sixstack_ch6_init[] = {
5774 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5775 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5776 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5777 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5784 static struct hda_verb alc883_sixstack_ch8_init[] = {
5785 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5786 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5787 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5788 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5792 static struct hda_channel_mode alc883_sixstack_modes[2] = {
5793 { 6, alc883_sixstack_ch6_init },
5794 { 8, alc883_sixstack_ch8_init },
5797 static struct hda_verb alc883_medion_eapd_verbs[] = {
5798 /* eanable EAPD on medion laptop */
5799 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5800 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
5804 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5805 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5808 static struct snd_kcontrol_new alc883_base_mixer[] = {
5809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5811 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5812 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5813 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5817 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5818 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5820 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5821 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5825 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5827 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5828 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5829 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5830 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5831 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5832 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5833 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5834 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5835 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5838 /* .name = "Capture Source", */
5839 .name = "Input Source",
5841 .info = alc883_mux_enum_info,
5842 .get = alc883_mux_enum_get,
5843 .put = alc883_mux_enum_put,
5848 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
5849 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5850 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5852 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5853 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5854 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5855 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5857 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5859 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5860 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5861 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5862 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5863 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5864 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5865 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5866 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5867 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5870 /* .name = "Capture Source", */
5871 .name = "Input Source",
5873 .info = alc883_mux_enum_info,
5874 .get = alc883_mux_enum_get,
5875 .put = alc883_mux_enum_put,
5880 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
5881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5883 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5884 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5885 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5886 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5887 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5888 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5890 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5891 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5895 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5898 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5900 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5901 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5902 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5903 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5904 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5905 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5908 /* .name = "Capture Source", */
5909 .name = "Input Source",
5911 .info = alc883_mux_enum_info,
5912 .get = alc883_mux_enum_get,
5913 .put = alc883_mux_enum_put,
5918 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
5919 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5920 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5921 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5922 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5923 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5924 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5925 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
5926 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
5927 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5928 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5929 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5930 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5931 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5933 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5935 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5936 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5937 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5938 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5939 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5940 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5941 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5945 /* .name = "Capture Source", */
5946 .name = "Input Source",
5948 .info = alc883_mux_enum_info,
5949 .get = alc883_mux_enum_get,
5950 .put = alc883_mux_enum_put,
5955 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
5956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5957 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5958 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5960 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5963 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5964 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5972 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5973 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5974 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5975 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5978 /* .name = "Capture Source", */
5979 .name = "Input Source",
5981 .info = alc883_mux_enum_info,
5982 .get = alc883_mux_enum_get,
5983 .put = alc883_mux_enum_put,
5988 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
5989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5991 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5997 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5998 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5999 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6000 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6003 /* .name = "Capture Source", */
6004 .name = "Input Source",
6006 .info = alc883_mux_enum_info,
6007 .get = alc883_mux_enum_get,
6008 .put = alc883_mux_enum_put,
6013 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6015 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6016 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6017 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6019 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6020 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6022 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6023 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6026 /* .name = "Capture Source", */
6027 .name = "Input Source",
6029 .info = alc883_mux_enum_info,
6030 .get = alc883_mux_enum_get,
6031 .put = alc883_mux_enum_put,
6036 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6037 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6038 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6039 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6040 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6041 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6043 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6044 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6045 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6046 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6047 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6048 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6049 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6052 /* .name = "Capture Source", */
6053 .name = "Input Source",
6055 .info = alc883_mux_enum_info,
6056 .get = alc883_mux_enum_get,
6057 .put = alc883_mux_enum_put,
6062 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6063 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6065 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6066 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6067 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6068 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6069 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, 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("Capture Volume", 0x08, 0x0, HDA_INPUT),
6073 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6074 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6075 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6077 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6078 /* .name = "Capture Source", */
6079 .name = "Input Source",
6081 .info = alc883_mux_enum_info,
6082 .get = alc883_mux_enum_get,
6083 .put = alc883_mux_enum_put,
6088 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6091 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6092 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6093 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6097 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6098 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 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 alc888_3st_hp_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", 0x0e, 0x0, HDA_OUTPUT),
6132 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6133 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6134 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6135 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6136 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 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_chmode_mixer[] = {
6168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6169 .name = "Channel Mode",
6170 .info = alc_ch_mode_info,
6171 .get = alc_ch_mode_get,
6172 .put = alc_ch_mode_put,
6177 static struct hda_verb alc883_init_verbs[] = {
6178 /* ADC1: mute amp left and right */
6179 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6180 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6181 /* ADC2: mute amp left and right */
6182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6183 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6184 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6197 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6198 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6199 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
6205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6207 /* Front Pin: output 0 (0x0c) */
6208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6210 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6211 /* Rear Pin: output 1 (0x0d) */
6212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6215 /* CLFE Pin: output 2 (0x0e) */
6216 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6218 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6219 /* Side Pin: output 3 (0x0f) */
6220 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6221 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6222 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6223 /* Mic (rear) pin: input vref at 80% */
6224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6226 /* Front Mic pin: input vref at 80% */
6227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6229 /* Line In pin: input */
6230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6232 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6235 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6236 /* CD pin widget for input */
6237 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6239 /* FIXME: use matrix-type input source selection */
6240 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6254 static struct hda_verb alc883_tagra_verbs[] = {
6255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6259 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6261 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6262 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6263 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6265 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6266 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6268 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6273 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6274 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6275 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6276 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6280 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6283 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6284 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6288 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6291 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6292 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6293 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6297 static struct hda_verb alc888_6st_hp_verbs[] = {
6298 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6299 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6300 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6301 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6305 static struct hda_verb alc888_3st_hp_verbs[] = {
6306 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6307 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6308 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6312 static struct hda_verb alc888_3st_hp_2ch_init[] = {
6313 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6314 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6315 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6316 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6320 static struct hda_verb alc888_3st_hp_6ch_init[] = {
6321 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6322 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6323 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6324 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6328 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
6329 { 2, alc888_3st_hp_2ch_init },
6330 { 6, alc888_3st_hp_6ch_init },
6333 /* toggle front-jack and RCA according to the hp-jack state */
6334 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6336 unsigned int present;
6338 present = snd_hda_codec_read(codec, 0x1b, 0,
6339 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6340 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6341 0x80, present ? 0x80 : 0);
6342 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6343 0x80, present ? 0x80 : 0);
6344 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6345 0x80, present ? 0x80 : 0);
6346 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6347 0x80, present ? 0x80 : 0);
6351 /* toggle RCA according to the front-jack state */
6352 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6354 unsigned int present;
6356 present = snd_hda_codec_read(codec, 0x14, 0,
6357 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6358 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6359 0x80, present ? 0x80 : 0);
6360 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6361 0x80, present ? 0x80 : 0);
6364 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6367 if ((res >> 26) == ALC880_HP_EVENT)
6368 alc888_lenovo_ms7195_front_automute(codec);
6369 if ((res >> 26) == ALC880_FRONT_EVENT)
6370 alc888_lenovo_ms7195_rca_automute(codec);
6373 static struct hda_verb alc883_medion_md2_verbs[] = {
6374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6377 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6379 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6383 /* toggle speaker-output according to the hp-jack state */
6384 static void alc883_medion_md2_automute(struct hda_codec *codec)
6386 unsigned int present;
6388 present = snd_hda_codec_read(codec, 0x14, 0,
6389 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6390 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6391 0x80, present ? 0x80 : 0);
6392 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6393 0x80, present ? 0x80 : 0);
6396 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
6399 if ((res >> 26) == ALC880_HP_EVENT)
6400 alc883_medion_md2_automute(codec);
6403 /* toggle speaker-output according to the hp-jack state */
6404 static void alc883_tagra_automute(struct hda_codec *codec)
6406 unsigned int present;
6409 present = snd_hda_codec_read(codec, 0x14, 0,
6410 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6411 bits = present ? 0x80 : 0;
6412 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
6414 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
6416 snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6420 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
6422 if ((res >> 26) == ALC880_HP_EVENT)
6423 alc883_tagra_automute(codec);
6426 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6428 unsigned int present;
6431 present = snd_hda_codec_read(codec, 0x14, 0,
6432 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6433 bits = present ? 0x80 : 0;
6434 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6436 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6440 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6442 unsigned int present;
6445 present = snd_hda_codec_read(codec, 0x1b, 0,
6446 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6447 bits = present ? 0x80 : 0;
6448 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6450 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6452 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6454 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6458 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
6461 if ((res >> 26) == ALC880_HP_EVENT)
6462 alc883_lenovo_101e_all_automute(codec);
6463 if ((res >> 26) == ALC880_FRONT_EVENT)
6464 alc883_lenovo_101e_ispeaker_automute(codec);
6468 * generic initialization of ADC, input mixers and output mixers
6470 static struct hda_verb alc883_auto_init_verbs[] = {
6472 * Unmute ADC0-2 and set the default input to mic-in
6474 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6476 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6477 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6479 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6481 * Note: PASD motherboards uses the Line In 2 as the input for
6482 * front panel mic (mic 2)
6484 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
6489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6492 * Set up output mixers (0x0c - 0x0f)
6494 /* set vol=0 to output mixers */
6495 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6496 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6498 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6499 /* set up input amps for analog loopback */
6500 /* Amp Indices: DAC = 0, mixer = 1 */
6501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6505 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6509 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6510 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6512 /* FIXME: use matrix-type input source selection */
6513 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6518 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
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(3)}, */
6525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6530 /* capture mixer elements */
6531 static struct snd_kcontrol_new alc883_capture_mixer[] = {
6532 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6533 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6534 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6535 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6538 /* The multiple "Capture Source" controls confuse alsamixer
6539 * So call somewhat different..
6540 * FIXME: the controls appear in the "playback" view!
6542 /* .name = "Capture Source", */
6543 .name = "Input Source",
6545 .info = alc882_mux_enum_info,
6546 .get = alc882_mux_enum_get,
6547 .put = alc882_mux_enum_put,
6552 /* pcm configuration: identiacal with ALC880 */
6553 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
6554 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
6555 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
6556 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
6559 * configuration and preset
6561 static const char *alc883_models[ALC883_MODEL_LAST] = {
6562 [ALC883_3ST_2ch_DIG] = "3stack-dig",
6563 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
6564 [ALC883_3ST_6ch] = "3stack-6ch",
6565 [ALC883_6ST_DIG] = "6stack-dig",
6566 [ALC883_TARGA_DIG] = "targa-dig",
6567 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
6568 [ALC883_ACER] = "acer",
6569 [ALC883_MEDION] = "medion",
6570 [ALC883_MEDION_MD2] = "medion-md2",
6571 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
6572 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
6573 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
6574 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
6575 [ALC888_6ST_HP] = "6stack-hp",
6576 [ALC888_3ST_HP] = "3stack-hp",
6577 [ALC883_AUTO] = "auto",
6580 static struct snd_pci_quirk alc883_cfg_tbl[] = {
6581 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
6582 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
6583 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
6584 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
6585 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
6586 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
6587 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
6588 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
6589 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
6590 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
6591 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
6592 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
6593 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
6594 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
6595 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
6596 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
6597 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
6598 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
6599 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
6600 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
6601 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
6602 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
6603 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
6604 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
6605 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
6606 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
6607 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
6608 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
6609 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
6610 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6611 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6612 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
6613 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
6614 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
6615 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
6619 static struct alc_config_preset alc883_presets[] = {
6620 [ALC883_3ST_2ch_DIG] = {
6621 .mixers = { alc883_3ST_2ch_mixer },
6622 .init_verbs = { alc883_init_verbs },
6623 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6624 .dac_nids = alc883_dac_nids,
6625 .dig_out_nid = ALC883_DIGOUT_NID,
6626 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6627 .adc_nids = alc883_adc_nids,
6628 .dig_in_nid = ALC883_DIGIN_NID,
6629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6630 .channel_mode = alc883_3ST_2ch_modes,
6631 .input_mux = &alc883_capture_source,
6633 [ALC883_3ST_6ch_DIG] = {
6634 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6635 .init_verbs = { alc883_init_verbs },
6636 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6637 .dac_nids = alc883_dac_nids,
6638 .dig_out_nid = ALC883_DIGOUT_NID,
6639 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6640 .adc_nids = alc883_adc_nids,
6641 .dig_in_nid = ALC883_DIGIN_NID,
6642 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6643 .channel_mode = alc883_3ST_6ch_modes,
6645 .input_mux = &alc883_capture_source,
6647 [ALC883_3ST_6ch] = {
6648 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6649 .init_verbs = { alc883_init_verbs },
6650 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6651 .dac_nids = alc883_dac_nids,
6652 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6653 .adc_nids = alc883_adc_nids,
6654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6655 .channel_mode = alc883_3ST_6ch_modes,
6657 .input_mux = &alc883_capture_source,
6659 [ALC883_6ST_DIG] = {
6660 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
6661 .init_verbs = { alc883_init_verbs },
6662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6663 .dac_nids = alc883_dac_nids,
6664 .dig_out_nid = ALC883_DIGOUT_NID,
6665 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6666 .adc_nids = alc883_adc_nids,
6667 .dig_in_nid = ALC883_DIGIN_NID,
6668 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6669 .channel_mode = alc883_sixstack_modes,
6670 .input_mux = &alc883_capture_source,
6672 [ALC883_TARGA_DIG] = {
6673 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
6674 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6675 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6676 .dac_nids = alc883_dac_nids,
6677 .dig_out_nid = ALC883_DIGOUT_NID,
6678 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6679 .adc_nids = alc883_adc_nids,
6680 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6681 .channel_mode = alc883_3ST_6ch_modes,
6683 .input_mux = &alc883_capture_source,
6684 .unsol_event = alc883_tagra_unsol_event,
6685 .init_hook = alc883_tagra_automute,
6687 [ALC883_TARGA_2ch_DIG] = {
6688 .mixers = { alc883_tagra_2ch_mixer},
6689 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6690 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6691 .dac_nids = alc883_dac_nids,
6692 .dig_out_nid = ALC883_DIGOUT_NID,
6693 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6694 .adc_nids = alc883_adc_nids,
6695 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6696 .channel_mode = alc883_3ST_2ch_modes,
6697 .input_mux = &alc883_capture_source,
6698 .unsol_event = alc883_tagra_unsol_event,
6699 .init_hook = alc883_tagra_automute,
6702 .mixers = { alc883_base_mixer,
6703 alc883_chmode_mixer },
6704 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6705 * and the headphone jack. Turn this on and rely on the
6706 * standard mute methods whenever the user wants to turn
6707 * these outputs off.
6709 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
6710 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6711 .dac_nids = alc883_dac_nids,
6712 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6713 .adc_nids = alc883_adc_nids,
6714 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6715 .channel_mode = alc883_3ST_2ch_modes,
6716 .input_mux = &alc883_capture_source,
6719 .mixers = { alc883_fivestack_mixer,
6720 alc883_chmode_mixer },
6721 .init_verbs = { alc883_init_verbs,
6722 alc883_medion_eapd_verbs },
6723 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6724 .dac_nids = alc883_dac_nids,
6725 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6726 .adc_nids = alc883_adc_nids,
6727 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6728 .channel_mode = alc883_sixstack_modes,
6729 .input_mux = &alc883_capture_source,
6731 [ALC883_MEDION_MD2] = {
6732 .mixers = { alc883_medion_md2_mixer},
6733 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
6734 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6735 .dac_nids = alc883_dac_nids,
6736 .dig_out_nid = ALC883_DIGOUT_NID,
6737 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6738 .adc_nids = alc883_adc_nids,
6739 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6740 .channel_mode = alc883_3ST_2ch_modes,
6741 .input_mux = &alc883_capture_source,
6742 .unsol_event = alc883_medion_md2_unsol_event,
6743 .init_hook = alc883_medion_md2_automute,
6745 [ALC883_LAPTOP_EAPD] = {
6746 .mixers = { alc883_base_mixer,
6747 alc883_chmode_mixer },
6748 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
6749 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6750 .dac_nids = alc883_dac_nids,
6751 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6752 .adc_nids = alc883_adc_nids,
6753 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6754 .channel_mode = alc883_3ST_2ch_modes,
6755 .input_mux = &alc883_capture_source,
6757 [ALC883_LENOVO_101E_2ch] = {
6758 .mixers = { alc883_lenovo_101e_2ch_mixer},
6759 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
6760 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6761 .dac_nids = alc883_dac_nids,
6762 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6763 .adc_nids = alc883_adc_nids,
6764 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6765 .channel_mode = alc883_3ST_2ch_modes,
6766 .input_mux = &alc883_lenovo_101e_capture_source,
6767 .unsol_event = alc883_lenovo_101e_unsol_event,
6768 .init_hook = alc883_lenovo_101e_all_automute,
6770 [ALC883_LENOVO_NB0763] = {
6771 .mixers = { alc883_lenovo_nb0763_mixer },
6772 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
6773 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6774 .dac_nids = alc883_dac_nids,
6775 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6776 .adc_nids = alc883_adc_nids,
6777 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6778 .channel_mode = alc883_3ST_2ch_modes,
6780 .input_mux = &alc883_lenovo_nb0763_capture_source,
6781 .unsol_event = alc883_medion_md2_unsol_event,
6782 .init_hook = alc883_medion_md2_automute,
6784 [ALC888_LENOVO_MS7195_DIG] = {
6785 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6786 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
6787 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6788 .dac_nids = alc883_dac_nids,
6789 .dig_out_nid = ALC883_DIGOUT_NID,
6790 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6791 .adc_nids = alc883_adc_nids,
6792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6793 .channel_mode = alc883_3ST_6ch_modes,
6795 .input_mux = &alc883_capture_source,
6796 .unsol_event = alc883_lenovo_ms7195_unsol_event,
6797 .init_hook = alc888_lenovo_ms7195_front_automute,
6800 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
6801 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
6802 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6803 .dac_nids = alc883_dac_nids,
6804 .dig_out_nid = ALC883_DIGOUT_NID,
6805 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6806 .adc_nids = alc883_adc_nids,
6807 .dig_in_nid = ALC883_DIGIN_NID,
6808 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6809 .channel_mode = alc883_sixstack_modes,
6810 .input_mux = &alc883_capture_source,
6813 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
6814 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
6815 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6816 .dac_nids = alc883_dac_nids,
6817 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6818 .adc_nids = alc883_adc_nids,
6819 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
6820 .channel_mode = alc888_3st_hp_modes,
6822 .input_mux = &alc883_capture_source,
6828 * BIOS auto configuration
6830 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
6831 hda_nid_t nid, int pin_type,
6835 struct alc_spec *spec = codec->spec;
6838 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6841 idx = spec->multiout.dac_nids[dac_idx] - 2;
6843 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6845 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6847 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6851 static void alc883_auto_init_multi_out(struct hda_codec *codec)
6853 struct alc_spec *spec = codec->spec;
6856 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6857 for (i = 0; i <= HDA_SIDE; i++) {
6858 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6859 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6861 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
6866 static void alc883_auto_init_hp_out(struct hda_codec *codec)
6868 struct alc_spec *spec = codec->spec;
6871 pin = spec->autocfg.hp_pins[0];
6872 if (pin) /* connect to front */
6874 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6877 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
6878 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
6880 static void alc883_auto_init_analog_input(struct hda_codec *codec)
6882 struct alc_spec *spec = codec->spec;
6885 for (i = 0; i < AUTO_PIN_LAST; i++) {
6886 hda_nid_t nid = spec->autocfg.input_pins[i];
6887 if (alc883_is_input_pin(nid)) {
6888 snd_hda_codec_write(codec, nid, 0,
6889 AC_VERB_SET_PIN_WIDGET_CONTROL,
6890 (i <= AUTO_PIN_FRONT_MIC ?
6891 PIN_VREF80 : PIN_IN));
6892 if (nid != ALC883_PIN_CD_NID)
6893 snd_hda_codec_write(codec, nid, 0,
6894 AC_VERB_SET_AMP_GAIN_MUTE,
6900 /* almost identical with ALC880 parser... */
6901 static int alc883_parse_auto_config(struct hda_codec *codec)
6903 struct alc_spec *spec = codec->spec;
6904 int err = alc880_parse_auto_config(codec);
6909 /* hack - override the init verbs */
6910 spec->init_verbs[0] = alc883_auto_init_verbs;
6911 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
6916 /* additional initialization for auto-configuration model */
6917 static void alc883_auto_init(struct hda_codec *codec)
6919 alc883_auto_init_multi_out(codec);
6920 alc883_auto_init_hp_out(codec);
6921 alc883_auto_init_analog_input(codec);
6924 static int patch_alc883(struct hda_codec *codec)
6926 struct alc_spec *spec;
6927 int err, board_config;
6929 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6935 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
6938 if (board_config < 0) {
6939 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
6940 "trying auto-probe from BIOS...\n");
6941 board_config = ALC883_AUTO;
6944 if (board_config == ALC883_AUTO) {
6945 /* automatic parse from the BIOS config */
6946 err = alc883_parse_auto_config(codec);
6952 "hda_codec: Cannot set up configuration "
6953 "from BIOS. Using base mode...\n");
6954 board_config = ALC883_3ST_2ch_DIG;
6958 if (board_config != ALC883_AUTO)
6959 setup_preset(spec, &alc883_presets[board_config]);
6961 spec->stream_name_analog = "ALC883 Analog";
6962 spec->stream_analog_playback = &alc883_pcm_analog_playback;
6963 spec->stream_analog_capture = &alc883_pcm_analog_capture;
6965 spec->stream_name_digital = "ALC883 Digital";
6966 spec->stream_digital_playback = &alc883_pcm_digital_playback;
6967 spec->stream_digital_capture = &alc883_pcm_digital_capture;
6969 if (!spec->adc_nids && spec->input_mux) {
6970 spec->adc_nids = alc883_adc_nids;
6971 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
6974 codec->patch_ops = alc_patch_ops;
6975 if (board_config == ALC883_AUTO)
6976 spec->init_hook = alc883_auto_init;
6985 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
6986 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
6988 #define alc262_dac_nids alc260_dac_nids
6989 #define alc262_adc_nids alc882_adc_nids
6990 #define alc262_adc_nids_alt alc882_adc_nids_alt
6992 #define alc262_modes alc260_modes
6993 #define alc262_capture_source alc882_capture_source
6995 static struct snd_kcontrol_new alc262_base_mixer[] = {
6996 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6997 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6998 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6999 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7008 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7009 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7012 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7013 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7017 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7019 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7026 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7027 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7028 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7029 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7030 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7031 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7032 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7037 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7038 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7039 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7040 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7041 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7042 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7044 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7045 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7047 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7048 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7049 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7050 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7051 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7052 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7053 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7054 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7055 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7056 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7057 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7061 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7062 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7063 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7064 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7066 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7067 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7069 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7070 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7071 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7072 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7073 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7074 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7075 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7076 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7080 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7081 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7082 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7083 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7087 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7089 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7092 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7093 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7097 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7099 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7103 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7104 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7108 #define alc262_capture_mixer alc882_capture_mixer
7109 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7112 * generic initialization of ADC, input mixers and output mixers
7114 static struct hda_verb alc262_init_verbs[] = {
7116 * Unmute ADC0-2 and set the default input to mic-in
7118 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7120 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7122 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7125 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7127 * Note: PASD motherboards uses the Line In 2 as the input for
7128 * front panel mic (mic 2)
7130 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7138 * Set up output mixers (0x0c - 0x0e)
7140 /* set vol=0 to output mixers */
7141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7144 /* set up input amps for analog loopback */
7145 /* Amp Indices: DAC = 0, mixer = 1 */
7146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7148 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7149 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7150 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7151 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7155 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7156 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7157 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7158 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7160 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7162 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7163 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7166 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7167 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7169 /* FIXME: use matrix-type input source selection */
7170 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7171 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7174 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7175 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7178 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7179 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7180 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7190 static struct hda_verb alc262_hippo_unsol_verbs[] = {
7191 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7196 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
7197 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7198 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7199 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7201 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7206 static struct hda_verb alc262_sony_unsol_verbs[] = {
7207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
7211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7215 /* mute/unmute internal speaker according to the hp jack and mute state */
7216 static void alc262_hippo_automute(struct hda_codec *codec, int force)
7218 struct alc_spec *spec = codec->spec;
7221 if (force || !spec->sense_updated) {
7222 unsigned int present;
7223 /* need to execute and sync at first */
7224 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7225 present = snd_hda_codec_read(codec, 0x15, 0,
7226 AC_VERB_GET_PIN_SENSE, 0);
7227 spec->jack_present = (present & 0x80000000) != 0;
7228 spec->sense_updated = 1;
7230 if (spec->jack_present) {
7231 /* mute internal speaker */
7232 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7234 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7237 /* unmute internal speaker if necessary */
7238 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7239 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7241 mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0);
7242 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7247 /* unsolicited event for HP jack sensing */
7248 static void alc262_hippo_unsol_event(struct hda_codec *codec,
7251 if ((res >> 26) != ALC880_HP_EVENT)
7253 alc262_hippo_automute(codec, 1);
7256 static void alc262_hippo1_automute(struct hda_codec *codec, int force)
7258 struct alc_spec *spec = codec->spec;
7261 if (force || !spec->sense_updated) {
7262 unsigned int present;
7263 /* need to execute and sync at first */
7264 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7265 present = snd_hda_codec_read(codec, 0x1b, 0,
7266 AC_VERB_GET_PIN_SENSE, 0);
7267 spec->jack_present = (present & 0x80000000) != 0;
7268 spec->sense_updated = 1;
7270 if (spec->jack_present) {
7271 /* mute internal speaker */
7272 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7274 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7277 /* unmute internal speaker if necessary */
7278 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7279 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7281 mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0);
7282 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7287 /* unsolicited event for HP jack sensing */
7288 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
7291 if ((res >> 26) != ALC880_HP_EVENT)
7293 alc262_hippo1_automute(codec, 1);
7298 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7301 #define ALC_HP_EVENT 0x37
7303 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
7304 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
7305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7309 static struct hda_input_mux alc262_fujitsu_capture_source = {
7317 static struct hda_input_mux alc262_HP_capture_source = {
7321 { "Front Mic", 0x3 },
7328 /* mute/unmute internal speaker according to the hp jack and mute state */
7329 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7331 struct alc_spec *spec = codec->spec;
7334 if (force || !spec->sense_updated) {
7335 unsigned int present;
7336 /* need to execute and sync at first */
7337 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
7338 present = snd_hda_codec_read(codec, 0x14, 0,
7339 AC_VERB_GET_PIN_SENSE, 0);
7340 spec->jack_present = (present & 0x80000000) != 0;
7341 spec->sense_updated = 1;
7343 if (spec->jack_present) {
7344 /* mute internal speaker */
7345 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7347 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7350 /* unmute internal speaker if necessary */
7351 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7352 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7354 mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0);
7355 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7360 /* unsolicited event for HP jack sensing */
7361 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
7364 if ((res >> 26) != ALC_HP_EVENT)
7366 alc262_fujitsu_automute(codec, 1);
7369 /* bind volumes of both NID 0x0c and 0x0d */
7370 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol,
7371 struct snd_ctl_elem_value *ucontrol)
7373 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7374 long *valp = ucontrol->value.integer.value;
7377 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0,
7378 0x7f, valp[0] & 0x7f);
7379 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0,
7380 0x7f, valp[1] & 0x7f);
7381 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
7382 0x7f, valp[0] & 0x7f);
7383 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
7384 0x7f, valp[1] & 0x7f);
7388 /* bind hp and internal speaker mute (with plug check) */
7389 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7390 struct snd_ctl_elem_value *ucontrol)
7392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7393 long *valp = ucontrol->value.integer.value;
7396 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7397 0x80, valp[0] ? 0 : 0x80);
7398 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7399 0x80, valp[1] ? 0 : 0x80);
7400 if (change || codec->in_resume)
7401 alc262_fujitsu_automute(codec, codec->in_resume);
7405 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
7407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7408 .name = "Master Playback Volume",
7409 .info = snd_hda_mixer_amp_volume_info,
7410 .get = snd_hda_mixer_amp_volume_get,
7411 .put = alc262_fujitsu_master_vol_put,
7412 .tlv = { .c = snd_hda_mixer_amp_tlv },
7413 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7417 .name = "Master Playback Switch",
7418 .info = snd_hda_mixer_amp_switch_info,
7419 .get = snd_hda_mixer_amp_switch_get,
7420 .put = alc262_fujitsu_master_sw_put,
7421 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7423 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7424 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7425 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7427 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7431 /* additional init verbs for Benq laptops */
7432 static struct hda_verb alc262_EAPD_verbs[] = {
7433 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7434 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7438 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
7439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7442 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7443 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7447 /* add playback controls from the parsed DAC table */
7448 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
7449 const struct auto_pin_cfg *cfg)
7454 spec->multiout.num_dacs = 1; /* only use one dac */
7455 spec->multiout.dac_nids = spec->private_dac_nids;
7456 spec->multiout.dac_nids[0] = 2;
7458 nid = cfg->line_out_pins[0];
7460 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7461 "Front Playback Volume",
7462 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
7465 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7466 "Front Playback Switch",
7467 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
7472 nid = cfg->speaker_pins[0];
7475 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7476 "Speaker Playback Volume",
7477 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7481 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7482 "Speaker Playback Switch",
7483 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7488 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7489 "Speaker Playback Switch",
7490 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7496 nid = cfg->hp_pins[0];
7498 /* spec->multiout.hp_nid = 2; */
7500 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7501 "Headphone Playback Volume",
7502 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7506 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7507 "Headphone Playback Switch",
7508 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7513 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7514 "Headphone Playback Switch",
7515 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7524 /* identical with ALC880 */
7525 #define alc262_auto_create_analog_input_ctls \
7526 alc880_auto_create_analog_input_ctls
7529 * generic initialization of ADC, input mixers and output mixers
7531 static struct hda_verb alc262_volume_init_verbs[] = {
7533 * Unmute ADC0-2 and set the default input to mic-in
7535 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7537 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7539 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7542 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7544 * Note: PASD motherboards uses the Line In 2 as the input for
7545 * front panel mic (mic 2)
7547 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7555 * Set up output mixers (0x0c - 0x0f)
7557 /* set vol=0 to output mixers */
7558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7559 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7562 /* set up input amps for analog loopback */
7563 /* Amp Indices: DAC = 0, mixer = 1 */
7564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7565 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7567 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7571 /* FIXME: use matrix-type input source selection */
7572 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7573 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7592 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
7594 * Unmute ADC0-2 and set the default input to mic-in
7596 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7598 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7600 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7601 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7603 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7605 * Note: PASD motherboards uses the Line In 2 as the input for
7606 * front panel mic (mic 2)
7608 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
7615 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},
7618 * Set up output mixers (0x0c - 0x0e)
7620 /* set vol=0 to output mixers */
7621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7625 /* set up input amps for analog loopback */
7626 /* Amp Indices: DAC = 0, mixer = 1 */
7627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7636 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7638 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7641 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7642 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7645 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7647 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7648 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7650 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7652 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7654 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7655 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7658 /* FIXME: use matrix-type input source selection */
7659 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7660 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7679 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
7681 * Unmute ADC0-2 and set the default input to mic-in
7683 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7685 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7686 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7687 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7688 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7690 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7692 * Note: PASD motherboards uses the Line In 2 as the input for front
7695 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
7702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},
7703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)},
7705 * Set up output mixers (0x0c - 0x0e)
7707 /* set vol=0 to output mixers */
7708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7710 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7712 /* set up input amps for analog loopback */
7713 /* Amp Indices: DAC = 0, mixer = 1 */
7714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7716 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7718 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7719 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
7723 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
7724 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
7725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
7726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
7727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
7728 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
7730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7733 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7736 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
7737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7739 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7740 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7741 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7743 /* FIXME: use matrix-type input source selection */
7744 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7745 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
7747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
7748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
7749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
7750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
7751 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
7754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7757 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7758 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7759 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7760 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7765 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7766 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7767 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7773 /* pcm configuration: identiacal with ALC880 */
7774 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
7775 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
7776 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
7777 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
7780 * BIOS auto configuration
7782 static int alc262_parse_auto_config(struct hda_codec *codec)
7784 struct alc_spec *spec = codec->spec;
7786 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
7788 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7792 if (!spec->autocfg.line_outs)
7793 return 0; /* can't find valid BIOS pin config */
7794 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
7797 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
7801 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
7803 if (spec->autocfg.dig_out_pin)
7804 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
7805 if (spec->autocfg.dig_in_pin)
7806 spec->dig_in_nid = ALC262_DIGIN_NID;
7808 if (spec->kctl_alloc)
7809 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
7811 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
7812 spec->num_mux_defs = 1;
7813 spec->input_mux = &spec->private_imux;
7818 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
7819 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
7820 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
7823 /* init callback for auto-configuration model -- overriding the default init */
7824 static void alc262_auto_init(struct hda_codec *codec)
7826 alc262_auto_init_multi_out(codec);
7827 alc262_auto_init_hp_out(codec);
7828 alc262_auto_init_analog_input(codec);
7832 * configuration and preset
7834 static const char *alc262_models[ALC262_MODEL_LAST] = {
7835 [ALC262_BASIC] = "basic",
7836 [ALC262_HIPPO] = "hippo",
7837 [ALC262_HIPPO_1] = "hippo_1",
7838 [ALC262_FUJITSU] = "fujitsu",
7839 [ALC262_HP_BPC] = "hp-bpc",
7840 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
7841 [ALC262_BENQ_ED8] = "benq",
7842 [ALC262_BENQ_T31] = "benq-t31",
7843 [ALC262_SONY_ASSAMD] = "sony-assamd",
7844 [ALC262_AUTO] = "auto",
7847 static struct snd_pci_quirk alc262_cfg_tbl[] = {
7848 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
7849 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
7850 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
7851 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
7852 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
7853 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
7854 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
7855 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
7856 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
7857 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
7858 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
7859 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
7860 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
7861 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
7862 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
7863 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
7864 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
7865 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
7866 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
7867 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
7868 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
7869 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
7870 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
7871 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7872 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7876 static struct alc_config_preset alc262_presets[] = {
7878 .mixers = { alc262_base_mixer },
7879 .init_verbs = { alc262_init_verbs },
7880 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7881 .dac_nids = alc262_dac_nids,
7883 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7884 .channel_mode = alc262_modes,
7885 .input_mux = &alc262_capture_source,
7888 .mixers = { alc262_base_mixer },
7889 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
7890 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7891 .dac_nids = alc262_dac_nids,
7893 .dig_out_nid = ALC262_DIGOUT_NID,
7894 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7895 .channel_mode = alc262_modes,
7896 .input_mux = &alc262_capture_source,
7897 .unsol_event = alc262_hippo_unsol_event,
7899 [ALC262_HIPPO_1] = {
7900 .mixers = { alc262_hippo1_mixer },
7901 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
7902 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7903 .dac_nids = alc262_dac_nids,
7905 .dig_out_nid = ALC262_DIGOUT_NID,
7906 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7907 .channel_mode = alc262_modes,
7908 .input_mux = &alc262_capture_source,
7909 .unsol_event = alc262_hippo1_unsol_event,
7911 [ALC262_FUJITSU] = {
7912 .mixers = { alc262_fujitsu_mixer },
7913 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs },
7914 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7915 .dac_nids = alc262_dac_nids,
7917 .dig_out_nid = ALC262_DIGOUT_NID,
7918 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7919 .channel_mode = alc262_modes,
7920 .input_mux = &alc262_fujitsu_capture_source,
7921 .unsol_event = alc262_fujitsu_unsol_event,
7924 .mixers = { alc262_HP_BPC_mixer },
7925 .init_verbs = { alc262_HP_BPC_init_verbs },
7926 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7927 .dac_nids = alc262_dac_nids,
7929 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7930 .channel_mode = alc262_modes,
7931 .input_mux = &alc262_HP_capture_source,
7933 [ALC262_HP_BPC_D7000_WF] = {
7934 .mixers = { alc262_HP_BPC_WildWest_mixer },
7935 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
7936 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7937 .dac_nids = alc262_dac_nids,
7939 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7940 .channel_mode = alc262_modes,
7941 .input_mux = &alc262_HP_capture_source,
7943 [ALC262_HP_BPC_D7000_WL] = {
7944 .mixers = { alc262_HP_BPC_WildWest_mixer,
7945 alc262_HP_BPC_WildWest_option_mixer },
7946 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
7947 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7948 .dac_nids = alc262_dac_nids,
7950 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7951 .channel_mode = alc262_modes,
7952 .input_mux = &alc262_HP_capture_source,
7954 [ALC262_BENQ_ED8] = {
7955 .mixers = { alc262_base_mixer },
7956 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
7957 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7958 .dac_nids = alc262_dac_nids,
7960 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7961 .channel_mode = alc262_modes,
7962 .input_mux = &alc262_capture_source,
7964 [ALC262_SONY_ASSAMD] = {
7965 .mixers = { alc262_sony_mixer },
7966 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
7967 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7968 .dac_nids = alc262_dac_nids,
7970 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7971 .channel_mode = alc262_modes,
7972 .input_mux = &alc262_capture_source,
7973 .unsol_event = alc262_hippo_unsol_event,
7975 [ALC262_BENQ_T31] = {
7976 .mixers = { alc262_benq_t31_mixer },
7977 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
7978 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7979 .dac_nids = alc262_dac_nids,
7981 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7982 .channel_mode = alc262_modes,
7983 .input_mux = &alc262_capture_source,
7984 .unsol_event = alc262_hippo_unsol_event,
7988 static int patch_alc262(struct hda_codec *codec)
7990 struct alc_spec *spec;
7994 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8000 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8005 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8006 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8007 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8008 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8012 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8016 if (board_config < 0) {
8017 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8018 "trying auto-probe from BIOS...\n");
8019 board_config = ALC262_AUTO;
8022 if (board_config == ALC262_AUTO) {
8023 /* automatic parse from the BIOS config */
8024 err = alc262_parse_auto_config(codec);
8030 "hda_codec: Cannot set up configuration "
8031 "from BIOS. Using base mode...\n");
8032 board_config = ALC262_BASIC;
8036 if (board_config != ALC262_AUTO)
8037 setup_preset(spec, &alc262_presets[board_config]);
8039 spec->stream_name_analog = "ALC262 Analog";
8040 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8041 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8043 spec->stream_name_digital = "ALC262 Digital";
8044 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8045 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8047 if (!spec->adc_nids && spec->input_mux) {
8048 /* check whether NID 0x07 is valid */
8049 unsigned int wcap = get_wcaps(codec, 0x07);
8052 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8053 if (wcap != AC_WID_AUD_IN) {
8054 spec->adc_nids = alc262_adc_nids_alt;
8055 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8056 spec->mixers[spec->num_mixers] =
8057 alc262_capture_alt_mixer;
8060 spec->adc_nids = alc262_adc_nids;
8061 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
8062 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
8067 codec->patch_ops = alc_patch_ops;
8068 if (board_config == ALC262_AUTO)
8069 spec->init_hook = alc262_auto_init;
8075 * ALC268 channel source setting (2 channel)
8077 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8078 #define alc268_modes alc260_modes
8080 static hda_nid_t alc268_dac_nids[2] = {
8085 static hda_nid_t alc268_adc_nids[2] = {
8090 static hda_nid_t alc268_adc_nids_alt[1] = {
8095 static struct snd_kcontrol_new alc268_base_mixer[] = {
8096 /* output mixer control */
8097 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
8098 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
8100 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8105 * generic initialization of ADC, input mixers and output mixers
8107 static struct hda_verb alc268_base_init_verbs[] = {
8108 /* Unmute DAC0-1 and set vol = 0 */
8109 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8110 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8111 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8112 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8113 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8114 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8117 * Set up output mixers (0x0c - 0x0e)
8119 /* set vol=0 to output mixers */
8120 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8123 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
8125 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8126 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8130 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8131 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8132 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8133 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8134 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8135 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8139 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8142 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8143 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8144 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8146 /* FIXME: use matrix-type input source selection */
8147 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
8148 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8152 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8163 * generic initialization of ADC, input mixers and output mixers
8165 static struct hda_verb alc268_volume_init_verbs[] = {
8166 /* set output DAC */
8167 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8168 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8169 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8173 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8174 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8175 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8176 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8178 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8179 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8180 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8182 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8187 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8189 /* set PCBEEP vol = 0 */
8190 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
8195 #define alc268_mux_enum_info alc_mux_enum_info
8196 #define alc268_mux_enum_get alc_mux_enum_get
8198 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8199 struct snd_ctl_elem_value *ucontrol)
8201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8202 struct alc_spec *spec = codec->spec;
8203 const struct hda_input_mux *imux = spec->input_mux;
8204 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
8205 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
8206 hda_nid_t nid = capture_mixers[adc_idx];
8207 unsigned int *cur_val = &spec->cur_mux[adc_idx];
8208 unsigned int i, idx;
8210 idx = ucontrol->value.enumerated.item[0];
8211 if (idx >= imux->num_items)
8212 idx = imux->num_items - 1;
8213 if (*cur_val == idx && !codec->in_resume)
8215 for (i = 0; i < imux->num_items; i++) {
8216 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
8217 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8218 v | (imux->items[i].index << 8));
8219 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL,
8226 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
8227 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8228 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8231 /* The multiple "Capture Source" controls confuse alsamixer
8232 * So call somewhat different..
8233 * FIXME: the controls appear in the "playback" view!
8235 /* .name = "Capture Source", */
8236 .name = "Input Source",
8238 .info = alc268_mux_enum_info,
8239 .get = alc268_mux_enum_get,
8240 .put = alc268_mux_enum_put,
8245 static struct snd_kcontrol_new alc268_capture_mixer[] = {
8246 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8247 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8248 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
8249 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
8251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8252 /* The multiple "Capture Source" controls confuse alsamixer
8253 * So call somewhat different..
8254 * FIXME: the controls appear in the "playback" view!
8256 /* .name = "Capture Source", */
8257 .name = "Input Source",
8259 .info = alc268_mux_enum_info,
8260 .get = alc268_mux_enum_get,
8261 .put = alc268_mux_enum_put,
8266 static struct hda_input_mux alc268_capture_source = {
8270 { "Front Mic", 0x1 },
8276 /* create input playback/capture controls for the given pin */
8277 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
8278 const char *ctlname, int idx)
8283 sprintf(name, "%s Playback Volume", ctlname);
8285 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8286 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
8290 } else if (nid == 0x15) {
8291 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8292 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
8298 sprintf(name, "%s Playback Switch", ctlname);
8299 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
8300 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
8306 /* add playback controls from the parsed DAC table */
8307 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
8308 const struct auto_pin_cfg *cfg)
8313 spec->multiout.num_dacs = 2; /* only use one dac */
8314 spec->multiout.dac_nids = spec->private_dac_nids;
8315 spec->multiout.dac_nids[0] = 2;
8316 spec->multiout.dac_nids[1] = 3;
8318 nid = cfg->line_out_pins[0];
8320 alc268_new_analog_output(spec, nid, "Front", 0);
8322 nid = cfg->speaker_pins[0];
8324 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8325 "Speaker Playback Volume",
8326 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
8330 nid = cfg->hp_pins[0];
8332 alc268_new_analog_output(spec, nid, "Headphone", 0);
8334 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
8336 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8337 "Mono Playback Switch",
8338 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
8345 /* create playback/capture controls for input pins */
8346 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
8347 const struct auto_pin_cfg *cfg)
8349 struct hda_input_mux *imux = &spec->private_imux;
8352 for (i = 0; i < AUTO_PIN_LAST; i++) {
8353 switch(cfg->input_pins[i]) {
8355 idx1 = 0; /* Mic 1 */
8358 idx1 = 1; /* Mic 2 */
8361 idx1 = 2; /* Line In */
8369 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
8370 imux->items[imux->num_items].index = idx1;
8376 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
8378 struct alc_spec *spec = codec->spec;
8379 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
8380 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
8381 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
8382 unsigned int dac_vol1, dac_vol2;
8385 snd_hda_codec_write(codec, speaker_nid, 0,
8386 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
8387 snd_hda_codec_write(codec, 0x0f, 0,
8388 AC_VERB_SET_AMP_GAIN_MUTE,
8390 snd_hda_codec_write(codec, 0x10, 0,
8391 AC_VERB_SET_AMP_GAIN_MUTE,
8394 snd_hda_codec_write(codec, 0x0f, 0,
8395 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8396 snd_hda_codec_write(codec, 0x10, 0,
8397 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8400 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
8401 if (line_nid == 0x14)
8402 dac_vol2 = AMP_OUT_ZERO;
8403 else if (line_nid == 0x15)
8404 dac_vol1 = AMP_OUT_ZERO;
8406 dac_vol2 = AMP_OUT_ZERO;
8407 else if (hp_nid == 0x15)
8408 dac_vol1 = AMP_OUT_ZERO;
8409 if (line_nid != 0x16 || hp_nid != 0x16 ||
8410 spec->autocfg.line_out_pins[1] != 0x16 ||
8411 spec->autocfg.line_out_pins[2] != 0x16)
8412 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
8414 snd_hda_codec_write(codec, 0x02, 0,
8415 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
8416 snd_hda_codec_write(codec, 0x03, 0,
8417 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
8420 /* pcm configuration: identiacal with ALC880 */
8421 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
8422 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
8423 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
8426 * BIOS auto configuration
8428 static int alc268_parse_auto_config(struct hda_codec *codec)
8430 struct alc_spec *spec = codec->spec;
8432 static hda_nid_t alc268_ignore[] = { 0 };
8434 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8438 if (!spec->autocfg.line_outs)
8439 return 0; /* can't find valid BIOS pin config */
8441 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
8444 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
8448 spec->multiout.max_channels = 2;
8450 /* digital only support output */
8451 if (spec->autocfg.dig_out_pin)
8452 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
8454 if (spec->kctl_alloc)
8455 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8457 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
8458 spec->num_mux_defs = 1;
8459 spec->input_mux = &spec->private_imux;
8464 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
8465 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
8466 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
8468 /* init callback for auto-configuration model -- overriding the default init */
8469 static void alc268_auto_init(struct hda_codec *codec)
8471 alc268_auto_init_multi_out(codec);
8472 alc268_auto_init_hp_out(codec);
8473 alc268_auto_init_mono_speaker_out(codec);
8474 alc268_auto_init_analog_input(codec);
8478 * configuration and preset
8480 static const char *alc268_models[ALC268_MODEL_LAST] = {
8481 [ALC268_3ST] = "3stack",
8482 [ALC268_AUTO] = "auto",
8485 static struct snd_pci_quirk alc268_cfg_tbl[] = {
8486 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
8490 static struct alc_config_preset alc268_presets[] = {
8492 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8493 .init_verbs = { alc268_base_init_verbs },
8494 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8495 .dac_nids = alc268_dac_nids,
8496 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8497 .adc_nids = alc268_adc_nids_alt,
8499 .dig_out_nid = ALC268_DIGOUT_NID,
8500 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8501 .channel_mode = alc268_modes,
8502 .input_mux = &alc268_capture_source,
8506 static int patch_alc268(struct hda_codec *codec)
8508 struct alc_spec *spec;
8512 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
8518 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
8522 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
8523 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
8524 "trying auto-probe from BIOS...\n");
8525 board_config = ALC268_AUTO;
8528 if (board_config == ALC268_AUTO) {
8529 /* automatic parse from the BIOS config */
8530 err = alc268_parse_auto_config(codec);
8536 "hda_codec: Cannot set up configuration "
8537 "from BIOS. Using base mode...\n");
8538 board_config = ALC268_3ST;
8542 if (board_config != ALC268_AUTO)
8543 setup_preset(spec, &alc268_presets[board_config]);
8545 spec->stream_name_analog = "ALC268 Analog";
8546 spec->stream_analog_playback = &alc268_pcm_analog_playback;
8547 spec->stream_analog_capture = &alc268_pcm_analog_capture;
8549 spec->stream_name_digital = "ALC268 Digital";
8550 spec->stream_digital_playback = &alc268_pcm_digital_playback;
8552 if (board_config == ALC268_AUTO) {
8553 if (!spec->adc_nids && spec->input_mux) {
8554 /* check whether NID 0x07 is valid */
8555 unsigned int wcap = get_wcaps(codec, 0x07);
8558 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8559 if (wcap != AC_WID_AUD_IN) {
8560 spec->adc_nids = alc268_adc_nids_alt;
8561 spec->num_adc_nids =
8562 ARRAY_SIZE(alc268_adc_nids_alt);
8563 spec->mixers[spec->num_mixers] =
8564 alc268_capture_alt_mixer;
8567 spec->adc_nids = alc268_adc_nids;
8568 spec->num_adc_nids =
8569 ARRAY_SIZE(alc268_adc_nids);
8570 spec->mixers[spec->num_mixers] =
8571 alc268_capture_mixer;
8576 codec->patch_ops = alc_patch_ops;
8577 if (board_config == ALC268_AUTO)
8578 spec->init_hook = alc268_auto_init;
8584 * ALC861 channel source setting (2/6 channel selection for 3-stack)
8588 * set the path ways for 2 channel output
8589 * need to set the codec line out and mic 1 pin widgets to inputs
8591 static struct hda_verb alc861_threestack_ch2_init[] = {
8592 /* set pin widget 1Ah (line in) for input */
8593 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8594 /* set pin widget 18h (mic1/2) for input, for mic also enable
8597 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8599 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8601 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8608 * need to set the codec line out and mic 1 pin widgets to outputs
8610 static struct hda_verb alc861_threestack_ch6_init[] = {
8611 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8612 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8613 /* set pin widget 18h (mic1) for output (CLFE)*/
8614 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8616 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8617 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8619 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8621 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8622 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8627 static struct hda_channel_mode alc861_threestack_modes[2] = {
8628 { 2, alc861_threestack_ch2_init },
8629 { 6, alc861_threestack_ch6_init },
8631 /* Set mic1 as input and unmute the mixer */
8632 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
8633 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8634 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8637 /* Set mic1 as output and mute mixer */
8638 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
8639 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8640 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8644 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
8645 { 2, alc861_uniwill_m31_ch2_init },
8646 { 4, alc861_uniwill_m31_ch4_init },
8649 /* Set mic1 and line-in as input and unmute the mixer */
8650 static struct hda_verb alc861_asus_ch2_init[] = {
8651 /* set pin widget 1Ah (line in) for input */
8652 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8653 /* set pin widget 18h (mic1/2) for input, for mic also enable
8656 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8658 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8660 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8661 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8665 /* Set mic1 nad line-in as output and mute mixer */
8666 static struct hda_verb alc861_asus_ch6_init[] = {
8667 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8668 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8669 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8670 /* set pin widget 18h (mic1) for output (CLFE)*/
8671 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8672 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8673 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8674 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8676 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8678 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8679 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8684 static struct hda_channel_mode alc861_asus_modes[2] = {
8685 { 2, alc861_asus_ch2_init },
8686 { 6, alc861_asus_ch6_init },
8691 static struct snd_kcontrol_new alc861_base_mixer[] = {
8692 /* output mixer control */
8693 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8694 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8695 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8696 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8697 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8699 /*Input mixer control */
8700 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8701 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8702 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8703 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8704 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8705 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8707 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8711 /* Capture mixer control */
8712 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8713 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8716 .name = "Capture Source",
8718 .info = alc_mux_enum_info,
8719 .get = alc_mux_enum_get,
8720 .put = alc_mux_enum_put,
8725 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
8726 /* output mixer control */
8727 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8728 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8729 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8730 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8731 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8733 /* Input mixer control */
8734 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8735 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8736 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8737 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8738 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8739 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8740 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8741 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8742 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8743 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8745 /* Capture mixer control */
8746 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8747 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8749 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8750 .name = "Capture Source",
8752 .info = alc_mux_enum_info,
8753 .get = alc_mux_enum_get,
8754 .put = alc_mux_enum_put,
8757 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8758 .name = "Channel Mode",
8759 .info = alc_ch_mode_info,
8760 .get = alc_ch_mode_get,
8761 .put = alc_ch_mode_put,
8762 .private_value = ARRAY_SIZE(alc861_threestack_modes),
8767 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
8768 /* output mixer control */
8769 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8771 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8773 /*Capture mixer control */
8774 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8775 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8778 .name = "Capture Source",
8780 .info = alc_mux_enum_info,
8781 .get = alc_mux_enum_get,
8782 .put = alc_mux_enum_put,
8788 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
8789 /* output mixer control */
8790 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8791 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8792 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8793 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8794 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8796 /* Input mixer control */
8797 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8798 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8799 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8800 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8802 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8804 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8805 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8808 /* Capture mixer control */
8809 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8810 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8812 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8813 .name = "Capture Source",
8815 .info = alc_mux_enum_info,
8816 .get = alc_mux_enum_get,
8817 .put = alc_mux_enum_put,
8820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8821 .name = "Channel Mode",
8822 .info = alc_ch_mode_info,
8823 .get = alc_ch_mode_get,
8824 .put = alc_ch_mode_put,
8825 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
8830 static struct snd_kcontrol_new alc861_asus_mixer[] = {
8831 /* output mixer control */
8832 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8833 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8834 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8835 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8836 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8838 /* Input mixer control */
8839 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8840 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8841 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8842 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8843 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8844 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8845 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8846 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
8850 /* Capture mixer control */
8851 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8852 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8854 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8855 .name = "Capture Source",
8857 .info = alc_mux_enum_info,
8858 .get = alc_mux_enum_get,
8859 .put = alc_mux_enum_put,
8862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8863 .name = "Channel Mode",
8864 .info = alc_ch_mode_info,
8865 .get = alc_ch_mode_get,
8866 .put = alc_ch_mode_put,
8867 .private_value = ARRAY_SIZE(alc861_asus_modes),
8872 /* additional mixer */
8873 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
8874 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8875 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8876 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
8877 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
8882 * generic initialization of ADC, input mixers and output mixers
8884 static struct hda_verb alc861_base_init_verbs[] = {
8886 * Unmute ADC0 and set the default input to mic-in
8888 /* port-A for surround (rear panel) */
8889 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8890 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
8891 /* port-B for mic-in (rear panel) with vref */
8892 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8893 /* port-C for line-in (rear panel) */
8894 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8895 /* port-D for Front */
8896 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8897 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
8898 /* port-E for HP out (front panel) */
8899 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8900 /* route front PCM to HP */
8901 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8902 /* port-F for mic-in (front panel) with vref */
8903 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8904 /* port-G for CLFE (rear panel) */
8905 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8906 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8907 /* port-H for side (rear panel) */
8908 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8909 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
8911 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8912 /* route front mic to ADC1*/
8913 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8916 /* Unmute DAC0~3 & spdif out*/
8917 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8918 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8919 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8920 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8923 /* Unmute Mixer 14 (mic) 1c (Line in)*/
8924 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8925 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8926 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8927 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8929 /* Unmute Stereo Mixer 15 */
8930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8933 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
8935 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8936 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8940 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8941 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8943 /* hp used DAC 3 (Front) */
8944 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8950 static struct hda_verb alc861_threestack_init_verbs[] = {
8952 * Unmute ADC0 and set the default input to mic-in
8954 /* port-A for surround (rear panel) */
8955 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8956 /* port-B for mic-in (rear panel) with vref */
8957 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8958 /* port-C for line-in (rear panel) */
8959 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8960 /* port-D for Front */
8961 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8962 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
8963 /* port-E for HP out (front panel) */
8964 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8965 /* route front PCM to HP */
8966 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8967 /* port-F for mic-in (front panel) with vref */
8968 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8969 /* port-G for CLFE (rear panel) */
8970 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8971 /* port-H for side (rear panel) */
8972 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8974 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8975 /* route front mic to ADC1*/
8976 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8977 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8978 /* Unmute DAC0~3 & spdif out*/
8979 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8980 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8981 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8982 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8985 /* Unmute Mixer 14 (mic) 1c (Line in)*/
8986 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8987 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8988 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8989 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8991 /* Unmute Stereo Mixer 15 */
8992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8995 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
8997 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8999 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9003 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9005 /* hp used DAC 3 (Front) */
9006 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9007 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9011 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
9013 * Unmute ADC0 and set the default input to mic-in
9015 /* port-A for surround (rear panel) */
9016 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9017 /* port-B for mic-in (rear panel) with vref */
9018 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9019 /* port-C for line-in (rear panel) */
9020 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9021 /* port-D for Front */
9022 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9023 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9024 /* port-E for HP out (front panel) */
9025 /* this has to be set to VREF80 */
9026 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9027 /* route front PCM to HP */
9028 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9029 /* port-F for mic-in (front panel) with vref */
9030 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9031 /* port-G for CLFE (rear panel) */
9032 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9033 /* port-H for side (rear panel) */
9034 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9036 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9037 /* route front mic to ADC1*/
9038 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9039 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9040 /* Unmute DAC0~3 & spdif out*/
9041 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9042 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9043 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9044 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9045 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9047 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9048 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9049 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9050 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9051 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9053 /* Unmute Stereo Mixer 15 */
9054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9059 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9060 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9061 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9063 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9065 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9067 /* hp used DAC 3 (Front) */
9068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9073 static struct hda_verb alc861_asus_init_verbs[] = {
9075 * Unmute ADC0 and set the default input to mic-in
9077 /* port-A for surround (rear panel)
9078 * according to codec#0 this is the HP jack
9080 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
9081 /* route front PCM to HP */
9082 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
9083 /* port-B for mic-in (rear panel) with vref */
9084 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9085 /* port-C for line-in (rear panel) */
9086 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9087 /* port-D for Front */
9088 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9089 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9090 /* port-E for HP out (front panel) */
9091 /* this has to be set to VREF80 */
9092 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9093 /* route front PCM to HP */
9094 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9095 /* port-F for mic-in (front panel) with vref */
9096 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9097 /* port-G for CLFE (rear panel) */
9098 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9099 /* port-H for side (rear panel) */
9100 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9102 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9103 /* route front mic to ADC1*/
9104 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9105 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9106 /* Unmute DAC0~3 & spdif out*/
9107 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9108 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9109 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9110 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9112 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9113 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9114 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9115 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9116 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9118 /* Unmute Stereo Mixer 15 */
9119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9122 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9124 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9125 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9126 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9127 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9129 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9130 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9132 /* hp used DAC 3 (Front) */
9133 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9134 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9138 /* additional init verbs for ASUS laptops */
9139 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
9140 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
9141 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
9146 * generic initialization of ADC, input mixers and output mixers
9148 static struct hda_verb alc861_auto_init_verbs[] = {
9150 * Unmute ADC0 and set the default input to mic-in
9152 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
9153 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9155 /* Unmute DAC0~3 & spdif out*/
9156 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9157 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9158 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9159 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9162 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9163 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9164 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9165 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9166 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9168 /* Unmute Stereo Mixer 15 */
9169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
9174 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9175 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9176 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9177 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9189 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9192 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
9197 static struct hda_verb alc861_toshiba_init_verbs[] = {
9198 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9203 /* toggle speaker-output according to the hp-jack state */
9204 static void alc861_toshiba_automute(struct hda_codec *codec)
9206 unsigned int present;
9208 present = snd_hda_codec_read(codec, 0x0f, 0,
9209 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9210 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0,
9211 0x80, present ? 0x80 : 0);
9212 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0,
9213 0x80, present ? 0x80 : 0);
9214 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3,
9215 0x80, present ? 0 : 0x80);
9216 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3,
9217 0x80, present ? 0 : 0x80);
9220 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
9223 if ((res >> 26) == ALC880_HP_EVENT)
9224 alc861_toshiba_automute(codec);
9227 /* pcm configuration: identiacal with ALC880 */
9228 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
9229 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
9230 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
9231 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
9234 #define ALC861_DIGOUT_NID 0x07
9236 static struct hda_channel_mode alc861_8ch_modes[1] = {
9240 static hda_nid_t alc861_dac_nids[4] = {
9241 /* front, surround, clfe, side */
9242 0x03, 0x06, 0x05, 0x04
9245 static hda_nid_t alc660_dac_nids[3] = {
9246 /* front, clfe, surround */
9250 static hda_nid_t alc861_adc_nids[1] = {
9255 static struct hda_input_mux alc861_capture_source = {
9259 { "Front Mic", 0x3 },
9266 /* fill in the dac_nids table from the parsed pin configuration */
9267 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
9268 const struct auto_pin_cfg *cfg)
9273 spec->multiout.dac_nids = spec->private_dac_nids;
9274 for (i = 0; i < cfg->line_outs; i++) {
9275 nid = cfg->line_out_pins[i];
9277 if (i >= ARRAY_SIZE(alc861_dac_nids))
9279 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
9282 spec->multiout.num_dacs = cfg->line_outs;
9286 /* add playback controls from the parsed DAC table */
9287 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
9288 const struct auto_pin_cfg *cfg)
9291 static const char *chname[4] = {
9292 "Front", "Surround", NULL /*CLFE*/, "Side"
9297 for (i = 0; i < cfg->line_outs; i++) {
9298 nid = spec->multiout.dac_nids[i];
9303 err = add_control(spec, ALC_CTL_BIND_MUTE,
9304 "Center Playback Switch",
9305 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
9309 err = add_control(spec, ALC_CTL_BIND_MUTE,
9310 "LFE Playback Switch",
9311 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9316 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
9318 if (nid == alc861_dac_nids[idx])
9320 sprintf(name, "%s Playback Switch", chname[idx]);
9321 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
9322 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9331 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
9339 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
9341 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9342 "Headphone Playback Switch",
9343 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9346 spec->multiout.hp_nid = nid;
9351 /* create playback/capture controls for input pins */
9352 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
9353 const struct auto_pin_cfg *cfg)
9355 struct hda_input_mux *imux = &spec->private_imux;
9356 int i, err, idx, idx1;
9358 for (i = 0; i < AUTO_PIN_LAST; i++) {
9359 switch (cfg->input_pins[i]) {
9362 idx = 2; /* Line In */
9366 idx = 2; /* Line In */
9370 idx = 1; /* Mic In */
9374 idx = 1; /* Mic In */
9384 err = new_analog_input(spec, cfg->input_pins[i],
9385 auto_pin_cfg_labels[i], idx, 0x15);
9389 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9390 imux->items[imux->num_items].index = idx1;
9396 static struct snd_kcontrol_new alc861_capture_mixer[] = {
9397 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9398 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9402 /* The multiple "Capture Source" controls confuse alsamixer
9403 * So call somewhat different..
9404 *FIXME: the controls appear in the "playback" view!
9406 /* .name = "Capture Source", */
9407 .name = "Input Source",
9409 .info = alc_mux_enum_info,
9410 .get = alc_mux_enum_get,
9411 .put = alc_mux_enum_put,
9416 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
9418 int pin_type, int dac_idx)
9422 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9424 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9429 static void alc861_auto_init_multi_out(struct hda_codec *codec)
9431 struct alc_spec *spec = codec->spec;
9434 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
9435 for (i = 0; i < spec->autocfg.line_outs; i++) {
9436 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9437 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9439 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
9440 spec->multiout.dac_nids[i]);
9444 static void alc861_auto_init_hp_out(struct hda_codec *codec)
9446 struct alc_spec *spec = codec->spec;
9449 pin = spec->autocfg.hp_pins[0];
9450 if (pin) /* connect to front */
9451 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
9452 spec->multiout.dac_nids[0]);
9455 static void alc861_auto_init_analog_input(struct hda_codec *codec)
9457 struct alc_spec *spec = codec->spec;
9460 for (i = 0; i < AUTO_PIN_LAST; i++) {
9461 hda_nid_t nid = spec->autocfg.input_pins[i];
9462 if (nid >= 0x0c && nid <= 0x11) {
9463 snd_hda_codec_write(codec, nid, 0,
9464 AC_VERB_SET_PIN_WIDGET_CONTROL,
9465 i <= AUTO_PIN_FRONT_MIC ?
9466 PIN_VREF80 : PIN_IN);
9471 /* parse the BIOS configuration and set up the alc_spec */
9472 /* return 1 if successful, 0 if the proper config is not found,
9473 * or a negative error code
9475 static int alc861_parse_auto_config(struct hda_codec *codec)
9477 struct alc_spec *spec = codec->spec;
9479 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9481 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9485 if (!spec->autocfg.line_outs)
9486 return 0; /* can't find valid BIOS pin config */
9488 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
9491 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
9494 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
9497 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
9501 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9503 if (spec->autocfg.dig_out_pin)
9504 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
9506 if (spec->kctl_alloc)
9507 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9509 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
9511 spec->num_mux_defs = 1;
9512 spec->input_mux = &spec->private_imux;
9514 spec->adc_nids = alc861_adc_nids;
9515 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
9516 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
9522 /* additional initialization for auto-configuration model */
9523 static void alc861_auto_init(struct hda_codec *codec)
9525 alc861_auto_init_multi_out(codec);
9526 alc861_auto_init_hp_out(codec);
9527 alc861_auto_init_analog_input(codec);
9532 * configuration and preset
9534 static const char *alc861_models[ALC861_MODEL_LAST] = {
9535 [ALC861_3ST] = "3stack",
9536 [ALC660_3ST] = "3stack-660",
9537 [ALC861_3ST_DIG] = "3stack-dig",
9538 [ALC861_6ST_DIG] = "6stack-dig",
9539 [ALC861_UNIWILL_M31] = "uniwill-m31",
9540 [ALC861_TOSHIBA] = "toshiba",
9541 [ALC861_ASUS] = "asus",
9542 [ALC861_ASUS_LAPTOP] = "asus-laptop",
9543 [ALC861_AUTO] = "auto",
9546 static struct snd_pci_quirk alc861_cfg_tbl[] = {
9547 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
9548 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9549 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9550 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
9551 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
9552 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
9553 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
9554 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
9555 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
9556 * Any other models that need this preset?
9558 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
9559 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
9560 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
9561 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
9562 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
9563 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
9564 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
9565 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
9569 static struct alc_config_preset alc861_presets[] = {
9571 .mixers = { alc861_3ST_mixer },
9572 .init_verbs = { alc861_threestack_init_verbs },
9573 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9574 .dac_nids = alc861_dac_nids,
9575 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9576 .channel_mode = alc861_threestack_modes,
9578 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9579 .adc_nids = alc861_adc_nids,
9580 .input_mux = &alc861_capture_source,
9582 [ALC861_3ST_DIG] = {
9583 .mixers = { alc861_base_mixer },
9584 .init_verbs = { alc861_threestack_init_verbs },
9585 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9586 .dac_nids = alc861_dac_nids,
9587 .dig_out_nid = ALC861_DIGOUT_NID,
9588 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9589 .channel_mode = alc861_threestack_modes,
9591 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9592 .adc_nids = alc861_adc_nids,
9593 .input_mux = &alc861_capture_source,
9595 [ALC861_6ST_DIG] = {
9596 .mixers = { alc861_base_mixer },
9597 .init_verbs = { alc861_base_init_verbs },
9598 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9599 .dac_nids = alc861_dac_nids,
9600 .dig_out_nid = ALC861_DIGOUT_NID,
9601 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
9602 .channel_mode = alc861_8ch_modes,
9603 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9604 .adc_nids = alc861_adc_nids,
9605 .input_mux = &alc861_capture_source,
9608 .mixers = { alc861_3ST_mixer },
9609 .init_verbs = { alc861_threestack_init_verbs },
9610 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
9611 .dac_nids = alc660_dac_nids,
9612 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9613 .channel_mode = alc861_threestack_modes,
9615 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9616 .adc_nids = alc861_adc_nids,
9617 .input_mux = &alc861_capture_source,
9619 [ALC861_UNIWILL_M31] = {
9620 .mixers = { alc861_uniwill_m31_mixer },
9621 .init_verbs = { alc861_uniwill_m31_init_verbs },
9622 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9623 .dac_nids = alc861_dac_nids,
9624 .dig_out_nid = ALC861_DIGOUT_NID,
9625 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
9626 .channel_mode = alc861_uniwill_m31_modes,
9628 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9629 .adc_nids = alc861_adc_nids,
9630 .input_mux = &alc861_capture_source,
9632 [ALC861_TOSHIBA] = {
9633 .mixers = { alc861_toshiba_mixer },
9634 .init_verbs = { alc861_base_init_verbs,
9635 alc861_toshiba_init_verbs },
9636 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9637 .dac_nids = alc861_dac_nids,
9638 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9639 .channel_mode = alc883_3ST_2ch_modes,
9640 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9641 .adc_nids = alc861_adc_nids,
9642 .input_mux = &alc861_capture_source,
9643 .unsol_event = alc861_toshiba_unsol_event,
9644 .init_hook = alc861_toshiba_automute,
9647 .mixers = { alc861_asus_mixer },
9648 .init_verbs = { alc861_asus_init_verbs },
9649 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9650 .dac_nids = alc861_dac_nids,
9651 .dig_out_nid = ALC861_DIGOUT_NID,
9652 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
9653 .channel_mode = alc861_asus_modes,
9656 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9657 .adc_nids = alc861_adc_nids,
9658 .input_mux = &alc861_capture_source,
9660 [ALC861_ASUS_LAPTOP] = {
9661 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
9662 .init_verbs = { alc861_asus_init_verbs,
9663 alc861_asus_laptop_init_verbs },
9664 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9665 .dac_nids = alc861_dac_nids,
9666 .dig_out_nid = ALC861_DIGOUT_NID,
9667 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9668 .channel_mode = alc883_3ST_2ch_modes,
9670 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9671 .adc_nids = alc861_adc_nids,
9672 .input_mux = &alc861_capture_source,
9677 static int patch_alc861(struct hda_codec *codec)
9679 struct alc_spec *spec;
9683 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9689 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
9693 if (board_config < 0) {
9694 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
9695 "trying auto-probe from BIOS...\n");
9696 board_config = ALC861_AUTO;
9699 if (board_config == ALC861_AUTO) {
9700 /* automatic parse from the BIOS config */
9701 err = alc861_parse_auto_config(codec);
9707 "hda_codec: Cannot set up configuration "
9708 "from BIOS. Using base mode...\n");
9709 board_config = ALC861_3ST_DIG;
9713 if (board_config != ALC861_AUTO)
9714 setup_preset(spec, &alc861_presets[board_config]);
9716 spec->stream_name_analog = "ALC861 Analog";
9717 spec->stream_analog_playback = &alc861_pcm_analog_playback;
9718 spec->stream_analog_capture = &alc861_pcm_analog_capture;
9720 spec->stream_name_digital = "ALC861 Digital";
9721 spec->stream_digital_playback = &alc861_pcm_digital_playback;
9722 spec->stream_digital_capture = &alc861_pcm_digital_capture;
9724 codec->patch_ops = alc_patch_ops;
9725 if (board_config == ALC861_AUTO)
9726 spec->init_hook = alc861_auto_init;
9736 * In addition, an independent DAC
9738 #define ALC861VD_DIGOUT_NID 0x06
9740 static hda_nid_t alc861vd_dac_nids[4] = {
9741 /* front, surr, clfe, side surr */
9742 0x02, 0x03, 0x04, 0x05
9745 /* dac_nids for ALC660vd are in a different order - according to
9747 * This should probably tesult in a different mixer for 6stack models
9748 * of ALC660vd codecs, but for now there is only 3stack mixer
9749 * - and it is the same as in 861vd.
9750 * adc_nids in ALC660vd are (is) the same as in 861vd
9752 static hda_nid_t alc660vd_dac_nids[3] = {
9753 /* front, rear, clfe, rear_surr */
9757 static hda_nid_t alc861vd_adc_nids[1] = {
9763 /* FIXME: should be a matrix-type input source selection */
9764 static struct hda_input_mux alc861vd_capture_source = {
9768 { "Front Mic", 0x1 },
9774 static struct hda_input_mux alc861vd_dallas_capture_source = {
9777 { "Front Mic", 0x0 },
9778 { "ATAPI Mic", 0x1 },
9783 #define alc861vd_mux_enum_info alc_mux_enum_info
9784 #define alc861vd_mux_enum_get alc_mux_enum_get
9786 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
9787 struct snd_ctl_elem_value *ucontrol)
9789 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9790 struct alc_spec *spec = codec->spec;
9791 const struct hda_input_mux *imux = spec->input_mux;
9792 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9793 static hda_nid_t capture_mixers[1] = { 0x22 };
9794 hda_nid_t nid = capture_mixers[adc_idx];
9795 unsigned int *cur_val = &spec->cur_mux[adc_idx];
9796 unsigned int i, idx;
9798 idx = ucontrol->value.enumerated.item[0];
9799 if (idx >= imux->num_items)
9800 idx = imux->num_items - 1;
9801 if (*cur_val == idx && !codec->in_resume)
9803 for (i = 0; i < imux->num_items; i++) {
9804 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
9805 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9806 v | (imux->items[i].index << 8));
9815 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
9822 static struct hda_verb alc861vd_6stack_ch6_init[] = {
9823 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9824 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9825 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9826 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9833 static struct hda_verb alc861vd_6stack_ch8_init[] = {
9834 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9835 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9836 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9837 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9841 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
9842 { 6, alc861vd_6stack_ch6_init },
9843 { 8, alc861vd_6stack_ch8_init },
9846 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
9848 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9849 .name = "Channel Mode",
9850 .info = alc_ch_mode_info,
9851 .get = alc_ch_mode_get,
9852 .put = alc_ch_mode_put,
9857 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
9858 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9859 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9863 /* The multiple "Capture Source" controls confuse alsamixer
9864 * So call somewhat different..
9865 *FIXME: the controls appear in the "playback" view!
9867 /* .name = "Capture Source", */
9868 .name = "Input Source",
9870 .info = alc861vd_mux_enum_info,
9871 .get = alc861vd_mux_enum_get,
9872 .put = alc861vd_mux_enum_put,
9877 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
9878 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
9880 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
9881 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9885 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9887 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
9889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
9891 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9892 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
9895 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9897 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9903 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9904 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9913 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
9914 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
9919 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
9920 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9921 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9925 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9927 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9929 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9933 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9934 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9936 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9937 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9939 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
9940 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
9945 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
9946 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9947 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
9948 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9956 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9957 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9958 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9960 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9961 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9966 /* Pin assignment: Front=0x14, HP = 0x15,
9967 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
9969 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
9970 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9971 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9973 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
9974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9975 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9976 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9977 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
9979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
9980 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9981 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9983 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9984 /* .name = "Capture Source", */
9985 .name = "Input Source",
9987 .info = alc882_mux_enum_info,
9988 .get = alc882_mux_enum_get,
9989 .put = alc882_mux_enum_put,
9995 * generic initialization of ADC, input mixers and output mixers
9997 static struct hda_verb alc861vd_volume_init_verbs[] = {
9999 * Unmute ADC0 and set the default input to mic-in
10001 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10002 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10004 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
10005 * the analog-loopback mixer widget
10007 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10014 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10021 * Set up output mixers (0x02 - 0x05)
10023 /* set vol=0 to output mixers */
10024 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10025 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10026 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10027 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10029 /* set up input amps for analog loopback */
10030 /* Amp Indices: DAC = 0, mixer = 1 */
10031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10034 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10035 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10036 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10038 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10044 * 3-stack pin configuration:
10045 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10047 static struct hda_verb alc861vd_3stack_init_verbs[] = {
10049 * Set pin mode and muting
10051 /* set front pin widgets 0x14 for output */
10052 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10053 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10054 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10056 /* Mic (rear) pin: input vref at 80% */
10057 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10058 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10059 /* Front Mic pin: input vref at 80% */
10060 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10062 /* Line In pin: input */
10063 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10065 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10067 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10068 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10069 /* CD pin widget for input */
10070 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10076 * 6-stack pin configuration:
10078 static struct hda_verb alc861vd_6stack_init_verbs[] = {
10080 * Set pin mode and muting
10082 /* set front pin widgets 0x14 for output */
10083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10085 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10087 /* Rear Pin: output 1 (0x0d) */
10088 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10090 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10091 /* CLFE Pin: output 2 (0x0e) */
10092 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10094 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
10095 /* Side Pin: output 3 (0x0f) */
10096 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10097 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10098 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
10100 /* Mic (rear) pin: input vref at 80% */
10101 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10102 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10103 /* Front Mic pin: input vref at 80% */
10104 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10105 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10106 /* Line In pin: input */
10107 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10108 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10109 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10111 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10112 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10113 /* CD pin widget for input */
10114 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10119 static struct hda_verb alc861vd_eapd_verbs[] = {
10120 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10124 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
10125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10128 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10129 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10133 /* toggle speaker-output according to the hp-jack state */
10134 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10136 unsigned int present;
10137 unsigned char bits;
10139 present = snd_hda_codec_read(codec, 0x1b, 0,
10140 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10141 bits = present ? 0x80 : 0;
10142 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10144 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10148 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10150 unsigned int present;
10151 unsigned char bits;
10153 present = snd_hda_codec_read(codec, 0x18, 0,
10154 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10155 bits = present ? 0x80 : 0;
10156 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1,
10158 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
10162 static void alc861vd_lenovo_automute(struct hda_codec *codec)
10164 alc861vd_lenovo_hp_automute(codec);
10165 alc861vd_lenovo_mic_automute(codec);
10168 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
10171 switch (res >> 26) {
10172 case ALC880_HP_EVENT:
10173 alc861vd_lenovo_hp_automute(codec);
10175 case ALC880_MIC_EVENT:
10176 alc861vd_lenovo_mic_automute(codec);
10181 static struct hda_verb alc861vd_dallas_verbs[] = {
10182 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10183 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10184 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10185 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10194 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10196 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10197 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10200 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10201 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10202 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10203 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10205 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10206 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10207 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10208 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10210 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10211 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10212 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10214 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10215 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10216 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10220 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10226 /* toggle speaker-output according to the hp-jack state */
10227 static void alc861vd_dallas_automute(struct hda_codec *codec)
10229 unsigned int present;
10231 present = snd_hda_codec_read(codec, 0x15, 0,
10232 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10233 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10234 0x80, present ? 0x80 : 0);
10235 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10236 0x80, present ? 0x80 : 0);
10239 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
10241 if ((res >> 26) == ALC880_HP_EVENT)
10242 alc861vd_dallas_automute(codec);
10245 /* pcm configuration: identiacal with ALC880 */
10246 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
10247 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
10248 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
10249 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
10252 * configuration and preset
10254 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
10255 [ALC660VD_3ST] = "3stack-660",
10256 [ALC660VD_3ST_DIG]= "3stack-660-digout",
10257 [ALC861VD_3ST] = "3stack",
10258 [ALC861VD_3ST_DIG] = "3stack-digout",
10259 [ALC861VD_6ST_DIG] = "6stack-digout",
10260 [ALC861VD_LENOVO] = "lenovo",
10261 [ALC861VD_DALLAS] = "dallas",
10262 [ALC861VD_AUTO] = "auto",
10265 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
10266 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
10267 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
10268 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
10269 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
10270 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
10272 SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),
10273 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
10274 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
10275 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
10276 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
10280 static struct alc_config_preset alc861vd_presets[] = {
10282 .mixers = { alc861vd_3st_mixer },
10283 .init_verbs = { alc861vd_volume_init_verbs,
10284 alc861vd_3stack_init_verbs },
10285 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10286 .dac_nids = alc660vd_dac_nids,
10287 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10288 .adc_nids = alc861vd_adc_nids,
10289 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10290 .channel_mode = alc861vd_3stack_2ch_modes,
10291 .input_mux = &alc861vd_capture_source,
10293 [ALC660VD_3ST_DIG] = {
10294 .mixers = { alc861vd_3st_mixer },
10295 .init_verbs = { alc861vd_volume_init_verbs,
10296 alc861vd_3stack_init_verbs },
10297 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10298 .dac_nids = alc660vd_dac_nids,
10299 .dig_out_nid = ALC861VD_DIGOUT_NID,
10300 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10301 .adc_nids = alc861vd_adc_nids,
10302 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10303 .channel_mode = alc861vd_3stack_2ch_modes,
10304 .input_mux = &alc861vd_capture_source,
10307 .mixers = { alc861vd_3st_mixer },
10308 .init_verbs = { alc861vd_volume_init_verbs,
10309 alc861vd_3stack_init_verbs },
10310 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10311 .dac_nids = alc861vd_dac_nids,
10312 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10313 .channel_mode = alc861vd_3stack_2ch_modes,
10314 .input_mux = &alc861vd_capture_source,
10316 [ALC861VD_3ST_DIG] = {
10317 .mixers = { alc861vd_3st_mixer },
10318 .init_verbs = { alc861vd_volume_init_verbs,
10319 alc861vd_3stack_init_verbs },
10320 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10321 .dac_nids = alc861vd_dac_nids,
10322 .dig_out_nid = ALC861VD_DIGOUT_NID,
10323 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10324 .channel_mode = alc861vd_3stack_2ch_modes,
10325 .input_mux = &alc861vd_capture_source,
10327 [ALC861VD_6ST_DIG] = {
10328 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
10329 .init_verbs = { alc861vd_volume_init_verbs,
10330 alc861vd_6stack_init_verbs },
10331 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10332 .dac_nids = alc861vd_dac_nids,
10333 .dig_out_nid = ALC861VD_DIGOUT_NID,
10334 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
10335 .channel_mode = alc861vd_6stack_modes,
10336 .input_mux = &alc861vd_capture_source,
10338 [ALC861VD_LENOVO] = {
10339 .mixers = { alc861vd_lenovo_mixer },
10340 .init_verbs = { alc861vd_volume_init_verbs,
10341 alc861vd_3stack_init_verbs,
10342 alc861vd_eapd_verbs,
10343 alc861vd_lenovo_unsol_verbs },
10344 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10345 .dac_nids = alc660vd_dac_nids,
10346 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10347 .adc_nids = alc861vd_adc_nids,
10348 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10349 .channel_mode = alc861vd_3stack_2ch_modes,
10350 .input_mux = &alc861vd_capture_source,
10351 .unsol_event = alc861vd_lenovo_unsol_event,
10352 .init_hook = alc861vd_lenovo_automute,
10354 [ALC861VD_DALLAS] = {
10355 .mixers = { alc861vd_dallas_mixer },
10356 .init_verbs = { alc861vd_dallas_verbs },
10357 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10358 .dac_nids = alc861vd_dac_nids,
10359 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10360 .adc_nids = alc861vd_adc_nids,
10361 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10362 .channel_mode = alc861vd_3stack_2ch_modes,
10363 .input_mux = &alc861vd_dallas_capture_source,
10364 .unsol_event = alc861vd_dallas_unsol_event,
10365 .init_hook = alc861vd_dallas_automute,
10370 * BIOS auto configuration
10372 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
10373 hda_nid_t nid, int pin_type, int dac_idx)
10375 /* set as output */
10376 snd_hda_codec_write(codec, nid, 0,
10377 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
10378 snd_hda_codec_write(codec, nid, 0,
10379 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
10382 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
10384 struct alc_spec *spec = codec->spec;
10387 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
10388 for (i = 0; i <= HDA_SIDE; i++) {
10389 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10390 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10392 alc861vd_auto_set_output_and_unmute(codec, nid,
10398 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
10400 struct alc_spec *spec = codec->spec;
10403 pin = spec->autocfg.hp_pins[0];
10404 if (pin) /* connect to front and use dac 0 */
10405 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10408 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
10409 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
10411 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
10413 struct alc_spec *spec = codec->spec;
10416 for (i = 0; i < AUTO_PIN_LAST; i++) {
10417 hda_nid_t nid = spec->autocfg.input_pins[i];
10418 if (alc861vd_is_input_pin(nid)) {
10419 snd_hda_codec_write(codec, nid, 0,
10420 AC_VERB_SET_PIN_WIDGET_CONTROL,
10421 i <= AUTO_PIN_FRONT_MIC ?
10422 PIN_VREF80 : PIN_IN);
10423 if (nid != ALC861VD_PIN_CD_NID)
10424 snd_hda_codec_write(codec, nid, 0,
10425 AC_VERB_SET_AMP_GAIN_MUTE,
10431 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
10432 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
10434 /* add playback controls from the parsed DAC table */
10435 /* Based on ALC880 version. But ALC861VD has separate,
10436 * different NIDs for mute/unmute switch and volume control */
10437 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10438 const struct auto_pin_cfg *cfg)
10441 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
10442 hda_nid_t nid_v, nid_s;
10445 for (i = 0; i < cfg->line_outs; i++) {
10446 if (!spec->multiout.dac_nids[i])
10448 nid_v = alc861vd_idx_to_mixer_vol(
10450 spec->multiout.dac_nids[i]));
10451 nid_s = alc861vd_idx_to_mixer_switch(
10453 spec->multiout.dac_nids[i]));
10457 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10458 "Center Playback Volume",
10459 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
10463 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10464 "LFE Playback Volume",
10465 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
10469 err = add_control(spec, ALC_CTL_BIND_MUTE,
10470 "Center Playback Switch",
10471 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
10475 err = add_control(spec, ALC_CTL_BIND_MUTE,
10476 "LFE Playback Switch",
10477 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
10482 sprintf(name, "%s Playback Volume", chname[i]);
10483 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10484 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
10488 sprintf(name, "%s Playback Switch", chname[i]);
10489 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10490 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
10499 /* add playback controls for speaker and HP outputs */
10500 /* Based on ALC880 version. But ALC861VD has separate,
10501 * different NIDs for mute/unmute switch and volume control */
10502 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
10503 hda_nid_t pin, const char *pfx)
10505 hda_nid_t nid_v, nid_s;
10512 if (alc880_is_fixed_pin(pin)) {
10513 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
10514 /* specify the DAC as the extra output */
10515 if (!spec->multiout.hp_nid)
10516 spec->multiout.hp_nid = nid_v;
10518 spec->multiout.extra_out_nid[0] = nid_v;
10519 /* control HP volume/switch on the output mixer amp */
10520 nid_v = alc861vd_idx_to_mixer_vol(
10521 alc880_fixed_pin_idx(pin));
10522 nid_s = alc861vd_idx_to_mixer_switch(
10523 alc880_fixed_pin_idx(pin));
10525 sprintf(name, "%s Playback Volume", pfx);
10526 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10527 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
10530 sprintf(name, "%s Playback Switch", pfx);
10531 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10532 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
10535 } else if (alc880_is_multi_pin(pin)) {
10536 /* set manual connection */
10537 /* we have only a switch on HP-out PIN */
10538 sprintf(name, "%s Playback Switch", pfx);
10539 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10540 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
10547 /* parse the BIOS configuration and set up the alc_spec
10548 * return 1 if successful, 0 if the proper config is not found,
10549 * or a negative error code
10550 * Based on ALC880 version - had to change it to override
10551 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
10552 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10554 struct alc_spec *spec = codec->spec;
10556 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10558 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10562 if (!spec->autocfg.line_outs)
10563 return 0; /* can't find valid BIOS pin config */
10565 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10568 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10571 err = alc861vd_auto_create_extra_out(spec,
10572 spec->autocfg.speaker_pins[0],
10576 err = alc861vd_auto_create_extra_out(spec,
10577 spec->autocfg.hp_pins[0],
10581 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
10585 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10587 if (spec->autocfg.dig_out_pin)
10588 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
10590 if (spec->kctl_alloc)
10591 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10593 spec->init_verbs[spec->num_init_verbs++]
10594 = alc861vd_volume_init_verbs;
10596 spec->num_mux_defs = 1;
10597 spec->input_mux = &spec->private_imux;
10602 /* additional initialization for auto-configuration model */
10603 static void alc861vd_auto_init(struct hda_codec *codec)
10605 alc861vd_auto_init_multi_out(codec);
10606 alc861vd_auto_init_hp_out(codec);
10607 alc861vd_auto_init_analog_input(codec);
10610 static int patch_alc861vd(struct hda_codec *codec)
10612 struct alc_spec *spec;
10613 int err, board_config;
10615 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10619 codec->spec = spec;
10621 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
10625 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
10626 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
10627 "ALC861VD, trying auto-probe from BIOS...\n");
10628 board_config = ALC861VD_AUTO;
10631 if (board_config == ALC861VD_AUTO) {
10632 /* automatic parse from the BIOS config */
10633 err = alc861vd_parse_auto_config(codec);
10639 "hda_codec: Cannot set up configuration "
10640 "from BIOS. Using base mode...\n");
10641 board_config = ALC861VD_3ST;
10645 if (board_config != ALC861VD_AUTO)
10646 setup_preset(spec, &alc861vd_presets[board_config]);
10648 spec->stream_name_analog = "ALC861VD Analog";
10649 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
10650 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
10652 spec->stream_name_digital = "ALC861VD Digital";
10653 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
10654 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
10656 spec->adc_nids = alc861vd_adc_nids;
10657 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
10659 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
10660 spec->num_mixers++;
10662 codec->patch_ops = alc_patch_ops;
10664 if (board_config == ALC861VD_AUTO)
10665 spec->init_hook = alc861vd_auto_init;
10673 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10674 * configuration. Each pin widget can choose any input DACs and a mixer.
10675 * Each ADC is connected from a mixer of all inputs. This makes possible
10676 * 6-channel independent captures.
10678 * In addition, an independent DAC for the multi-playback (not used in this
10681 #define ALC662_DIGOUT_NID 0x06
10682 #define ALC662_DIGIN_NID 0x0a
10684 static hda_nid_t alc662_dac_nids[4] = {
10685 /* front, rear, clfe, rear_surr */
10689 static hda_nid_t alc662_adc_nids[1] = {
10694 /* FIXME: should be a matrix-type input source selection */
10696 static struct hda_input_mux alc662_capture_source = {
10700 { "Front Mic", 0x1 },
10706 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
10713 #define alc662_mux_enum_info alc_mux_enum_info
10714 #define alc662_mux_enum_get alc_mux_enum_get
10716 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
10717 struct snd_ctl_elem_value *ucontrol)
10719 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10720 struct alc_spec *spec = codec->spec;
10721 const struct hda_input_mux *imux = spec->input_mux;
10722 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
10723 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
10724 hda_nid_t nid = capture_mixers[adc_idx];
10725 unsigned int *cur_val = &spec->cur_mux[adc_idx];
10726 unsigned int i, idx;
10728 idx = ucontrol->value.enumerated.item[0];
10729 if (idx >= imux->num_items)
10730 idx = imux->num_items - 1;
10731 if (*cur_val == idx && !codec->in_resume)
10733 for (i = 0; i < imux->num_items; i++) {
10734 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
10735 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
10736 v | (imux->items[i].index << 8));
10744 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
10751 static struct hda_verb alc662_3ST_ch2_init[] = {
10752 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
10753 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
10755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10762 static struct hda_verb alc662_3ST_ch6_init[] = {
10763 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10764 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10765 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
10766 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10767 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10768 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
10772 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
10773 { 2, alc662_3ST_ch2_init },
10774 { 6, alc662_3ST_ch6_init },
10780 static struct hda_verb alc662_sixstack_ch6_init[] = {
10781 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10782 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10783 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10790 static struct hda_verb alc662_sixstack_ch8_init[] = {
10791 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10792 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10793 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10797 static struct hda_channel_mode alc662_5stack_modes[2] = {
10798 { 2, alc662_sixstack_ch6_init },
10799 { 6, alc662_sixstack_ch8_init },
10802 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10803 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10806 static struct snd_kcontrol_new alc662_base_mixer[] = {
10807 /* output mixer control */
10808 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10809 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
10810 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10811 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10812 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
10813 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
10814 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
10815 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
10816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10818 /*Input mixer control */
10819 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
10820 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
10821 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
10822 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
10823 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
10824 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
10825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
10826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
10828 /* Capture mixer control */
10829 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10830 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10832 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10833 .name = "Capture Source",
10835 .info = alc_mux_enum_info,
10836 .get = alc_mux_enum_get,
10837 .put = alc_mux_enum_put,
10842 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
10843 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10844 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10846 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10847 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10852 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10853 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10854 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10855 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10856 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10857 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10860 /* .name = "Capture Source", */
10861 .name = "Input Source",
10863 .info = alc662_mux_enum_info,
10864 .get = alc662_mux_enum_get,
10865 .put = alc662_mux_enum_put,
10870 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
10871 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10872 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10873 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10874 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
10875 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
10876 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
10877 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
10878 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
10879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10880 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10881 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10882 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10883 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10886 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10887 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10888 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10889 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10890 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10891 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10893 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10894 /* .name = "Capture Source", */
10895 .name = "Input Source",
10897 .info = alc662_mux_enum_info,
10898 .get = alc662_mux_enum_get,
10899 .put = alc662_mux_enum_put,
10904 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
10905 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10906 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10907 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10908 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
10909 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10914 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10915 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10918 /* .name = "Capture Source", */
10919 .name = "Input Source",
10921 .info = alc662_mux_enum_info,
10922 .get = alc662_mux_enum_get,
10923 .put = alc662_mux_enum_put,
10928 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
10930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10931 .name = "Channel Mode",
10932 .info = alc_ch_mode_info,
10933 .get = alc_ch_mode_get,
10934 .put = alc_ch_mode_put,
10939 static struct hda_verb alc662_init_verbs[] = {
10940 /* ADC: mute amp left and right */
10941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10942 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10943 /* Front mixer: unmute input/output amp left and right (volume = 0) */
10945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10951 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10952 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10953 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10954 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10955 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10956 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10958 /* Front Pin: output 0 (0x0c) */
10959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10962 /* Rear Pin: output 1 (0x0d) */
10963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10966 /* CLFE Pin: output 2 (0x0e) */
10967 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10968 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10970 /* Mic (rear) pin: input vref at 80% */
10971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10973 /* Front Mic pin: input vref at 80% */
10974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10976 /* Line In pin: input */
10977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10979 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10982 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10983 /* CD pin widget for input */
10984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10986 /* FIXME: use matrix-type input source selection */
10987 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10996 static struct hda_verb alc662_sue_init_verbs[] = {
10997 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
10998 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
11003 * generic initialization of ADC, input mixers and output mixers
11005 static struct hda_verb alc662_auto_init_verbs[] = {
11007 * Unmute ADC and set the default input to mic-in
11009 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11012 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11014 * Note: PASD motherboards uses the Line In 2 as the input for front
11015 * panel mic (mic 2)
11017 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11025 * Set up output mixers (0x0c - 0x0f)
11027 /* set vol=0 to output mixers */
11028 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11029 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11030 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11032 /* set up input amps for analog loopback */
11033 /* Amp Indices: DAC = 0, mixer = 1 */
11034 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11035 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11036 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11038 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11039 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11042 /* FIXME: use matrix-type input source selection */
11043 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11045 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11046 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11047 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11048 /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
11049 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11054 /* capture mixer elements */
11055 static struct snd_kcontrol_new alc662_capture_mixer[] = {
11056 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11057 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11060 /* The multiple "Capture Source" controls confuse alsamixer
11061 * So call somewhat different..
11062 * FIXME: the controls appear in the "playback" view!
11064 /* .name = "Capture Source", */
11065 .name = "Input Source",
11067 .info = alc882_mux_enum_info,
11068 .get = alc882_mux_enum_get,
11069 .put = alc882_mux_enum_put,
11074 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11076 unsigned int present;
11077 unsigned char bits;
11079 present = snd_hda_codec_read(codec, 0x14, 0,
11080 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11081 bits = present ? 0x80 : 0;
11082 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
11084 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11088 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11090 unsigned int present;
11091 unsigned char bits;
11093 present = snd_hda_codec_read(codec, 0x1b, 0,
11094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11095 bits = present ? 0x80 : 0;
11096 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
11098 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11100 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11102 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11106 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
11109 if ((res >> 26) == ALC880_HP_EVENT)
11110 alc662_lenovo_101e_all_automute(codec);
11111 if ((res >> 26) == ALC880_FRONT_EVENT)
11112 alc662_lenovo_101e_ispeaker_automute(codec);
11116 /* pcm configuration: identiacal with ALC880 */
11117 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
11118 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
11119 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
11120 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
11123 * configuration and preset
11125 static const char *alc662_models[ALC662_MODEL_LAST] = {
11126 [ALC662_3ST_2ch_DIG] = "3stack-dig",
11127 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
11128 [ALC662_3ST_6ch] = "3stack-6ch",
11129 [ALC662_5ST_DIG] = "6stack-dig",
11130 [ALC662_LENOVO_101E] = "lenovo-101e",
11131 [ALC662_AUTO] = "auto",
11134 static struct snd_pci_quirk alc662_cfg_tbl[] = {
11135 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
11139 static struct alc_config_preset alc662_presets[] = {
11140 [ALC662_3ST_2ch_DIG] = {
11141 .mixers = { alc662_3ST_2ch_mixer },
11142 .init_verbs = { alc662_init_verbs },
11143 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11144 .dac_nids = alc662_dac_nids,
11145 .dig_out_nid = ALC662_DIGOUT_NID,
11146 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11147 .adc_nids = alc662_adc_nids,
11148 .dig_in_nid = ALC662_DIGIN_NID,
11149 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11150 .channel_mode = alc662_3ST_2ch_modes,
11151 .input_mux = &alc662_capture_source,
11153 [ALC662_3ST_6ch_DIG] = {
11154 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11155 .init_verbs = { alc662_init_verbs },
11156 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11157 .dac_nids = alc662_dac_nids,
11158 .dig_out_nid = ALC662_DIGOUT_NID,
11159 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11160 .adc_nids = alc662_adc_nids,
11161 .dig_in_nid = ALC662_DIGIN_NID,
11162 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11163 .channel_mode = alc662_3ST_6ch_modes,
11165 .input_mux = &alc662_capture_source,
11167 [ALC662_3ST_6ch] = {
11168 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11169 .init_verbs = { alc662_init_verbs },
11170 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11171 .dac_nids = alc662_dac_nids,
11172 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11173 .adc_nids = alc662_adc_nids,
11174 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11175 .channel_mode = alc662_3ST_6ch_modes,
11177 .input_mux = &alc662_capture_source,
11179 [ALC662_5ST_DIG] = {
11180 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
11181 .init_verbs = { alc662_init_verbs },
11182 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11183 .dac_nids = alc662_dac_nids,
11184 .dig_out_nid = ALC662_DIGOUT_NID,
11185 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11186 .adc_nids = alc662_adc_nids,
11187 .dig_in_nid = ALC662_DIGIN_NID,
11188 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
11189 .channel_mode = alc662_5stack_modes,
11190 .input_mux = &alc662_capture_source,
11192 [ALC662_LENOVO_101E] = {
11193 .mixers = { alc662_lenovo_101e_mixer },
11194 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
11195 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11196 .dac_nids = alc662_dac_nids,
11197 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11198 .adc_nids = alc662_adc_nids,
11199 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11200 .channel_mode = alc662_3ST_2ch_modes,
11201 .input_mux = &alc662_lenovo_101e_capture_source,
11202 .unsol_event = alc662_lenovo_101e_unsol_event,
11203 .init_hook = alc662_lenovo_101e_all_automute,
11210 * BIOS auto configuration
11213 /* add playback controls from the parsed DAC table */
11214 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
11215 const struct auto_pin_cfg *cfg)
11218 static const char *chname[4] = {
11219 "Front", "Surround", NULL /*CLFE*/, "Side"
11224 for (i = 0; i < cfg->line_outs; i++) {
11225 if (!spec->multiout.dac_nids[i])
11227 nid = alc880_idx_to_mixer(i);
11230 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11231 "Center Playback Volume",
11232 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11236 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11237 "LFE Playback Volume",
11238 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11242 err = add_control(spec, ALC_CTL_BIND_MUTE,
11243 "Center Playback Switch",
11244 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
11248 err = add_control(spec, ALC_CTL_BIND_MUTE,
11249 "LFE Playback Switch",
11250 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
11255 sprintf(name, "%s Playback Volume", chname[i]);
11256 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11257 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11261 sprintf(name, "%s Playback Switch", chname[i]);
11262 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11263 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
11272 /* add playback controls for speaker and HP outputs */
11273 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
11283 if (alc880_is_fixed_pin(pin)) {
11284 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11285 /* printk("DAC nid=%x\n",nid); */
11286 /* specify the DAC as the extra output */
11287 if (!spec->multiout.hp_nid)
11288 spec->multiout.hp_nid = nid;
11290 spec->multiout.extra_out_nid[0] = nid;
11291 /* control HP volume/switch on the output mixer amp */
11292 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11293 sprintf(name, "%s Playback Volume", pfx);
11294 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11295 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11298 sprintf(name, "%s Playback Switch", pfx);
11299 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11300 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
11303 } else if (alc880_is_multi_pin(pin)) {
11304 /* set manual connection */
11305 /* we have only a switch on HP-out PIN */
11306 sprintf(name, "%s Playback Switch", pfx);
11307 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11308 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11315 /* create playback/capture controls for input pins */
11316 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
11317 const struct auto_pin_cfg *cfg)
11319 struct hda_input_mux *imux = &spec->private_imux;
11322 for (i = 0; i < AUTO_PIN_LAST; i++) {
11323 if (alc880_is_input_pin(cfg->input_pins[i])) {
11324 idx = alc880_input_pin_idx(cfg->input_pins[i]);
11325 err = new_analog_input(spec, cfg->input_pins[i],
11326 auto_pin_cfg_labels[i],
11330 imux->items[imux->num_items].label =
11331 auto_pin_cfg_labels[i];
11332 imux->items[imux->num_items].index =
11333 alc880_input_pin_idx(cfg->input_pins[i]);
11340 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
11341 hda_nid_t nid, int pin_type,
11344 /* set as output */
11345 snd_hda_codec_write(codec, nid, 0,
11346 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11347 snd_hda_codec_write(codec, nid, 0,
11348 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11349 /* need the manual connection? */
11350 if (alc880_is_multi_pin(nid)) {
11351 struct alc_spec *spec = codec->spec;
11352 int idx = alc880_multi_pin_idx(nid);
11353 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
11354 AC_VERB_SET_CONNECT_SEL,
11355 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
11359 static void alc662_auto_init_multi_out(struct hda_codec *codec)
11361 struct alc_spec *spec = codec->spec;
11364 for (i = 0; i <= HDA_SIDE; i++) {
11365 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11366 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11368 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
11373 static void alc662_auto_init_hp_out(struct hda_codec *codec)
11375 struct alc_spec *spec = codec->spec;
11378 pin = spec->autocfg.hp_pins[0];
11379 if (pin) /* connect to front */
11381 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11384 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
11385 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
11387 static void alc662_auto_init_analog_input(struct hda_codec *codec)
11389 struct alc_spec *spec = codec->spec;
11392 for (i = 0; i < AUTO_PIN_LAST; i++) {
11393 hda_nid_t nid = spec->autocfg.input_pins[i];
11394 if (alc662_is_input_pin(nid)) {
11395 snd_hda_codec_write(codec, nid, 0,
11396 AC_VERB_SET_PIN_WIDGET_CONTROL,
11397 (i <= AUTO_PIN_FRONT_MIC ?
11398 PIN_VREF80 : PIN_IN));
11399 if (nid != ALC662_PIN_CD_NID)
11400 snd_hda_codec_write(codec, nid, 0,
11401 AC_VERB_SET_AMP_GAIN_MUTE,
11407 static int alc662_parse_auto_config(struct hda_codec *codec)
11409 struct alc_spec *spec = codec->spec;
11411 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11413 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11417 if (!spec->autocfg.line_outs)
11418 return 0; /* can't find valid BIOS pin config */
11420 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11423 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
11426 err = alc662_auto_create_extra_out(spec,
11427 spec->autocfg.speaker_pins[0],
11431 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11435 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
11439 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11441 if (spec->autocfg.dig_out_pin)
11442 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
11444 if (spec->kctl_alloc)
11445 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11447 spec->num_mux_defs = 1;
11448 spec->input_mux = &spec->private_imux;
11450 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
11451 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
11452 spec->num_mixers++;
11456 /* additional initialization for auto-configuration model */
11457 static void alc662_auto_init(struct hda_codec *codec)
11459 alc662_auto_init_multi_out(codec);
11460 alc662_auto_init_hp_out(codec);
11461 alc662_auto_init_analog_input(codec);
11464 static int patch_alc662(struct hda_codec *codec)
11466 struct alc_spec *spec;
11467 int err, board_config;
11469 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11473 codec->spec = spec;
11475 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
11478 if (board_config < 0) {
11479 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
11480 "trying auto-probe from BIOS...\n");
11481 board_config = ALC662_AUTO;
11484 if (board_config == ALC662_AUTO) {
11485 /* automatic parse from the BIOS config */
11486 err = alc662_parse_auto_config(codec);
11492 "hda_codec: Cannot set up configuration "
11493 "from BIOS. Using base mode...\n");
11494 board_config = ALC662_3ST_2ch_DIG;
11498 if (board_config != ALC662_AUTO)
11499 setup_preset(spec, &alc662_presets[board_config]);
11501 spec->stream_name_analog = "ALC662 Analog";
11502 spec->stream_analog_playback = &alc662_pcm_analog_playback;
11503 spec->stream_analog_capture = &alc662_pcm_analog_capture;
11505 spec->stream_name_digital = "ALC662 Digital";
11506 spec->stream_digital_playback = &alc662_pcm_digital_playback;
11507 spec->stream_digital_capture = &alc662_pcm_digital_capture;
11509 if (!spec->adc_nids && spec->input_mux) {
11510 spec->adc_nids = alc662_adc_nids;
11511 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
11514 codec->patch_ops = alc_patch_ops;
11515 if (board_config == ALC662_AUTO)
11516 spec->init_hook = alc662_auto_init;
11524 struct hda_codec_preset snd_hda_preset_realtek[] = {
11525 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
11526 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
11527 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
11528 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
11529 .patch = patch_alc861 },
11530 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
11531 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
11532 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
11533 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
11534 .patch = patch_alc883 },
11535 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
11536 .patch = patch_alc662 },
11537 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
11538 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
11539 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
11540 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
11541 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
11542 {} /* terminator */