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 (?)
1929 /* seems analog CD is not working */
1930 static struct hda_input_mux alc880_lg_lw_capture_source = {
1934 { "Internal Mic", 0x1 },
1938 #define alc880_lg_lw_modes alc880_threestack_modes
1940 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
1941 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1942 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1944 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1945 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1946 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1947 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1948 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1949 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1950 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1953 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1954 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1956 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1957 .name = "Channel Mode",
1958 .info = alc_ch_mode_info,
1959 .get = alc_ch_mode_get,
1960 .put = alc_ch_mode_put,
1965 static struct hda_verb alc880_lg_lw_init_verbs[] = {
1966 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1967 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1968 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1970 /* set capture source to mic-in */
1971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1972 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1973 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1974 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)},
1976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1980 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1981 /* mic-in to input */
1982 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1983 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1992 /* toggle speaker-output according to the hp-jack state */
1993 static void alc880_lg_lw_automute(struct hda_codec *codec)
1995 unsigned int present;
1998 present = snd_hda_codec_read(codec, 0x1b, 0,
1999 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2000 bits = present ? 0x80 : 0;
2001 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
2003 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
2007 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
2009 /* Looks like the unsol event is incompatible with the standard
2010 * definition. 4bit tag is placed at 28 bit!
2012 if ((res >> 28) == 0x01)
2013 alc880_lg_lw_automute(codec);
2020 static int alc_init(struct hda_codec *codec)
2022 struct alc_spec *spec = codec->spec;
2025 for (i = 0; i < spec->num_init_verbs; i++)
2026 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2028 if (spec->init_hook)
2029 spec->init_hook(codec);
2034 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2036 struct alc_spec *spec = codec->spec;
2038 if (spec->unsol_event)
2039 spec->unsol_event(codec, res);
2046 static int alc_resume(struct hda_codec *codec)
2048 struct alc_spec *spec = codec->spec;
2052 for (i = 0; i < spec->num_mixers; i++)
2053 snd_hda_resume_ctls(codec, spec->mixers[i]);
2054 if (spec->multiout.dig_out_nid)
2055 snd_hda_resume_spdif_out(codec);
2056 if (spec->dig_in_nid)
2057 snd_hda_resume_spdif_in(codec);
2064 * Analog playback callbacks
2066 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2067 struct hda_codec *codec,
2068 struct snd_pcm_substream *substream)
2070 struct alc_spec *spec = codec->spec;
2071 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2074 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2075 struct hda_codec *codec,
2076 unsigned int stream_tag,
2077 unsigned int format,
2078 struct snd_pcm_substream *substream)
2080 struct alc_spec *spec = codec->spec;
2081 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2082 stream_tag, format, substream);
2085 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2086 struct hda_codec *codec,
2087 struct snd_pcm_substream *substream)
2089 struct alc_spec *spec = codec->spec;
2090 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2096 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2097 struct hda_codec *codec,
2098 struct snd_pcm_substream *substream)
2100 struct alc_spec *spec = codec->spec;
2101 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2104 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2105 struct hda_codec *codec,
2106 unsigned int stream_tag,
2107 unsigned int format,
2108 struct snd_pcm_substream *substream)
2110 struct alc_spec *spec = codec->spec;
2111 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2112 stream_tag, format, substream);
2115 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2116 struct hda_codec *codec,
2117 struct snd_pcm_substream *substream)
2119 struct alc_spec *spec = codec->spec;
2120 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2126 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2127 struct hda_codec *codec,
2128 unsigned int stream_tag,
2129 unsigned int format,
2130 struct snd_pcm_substream *substream)
2132 struct alc_spec *spec = codec->spec;
2134 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2135 stream_tag, 0, format);
2139 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2140 struct hda_codec *codec,
2141 struct snd_pcm_substream *substream)
2143 struct alc_spec *spec = codec->spec;
2145 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2153 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2157 /* NID is set in alc_build_pcms */
2159 .open = alc880_playback_pcm_open,
2160 .prepare = alc880_playback_pcm_prepare,
2161 .cleanup = alc880_playback_pcm_cleanup
2165 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2169 /* NID is set in alc_build_pcms */
2171 .prepare = alc880_capture_pcm_prepare,
2172 .cleanup = alc880_capture_pcm_cleanup
2176 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2180 /* NID is set in alc_build_pcms */
2182 .open = alc880_dig_playback_pcm_open,
2183 .close = alc880_dig_playback_pcm_close,
2184 .prepare = alc880_dig_playback_pcm_prepare
2188 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2192 /* NID is set in alc_build_pcms */
2195 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2196 static struct hda_pcm_stream alc_pcm_null_playback = {
2202 static int alc_build_pcms(struct hda_codec *codec)
2204 struct alc_spec *spec = codec->spec;
2205 struct hda_pcm *info = spec->pcm_rec;
2208 codec->num_pcms = 1;
2209 codec->pcm_info = info;
2211 info->name = spec->stream_name_analog;
2212 if (spec->stream_analog_playback) {
2213 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2214 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2215 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2217 if (spec->stream_analog_capture) {
2218 snd_assert(spec->adc_nids, return -EINVAL);
2219 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2220 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2223 if (spec->channel_mode) {
2224 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2225 for (i = 0; i < spec->num_channel_mode; i++) {
2226 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2227 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2232 /* SPDIF for stream index #1 */
2233 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2234 codec->num_pcms = 2;
2235 info = spec->pcm_rec + 1;
2236 info->name = spec->stream_name_digital;
2237 if (spec->multiout.dig_out_nid &&
2238 spec->stream_digital_playback) {
2239 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2240 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2242 if (spec->dig_in_nid &&
2243 spec->stream_digital_capture) {
2244 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2245 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2249 /* If the use of more than one ADC is requested for the current
2250 * model, configure a second analog capture-only PCM.
2252 /* Additional Analaog capture for index #2 */
2253 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2255 codec->num_pcms = 3;
2256 info = spec->pcm_rec + 2;
2257 info->name = spec->stream_name_analog;
2258 /* No playback stream for second PCM */
2259 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2260 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2261 if (spec->stream_analog_capture) {
2262 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2263 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2270 static void alc_free(struct hda_codec *codec)
2272 struct alc_spec *spec = codec->spec;
2278 if (spec->kctl_alloc) {
2279 for (i = 0; i < spec->num_kctl_used; i++)
2280 kfree(spec->kctl_alloc[i].name);
2281 kfree(spec->kctl_alloc);
2288 static struct hda_codec_ops alc_patch_ops = {
2289 .build_controls = alc_build_controls,
2290 .build_pcms = alc_build_pcms,
2293 .unsol_event = alc_unsol_event,
2295 .resume = alc_resume,
2301 * Test configuration for debugging
2303 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2306 #ifdef CONFIG_SND_DEBUG
2307 static hda_nid_t alc880_test_dac_nids[4] = {
2308 0x02, 0x03, 0x04, 0x05
2311 static struct hda_input_mux alc880_test_capture_source = {
2320 { "Surround", 0x6 },
2324 static struct hda_channel_mode alc880_test_modes[4] = {
2331 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2332 struct snd_ctl_elem_info *uinfo)
2334 static char *texts[] = {
2335 "N/A", "Line Out", "HP Out",
2336 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2338 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2340 uinfo->value.enumerated.items = 8;
2341 if (uinfo->value.enumerated.item >= 8)
2342 uinfo->value.enumerated.item = 7;
2343 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2347 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2348 struct snd_ctl_elem_value *ucontrol)
2350 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2351 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2352 unsigned int pin_ctl, item = 0;
2354 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2355 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2356 if (pin_ctl & AC_PINCTL_OUT_EN) {
2357 if (pin_ctl & AC_PINCTL_HP_EN)
2361 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2362 switch (pin_ctl & AC_PINCTL_VREFEN) {
2363 case AC_PINCTL_VREF_HIZ: item = 3; break;
2364 case AC_PINCTL_VREF_50: item = 4; break;
2365 case AC_PINCTL_VREF_GRD: item = 5; break;
2366 case AC_PINCTL_VREF_80: item = 6; break;
2367 case AC_PINCTL_VREF_100: item = 7; break;
2370 ucontrol->value.enumerated.item[0] = item;
2374 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2375 struct snd_ctl_elem_value *ucontrol)
2377 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2378 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2379 static unsigned int ctls[] = {
2380 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2381 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2382 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2383 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2384 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2385 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2387 unsigned int old_ctl, new_ctl;
2389 old_ctl = snd_hda_codec_read(codec, nid, 0,
2390 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2391 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2392 if (old_ctl != new_ctl) {
2393 snd_hda_codec_write(codec, nid, 0,
2394 AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl);
2395 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
2396 (ucontrol->value.enumerated.item[0] >= 3 ?
2403 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2404 struct snd_ctl_elem_info *uinfo)
2406 static char *texts[] = {
2407 "Front", "Surround", "CLFE", "Side"
2409 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2411 uinfo->value.enumerated.items = 4;
2412 if (uinfo->value.enumerated.item >= 4)
2413 uinfo->value.enumerated.item = 3;
2414 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2418 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2419 struct snd_ctl_elem_value *ucontrol)
2421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2422 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2425 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2426 ucontrol->value.enumerated.item[0] = sel & 3;
2430 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
2431 struct snd_ctl_elem_value *ucontrol)
2433 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2434 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2437 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
2438 if (ucontrol->value.enumerated.item[0] != sel) {
2439 sel = ucontrol->value.enumerated.item[0] & 3;
2440 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel);
2446 #define PIN_CTL_TEST(xname,nid) { \
2447 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2449 .info = alc_test_pin_ctl_info, \
2450 .get = alc_test_pin_ctl_get, \
2451 .put = alc_test_pin_ctl_put, \
2452 .private_value = nid \
2455 #define PIN_SRC_TEST(xname,nid) { \
2456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2458 .info = alc_test_pin_src_info, \
2459 .get = alc_test_pin_src_get, \
2460 .put = alc_test_pin_src_put, \
2461 .private_value = nid \
2464 static struct snd_kcontrol_new alc880_test_mixer[] = {
2465 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2466 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2467 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2468 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2469 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2470 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2471 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2472 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2473 PIN_CTL_TEST("Front Pin Mode", 0x14),
2474 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2475 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2476 PIN_CTL_TEST("Side Pin Mode", 0x17),
2477 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2478 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2479 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2480 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2481 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2482 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2483 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2484 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2485 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2486 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2487 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2488 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2489 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2490 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2491 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2492 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2493 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2494 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2496 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2497 .name = "Channel Mode",
2498 .info = alc_ch_mode_info,
2499 .get = alc_ch_mode_get,
2500 .put = alc_ch_mode_put,
2505 static struct hda_verb alc880_test_init_verbs[] = {
2506 /* Unmute inputs of 0x0c - 0x0f */
2507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2509 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2511 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2512 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2513 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2514 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2515 /* Vol output for 0x0c-0x0f */
2516 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2517 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2520 /* Set output pins 0x14-0x17 */
2521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2524 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2525 /* Unmute output pins 0x14-0x17 */
2526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2529 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 /* Set input pins 0x18-0x1c */
2531 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2535 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2536 /* Mute input pins 0x18-0x1b */
2537 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2539 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2540 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2543 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2544 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2545 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2546 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2547 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2548 /* Analog input/passthru */
2549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2561 static const char *alc880_models[ALC880_MODEL_LAST] = {
2562 [ALC880_3ST] = "3stack",
2563 [ALC880_TCL_S700] = "tcl",
2564 [ALC880_3ST_DIG] = "3stack-digout",
2565 [ALC880_CLEVO] = "clevo",
2566 [ALC880_5ST] = "5stack",
2567 [ALC880_5ST_DIG] = "5stack-digout",
2568 [ALC880_W810] = "w810",
2569 [ALC880_Z71V] = "z71v",
2570 [ALC880_6ST] = "6stack",
2571 [ALC880_6ST_DIG] = "6stack-digout",
2572 [ALC880_ASUS] = "asus",
2573 [ALC880_ASUS_W1V] = "asus-w1v",
2574 [ALC880_ASUS_DIG] = "asus-dig",
2575 [ALC880_ASUS_DIG2] = "asus-dig2",
2576 [ALC880_UNIWILL_DIG] = "uniwill",
2577 [ALC880_UNIWILL_P53] = "uniwill-p53",
2578 [ALC880_FUJITSU] = "fujitsu",
2579 [ALC880_F1734] = "F1734",
2581 [ALC880_LG_LW] = "lg-lw",
2582 #ifdef CONFIG_SND_DEBUG
2583 [ALC880_TEST] = "test",
2585 [ALC880_AUTO] = "auto",
2588 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2589 /* Broken BIOS configuration */
2590 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2591 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2593 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2594 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2595 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2596 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2597 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2598 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2599 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2600 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2601 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2603 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2604 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2606 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2607 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2608 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2609 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2610 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2611 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2612 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2613 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2614 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2615 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2616 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2617 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2618 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2619 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2620 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2622 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2623 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2624 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2625 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2626 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2627 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2628 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2629 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2630 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2631 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2632 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2633 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2634 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2635 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2636 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2637 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2638 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2639 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2641 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2642 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2643 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2644 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2646 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2647 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2648 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2649 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2651 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2652 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2653 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2654 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2656 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2657 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2658 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2659 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2660 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2661 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2662 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2663 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2664 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2665 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2666 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2672 * ALC880 codec presets
2674 static struct alc_config_preset alc880_presets[] = {
2676 .mixers = { alc880_three_stack_mixer },
2677 .init_verbs = { alc880_volume_init_verbs,
2678 alc880_pin_3stack_init_verbs },
2679 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2680 .dac_nids = alc880_dac_nids,
2681 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2682 .channel_mode = alc880_threestack_modes,
2684 .input_mux = &alc880_capture_source,
2686 [ALC880_3ST_DIG] = {
2687 .mixers = { alc880_three_stack_mixer },
2688 .init_verbs = { alc880_volume_init_verbs,
2689 alc880_pin_3stack_init_verbs },
2690 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2691 .dac_nids = alc880_dac_nids,
2692 .dig_out_nid = ALC880_DIGOUT_NID,
2693 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2694 .channel_mode = alc880_threestack_modes,
2696 .input_mux = &alc880_capture_source,
2698 [ALC880_TCL_S700] = {
2699 .mixers = { alc880_tcl_s700_mixer },
2700 .init_verbs = { alc880_volume_init_verbs,
2701 alc880_pin_tcl_S700_init_verbs,
2702 alc880_gpio2_init_verbs },
2703 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2704 .dac_nids = alc880_dac_nids,
2706 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2707 .channel_mode = alc880_2_jack_modes,
2708 .input_mux = &alc880_capture_source,
2711 .mixers = { alc880_three_stack_mixer,
2712 alc880_five_stack_mixer},
2713 .init_verbs = { alc880_volume_init_verbs,
2714 alc880_pin_5stack_init_verbs },
2715 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2716 .dac_nids = alc880_dac_nids,
2717 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2718 .channel_mode = alc880_fivestack_modes,
2719 .input_mux = &alc880_capture_source,
2721 [ALC880_5ST_DIG] = {
2722 .mixers = { alc880_three_stack_mixer,
2723 alc880_five_stack_mixer },
2724 .init_verbs = { alc880_volume_init_verbs,
2725 alc880_pin_5stack_init_verbs },
2726 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2727 .dac_nids = alc880_dac_nids,
2728 .dig_out_nid = ALC880_DIGOUT_NID,
2729 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2730 .channel_mode = alc880_fivestack_modes,
2731 .input_mux = &alc880_capture_source,
2734 .mixers = { alc880_six_stack_mixer },
2735 .init_verbs = { alc880_volume_init_verbs,
2736 alc880_pin_6stack_init_verbs },
2737 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2738 .dac_nids = alc880_6st_dac_nids,
2739 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2740 .channel_mode = alc880_sixstack_modes,
2741 .input_mux = &alc880_6stack_capture_source,
2743 [ALC880_6ST_DIG] = {
2744 .mixers = { alc880_six_stack_mixer },
2745 .init_verbs = { alc880_volume_init_verbs,
2746 alc880_pin_6stack_init_verbs },
2747 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2748 .dac_nids = alc880_6st_dac_nids,
2749 .dig_out_nid = ALC880_DIGOUT_NID,
2750 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2751 .channel_mode = alc880_sixstack_modes,
2752 .input_mux = &alc880_6stack_capture_source,
2755 .mixers = { alc880_w810_base_mixer },
2756 .init_verbs = { alc880_volume_init_verbs,
2757 alc880_pin_w810_init_verbs,
2758 alc880_gpio2_init_verbs },
2759 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2760 .dac_nids = alc880_w810_dac_nids,
2761 .dig_out_nid = ALC880_DIGOUT_NID,
2762 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2763 .channel_mode = alc880_w810_modes,
2764 .input_mux = &alc880_capture_source,
2767 .mixers = { alc880_z71v_mixer },
2768 .init_verbs = { alc880_volume_init_verbs,
2769 alc880_pin_z71v_init_verbs },
2770 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2771 .dac_nids = alc880_z71v_dac_nids,
2772 .dig_out_nid = ALC880_DIGOUT_NID,
2774 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2775 .channel_mode = alc880_2_jack_modes,
2776 .input_mux = &alc880_capture_source,
2779 .mixers = { alc880_f1734_mixer },
2780 .init_verbs = { alc880_volume_init_verbs,
2781 alc880_pin_f1734_init_verbs },
2782 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2783 .dac_nids = alc880_f1734_dac_nids,
2785 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2786 .channel_mode = alc880_2_jack_modes,
2787 .input_mux = &alc880_capture_source,
2790 .mixers = { alc880_asus_mixer },
2791 .init_verbs = { alc880_volume_init_verbs,
2792 alc880_pin_asus_init_verbs,
2793 alc880_gpio1_init_verbs },
2794 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2795 .dac_nids = alc880_asus_dac_nids,
2796 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2797 .channel_mode = alc880_asus_modes,
2799 .input_mux = &alc880_capture_source,
2801 [ALC880_ASUS_DIG] = {
2802 .mixers = { alc880_asus_mixer },
2803 .init_verbs = { alc880_volume_init_verbs,
2804 alc880_pin_asus_init_verbs,
2805 alc880_gpio1_init_verbs },
2806 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2807 .dac_nids = alc880_asus_dac_nids,
2808 .dig_out_nid = ALC880_DIGOUT_NID,
2809 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2810 .channel_mode = alc880_asus_modes,
2812 .input_mux = &alc880_capture_source,
2814 [ALC880_ASUS_DIG2] = {
2815 .mixers = { alc880_asus_mixer },
2816 .init_verbs = { alc880_volume_init_verbs,
2817 alc880_pin_asus_init_verbs,
2818 alc880_gpio2_init_verbs }, /* use GPIO2 */
2819 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2820 .dac_nids = alc880_asus_dac_nids,
2821 .dig_out_nid = ALC880_DIGOUT_NID,
2822 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2823 .channel_mode = alc880_asus_modes,
2825 .input_mux = &alc880_capture_source,
2827 [ALC880_ASUS_W1V] = {
2828 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2829 .init_verbs = { alc880_volume_init_verbs,
2830 alc880_pin_asus_init_verbs,
2831 alc880_gpio1_init_verbs },
2832 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2833 .dac_nids = alc880_asus_dac_nids,
2834 .dig_out_nid = ALC880_DIGOUT_NID,
2835 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2836 .channel_mode = alc880_asus_modes,
2838 .input_mux = &alc880_capture_source,
2840 [ALC880_UNIWILL_DIG] = {
2841 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2842 .init_verbs = { alc880_volume_init_verbs,
2843 alc880_pin_asus_init_verbs },
2844 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2845 .dac_nids = alc880_asus_dac_nids,
2846 .dig_out_nid = ALC880_DIGOUT_NID,
2847 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2848 .channel_mode = alc880_asus_modes,
2850 .input_mux = &alc880_capture_source,
2852 [ALC880_UNIWILL] = {
2853 .mixers = { alc880_uniwill_mixer },
2854 .init_verbs = { alc880_volume_init_verbs,
2855 alc880_uniwill_init_verbs },
2856 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2857 .dac_nids = alc880_asus_dac_nids,
2858 .dig_out_nid = ALC880_DIGOUT_NID,
2859 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2860 .channel_mode = alc880_threestack_modes,
2862 .input_mux = &alc880_capture_source,
2863 .unsol_event = alc880_uniwill_unsol_event,
2864 .init_hook = alc880_uniwill_automute,
2866 [ALC880_UNIWILL_P53] = {
2867 .mixers = { alc880_uniwill_p53_mixer },
2868 .init_verbs = { alc880_volume_init_verbs,
2869 alc880_uniwill_p53_init_verbs },
2870 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2871 .dac_nids = alc880_asus_dac_nids,
2872 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2873 .channel_mode = alc880_threestack_modes,
2874 .input_mux = &alc880_capture_source,
2875 .unsol_event = alc880_uniwill_p53_unsol_event,
2876 .init_hook = alc880_uniwill_p53_hp_automute,
2878 [ALC880_FUJITSU] = {
2879 .mixers = { alc880_fujitsu_mixer,
2880 alc880_pcbeep_mixer, },
2881 .init_verbs = { alc880_volume_init_verbs,
2882 alc880_uniwill_p53_init_verbs,
2883 alc880_beep_init_verbs },
2884 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2885 .dac_nids = alc880_dac_nids,
2886 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2887 .channel_mode = alc880_2_jack_modes,
2888 .input_mux = &alc880_capture_source,
2889 .unsol_event = alc880_uniwill_p53_unsol_event,
2890 .init_hook = alc880_uniwill_p53_hp_automute,
2893 .mixers = { alc880_three_stack_mixer },
2894 .init_verbs = { alc880_volume_init_verbs,
2895 alc880_pin_clevo_init_verbs },
2896 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2897 .dac_nids = alc880_dac_nids,
2899 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2900 .channel_mode = alc880_threestack_modes,
2902 .input_mux = &alc880_capture_source,
2905 .mixers = { alc880_lg_mixer },
2906 .init_verbs = { alc880_volume_init_verbs,
2907 alc880_lg_init_verbs },
2908 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
2909 .dac_nids = alc880_lg_dac_nids,
2910 .dig_out_nid = ALC880_DIGOUT_NID,
2911 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
2912 .channel_mode = alc880_lg_ch_modes,
2914 .input_mux = &alc880_lg_capture_source,
2915 .unsol_event = alc880_lg_unsol_event,
2916 .init_hook = alc880_lg_automute,
2919 .mixers = { alc880_lg_lw_mixer },
2920 .init_verbs = { alc880_volume_init_verbs,
2921 alc880_lg_lw_init_verbs },
2922 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2923 .dac_nids = alc880_dac_nids,
2924 .dig_out_nid = ALC880_DIGOUT_NID,
2925 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
2926 .channel_mode = alc880_lg_lw_modes,
2927 .input_mux = &alc880_lg_lw_capture_source,
2928 .unsol_event = alc880_lg_lw_unsol_event,
2929 .init_hook = alc880_lg_lw_automute,
2931 #ifdef CONFIG_SND_DEBUG
2933 .mixers = { alc880_test_mixer },
2934 .init_verbs = { alc880_test_init_verbs },
2935 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
2936 .dac_nids = alc880_test_dac_nids,
2937 .dig_out_nid = ALC880_DIGOUT_NID,
2938 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
2939 .channel_mode = alc880_test_modes,
2940 .input_mux = &alc880_test_capture_source,
2946 * Automatic parse of I/O pins from the BIOS configuration
2949 #define NUM_CONTROL_ALLOC 32
2950 #define NUM_VERB_ALLOC 32
2954 ALC_CTL_WIDGET_MUTE,
2957 static struct snd_kcontrol_new alc880_control_templates[] = {
2958 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2959 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2960 HDA_BIND_MUTE(NULL, 0, 0, 0),
2963 /* add dynamic controls */
2964 static int add_control(struct alc_spec *spec, int type, const char *name,
2967 struct snd_kcontrol_new *knew;
2969 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2970 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2972 /* array + terminator */
2973 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
2976 if (spec->kctl_alloc) {
2977 memcpy(knew, spec->kctl_alloc,
2978 sizeof(*knew) * spec->num_kctl_alloc);
2979 kfree(spec->kctl_alloc);
2981 spec->kctl_alloc = knew;
2982 spec->num_kctl_alloc = num;
2985 knew = &spec->kctl_alloc[spec->num_kctl_used];
2986 *knew = alc880_control_templates[type];
2987 knew->name = kstrdup(name, GFP_KERNEL);
2990 knew->private_value = val;
2991 spec->num_kctl_used++;
2995 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2996 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2997 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2998 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2999 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3000 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3001 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3002 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3003 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3004 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3005 #define ALC880_PIN_CD_NID 0x1c
3007 /* fill in the dac_nids table from the parsed pin configuration */
3008 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3009 const struct auto_pin_cfg *cfg)
3015 memset(assigned, 0, sizeof(assigned));
3016 spec->multiout.dac_nids = spec->private_dac_nids;
3018 /* check the pins hardwired to audio widget */
3019 for (i = 0; i < cfg->line_outs; i++) {
3020 nid = cfg->line_out_pins[i];
3021 if (alc880_is_fixed_pin(nid)) {
3022 int idx = alc880_fixed_pin_idx(nid);
3023 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3027 /* left pins can be connect to any audio widget */
3028 for (i = 0; i < cfg->line_outs; i++) {
3029 nid = cfg->line_out_pins[i];
3030 if (alc880_is_fixed_pin(nid))
3032 /* search for an empty channel */
3033 for (j = 0; j < cfg->line_outs; j++) {
3035 spec->multiout.dac_nids[i] =
3036 alc880_idx_to_dac(j);
3042 spec->multiout.num_dacs = cfg->line_outs;
3046 /* add playback controls from the parsed DAC table */
3047 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3048 const struct auto_pin_cfg *cfg)
3051 static const char *chname[4] = {
3052 "Front", "Surround", NULL /*CLFE*/, "Side"
3057 for (i = 0; i < cfg->line_outs; i++) {
3058 if (!spec->multiout.dac_nids[i])
3060 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3063 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3064 "Center Playback Volume",
3065 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3069 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3070 "LFE Playback Volume",
3071 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3075 err = add_control(spec, ALC_CTL_BIND_MUTE,
3076 "Center Playback Switch",
3077 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3081 err = add_control(spec, ALC_CTL_BIND_MUTE,
3082 "LFE Playback Switch",
3083 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3088 sprintf(name, "%s Playback Volume", chname[i]);
3089 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3090 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3094 sprintf(name, "%s Playback Switch", chname[i]);
3095 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3096 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3105 /* add playback controls for speaker and HP outputs */
3106 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3116 if (alc880_is_fixed_pin(pin)) {
3117 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3118 /* specify the DAC as the extra output */
3119 if (!spec->multiout.hp_nid)
3120 spec->multiout.hp_nid = nid;
3122 spec->multiout.extra_out_nid[0] = nid;
3123 /* control HP volume/switch on the output mixer amp */
3124 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3125 sprintf(name, "%s Playback Volume", pfx);
3126 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3127 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3130 sprintf(name, "%s Playback Switch", pfx);
3131 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3132 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3135 } else if (alc880_is_multi_pin(pin)) {
3136 /* set manual connection */
3137 /* we have only a switch on HP-out PIN */
3138 sprintf(name, "%s Playback Switch", pfx);
3139 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3140 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3147 /* create input playback/capture controls for the given pin */
3148 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3149 const char *ctlname,
3150 int idx, hda_nid_t mix_nid)
3155 sprintf(name, "%s Playback Volume", ctlname);
3156 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3157 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3160 sprintf(name, "%s Playback Switch", ctlname);
3161 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3162 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3168 /* create playback/capture controls for input pins */
3169 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3170 const struct auto_pin_cfg *cfg)
3172 struct hda_input_mux *imux = &spec->private_imux;
3175 for (i = 0; i < AUTO_PIN_LAST; i++) {
3176 if (alc880_is_input_pin(cfg->input_pins[i])) {
3177 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3178 err = new_analog_input(spec, cfg->input_pins[i],
3179 auto_pin_cfg_labels[i],
3183 imux->items[imux->num_items].label =
3184 auto_pin_cfg_labels[i];
3185 imux->items[imux->num_items].index =
3186 alc880_input_pin_idx(cfg->input_pins[i]);
3193 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3194 hda_nid_t nid, int pin_type,
3198 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3200 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3202 /* need the manual connection? */
3203 if (alc880_is_multi_pin(nid)) {
3204 struct alc_spec *spec = codec->spec;
3205 int idx = alc880_multi_pin_idx(nid);
3206 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3207 AC_VERB_SET_CONNECT_SEL,
3208 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3212 static int get_pin_type(int line_out_type)
3214 if (line_out_type == AUTO_PIN_HP_OUT)
3220 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3222 struct alc_spec *spec = codec->spec;
3225 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3226 for (i = 0; i < spec->autocfg.line_outs; i++) {
3227 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3228 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3229 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3233 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3235 struct alc_spec *spec = codec->spec;
3238 pin = spec->autocfg.speaker_pins[0];
3239 if (pin) /* connect to front */
3240 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3241 pin = spec->autocfg.hp_pins[0];
3242 if (pin) /* connect to front */
3243 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3246 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3248 struct alc_spec *spec = codec->spec;
3251 for (i = 0; i < AUTO_PIN_LAST; i++) {
3252 hda_nid_t nid = spec->autocfg.input_pins[i];
3253 if (alc880_is_input_pin(nid)) {
3254 snd_hda_codec_write(codec, nid, 0,
3255 AC_VERB_SET_PIN_WIDGET_CONTROL,
3256 i <= AUTO_PIN_FRONT_MIC ?
3257 PIN_VREF80 : PIN_IN);
3258 if (nid != ALC880_PIN_CD_NID)
3259 snd_hda_codec_write(codec, nid, 0,
3260 AC_VERB_SET_AMP_GAIN_MUTE,
3266 /* parse the BIOS configuration and set up the alc_spec */
3267 /* return 1 if successful, 0 if the proper config is not found,
3268 * or a negative error code
3270 static int alc880_parse_auto_config(struct hda_codec *codec)
3272 struct alc_spec *spec = codec->spec;
3274 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3276 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3280 if (!spec->autocfg.line_outs)
3281 return 0; /* can't find valid BIOS pin config */
3283 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3286 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3289 err = alc880_auto_create_extra_out(spec,
3290 spec->autocfg.speaker_pins[0],
3294 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3298 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3302 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3304 if (spec->autocfg.dig_out_pin)
3305 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3306 if (spec->autocfg.dig_in_pin)
3307 spec->dig_in_nid = ALC880_DIGIN_NID;
3309 if (spec->kctl_alloc)
3310 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3312 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3314 spec->num_mux_defs = 1;
3315 spec->input_mux = &spec->private_imux;
3320 /* additional initialization for auto-configuration model */
3321 static void alc880_auto_init(struct hda_codec *codec)
3323 alc880_auto_init_multi_out(codec);
3324 alc880_auto_init_extra_out(codec);
3325 alc880_auto_init_analog_input(codec);
3329 * OK, here we have finally the patch for ALC880
3332 static int patch_alc880(struct hda_codec *codec)
3334 struct alc_spec *spec;
3338 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3344 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3347 if (board_config < 0) {
3348 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3349 "trying auto-probe from BIOS...\n");
3350 board_config = ALC880_AUTO;
3353 if (board_config == ALC880_AUTO) {
3354 /* automatic parse from the BIOS config */
3355 err = alc880_parse_auto_config(codec);
3361 "hda_codec: Cannot set up configuration "
3362 "from BIOS. Using 3-stack mode...\n");
3363 board_config = ALC880_3ST;
3367 if (board_config != ALC880_AUTO)
3368 setup_preset(spec, &alc880_presets[board_config]);
3370 spec->stream_name_analog = "ALC880 Analog";
3371 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3372 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3374 spec->stream_name_digital = "ALC880 Digital";
3375 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3376 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3378 if (!spec->adc_nids && spec->input_mux) {
3379 /* check whether NID 0x07 is valid */
3380 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3382 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3383 if (wcap != AC_WID_AUD_IN) {
3384 spec->adc_nids = alc880_adc_nids_alt;
3385 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3386 spec->mixers[spec->num_mixers] =
3387 alc880_capture_alt_mixer;
3390 spec->adc_nids = alc880_adc_nids;
3391 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3392 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3397 codec->patch_ops = alc_patch_ops;
3398 if (board_config == ALC880_AUTO)
3399 spec->init_hook = alc880_auto_init;
3409 static hda_nid_t alc260_dac_nids[1] = {
3414 static hda_nid_t alc260_adc_nids[1] = {
3419 static hda_nid_t alc260_adc_nids_alt[1] = {
3424 static hda_nid_t alc260_hp_adc_nids[2] = {
3429 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3430 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3432 static hda_nid_t alc260_dual_adc_nids[2] = {
3437 #define ALC260_DIGOUT_NID 0x03
3438 #define ALC260_DIGIN_NID 0x06
3440 static struct hda_input_mux alc260_capture_source = {
3444 { "Front Mic", 0x1 },
3450 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3451 * headphone jack and the internal CD lines since these are the only pins at
3452 * which audio can appear. For flexibility, also allow the option of
3453 * recording the mixer output on the second ADC (ADC0 doesn't have a
3454 * connection to the mixer output).
3456 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3460 { "Mic/Line", 0x0 },
3462 { "Headphone", 0x2 },
3468 { "Mic/Line", 0x0 },
3470 { "Headphone", 0x2 },
3477 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3478 * the Fujitsu S702x, but jacks are marked differently.
3480 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3487 { "Headphone", 0x5 },
3496 { "Headphone", 0x6 },
3502 * This is just place-holder, so there's something for alc_build_pcms to look
3503 * at when it calculates the maximum number of channels. ALC260 has no mixer
3504 * element which allows changing the channel mode, so the verb list is
3507 static struct hda_channel_mode alc260_modes[1] = {
3512 /* Mixer combinations
3514 * basic: base_output + input + pc_beep + capture
3515 * HP: base_output + input + capture_alt
3516 * HP_3013: hp_3013 + input + capture
3517 * fujitsu: fujitsu + capture
3518 * acer: acer + capture
3521 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3522 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3523 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3524 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3525 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3526 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3527 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3531 static struct snd_kcontrol_new alc260_input_mixer[] = {
3532 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3533 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3534 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3535 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3537 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3538 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3539 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3543 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3544 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3545 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3549 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3550 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3551 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3552 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3553 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3554 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3555 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3556 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3557 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3561 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3562 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3564 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3565 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3566 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3567 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3568 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3569 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3570 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3571 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3572 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3573 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3574 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3575 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3576 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3580 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3581 * versions of the ALC260 don't act on requests to enable mic bias from NID
3582 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3583 * datasheet doesn't mention this restriction. At this stage it's not clear
3584 * whether this behaviour is intentional or is a hardware bug in chip
3585 * revisions available in early 2006. Therefore for now allow the
3586 * "Headphone Jack Mode" control to span all choices, but if it turns out
3587 * that the lack of mic bias for this NID is intentional we could change the
3588 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3590 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3591 * don't appear to make the mic bias available from the "line" jack, even
3592 * though the NID used for this jack (0x14) can supply it. The theory is
3593 * that perhaps Acer have included blocking capacitors between the ALC260
3594 * and the output jack. If this turns out to be the case for all such
3595 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3596 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3598 * The C20x Tablet series have a mono internal speaker which is controlled
3599 * via the chip's Mono sum widget and pin complex, so include the necessary
3600 * controls for such models. On models without a "mono speaker" the control
3601 * won't do anything.
3603 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3604 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3605 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3606 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3607 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3609 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3611 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3612 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3614 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3615 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3616 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3617 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3618 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3619 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3620 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3624 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3625 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3627 static struct snd_kcontrol_new alc260_will_mixer[] = {
3628 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3629 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3631 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3632 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3633 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3634 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3635 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3636 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3637 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3638 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3639 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3643 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3644 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3646 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3647 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3648 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3650 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3651 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3652 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3653 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3654 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3655 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3656 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3660 /* capture mixer elements */
3661 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3662 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3663 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3664 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3665 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3668 /* The multiple "Capture Source" controls confuse alsamixer
3669 * So call somewhat different..
3670 * FIXME: the controls appear in the "playback" view!
3672 /* .name = "Capture Source", */
3673 .name = "Input Source",
3675 .info = alc_mux_enum_info,
3676 .get = alc_mux_enum_get,
3677 .put = alc_mux_enum_put,
3682 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3683 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3684 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3686 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3687 /* The multiple "Capture Source" controls confuse alsamixer
3688 * So call somewhat different..
3689 * FIXME: the controls appear in the "playback" view!
3691 /* .name = "Capture Source", */
3692 .name = "Input Source",
3694 .info = alc_mux_enum_info,
3695 .get = alc_mux_enum_get,
3696 .put = alc_mux_enum_put,
3702 * initialization verbs
3704 static struct hda_verb alc260_init_verbs[] = {
3705 /* Line In pin widget for input */
3706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3707 /* CD pin widget for input */
3708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3709 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3710 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3711 /* Mic2 (front panel) pin widget for input and vref at 80% */
3712 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3713 /* LINE-2 is used for line-out in rear */
3714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3715 /* select line-out */
3716 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3718 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3720 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3722 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3723 /* mute capture amp left and right */
3724 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3725 /* set connection select to line in (default select for this ADC) */
3726 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3727 /* mute capture amp left and right */
3728 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3729 /* set connection select to line in (default select for this ADC) */
3730 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3731 /* set vol=0 Line-Out mixer amp left and right */
3732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3733 /* unmute pin widget amp left and right (no gain on this amp) */
3734 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3735 /* set vol=0 HP mixer amp left and right */
3736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3737 /* unmute pin widget amp left and right (no gain on this amp) */
3738 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3739 /* set vol=0 Mono mixer amp left and right */
3740 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3741 /* unmute pin widget amp left and right (no gain on this amp) */
3742 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3743 /* unmute LINE-2 out pin */
3744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3745 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
3751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
3753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3754 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3755 /* mute Front out path */
3756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3758 /* mute Headphone out path */
3759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3761 /* mute Mono out path */
3762 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3763 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3767 #if 0 /* should be identical with alc260_init_verbs? */
3768 static struct hda_verb alc260_hp_init_verbs[] = {
3769 /* Headphone and output */
3770 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3772 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3773 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3774 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3775 /* Mic2 (front panel) pin widget for input and vref at 80% */
3776 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3777 /* Line In pin widget for input */
3778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3779 /* Line-2 pin widget for output */
3780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3781 /* CD pin widget for input */
3782 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3783 /* unmute amp left and right */
3784 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3785 /* set connection select to line in (default select for this ADC) */
3786 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3787 /* unmute Line-Out mixer amp left and right (volume = 0) */
3788 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3789 /* mute pin widget amp left and right (no gain on this amp) */
3790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3791 /* unmute HP mixer amp left and right (volume = 0) */
3792 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3793 /* mute pin widget amp left and right (no gain on this amp) */
3794 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3795 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
3800 /* unmute Line In */
3801 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
3803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3804 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3805 /* Unmute Front out path */
3806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3808 /* Unmute Headphone out path */
3809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3811 /* Unmute Mono out path */
3812 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3813 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3818 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3819 /* Line out and output */
3820 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3822 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3823 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3824 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3825 /* Mic2 (front panel) pin widget for input and vref at 80% */
3826 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3827 /* Line In pin widget for input */
3828 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3829 /* Headphone pin widget for output */
3830 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3831 /* CD pin widget for input */
3832 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3833 /* unmute amp left and right */
3834 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3835 /* set connection select to line in (default select for this ADC) */
3836 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3837 /* unmute Line-Out mixer amp left and right (volume = 0) */
3838 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3839 /* mute pin widget amp left and right (no gain on this amp) */
3840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3841 /* unmute HP mixer amp left and right (volume = 0) */
3842 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3843 /* mute pin widget amp left and right (no gain on this amp) */
3844 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3845 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
3850 /* unmute Line In */
3851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
3853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3854 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3855 /* Unmute Front out path */
3856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3857 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3858 /* Unmute Headphone out path */
3859 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3860 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3861 /* Unmute Mono out path */
3862 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3863 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3867 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3868 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3869 * audio = 0x16, internal speaker = 0x10.
3871 static struct hda_verb alc260_fujitsu_init_verbs[] = {
3872 /* Disable all GPIOs */
3873 {0x01, AC_VERB_SET_GPIO_MASK, 0},
3874 /* Internal speaker is connected to headphone pin */
3875 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3876 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3877 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3878 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3879 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3880 /* Ensure all other unused pins are disabled and muted. */
3881 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3882 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3883 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3884 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3885 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3886 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3890 /* Disable digital (SPDIF) pins */
3891 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3892 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3894 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3895 * when acting as an output.
3897 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3899 /* Start with output sum widgets muted and their output gains at min */
3900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3906 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3910 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3911 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3912 /* Unmute Line1 pin widget output buffer since it starts as an output.
3913 * If the pin mode is changed by the user the pin mode control will
3914 * take care of enabling the pin's input/output buffers as needed.
3915 * Therefore there's no need to enable the input buffer at this
3918 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3919 /* Unmute input buffer of pin widget used for Line-in (no equiv
3922 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3924 /* Mute capture amp left and right */
3925 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3926 /* Set ADC connection select to match default mixer setting - line
3929 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
3931 /* Do the same for the second ADC: mute capture input amp and
3932 * set ADC connection to line in (on mic1 pin)
3934 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3935 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
3937 /* Mute all inputs to mixer widget (even unconnected ones) */
3938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
3939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
3940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
3941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
3942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
3943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
3945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
3950 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3951 * similar laptops (adapted from Fujitsu init verbs).
3953 static struct hda_verb alc260_acer_init_verbs[] = {
3954 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3955 * the headphone jack. Turn this on and rely on the standard mute
3956 * methods whenever the user wants to turn these outputs off.
3958 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
3959 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
3960 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
3961 /* Internal speaker/Headphone jack is connected to Line-out pin */
3962 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3963 /* Internal microphone/Mic jack is connected to Mic1 pin */
3964 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3965 /* Line In jack is connected to Line1 pin */
3966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3967 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
3968 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3969 /* Ensure all other unused pins are disabled and muted. */
3970 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3971 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3972 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3973 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3976 /* Disable digital (SPDIF) pins */
3977 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3978 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3980 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3981 * bus when acting as outputs.
3983 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
3984 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3986 /* Start with output sum widgets muted and their output gains at min */
3987 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3989 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3991 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3993 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3994 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3995 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3997 /* Unmute Line-out pin widget amp left and right
3998 * (no equiv mixer ctrl)
4000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4001 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4002 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4003 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4004 * inputs. If the pin mode is changed by the user the pin mode control
4005 * will take care of enabling the pin's input/output buffers as needed.
4006 * Therefore there's no need to enable the input buffer at this
4009 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4012 /* Mute capture amp left and right */
4013 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4014 /* Set ADC connection select to match default mixer setting - mic
4017 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4019 /* Do similar with the second ADC: mute capture input amp and
4020 * set ADC connection to mic to match ALSA's default state.
4022 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4023 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4025 /* Mute all inputs to mixer widget (even unconnected ones) */
4026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4038 static struct hda_verb alc260_will_verbs[] = {
4039 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4040 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4041 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4042 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4043 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4044 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4048 static struct hda_verb alc260_replacer_672v_verbs[] = {
4049 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4050 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4051 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4053 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4054 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4055 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4057 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4061 /* toggle speaker-output according to the hp-jack state */
4062 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4064 unsigned int present;
4066 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4067 present = snd_hda_codec_read(codec, 0x0f, 0,
4068 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4070 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 1);
4071 snd_hda_codec_write(codec, 0x0f, 0,
4072 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4074 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
4075 snd_hda_codec_write(codec, 0x0f, 0,
4076 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4080 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
4083 if ((res >> 26) == ALC880_HP_EVENT)
4084 alc260_replacer_672v_automute(codec);
4087 /* Test configuration for debugging, modelled after the ALC880 test
4090 #ifdef CONFIG_SND_DEBUG
4091 static hda_nid_t alc260_test_dac_nids[1] = {
4094 static hda_nid_t alc260_test_adc_nids[2] = {
4097 /* For testing the ALC260, each input MUX needs its own definition since
4098 * the signal assignments are different. This assumes that the first ADC
4101 static struct hda_input_mux alc260_test_capture_sources[2] = {
4105 { "MIC1 pin", 0x0 },
4106 { "MIC2 pin", 0x1 },
4107 { "LINE1 pin", 0x2 },
4108 { "LINE2 pin", 0x3 },
4110 { "LINE-OUT pin", 0x5 },
4111 { "HP-OUT pin", 0x6 },
4117 { "MIC1 pin", 0x0 },
4118 { "MIC2 pin", 0x1 },
4119 { "LINE1 pin", 0x2 },
4120 { "LINE2 pin", 0x3 },
4123 { "LINE-OUT pin", 0x6 },
4124 { "HP-OUT pin", 0x7 },
4128 static struct snd_kcontrol_new alc260_test_mixer[] = {
4129 /* Output driver widgets */
4130 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4131 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4132 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4133 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
4134 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4135 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
4137 /* Modes for retasking pin widgets
4138 * Note: the ALC260 doesn't seem to act on requests to enable mic
4139 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4140 * mention this restriction. At this stage it's not clear whether
4141 * this behaviour is intentional or is a hardware bug in chip
4142 * revisions available at least up until early 2006. Therefore for
4143 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4144 * choices, but if it turns out that the lack of mic bias for these
4145 * NIDs is intentional we could change their modes from
4146 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4148 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
4149 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
4150 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
4151 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
4152 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
4153 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
4155 /* Loopback mixer controls */
4156 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
4157 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
4158 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
4159 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
4160 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
4161 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
4162 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
4163 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
4164 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4165 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4166 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
4167 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
4168 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
4169 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
4170 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
4171 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
4173 /* Controls for GPIO pins, assuming they are configured as outputs */
4174 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4175 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4176 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4177 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4179 /* Switches to allow the digital IO pins to be enabled. The datasheet
4180 * is ambigious as to which NID is which; testing on laptops which
4181 * make this output available should provide clarification.
4183 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4184 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4188 static struct hda_verb alc260_test_init_verbs[] = {
4189 /* Enable all GPIOs as outputs with an initial value of 0 */
4190 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
4191 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4192 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
4194 /* Enable retasking pins as output, initially without power amp */
4195 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4196 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4197 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4199 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4200 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4202 /* Disable digital (SPDIF) pins initially, but users can enable
4203 * them via a mixer switch. In the case of SPDIF-out, this initverb
4204 * payload also sets the generation to 0, output to be in "consumer"
4205 * PCM format, copyright asserted, no pre-emphasis and no validity
4208 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
4209 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
4211 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4212 * OUT1 sum bus when acting as an output.
4214 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
4215 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
4216 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
4217 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
4219 /* Start with output sum widgets muted and their output gains at min */
4220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4221 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4223 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4224 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4225 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4226 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4227 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4228 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4230 /* Unmute retasking pin widget output buffers since the default
4231 * state appears to be output. As the pin mode is changed by the
4232 * user the pin mode control will take care of enabling the pin's
4233 * input/output buffers as needed.
4235 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4236 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4239 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4240 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4241 /* Also unmute the mono-out pin widget */
4242 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4244 /* Mute capture amp left and right */
4245 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4246 /* Set ADC connection select to match default mixer setting (mic1
4249 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4251 /* Do the same for the second ADC: mute capture input amp and
4252 * set ADC connection to mic1 pin
4254 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4255 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4257 /* Mute all inputs to mixer widget (even unconnected ones) */
4258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4261 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4263 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4271 static struct hda_pcm_stream alc260_pcm_analog_playback = {
4277 static struct hda_pcm_stream alc260_pcm_analog_capture = {
4283 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4284 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4287 * for BIOS auto-configuration
4290 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
4294 unsigned long vol_val, sw_val;
4298 if (nid >= 0x0f && nid < 0x11) {
4299 nid_vol = nid - 0x7;
4300 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4301 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4302 } else if (nid == 0x11) {
4303 nid_vol = nid - 0x7;
4304 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
4305 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
4306 } else if (nid >= 0x12 && nid <= 0x15) {
4308 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
4309 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
4313 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
4314 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
4317 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
4318 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
4324 /* add playback controls from the parsed DAC table */
4325 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
4326 const struct auto_pin_cfg *cfg)
4331 spec->multiout.num_dacs = 1;
4332 spec->multiout.dac_nids = spec->private_dac_nids;
4333 spec->multiout.dac_nids[0] = 0x02;
4335 nid = cfg->line_out_pins[0];
4337 err = alc260_add_playback_controls(spec, nid, "Front");
4342 nid = cfg->speaker_pins[0];
4344 err = alc260_add_playback_controls(spec, nid, "Speaker");
4349 nid = cfg->hp_pins[0];
4351 err = alc260_add_playback_controls(spec, nid, "Headphone");
4358 /* create playback/capture controls for input pins */
4359 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
4360 const struct auto_pin_cfg *cfg)
4362 struct hda_input_mux *imux = &spec->private_imux;
4365 for (i = 0; i < AUTO_PIN_LAST; i++) {
4366 if (cfg->input_pins[i] >= 0x12) {
4367 idx = cfg->input_pins[i] - 0x12;
4368 err = new_analog_input(spec, cfg->input_pins[i],
4369 auto_pin_cfg_labels[i], idx,
4373 imux->items[imux->num_items].label =
4374 auto_pin_cfg_labels[i];
4375 imux->items[imux->num_items].index = idx;
4378 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
4379 idx = cfg->input_pins[i] - 0x09;
4380 err = new_analog_input(spec, cfg->input_pins[i],
4381 auto_pin_cfg_labels[i], idx,
4385 imux->items[imux->num_items].label =
4386 auto_pin_cfg_labels[i];
4387 imux->items[imux->num_items].index = idx;
4394 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
4395 hda_nid_t nid, int pin_type,
4399 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4401 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4403 /* need the manual connection? */
4405 int idx = nid - 0x12;
4406 snd_hda_codec_write(codec, idx + 0x0b, 0,
4407 AC_VERB_SET_CONNECT_SEL, sel_idx);
4411 static void alc260_auto_init_multi_out(struct hda_codec *codec)
4413 struct alc_spec *spec = codec->spec;
4416 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
4417 nid = spec->autocfg.line_out_pins[0];
4419 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4420 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
4423 nid = spec->autocfg.speaker_pins[0];
4425 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
4427 nid = spec->autocfg.hp_pins[0];
4429 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
4432 #define ALC260_PIN_CD_NID 0x16
4433 static void alc260_auto_init_analog_input(struct hda_codec *codec)
4435 struct alc_spec *spec = codec->spec;
4438 for (i = 0; i < AUTO_PIN_LAST; i++) {
4439 hda_nid_t nid = spec->autocfg.input_pins[i];
4441 snd_hda_codec_write(codec, nid, 0,
4442 AC_VERB_SET_PIN_WIDGET_CONTROL,
4443 i <= AUTO_PIN_FRONT_MIC ?
4444 PIN_VREF80 : PIN_IN);
4445 if (nid != ALC260_PIN_CD_NID)
4446 snd_hda_codec_write(codec, nid, 0,
4447 AC_VERB_SET_AMP_GAIN_MUTE,
4454 * generic initialization of ADC, input mixers and output mixers
4456 static struct hda_verb alc260_volume_init_verbs[] = {
4458 * Unmute ADC0-1 and set the default input to mic-in
4460 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4461 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4462 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4463 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4465 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4467 * Note: PASD motherboards uses the Line In 2 as the input for
4468 * front panel mic (mic 2)
4470 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
4474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
4475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
4478 * Set up output mixers (0x08 - 0x0a)
4480 /* set vol=0 to output mixers */
4481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4482 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4483 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4484 /* set up input amps for analog loopback */
4485 /* Amp Indices: DAC = 0, mixer = 1 */
4486 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4489 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4496 static int alc260_parse_auto_config(struct hda_codec *codec)
4498 struct alc_spec *spec = codec->spec;
4501 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4503 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4507 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4510 if (!spec->kctl_alloc)
4511 return 0; /* can't find valid BIOS pin config */
4512 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4516 spec->multiout.max_channels = 2;
4518 if (spec->autocfg.dig_out_pin)
4519 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4520 if (spec->kctl_alloc)
4521 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4523 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4525 spec->num_mux_defs = 1;
4526 spec->input_mux = &spec->private_imux;
4528 /* check whether NID 0x04 is valid */
4529 wcap = get_wcaps(codec, 0x04);
4530 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4531 if (wcap != AC_WID_AUD_IN) {
4532 spec->adc_nids = alc260_adc_nids_alt;
4533 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4534 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4536 spec->adc_nids = alc260_adc_nids;
4537 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4538 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4545 /* additional initialization for auto-configuration model */
4546 static void alc260_auto_init(struct hda_codec *codec)
4548 alc260_auto_init_multi_out(codec);
4549 alc260_auto_init_analog_input(codec);
4553 * ALC260 configurations
4555 static const char *alc260_models[ALC260_MODEL_LAST] = {
4556 [ALC260_BASIC] = "basic",
4558 [ALC260_HP_3013] = "hp-3013",
4559 [ALC260_FUJITSU_S702X] = "fujitsu",
4560 [ALC260_ACER] = "acer",
4561 [ALC260_WILL] = "will",
4562 [ALC260_REPLACER_672V] = "replacer",
4563 #ifdef CONFIG_SND_DEBUG
4564 [ALC260_TEST] = "test",
4566 [ALC260_AUTO] = "auto",
4569 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4570 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4571 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4572 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4573 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4574 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4575 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4576 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4577 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4578 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4579 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4580 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4581 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4582 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4583 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4584 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4585 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4586 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4587 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4591 static struct alc_config_preset alc260_presets[] = {
4593 .mixers = { alc260_base_output_mixer,
4595 alc260_pc_beep_mixer,
4596 alc260_capture_mixer },
4597 .init_verbs = { alc260_init_verbs },
4598 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4599 .dac_nids = alc260_dac_nids,
4600 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4601 .adc_nids = alc260_adc_nids,
4602 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4603 .channel_mode = alc260_modes,
4604 .input_mux = &alc260_capture_source,
4607 .mixers = { alc260_base_output_mixer,
4609 alc260_capture_alt_mixer },
4610 .init_verbs = { alc260_init_verbs },
4611 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4612 .dac_nids = alc260_dac_nids,
4613 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4614 .adc_nids = alc260_hp_adc_nids,
4615 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4616 .channel_mode = alc260_modes,
4617 .input_mux = &alc260_capture_source,
4619 [ALC260_HP_3013] = {
4620 .mixers = { alc260_hp_3013_mixer,
4622 alc260_capture_alt_mixer },
4623 .init_verbs = { alc260_hp_3013_init_verbs },
4624 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4625 .dac_nids = alc260_dac_nids,
4626 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4627 .adc_nids = alc260_hp_adc_nids,
4628 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4629 .channel_mode = alc260_modes,
4630 .input_mux = &alc260_capture_source,
4632 [ALC260_FUJITSU_S702X] = {
4633 .mixers = { alc260_fujitsu_mixer,
4634 alc260_capture_mixer },
4635 .init_verbs = { alc260_fujitsu_init_verbs },
4636 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4637 .dac_nids = alc260_dac_nids,
4638 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4639 .adc_nids = alc260_dual_adc_nids,
4640 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4641 .channel_mode = alc260_modes,
4642 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4643 .input_mux = alc260_fujitsu_capture_sources,
4646 .mixers = { alc260_acer_mixer,
4647 alc260_capture_mixer },
4648 .init_verbs = { alc260_acer_init_verbs },
4649 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4650 .dac_nids = alc260_dac_nids,
4651 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4652 .adc_nids = alc260_dual_adc_nids,
4653 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4654 .channel_mode = alc260_modes,
4655 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4656 .input_mux = alc260_acer_capture_sources,
4659 .mixers = { alc260_will_mixer,
4660 alc260_capture_mixer },
4661 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4662 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4663 .dac_nids = alc260_dac_nids,
4664 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4665 .adc_nids = alc260_adc_nids,
4666 .dig_out_nid = ALC260_DIGOUT_NID,
4667 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4668 .channel_mode = alc260_modes,
4669 .input_mux = &alc260_capture_source,
4671 [ALC260_REPLACER_672V] = {
4672 .mixers = { alc260_replacer_672v_mixer,
4673 alc260_capture_mixer },
4674 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4675 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4676 .dac_nids = alc260_dac_nids,
4677 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4678 .adc_nids = alc260_adc_nids,
4679 .dig_out_nid = ALC260_DIGOUT_NID,
4680 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4681 .channel_mode = alc260_modes,
4682 .input_mux = &alc260_capture_source,
4683 .unsol_event = alc260_replacer_672v_unsol_event,
4684 .init_hook = alc260_replacer_672v_automute,
4686 #ifdef CONFIG_SND_DEBUG
4688 .mixers = { alc260_test_mixer,
4689 alc260_capture_mixer },
4690 .init_verbs = { alc260_test_init_verbs },
4691 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4692 .dac_nids = alc260_test_dac_nids,
4693 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4694 .adc_nids = alc260_test_adc_nids,
4695 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4696 .channel_mode = alc260_modes,
4697 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4698 .input_mux = alc260_test_capture_sources,
4703 static int patch_alc260(struct hda_codec *codec)
4705 struct alc_spec *spec;
4706 int err, board_config;
4708 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4714 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4717 if (board_config < 0) {
4718 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4719 "trying auto-probe from BIOS...\n");
4720 board_config = ALC260_AUTO;
4723 if (board_config == ALC260_AUTO) {
4724 /* automatic parse from the BIOS config */
4725 err = alc260_parse_auto_config(codec);
4731 "hda_codec: Cannot set up configuration "
4732 "from BIOS. Using base mode...\n");
4733 board_config = ALC260_BASIC;
4737 if (board_config != ALC260_AUTO)
4738 setup_preset(spec, &alc260_presets[board_config]);
4740 spec->stream_name_analog = "ALC260 Analog";
4741 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4742 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4744 spec->stream_name_digital = "ALC260 Digital";
4745 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4746 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4748 codec->patch_ops = alc_patch_ops;
4749 if (board_config == ALC260_AUTO)
4750 spec->init_hook = alc260_auto_init;
4759 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4760 * configuration. Each pin widget can choose any input DACs and a mixer.
4761 * Each ADC is connected from a mixer of all inputs. This makes possible
4762 * 6-channel independent captures.
4764 * In addition, an independent DAC for the multi-playback (not used in this
4767 #define ALC882_DIGOUT_NID 0x06
4768 #define ALC882_DIGIN_NID 0x0a
4770 static struct hda_channel_mode alc882_ch_modes[1] = {
4774 static hda_nid_t alc882_dac_nids[4] = {
4775 /* front, rear, clfe, rear_surr */
4776 0x02, 0x03, 0x04, 0x05
4779 /* identical with ALC880 */
4780 #define alc882_adc_nids alc880_adc_nids
4781 #define alc882_adc_nids_alt alc880_adc_nids_alt
4784 /* FIXME: should be a matrix-type input source selection */
4786 static struct hda_input_mux alc882_capture_source = {
4790 { "Front Mic", 0x1 },
4795 #define alc882_mux_enum_info alc_mux_enum_info
4796 #define alc882_mux_enum_get alc_mux_enum_get
4798 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4799 struct snd_ctl_elem_value *ucontrol)
4801 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4802 struct alc_spec *spec = codec->spec;
4803 const struct hda_input_mux *imux = spec->input_mux;
4804 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4805 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4806 hda_nid_t nid = capture_mixers[adc_idx];
4807 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4808 unsigned int i, idx;
4810 idx = ucontrol->value.enumerated.item[0];
4811 if (idx >= imux->num_items)
4812 idx = imux->num_items - 1;
4813 if (*cur_val == idx && !codec->in_resume)
4815 for (i = 0; i < imux->num_items; i++) {
4816 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
4817 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4818 v | (imux->items[i].index << 8));
4827 static struct hda_verb alc882_3ST_ch2_init[] = {
4828 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
4829 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4830 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4831 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4838 static struct hda_verb alc882_3ST_ch6_init[] = {
4839 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4840 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4841 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
4842 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4843 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4844 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4848 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
4849 { 2, alc882_3ST_ch2_init },
4850 { 6, alc882_3ST_ch6_init },
4856 static struct hda_verb alc882_sixstack_ch6_init[] = {
4857 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
4858 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4859 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4860 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4867 static struct hda_verb alc882_sixstack_ch8_init[] = {
4868 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4869 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4870 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4875 static struct hda_channel_mode alc882_sixstack_modes[2] = {
4876 { 6, alc882_sixstack_ch6_init },
4877 { 8, alc882_sixstack_ch8_init },
4880 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4881 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4883 static struct snd_kcontrol_new alc882_base_mixer[] = {
4884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4887 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
4889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
4890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4892 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4893 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4895 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4896 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4897 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4898 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4900 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4902 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4903 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
4904 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4905 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4906 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4910 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
4911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4915 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4916 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4918 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4920 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4921 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4925 static struct snd_kcontrol_new alc882_targa_mixer[] = {
4926 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4927 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4929 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4930 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4935 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4936 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4940 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
4941 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
4943 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
4944 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4945 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
4946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4947 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4950 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4951 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4952 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
4953 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
4954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4959 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
4961 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4962 .name = "Channel Mode",
4963 .info = alc_ch_mode_info,
4964 .get = alc_ch_mode_get,
4965 .put = alc_ch_mode_put,
4970 static struct hda_verb alc882_init_verbs[] = {
4971 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4974 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4976 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4980 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4984 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4985 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4986 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4988 /* Front Pin: output 0 (0x0c) */
4989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4991 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
4992 /* Rear Pin: output 1 (0x0d) */
4993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4995 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
4996 /* CLFE Pin: output 2 (0x0e) */
4997 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4999 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5000 /* Side Pin: output 3 (0x0f) */
5001 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5003 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5004 /* Mic (rear) pin: input vref at 80% */
5005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5007 /* Front Mic pin: input vref at 80% */
5008 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5009 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5010 /* Line In pin: input */
5011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5013 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5015 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5016 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5017 /* CD pin widget for input */
5018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5020 /* FIXME: use matrix-type input source selection */
5021 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5022 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5037 /* ADC1: mute amp left and right */
5038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5039 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5040 /* ADC2: mute amp left and right */
5041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5042 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5043 /* ADC3: mute amp left and right */
5044 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5045 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5050 static struct hda_verb alc882_eapd_verbs[] = {
5051 /* change to EAPD mode */
5052 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5053 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5058 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5059 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5060 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5064 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5065 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5069 static struct hda_verb alc882_macpro_init_verbs[] = {
5070 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5074 /* Front Pin: output 0 (0x0c) */
5075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5078 /* Front Mic pin: input vref at 80% */
5079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5081 /* Speaker: output */
5082 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5083 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5084 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5085 /* Headphone output (output 0 - 0x0c) */
5086 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5088 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5090 /* FIXME: use matrix-type input source selection */
5091 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5092 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5106 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5107 /* ADC1: mute amp left and right */
5108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5109 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5110 /* ADC2: mute amp left and right */
5111 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5112 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5113 /* ADC3: mute amp left and right */
5114 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5115 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5120 static struct hda_verb alc882_targa_verbs[] = {
5121 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5125 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5127 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5128 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5129 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5131 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5132 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5133 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5134 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5138 /* toggle speaker-output according to the hp-jack state */
5139 static void alc882_targa_automute(struct hda_codec *codec)
5141 unsigned int present;
5143 present = snd_hda_codec_read(codec, 0x14, 0,
5144 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5145 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
5146 0x80, present ? 0x80 : 0);
5147 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
5148 0x80, present ? 0x80 : 0);
5149 snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3);
5152 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5154 /* Looks like the unsol event is incompatible with the standard
5155 * definition. 4bit tag is placed at 26 bit!
5157 if (((res >> 26) == ALC880_HP_EVENT)) {
5158 alc882_targa_automute(codec);
5162 static struct hda_verb alc882_asus_a7j_verbs[] = {
5163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5170 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5171 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5172 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5174 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5175 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5176 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5180 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5182 unsigned int gpiostate, gpiomask, gpiodir;
5184 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5185 AC_VERB_GET_GPIO_DATA, 0);
5188 gpiostate |= (1 << pin);
5190 gpiostate &= ~(1 << pin);
5192 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5193 AC_VERB_GET_GPIO_MASK, 0);
5194 gpiomask |= (1 << pin);
5196 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5197 AC_VERB_GET_GPIO_DIRECTION, 0);
5198 gpiodir |= (1 << pin);
5201 snd_hda_codec_write(codec, codec->afg, 0,
5202 AC_VERB_SET_GPIO_MASK, gpiomask);
5203 snd_hda_codec_write(codec, codec->afg, 0,
5204 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5208 snd_hda_codec_write(codec, codec->afg, 0,
5209 AC_VERB_SET_GPIO_DATA, gpiostate);
5213 * generic initialization of ADC, input mixers and output mixers
5215 static struct hda_verb alc882_auto_init_verbs[] = {
5217 * Unmute ADC0-2 and set the default input to mic-in
5219 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5220 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5221 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5223 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5224 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5226 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5228 * Note: PASD motherboards uses the Line In 2 as the input for
5229 * front panel mic (mic 2)
5231 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
5235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
5239 * Set up output mixers (0x0c - 0x0f)
5241 /* set vol=0 to output mixers */
5242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5245 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5246 /* set up input amps for analog loopback */
5247 /* Amp Indices: DAC = 0, mixer = 1 */
5248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5256 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5257 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5259 /* FIXME: use matrix-type input source selection */
5260 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5261 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5262 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5267 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5272 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5280 /* capture mixer elements */
5281 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5282 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5283 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5284 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5285 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5288 /* The multiple "Capture Source" controls confuse alsamixer
5289 * So call somewhat different..
5290 * FIXME: the controls appear in the "playback" view!
5292 /* .name = "Capture Source", */
5293 .name = "Input Source",
5295 .info = alc882_mux_enum_info,
5296 .get = alc882_mux_enum_get,
5297 .put = alc882_mux_enum_put,
5302 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5303 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5304 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5305 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5306 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5307 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5308 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5311 /* The multiple "Capture Source" controls confuse alsamixer
5312 * So call somewhat different..
5313 * FIXME: the controls appear in the "playback" view!
5315 /* .name = "Capture Source", */
5316 .name = "Input Source",
5318 .info = alc882_mux_enum_info,
5319 .get = alc882_mux_enum_get,
5320 .put = alc882_mux_enum_put,
5325 /* pcm configuration: identiacal with ALC880 */
5326 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5327 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5328 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5329 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5332 * configuration and preset
5334 static const char *alc882_models[ALC882_MODEL_LAST] = {
5335 [ALC882_3ST_DIG] = "3stack-dig",
5336 [ALC882_6ST_DIG] = "6stack-dig",
5337 [ALC882_ARIMA] = "arima",
5338 [ALC882_W2JC] = "w2jc",
5339 [ALC885_MACPRO] = "macpro",
5340 [ALC882_AUTO] = "auto",
5343 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5344 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5345 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5346 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5347 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5348 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5349 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5350 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5351 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5355 static struct alc_config_preset alc882_presets[] = {
5356 [ALC882_3ST_DIG] = {
5357 .mixers = { alc882_base_mixer },
5358 .init_verbs = { alc882_init_verbs },
5359 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5360 .dac_nids = alc882_dac_nids,
5361 .dig_out_nid = ALC882_DIGOUT_NID,
5362 .dig_in_nid = ALC882_DIGIN_NID,
5363 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5364 .channel_mode = alc882_ch_modes,
5366 .input_mux = &alc882_capture_source,
5368 [ALC882_6ST_DIG] = {
5369 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5370 .init_verbs = { alc882_init_verbs },
5371 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5372 .dac_nids = alc882_dac_nids,
5373 .dig_out_nid = ALC882_DIGOUT_NID,
5374 .dig_in_nid = ALC882_DIGIN_NID,
5375 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5376 .channel_mode = alc882_sixstack_modes,
5377 .input_mux = &alc882_capture_source,
5380 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5381 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5382 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5383 .dac_nids = alc882_dac_nids,
5384 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5385 .channel_mode = alc882_sixstack_modes,
5386 .input_mux = &alc882_capture_source,
5389 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5390 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5391 alc880_gpio1_init_verbs },
5392 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5393 .dac_nids = alc882_dac_nids,
5394 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5395 .channel_mode = alc880_threestack_modes,
5397 .input_mux = &alc882_capture_source,
5398 .dig_out_nid = ALC882_DIGOUT_NID,
5401 .mixers = { alc882_macpro_mixer },
5402 .init_verbs = { alc882_macpro_init_verbs },
5403 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5404 .dac_nids = alc882_dac_nids,
5405 .dig_out_nid = ALC882_DIGOUT_NID,
5406 .dig_in_nid = ALC882_DIGIN_NID,
5407 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5408 .channel_mode = alc882_ch_modes,
5409 .input_mux = &alc882_capture_source,
5412 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5413 alc882_capture_mixer },
5414 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5415 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5416 .dac_nids = alc882_dac_nids,
5417 .dig_out_nid = ALC882_DIGOUT_NID,
5418 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5419 .adc_nids = alc882_adc_nids,
5420 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5421 .channel_mode = alc882_3ST_6ch_modes,
5423 .input_mux = &alc882_capture_source,
5424 .unsol_event = alc882_targa_unsol_event,
5425 .init_hook = alc882_targa_automute,
5427 [ALC882_ASUS_A7J] = {
5428 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5429 alc882_capture_mixer },
5430 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5431 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5432 .dac_nids = alc882_dac_nids,
5433 .dig_out_nid = ALC882_DIGOUT_NID,
5434 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5435 .adc_nids = alc882_adc_nids,
5436 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5437 .channel_mode = alc882_3ST_6ch_modes,
5439 .input_mux = &alc882_capture_source,
5448 PINFIX_ABIT_AW9D_MAX
5451 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5452 { 0x15, 0x01080104 }, /* side */
5453 { 0x16, 0x01011012 }, /* rear */
5454 { 0x17, 0x01016011 }, /* clfe */
5458 static const struct alc_pincfg *alc882_pin_fixes[] = {
5459 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5462 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5463 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5468 * BIOS auto configuration
5470 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5471 hda_nid_t nid, int pin_type,
5475 struct alc_spec *spec = codec->spec;
5478 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5481 idx = spec->multiout.dac_nids[dac_idx] - 2;
5483 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5487 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5491 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5493 struct alc_spec *spec = codec->spec;
5496 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5497 for (i = 0; i <= HDA_SIDE; i++) {
5498 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5499 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5501 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5506 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5508 struct alc_spec *spec = codec->spec;
5511 pin = spec->autocfg.hp_pins[0];
5512 if (pin) /* connect to front */
5514 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5517 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5518 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5520 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5522 struct alc_spec *spec = codec->spec;
5525 for (i = 0; i < AUTO_PIN_LAST; i++) {
5526 hda_nid_t nid = spec->autocfg.input_pins[i];
5527 if (alc882_is_input_pin(nid)) {
5528 snd_hda_codec_write(codec, nid, 0,
5529 AC_VERB_SET_PIN_WIDGET_CONTROL,
5530 i <= AUTO_PIN_FRONT_MIC ?
5531 PIN_VREF80 : PIN_IN);
5532 if (nid != ALC882_PIN_CD_NID)
5533 snd_hda_codec_write(codec, nid, 0,
5534 AC_VERB_SET_AMP_GAIN_MUTE,
5540 /* almost identical with ALC880 parser... */
5541 static int alc882_parse_auto_config(struct hda_codec *codec)
5543 struct alc_spec *spec = codec->spec;
5544 int err = alc880_parse_auto_config(codec);
5549 /* hack - override the init verbs */
5550 spec->init_verbs[0] = alc882_auto_init_verbs;
5554 /* additional initialization for auto-configuration model */
5555 static void alc882_auto_init(struct hda_codec *codec)
5557 alc882_auto_init_multi_out(codec);
5558 alc882_auto_init_hp_out(codec);
5559 alc882_auto_init_analog_input(codec);
5562 static int patch_alc882(struct hda_codec *codec)
5564 struct alc_spec *spec;
5565 int err, board_config;
5567 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5573 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
5577 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
5578 /* Pick up systems that don't supply PCI SSID */
5579 switch (codec->subsystem_id) {
5580 case 0x106b0c00: /* Mac Pro */
5581 board_config = ALC885_MACPRO;
5584 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
5585 "trying auto-probe from BIOS...\n");
5586 board_config = ALC882_AUTO;
5590 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
5592 if (board_config == ALC882_AUTO) {
5593 /* automatic parse from the BIOS config */
5594 err = alc882_parse_auto_config(codec);
5600 "hda_codec: Cannot set up configuration "
5601 "from BIOS. Using base mode...\n");
5602 board_config = ALC882_3ST_DIG;
5606 if (board_config != ALC882_AUTO)
5607 setup_preset(spec, &alc882_presets[board_config]);
5609 if (board_config == ALC885_MACPRO) {
5610 alc882_gpio_mute(codec, 0, 0);
5611 alc882_gpio_mute(codec, 1, 0);
5614 spec->stream_name_analog = "ALC882 Analog";
5615 spec->stream_analog_playback = &alc882_pcm_analog_playback;
5616 spec->stream_analog_capture = &alc882_pcm_analog_capture;
5618 spec->stream_name_digital = "ALC882 Digital";
5619 spec->stream_digital_playback = &alc882_pcm_digital_playback;
5620 spec->stream_digital_capture = &alc882_pcm_digital_capture;
5622 if (!spec->adc_nids && spec->input_mux) {
5623 /* check whether NID 0x07 is valid */
5624 unsigned int wcap = get_wcaps(codec, 0x07);
5626 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5627 if (wcap != AC_WID_AUD_IN) {
5628 spec->adc_nids = alc882_adc_nids_alt;
5629 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
5630 spec->mixers[spec->num_mixers] =
5631 alc882_capture_alt_mixer;
5634 spec->adc_nids = alc882_adc_nids;
5635 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
5636 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
5641 codec->patch_ops = alc_patch_ops;
5642 if (board_config == ALC882_AUTO)
5643 spec->init_hook = alc882_auto_init;
5651 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
5652 * configuration. Each pin widget can choose any input DACs and a mixer.
5653 * Each ADC is connected from a mixer of all inputs. This makes possible
5654 * 6-channel independent captures.
5656 * In addition, an independent DAC for the multi-playback (not used in this
5659 #define ALC883_DIGOUT_NID 0x06
5660 #define ALC883_DIGIN_NID 0x0a
5662 static hda_nid_t alc883_dac_nids[4] = {
5663 /* front, rear, clfe, rear_surr */
5664 0x02, 0x04, 0x03, 0x05
5667 static hda_nid_t alc883_adc_nids[2] = {
5673 /* FIXME: should be a matrix-type input source selection */
5675 static struct hda_input_mux alc883_capture_source = {
5679 { "Front Mic", 0x1 },
5685 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
5693 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
5703 #define alc883_mux_enum_info alc_mux_enum_info
5704 #define alc883_mux_enum_get alc_mux_enum_get
5706 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5707 struct snd_ctl_elem_value *ucontrol)
5709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5710 struct alc_spec *spec = codec->spec;
5711 const struct hda_input_mux *imux = spec->input_mux;
5712 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5713 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5714 hda_nid_t nid = capture_mixers[adc_idx];
5715 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5716 unsigned int i, idx;
5718 idx = ucontrol->value.enumerated.item[0];
5719 if (idx >= imux->num_items)
5720 idx = imux->num_items - 1;
5721 if (*cur_val == idx && !codec->in_resume)
5723 for (i = 0; i < imux->num_items; i++) {
5724 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
5725 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5726 v | (imux->items[i].index << 8));
5735 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
5742 static struct hda_verb alc883_3ST_ch2_init[] = {
5743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5745 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5746 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5753 static struct hda_verb alc883_3ST_ch6_init[] = {
5754 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5755 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5756 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5757 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5758 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5759 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5763 static struct hda_channel_mode alc883_3ST_6ch_modes[2] = {
5764 { 2, alc883_3ST_ch2_init },
5765 { 6, alc883_3ST_ch6_init },
5771 static struct hda_verb alc883_sixstack_ch6_init[] = {
5772 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5773 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5774 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5775 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5782 static struct hda_verb alc883_sixstack_ch8_init[] = {
5783 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5784 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5785 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5786 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5790 static struct hda_channel_mode alc883_sixstack_modes[2] = {
5791 { 6, alc883_sixstack_ch6_init },
5792 { 8, alc883_sixstack_ch8_init },
5795 static struct hda_verb alc883_medion_eapd_verbs[] = {
5796 /* eanable EAPD on medion laptop */
5797 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5798 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
5802 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5803 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5806 static struct snd_kcontrol_new alc883_base_mixer[] = {
5807 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5808 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5809 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5810 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5811 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5812 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5813 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5814 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5815 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5816 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5817 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5820 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5821 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5823 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5826 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5828 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5829 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5830 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5831 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5832 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5833 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5835 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5836 /* .name = "Capture Source", */
5837 .name = "Input Source",
5839 .info = alc883_mux_enum_info,
5840 .get = alc883_mux_enum_get,
5841 .put = alc883_mux_enum_put,
5846 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
5847 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5848 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5855 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5857 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5858 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5859 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5860 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5861 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5862 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5863 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5864 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5865 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5867 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5868 /* .name = "Capture Source", */
5869 .name = "Input Source",
5871 .info = alc883_mux_enum_info,
5872 .get = alc883_mux_enum_get,
5873 .put = alc883_mux_enum_put,
5878 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
5879 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5880 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5881 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5882 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5883 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5884 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5885 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5886 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5888 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5889 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5895 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5897 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5898 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5899 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5900 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5901 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5902 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5903 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5906 /* .name = "Capture Source", */
5907 .name = "Input Source",
5909 .info = alc883_mux_enum_info,
5910 .get = alc883_mux_enum_get,
5911 .put = alc883_mux_enum_put,
5916 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
5917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5918 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5919 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5920 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5923 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
5924 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
5925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5933 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5934 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5936 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5937 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5938 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5939 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5943 /* .name = "Capture Source", */
5944 .name = "Input Source",
5946 .info = alc883_mux_enum_info,
5947 .get = alc883_mux_enum_get,
5948 .put = alc883_mux_enum_put,
5953 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
5954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5956 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5957 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5958 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5959 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5960 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5961 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5962 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5963 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5964 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5965 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5966 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5970 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5971 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5972 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5973 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5975 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5976 /* .name = "Capture Source", */
5977 .name = "Input Source",
5979 .info = alc883_mux_enum_info,
5980 .get = alc883_mux_enum_get,
5981 .put = alc883_mux_enum_put,
5986 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
5987 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5988 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
5989 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5995 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5996 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5997 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5998 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6001 /* .name = "Capture Source", */
6002 .name = "Input Source",
6004 .info = alc883_mux_enum_info,
6005 .get = alc883_mux_enum_get,
6006 .put = alc883_mux_enum_put,
6011 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6013 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6014 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6015 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6018 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6020 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6021 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6023 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6024 /* .name = "Capture Source", */
6025 .name = "Input Source",
6027 .info = alc883_mux_enum_info,
6028 .get = alc883_mux_enum_get,
6029 .put = alc883_mux_enum_put,
6034 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6035 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6036 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6038 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6039 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6042 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6043 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6044 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6045 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6046 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6047 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6049 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6050 /* .name = "Capture Source", */
6051 .name = "Input Source",
6053 .info = alc883_mux_enum_info,
6054 .get = alc883_mux_enum_get,
6055 .put = alc883_mux_enum_put,
6060 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6062 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6063 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6064 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6065 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6068 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6069 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6071 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6072 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6073 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6075 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6076 /* .name = "Capture Source", */
6077 .name = "Input Source",
6079 .info = alc883_mux_enum_info,
6080 .get = alc883_mux_enum_get,
6081 .put = alc883_mux_enum_put,
6086 static struct snd_kcontrol_new alc888_hp_nettle_mixer[] = {
6087 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6088 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6089 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6090 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6091 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6092 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6093 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6094 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6095 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6096 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6098 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6099 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6106 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6107 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6108 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6109 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6110 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6111 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6112 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6113 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6116 /* .name = "Capture Source", */
6117 .name = "Input Source",
6119 .info = alc883_mux_enum_info,
6120 .get = alc883_mux_enum_get,
6121 .put = alc883_mux_enum_put,
6126 static struct snd_kcontrol_new alc888_hp_lucknow_mixer[] = {
6127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6129 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6130 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6131 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6133 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6134 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6135 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6144 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6146 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6147 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6148 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6149 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6150 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6151 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6154 /* .name = "Capture Source", */
6155 .name = "Input Source",
6157 .info = alc883_mux_enum_info,
6158 .get = alc883_mux_enum_get,
6159 .put = alc883_mux_enum_put,
6164 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6166 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6167 .name = "Channel Mode",
6168 .info = alc_ch_mode_info,
6169 .get = alc_ch_mode_get,
6170 .put = alc_ch_mode_put,
6175 static struct hda_verb alc883_init_verbs[] = {
6176 /* ADC1: mute amp left and right */
6177 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6178 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6179 /* ADC2: mute amp left and right */
6180 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6181 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6182 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6187 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6193 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6195 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6196 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6197 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
6203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6205 /* Front Pin: output 0 (0x0c) */
6206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6208 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6209 /* Rear Pin: output 1 (0x0d) */
6210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6211 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6212 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6213 /* CLFE Pin: output 2 (0x0e) */
6214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6215 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6216 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6217 /* Side Pin: output 3 (0x0f) */
6218 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6219 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6220 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6221 /* Mic (rear) pin: input vref at 80% */
6222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6224 /* Front Mic pin: input vref at 80% */
6225 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6226 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6227 /* Line In pin: input */
6228 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6229 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6230 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6232 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6233 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6234 /* CD pin widget for input */
6235 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6237 /* FIXME: use matrix-type input source selection */
6238 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6245 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6246 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6252 static struct hda_verb alc883_tagra_verbs[] = {
6253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6259 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6260 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6261 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6263 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6264 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6265 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6266 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6271 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6272 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6273 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6274 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6278 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6279 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6281 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6286 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6290 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6291 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6295 static struct hda_verb alc888_hp_nettle_verbs[] = {
6296 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6297 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6298 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6299 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6303 static struct hda_verb alc888_hp_lucknow_verbs[] = {
6304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6305 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6306 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6310 static struct hda_verb alc888_hp_lucknow_2ch_init[] = {
6311 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6312 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6313 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6314 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6318 static struct hda_verb alc888_hp_lucknow_6ch_init[] = {
6319 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6320 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6321 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6322 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6326 static struct hda_channel_mode alc888_hp_lucknow_modes[2] = {
6327 { 2, alc888_hp_lucknow_2ch_init },
6328 { 6, alc888_hp_lucknow_6ch_init },
6331 /* toggle front-jack and RCA according to the hp-jack state */
6332 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6334 unsigned int present;
6336 present = snd_hda_codec_read(codec, 0x1b, 0,
6337 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6338 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6339 0x80, present ? 0x80 : 0);
6340 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6341 0x80, present ? 0x80 : 0);
6342 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6343 0x80, present ? 0x80 : 0);
6344 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6345 0x80, present ? 0x80 : 0);
6349 /* toggle RCA according to the front-jack state */
6350 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6352 unsigned int present;
6354 present = snd_hda_codec_read(codec, 0x14, 0,
6355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6356 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6357 0x80, present ? 0x80 : 0);
6358 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6359 0x80, present ? 0x80 : 0);
6362 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6365 if ((res >> 26) == ALC880_HP_EVENT)
6366 alc888_lenovo_ms7195_front_automute(codec);
6367 if ((res >> 26) == ALC880_FRONT_EVENT)
6368 alc888_lenovo_ms7195_rca_automute(codec);
6371 static struct hda_verb alc883_medion_md2_verbs[] = {
6372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6377 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6381 /* toggle speaker-output according to the hp-jack state */
6382 static void alc883_medion_md2_automute(struct hda_codec *codec)
6384 unsigned int present;
6386 present = snd_hda_codec_read(codec, 0x14, 0,
6387 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6388 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6389 0x80, present ? 0x80 : 0);
6390 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6391 0x80, present ? 0x80 : 0);
6394 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
6397 if ((res >> 26) == ALC880_HP_EVENT)
6398 alc883_medion_md2_automute(codec);
6401 /* toggle speaker-output according to the hp-jack state */
6402 static void alc883_tagra_automute(struct hda_codec *codec)
6404 unsigned int present;
6407 present = snd_hda_codec_read(codec, 0x14, 0,
6408 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6409 bits = present ? 0x80 : 0;
6410 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
6412 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
6414 snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6418 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
6420 if ((res >> 26) == ALC880_HP_EVENT)
6421 alc883_tagra_automute(codec);
6424 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6426 unsigned int present;
6429 present = snd_hda_codec_read(codec, 0x14, 0,
6430 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6431 bits = present ? 0x80 : 0;
6432 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6434 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6438 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6440 unsigned int present;
6443 present = snd_hda_codec_read(codec, 0x1b, 0,
6444 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6445 bits = present ? 0x80 : 0;
6446 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6448 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6450 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6452 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6456 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
6459 if ((res >> 26) == ALC880_HP_EVENT)
6460 alc883_lenovo_101e_all_automute(codec);
6461 if ((res >> 26) == ALC880_FRONT_EVENT)
6462 alc883_lenovo_101e_ispeaker_automute(codec);
6466 * generic initialization of ADC, input mixers and output mixers
6468 static struct hda_verb alc883_auto_init_verbs[] = {
6470 * Unmute ADC0-2 and set the default input to mic-in
6472 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6473 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6474 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6475 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6477 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6479 * Note: PASD motherboards uses the Line In 2 as the input for
6480 * front panel mic (mic 2)
6482 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
6487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6490 * Set up output mixers (0x0c - 0x0f)
6492 /* set vol=0 to output mixers */
6493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6495 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6496 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6497 /* set up input amps for analog loopback */
6498 /* Amp Indices: DAC = 0, mixer = 1 */
6499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6507 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6508 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6510 /* FIXME: use matrix-type input source selection */
6511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6513 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6516 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6519 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6521 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6522 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6528 /* capture mixer elements */
6529 static struct snd_kcontrol_new alc883_capture_mixer[] = {
6530 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6531 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6532 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6533 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6535 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6536 /* The multiple "Capture Source" controls confuse alsamixer
6537 * So call somewhat different..
6538 * FIXME: the controls appear in the "playback" view!
6540 /* .name = "Capture Source", */
6541 .name = "Input Source",
6543 .info = alc882_mux_enum_info,
6544 .get = alc882_mux_enum_get,
6545 .put = alc882_mux_enum_put,
6550 /* pcm configuration: identiacal with ALC880 */
6551 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
6552 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
6553 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
6554 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
6557 * configuration and preset
6559 static const char *alc883_models[ALC883_MODEL_LAST] = {
6560 [ALC883_3ST_2ch_DIG] = "3stack-dig",
6561 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
6562 [ALC883_3ST_6ch] = "3stack-6ch",
6563 [ALC883_6ST_DIG] = "6stack-dig",
6564 [ALC883_TARGA_DIG] = "targa-dig",
6565 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
6566 [ALC883_ACER] = "acer",
6567 [ALC883_MEDION] = "medion",
6568 [ALC883_MEDION_MD2] = "medion-md2",
6569 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
6570 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
6571 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
6572 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
6573 [ALC888_HP_NETTLE] = "hp-nettle",
6574 [ALC888_HP_LUCKNOW] = "hp-lucknow",
6575 [ALC883_AUTO] = "auto",
6578 static struct snd_pci_quirk alc883_cfg_tbl[] = {
6579 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
6580 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
6581 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
6582 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
6583 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
6584 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
6585 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
6586 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
6587 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
6588 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
6589 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
6590 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
6591 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
6592 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
6593 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
6594 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
6595 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
6596 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
6597 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
6598 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
6599 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
6600 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
6601 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
6602 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
6603 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
6604 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
6605 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
6606 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
6607 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6608 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6609 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_HP_NETTLE),
6610 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_HP_LUCKNOW),
6611 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
6615 static struct alc_config_preset alc883_presets[] = {
6616 [ALC883_3ST_2ch_DIG] = {
6617 .mixers = { alc883_3ST_2ch_mixer },
6618 .init_verbs = { alc883_init_verbs },
6619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6620 .dac_nids = alc883_dac_nids,
6621 .dig_out_nid = ALC883_DIGOUT_NID,
6622 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6623 .adc_nids = alc883_adc_nids,
6624 .dig_in_nid = ALC883_DIGIN_NID,
6625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6626 .channel_mode = alc883_3ST_2ch_modes,
6627 .input_mux = &alc883_capture_source,
6629 [ALC883_3ST_6ch_DIG] = {
6630 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6631 .init_verbs = { alc883_init_verbs },
6632 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6633 .dac_nids = alc883_dac_nids,
6634 .dig_out_nid = ALC883_DIGOUT_NID,
6635 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6636 .adc_nids = alc883_adc_nids,
6637 .dig_in_nid = ALC883_DIGIN_NID,
6638 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6639 .channel_mode = alc883_3ST_6ch_modes,
6641 .input_mux = &alc883_capture_source,
6643 [ALC883_3ST_6ch] = {
6644 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6645 .init_verbs = { alc883_init_verbs },
6646 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6647 .dac_nids = alc883_dac_nids,
6648 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6649 .adc_nids = alc883_adc_nids,
6650 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6651 .channel_mode = alc883_3ST_6ch_modes,
6653 .input_mux = &alc883_capture_source,
6655 [ALC883_6ST_DIG] = {
6656 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
6657 .init_verbs = { alc883_init_verbs },
6658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6659 .dac_nids = alc883_dac_nids,
6660 .dig_out_nid = ALC883_DIGOUT_NID,
6661 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6662 .adc_nids = alc883_adc_nids,
6663 .dig_in_nid = ALC883_DIGIN_NID,
6664 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6665 .channel_mode = alc883_sixstack_modes,
6666 .input_mux = &alc883_capture_source,
6668 [ALC883_TARGA_DIG] = {
6669 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
6670 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6672 .dac_nids = alc883_dac_nids,
6673 .dig_out_nid = ALC883_DIGOUT_NID,
6674 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6675 .adc_nids = alc883_adc_nids,
6676 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6677 .channel_mode = alc883_3ST_6ch_modes,
6679 .input_mux = &alc883_capture_source,
6680 .unsol_event = alc883_tagra_unsol_event,
6681 .init_hook = alc883_tagra_automute,
6683 [ALC883_TARGA_2ch_DIG] = {
6684 .mixers = { alc883_tagra_2ch_mixer},
6685 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6686 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6687 .dac_nids = alc883_dac_nids,
6688 .dig_out_nid = ALC883_DIGOUT_NID,
6689 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6690 .adc_nids = alc883_adc_nids,
6691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6692 .channel_mode = alc883_3ST_2ch_modes,
6693 .input_mux = &alc883_capture_source,
6694 .unsol_event = alc883_tagra_unsol_event,
6695 .init_hook = alc883_tagra_automute,
6698 .mixers = { alc883_base_mixer,
6699 alc883_chmode_mixer },
6700 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6701 * and the headphone jack. Turn this on and rely on the
6702 * standard mute methods whenever the user wants to turn
6703 * these outputs off.
6705 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
6706 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6707 .dac_nids = alc883_dac_nids,
6708 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6709 .adc_nids = alc883_adc_nids,
6710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6711 .channel_mode = alc883_3ST_2ch_modes,
6712 .input_mux = &alc883_capture_source,
6715 .mixers = { alc883_fivestack_mixer,
6716 alc883_chmode_mixer },
6717 .init_verbs = { alc883_init_verbs,
6718 alc883_medion_eapd_verbs },
6719 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6720 .dac_nids = alc883_dac_nids,
6721 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6722 .adc_nids = alc883_adc_nids,
6723 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6724 .channel_mode = alc883_sixstack_modes,
6725 .input_mux = &alc883_capture_source,
6727 [ALC883_MEDION_MD2] = {
6728 .mixers = { alc883_medion_md2_mixer},
6729 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
6730 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6731 .dac_nids = alc883_dac_nids,
6732 .dig_out_nid = ALC883_DIGOUT_NID,
6733 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6734 .adc_nids = alc883_adc_nids,
6735 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6736 .channel_mode = alc883_3ST_2ch_modes,
6737 .input_mux = &alc883_capture_source,
6738 .unsol_event = alc883_medion_md2_unsol_event,
6739 .init_hook = alc883_medion_md2_automute,
6741 [ALC883_LAPTOP_EAPD] = {
6742 .mixers = { alc883_base_mixer,
6743 alc883_chmode_mixer },
6744 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
6745 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6746 .dac_nids = alc883_dac_nids,
6747 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6748 .adc_nids = alc883_adc_nids,
6749 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6750 .channel_mode = alc883_3ST_2ch_modes,
6751 .input_mux = &alc883_capture_source,
6753 [ALC883_LENOVO_101E_2ch] = {
6754 .mixers = { alc883_lenovo_101e_2ch_mixer},
6755 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
6756 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6757 .dac_nids = alc883_dac_nids,
6758 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6759 .adc_nids = alc883_adc_nids,
6760 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6761 .channel_mode = alc883_3ST_2ch_modes,
6762 .input_mux = &alc883_lenovo_101e_capture_source,
6763 .unsol_event = alc883_lenovo_101e_unsol_event,
6764 .init_hook = alc883_lenovo_101e_all_automute,
6766 [ALC883_LENOVO_NB0763] = {
6767 .mixers = { alc883_lenovo_nb0763_mixer },
6768 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
6769 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6770 .dac_nids = alc883_dac_nids,
6771 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6772 .adc_nids = alc883_adc_nids,
6773 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6774 .channel_mode = alc883_3ST_2ch_modes,
6776 .input_mux = &alc883_lenovo_nb0763_capture_source,
6777 .unsol_event = alc883_medion_md2_unsol_event,
6778 .init_hook = alc883_medion_md2_automute,
6780 [ALC888_LENOVO_MS7195_DIG] = {
6781 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6782 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
6783 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6784 .dac_nids = alc883_dac_nids,
6785 .dig_out_nid = ALC883_DIGOUT_NID,
6786 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6787 .adc_nids = alc883_adc_nids,
6788 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6789 .channel_mode = alc883_3ST_6ch_modes,
6791 .input_mux = &alc883_capture_source,
6792 .unsol_event = alc883_lenovo_ms7195_unsol_event,
6793 .init_hook = alc888_lenovo_ms7195_front_automute,
6795 [ALC888_HP_NETTLE] = {
6796 .mixers = { alc888_hp_nettle_mixer, alc883_chmode_mixer },
6797 .init_verbs = { alc883_init_verbs, alc888_hp_nettle_verbs },
6798 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6799 .dac_nids = alc883_dac_nids,
6800 .dig_out_nid = ALC883_DIGOUT_NID,
6801 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6802 .adc_nids = alc883_adc_nids,
6803 .dig_in_nid = ALC883_DIGIN_NID,
6804 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6805 .channel_mode = alc883_sixstack_modes,
6806 .input_mux = &alc883_capture_source,
6808 [ALC888_HP_LUCKNOW] = {
6809 .mixers = { alc888_hp_lucknow_mixer, alc883_chmode_mixer },
6810 .init_verbs = { alc883_init_verbs, alc888_hp_lucknow_verbs },
6811 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6812 .dac_nids = alc883_dac_nids,
6813 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6814 .adc_nids = alc883_adc_nids,
6815 .num_channel_mode = ARRAY_SIZE(alc888_hp_lucknow_modes),
6816 .channel_mode = alc888_hp_lucknow_modes,
6818 .input_mux = &alc883_capture_source,
6824 * BIOS auto configuration
6826 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
6827 hda_nid_t nid, int pin_type,
6831 struct alc_spec *spec = codec->spec;
6834 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6837 idx = spec->multiout.dac_nids[dac_idx] - 2;
6839 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6841 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6843 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6847 static void alc883_auto_init_multi_out(struct hda_codec *codec)
6849 struct alc_spec *spec = codec->spec;
6852 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6853 for (i = 0; i <= HDA_SIDE; i++) {
6854 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6855 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6857 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
6862 static void alc883_auto_init_hp_out(struct hda_codec *codec)
6864 struct alc_spec *spec = codec->spec;
6867 pin = spec->autocfg.hp_pins[0];
6868 if (pin) /* connect to front */
6870 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
6873 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
6874 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
6876 static void alc883_auto_init_analog_input(struct hda_codec *codec)
6878 struct alc_spec *spec = codec->spec;
6881 for (i = 0; i < AUTO_PIN_LAST; i++) {
6882 hda_nid_t nid = spec->autocfg.input_pins[i];
6883 if (alc883_is_input_pin(nid)) {
6884 snd_hda_codec_write(codec, nid, 0,
6885 AC_VERB_SET_PIN_WIDGET_CONTROL,
6886 (i <= AUTO_PIN_FRONT_MIC ?
6887 PIN_VREF80 : PIN_IN));
6888 if (nid != ALC883_PIN_CD_NID)
6889 snd_hda_codec_write(codec, nid, 0,
6890 AC_VERB_SET_AMP_GAIN_MUTE,
6896 /* almost identical with ALC880 parser... */
6897 static int alc883_parse_auto_config(struct hda_codec *codec)
6899 struct alc_spec *spec = codec->spec;
6900 int err = alc880_parse_auto_config(codec);
6905 /* hack - override the init verbs */
6906 spec->init_verbs[0] = alc883_auto_init_verbs;
6907 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
6912 /* additional initialization for auto-configuration model */
6913 static void alc883_auto_init(struct hda_codec *codec)
6915 alc883_auto_init_multi_out(codec);
6916 alc883_auto_init_hp_out(codec);
6917 alc883_auto_init_analog_input(codec);
6920 static int patch_alc883(struct hda_codec *codec)
6922 struct alc_spec *spec;
6923 int err, board_config;
6925 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6931 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
6934 if (board_config < 0) {
6935 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
6936 "trying auto-probe from BIOS...\n");
6937 board_config = ALC883_AUTO;
6940 if (board_config == ALC883_AUTO) {
6941 /* automatic parse from the BIOS config */
6942 err = alc883_parse_auto_config(codec);
6948 "hda_codec: Cannot set up configuration "
6949 "from BIOS. Using base mode...\n");
6950 board_config = ALC883_3ST_2ch_DIG;
6954 if (board_config != ALC883_AUTO)
6955 setup_preset(spec, &alc883_presets[board_config]);
6957 spec->stream_name_analog = "ALC883 Analog";
6958 spec->stream_analog_playback = &alc883_pcm_analog_playback;
6959 spec->stream_analog_capture = &alc883_pcm_analog_capture;
6961 spec->stream_name_digital = "ALC883 Digital";
6962 spec->stream_digital_playback = &alc883_pcm_digital_playback;
6963 spec->stream_digital_capture = &alc883_pcm_digital_capture;
6965 if (!spec->adc_nids && spec->input_mux) {
6966 spec->adc_nids = alc883_adc_nids;
6967 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
6970 codec->patch_ops = alc_patch_ops;
6971 if (board_config == ALC883_AUTO)
6972 spec->init_hook = alc883_auto_init;
6981 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
6982 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
6984 #define alc262_dac_nids alc260_dac_nids
6985 #define alc262_adc_nids alc882_adc_nids
6986 #define alc262_adc_nids_alt alc882_adc_nids_alt
6988 #define alc262_modes alc260_modes
6989 #define alc262_capture_source alc882_capture_source
6991 static struct snd_kcontrol_new alc262_base_mixer[] = {
6992 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6993 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6994 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6995 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6996 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6997 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7001 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7002 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7003 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7004 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7005 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7007 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7008 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7009 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7013 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7014 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7015 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7016 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7017 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7018 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7019 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7023 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7024 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7025 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7026 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7027 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7028 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7033 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7034 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7035 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7037 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7038 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7042 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7043 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7044 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7045 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7048 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7049 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7050 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7051 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7052 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7053 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7057 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7058 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7059 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7060 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7061 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7062 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7063 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7064 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7065 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7067 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7068 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7071 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7072 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7076 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7077 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7078 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7079 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7083 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7085 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7087 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7088 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7089 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7093 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7095 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7099 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7100 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7104 #define alc262_capture_mixer alc882_capture_mixer
7105 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7108 * generic initialization of ADC, input mixers and output mixers
7110 static struct hda_verb alc262_init_verbs[] = {
7112 * Unmute ADC0-2 and set the default input to mic-in
7114 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7116 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7118 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7119 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7121 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7123 * Note: PASD motherboards uses the Line In 2 as the input for
7124 * front panel mic (mic 2)
7126 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7134 * Set up output mixers (0x0c - 0x0e)
7136 /* set vol=0 to output mixers */
7137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7139 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7140 /* set up input amps for analog loopback */
7141 /* Amp Indices: DAC = 0, mixer = 1 */
7142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7143 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7145 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7147 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7149 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7151 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7152 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7154 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7158 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7159 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7160 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7163 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7165 /* FIXME: use matrix-type input source selection */
7166 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7167 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7171 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7186 static struct hda_verb alc262_hippo_unsol_verbs[] = {
7187 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7192 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
7193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7194 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7197 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7198 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7202 static struct hda_verb alc262_sony_unsol_verbs[] = {
7203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7205 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
7207 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7211 /* mute/unmute internal speaker according to the hp jack and mute state */
7212 static void alc262_hippo_automute(struct hda_codec *codec, int force)
7214 struct alc_spec *spec = codec->spec;
7217 if (force || !spec->sense_updated) {
7218 unsigned int present;
7219 /* need to execute and sync at first */
7220 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7221 present = snd_hda_codec_read(codec, 0x15, 0,
7222 AC_VERB_GET_PIN_SENSE, 0);
7223 spec->jack_present = (present & 0x80000000) != 0;
7224 spec->sense_updated = 1;
7226 if (spec->jack_present) {
7227 /* mute internal speaker */
7228 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7230 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7233 /* unmute internal speaker if necessary */
7234 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7235 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7237 mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0);
7238 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7243 /* unsolicited event for HP jack sensing */
7244 static void alc262_hippo_unsol_event(struct hda_codec *codec,
7247 if ((res >> 26) != ALC880_HP_EVENT)
7249 alc262_hippo_automute(codec, 1);
7252 static void alc262_hippo1_automute(struct hda_codec *codec, int force)
7254 struct alc_spec *spec = codec->spec;
7257 if (force || !spec->sense_updated) {
7258 unsigned int present;
7259 /* need to execute and sync at first */
7260 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7261 present = snd_hda_codec_read(codec, 0x1b, 0,
7262 AC_VERB_GET_PIN_SENSE, 0);
7263 spec->jack_present = (present & 0x80000000) != 0;
7264 spec->sense_updated = 1;
7266 if (spec->jack_present) {
7267 /* mute internal speaker */
7268 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7270 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7273 /* unmute internal speaker if necessary */
7274 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7275 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7277 mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0);
7278 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7283 /* unsolicited event for HP jack sensing */
7284 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
7287 if ((res >> 26) != ALC880_HP_EVENT)
7289 alc262_hippo1_automute(codec, 1);
7294 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7297 #define ALC_HP_EVENT 0x37
7299 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
7300 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
7301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7305 static struct hda_input_mux alc262_fujitsu_capture_source = {
7313 static struct hda_input_mux alc262_HP_capture_source = {
7317 { "Front Mic", 0x3 },
7324 /* mute/unmute internal speaker according to the hp jack and mute state */
7325 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7327 struct alc_spec *spec = codec->spec;
7330 if (force || !spec->sense_updated) {
7331 unsigned int present;
7332 /* need to execute and sync at first */
7333 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
7334 present = snd_hda_codec_read(codec, 0x14, 0,
7335 AC_VERB_GET_PIN_SENSE, 0);
7336 spec->jack_present = (present & 0x80000000) != 0;
7337 spec->sense_updated = 1;
7339 if (spec->jack_present) {
7340 /* mute internal speaker */
7341 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7343 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7346 /* unmute internal speaker if necessary */
7347 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7348 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
7350 mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0);
7351 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7356 /* unsolicited event for HP jack sensing */
7357 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
7360 if ((res >> 26) != ALC_HP_EVENT)
7362 alc262_fujitsu_automute(codec, 1);
7365 /* bind volumes of both NID 0x0c and 0x0d */
7366 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol,
7367 struct snd_ctl_elem_value *ucontrol)
7369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7370 long *valp = ucontrol->value.integer.value;
7373 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0,
7374 0x7f, valp[0] & 0x7f);
7375 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0,
7376 0x7f, valp[1] & 0x7f);
7377 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
7378 0x7f, valp[0] & 0x7f);
7379 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
7380 0x7f, valp[1] & 0x7f);
7384 /* bind hp and internal speaker mute (with plug check) */
7385 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7386 struct snd_ctl_elem_value *ucontrol)
7388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7389 long *valp = ucontrol->value.integer.value;
7392 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7393 0x80, valp[0] ? 0 : 0x80);
7394 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7395 0x80, valp[1] ? 0 : 0x80);
7396 if (change || codec->in_resume)
7397 alc262_fujitsu_automute(codec, codec->in_resume);
7401 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
7403 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7404 .name = "Master Playback Volume",
7405 .info = snd_hda_mixer_amp_volume_info,
7406 .get = snd_hda_mixer_amp_volume_get,
7407 .put = alc262_fujitsu_master_vol_put,
7408 .tlv = { .c = snd_hda_mixer_amp_tlv },
7409 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7412 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7413 .name = "Master Playback Switch",
7414 .info = snd_hda_mixer_amp_switch_info,
7415 .get = snd_hda_mixer_amp_switch_get,
7416 .put = alc262_fujitsu_master_sw_put,
7417 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7419 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7420 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7421 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7427 /* additional init verbs for Benq laptops */
7428 static struct hda_verb alc262_EAPD_verbs[] = {
7429 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7430 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7434 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
7435 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7436 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7438 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7439 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7443 /* add playback controls from the parsed DAC table */
7444 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
7445 const struct auto_pin_cfg *cfg)
7450 spec->multiout.num_dacs = 1; /* only use one dac */
7451 spec->multiout.dac_nids = spec->private_dac_nids;
7452 spec->multiout.dac_nids[0] = 2;
7454 nid = cfg->line_out_pins[0];
7456 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7457 "Front Playback Volume",
7458 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
7461 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7462 "Front Playback Switch",
7463 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
7468 nid = cfg->speaker_pins[0];
7471 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7472 "Speaker Playback Volume",
7473 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7477 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7478 "Speaker Playback Switch",
7479 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7484 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7485 "Speaker Playback Switch",
7486 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7492 nid = cfg->hp_pins[0];
7494 /* spec->multiout.hp_nid = 2; */
7496 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7497 "Headphone Playback Volume",
7498 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7502 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7503 "Headphone Playback Switch",
7504 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7509 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7510 "Headphone Playback Switch",
7511 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7520 /* identical with ALC880 */
7521 #define alc262_auto_create_analog_input_ctls \
7522 alc880_auto_create_analog_input_ctls
7525 * generic initialization of ADC, input mixers and output mixers
7527 static struct hda_verb alc262_volume_init_verbs[] = {
7529 * Unmute ADC0-2 and set the default input to mic-in
7531 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7533 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7535 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7538 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7540 * Note: PASD motherboards uses the Line In 2 as the input for
7541 * front panel mic (mic 2)
7543 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7544 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7551 * Set up output mixers (0x0c - 0x0f)
7553 /* set vol=0 to output mixers */
7554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7556 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7558 /* set up input amps for analog loopback */
7559 /* Amp Indices: DAC = 0, mixer = 1 */
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7564 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7567 /* FIXME: use matrix-type input source selection */
7568 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7569 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7588 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
7590 * Unmute ADC0-2 and set the default input to mic-in
7592 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7594 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7596 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7599 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7601 * Note: PASD motherboards uses the Line In 2 as the input for
7602 * front panel mic (mic 2)
7604 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
7611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},
7614 * Set up output mixers (0x0c - 0x0e)
7616 /* set vol=0 to output mixers */
7617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7621 /* set up input amps for analog loopback */
7622 /* Amp Indices: DAC = 0, mixer = 1 */
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7627 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7634 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7637 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7641 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7644 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7647 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7650 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7651 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7654 /* FIXME: use matrix-type input source selection */
7655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7656 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7675 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
7677 * Unmute ADC0-2 and set the default input to mic-in
7679 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7681 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7683 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7686 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7688 * Note: PASD motherboards uses the Line In 2 as the input for front
7691 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7692 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7693 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7696 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
7697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
7698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},
7699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)},
7701 * Set up output mixers (0x0c - 0x0e)
7703 /* set vol=0 to output mixers */
7704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7705 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7706 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7708 /* set up input amps for analog loopback */
7709 /* Amp Indices: DAC = 0, mixer = 1 */
7710 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
7719 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
7720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
7721 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
7722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
7723 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
7724 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
7726 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7729 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7730 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7732 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
7733 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7734 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7735 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7736 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7737 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7739 /* FIXME: use matrix-type input source selection */
7740 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7741 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
7743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
7744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
7745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
7746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
7747 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
7750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7751 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7755 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7756 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7761 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7762 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7763 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7769 /* pcm configuration: identiacal with ALC880 */
7770 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
7771 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
7772 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
7773 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
7776 * BIOS auto configuration
7778 static int alc262_parse_auto_config(struct hda_codec *codec)
7780 struct alc_spec *spec = codec->spec;
7782 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
7784 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7788 if (!spec->autocfg.line_outs)
7789 return 0; /* can't find valid BIOS pin config */
7790 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
7793 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
7797 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
7799 if (spec->autocfg.dig_out_pin)
7800 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
7801 if (spec->autocfg.dig_in_pin)
7802 spec->dig_in_nid = ALC262_DIGIN_NID;
7804 if (spec->kctl_alloc)
7805 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
7807 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
7808 spec->num_mux_defs = 1;
7809 spec->input_mux = &spec->private_imux;
7814 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
7815 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
7816 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
7819 /* init callback for auto-configuration model -- overriding the default init */
7820 static void alc262_auto_init(struct hda_codec *codec)
7822 alc262_auto_init_multi_out(codec);
7823 alc262_auto_init_hp_out(codec);
7824 alc262_auto_init_analog_input(codec);
7828 * configuration and preset
7830 static const char *alc262_models[ALC262_MODEL_LAST] = {
7831 [ALC262_BASIC] = "basic",
7832 [ALC262_HIPPO] = "hippo",
7833 [ALC262_HIPPO_1] = "hippo_1",
7834 [ALC262_FUJITSU] = "fujitsu",
7835 [ALC262_HP_BPC] = "hp-bpc",
7836 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
7837 [ALC262_BENQ_ED8] = "benq",
7838 [ALC262_BENQ_T31] = "benq-t31",
7839 [ALC262_SONY_ASSAMD] = "sony-assamd",
7840 [ALC262_AUTO] = "auto",
7843 static struct snd_pci_quirk alc262_cfg_tbl[] = {
7844 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
7845 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
7846 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
7847 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
7848 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
7849 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
7850 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
7851 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
7852 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
7853 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
7854 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
7855 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
7856 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
7857 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
7858 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
7859 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
7860 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
7861 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
7862 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
7863 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
7864 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
7865 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
7866 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
7867 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7868 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7872 static struct alc_config_preset alc262_presets[] = {
7874 .mixers = { alc262_base_mixer },
7875 .init_verbs = { alc262_init_verbs },
7876 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7877 .dac_nids = alc262_dac_nids,
7879 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7880 .channel_mode = alc262_modes,
7881 .input_mux = &alc262_capture_source,
7884 .mixers = { alc262_base_mixer },
7885 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
7886 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7887 .dac_nids = alc262_dac_nids,
7889 .dig_out_nid = ALC262_DIGOUT_NID,
7890 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7891 .channel_mode = alc262_modes,
7892 .input_mux = &alc262_capture_source,
7893 .unsol_event = alc262_hippo_unsol_event,
7895 [ALC262_HIPPO_1] = {
7896 .mixers = { alc262_hippo1_mixer },
7897 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
7898 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7899 .dac_nids = alc262_dac_nids,
7901 .dig_out_nid = ALC262_DIGOUT_NID,
7902 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7903 .channel_mode = alc262_modes,
7904 .input_mux = &alc262_capture_source,
7905 .unsol_event = alc262_hippo1_unsol_event,
7907 [ALC262_FUJITSU] = {
7908 .mixers = { alc262_fujitsu_mixer },
7909 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs },
7910 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7911 .dac_nids = alc262_dac_nids,
7913 .dig_out_nid = ALC262_DIGOUT_NID,
7914 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7915 .channel_mode = alc262_modes,
7916 .input_mux = &alc262_fujitsu_capture_source,
7917 .unsol_event = alc262_fujitsu_unsol_event,
7920 .mixers = { alc262_HP_BPC_mixer },
7921 .init_verbs = { alc262_HP_BPC_init_verbs },
7922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7923 .dac_nids = alc262_dac_nids,
7925 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7926 .channel_mode = alc262_modes,
7927 .input_mux = &alc262_HP_capture_source,
7929 [ALC262_HP_BPC_D7000_WF] = {
7930 .mixers = { alc262_HP_BPC_WildWest_mixer },
7931 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
7932 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7933 .dac_nids = alc262_dac_nids,
7935 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7936 .channel_mode = alc262_modes,
7937 .input_mux = &alc262_HP_capture_source,
7939 [ALC262_HP_BPC_D7000_WL] = {
7940 .mixers = { alc262_HP_BPC_WildWest_mixer,
7941 alc262_HP_BPC_WildWest_option_mixer },
7942 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
7943 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7944 .dac_nids = alc262_dac_nids,
7946 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7947 .channel_mode = alc262_modes,
7948 .input_mux = &alc262_HP_capture_source,
7950 [ALC262_BENQ_ED8] = {
7951 .mixers = { alc262_base_mixer },
7952 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
7953 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7954 .dac_nids = alc262_dac_nids,
7956 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7957 .channel_mode = alc262_modes,
7958 .input_mux = &alc262_capture_source,
7960 [ALC262_SONY_ASSAMD] = {
7961 .mixers = { alc262_sony_mixer },
7962 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
7963 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7964 .dac_nids = alc262_dac_nids,
7966 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7967 .channel_mode = alc262_modes,
7968 .input_mux = &alc262_capture_source,
7969 .unsol_event = alc262_hippo_unsol_event,
7971 [ALC262_BENQ_T31] = {
7972 .mixers = { alc262_benq_t31_mixer },
7973 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
7974 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
7975 .dac_nids = alc262_dac_nids,
7977 .num_channel_mode = ARRAY_SIZE(alc262_modes),
7978 .channel_mode = alc262_modes,
7979 .input_mux = &alc262_capture_source,
7980 .unsol_event = alc262_hippo_unsol_event,
7984 static int patch_alc262(struct hda_codec *codec)
7986 struct alc_spec *spec;
7990 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7996 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8001 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8002 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8003 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8004 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8008 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8012 if (board_config < 0) {
8013 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8014 "trying auto-probe from BIOS...\n");
8015 board_config = ALC262_AUTO;
8018 if (board_config == ALC262_AUTO) {
8019 /* automatic parse from the BIOS config */
8020 err = alc262_parse_auto_config(codec);
8026 "hda_codec: Cannot set up configuration "
8027 "from BIOS. Using base mode...\n");
8028 board_config = ALC262_BASIC;
8032 if (board_config != ALC262_AUTO)
8033 setup_preset(spec, &alc262_presets[board_config]);
8035 spec->stream_name_analog = "ALC262 Analog";
8036 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8037 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8039 spec->stream_name_digital = "ALC262 Digital";
8040 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8041 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8043 if (!spec->adc_nids && spec->input_mux) {
8044 /* check whether NID 0x07 is valid */
8045 unsigned int wcap = get_wcaps(codec, 0x07);
8048 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8049 if (wcap != AC_WID_AUD_IN) {
8050 spec->adc_nids = alc262_adc_nids_alt;
8051 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8052 spec->mixers[spec->num_mixers] =
8053 alc262_capture_alt_mixer;
8056 spec->adc_nids = alc262_adc_nids;
8057 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
8058 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
8063 codec->patch_ops = alc_patch_ops;
8064 if (board_config == ALC262_AUTO)
8065 spec->init_hook = alc262_auto_init;
8071 * ALC268 channel source setting (2 channel)
8073 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8074 #define alc268_modes alc260_modes
8076 static hda_nid_t alc268_dac_nids[2] = {
8081 static hda_nid_t alc268_adc_nids[2] = {
8086 static hda_nid_t alc268_adc_nids_alt[1] = {
8091 static struct snd_kcontrol_new alc268_base_mixer[] = {
8092 /* output mixer control */
8093 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
8096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8101 * generic initialization of ADC, input mixers and output mixers
8103 static struct hda_verb alc268_base_init_verbs[] = {
8104 /* Unmute DAC0-1 and set vol = 0 */
8105 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8106 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8107 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8108 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8109 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8110 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8113 * Set up output mixers (0x0c - 0x0e)
8115 /* set vol=0 to output mixers */
8116 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8117 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8118 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8119 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
8121 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8122 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8125 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8126 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8127 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8128 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8129 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8130 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8131 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8133 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8136 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8139 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8140 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8142 /* FIXME: use matrix-type input source selection */
8143 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
8144 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8149 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8151 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8152 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8153 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8154 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8159 * generic initialization of ADC, input mixers and output mixers
8161 static struct hda_verb alc268_volume_init_verbs[] = {
8162 /* set output DAC */
8163 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8164 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8165 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8166 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8168 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8169 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8170 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8171 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8172 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8174 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8175 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8176 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8178 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8180 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8183 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8185 /* set PCBEEP vol = 0 */
8186 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
8191 #define alc268_mux_enum_info alc_mux_enum_info
8192 #define alc268_mux_enum_get alc_mux_enum_get
8194 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8195 struct snd_ctl_elem_value *ucontrol)
8197 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8198 struct alc_spec *spec = codec->spec;
8199 const struct hda_input_mux *imux = spec->input_mux;
8200 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
8201 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
8202 hda_nid_t nid = capture_mixers[adc_idx];
8203 unsigned int *cur_val = &spec->cur_mux[adc_idx];
8204 unsigned int i, idx;
8206 idx = ucontrol->value.enumerated.item[0];
8207 if (idx >= imux->num_items)
8208 idx = imux->num_items - 1;
8209 if (*cur_val == idx && !codec->in_resume)
8211 for (i = 0; i < imux->num_items; i++) {
8212 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
8213 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8214 v | (imux->items[i].index << 8));
8215 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL,
8222 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
8223 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8224 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8227 /* The multiple "Capture Source" controls confuse alsamixer
8228 * So call somewhat different..
8229 * FIXME: the controls appear in the "playback" view!
8231 /* .name = "Capture Source", */
8232 .name = "Input Source",
8234 .info = alc268_mux_enum_info,
8235 .get = alc268_mux_enum_get,
8236 .put = alc268_mux_enum_put,
8241 static struct snd_kcontrol_new alc268_capture_mixer[] = {
8242 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8243 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8244 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
8245 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
8247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8248 /* The multiple "Capture Source" controls confuse alsamixer
8249 * So call somewhat different..
8250 * FIXME: the controls appear in the "playback" view!
8252 /* .name = "Capture Source", */
8253 .name = "Input Source",
8255 .info = alc268_mux_enum_info,
8256 .get = alc268_mux_enum_get,
8257 .put = alc268_mux_enum_put,
8262 static struct hda_input_mux alc268_capture_source = {
8266 { "Front Mic", 0x1 },
8272 /* create input playback/capture controls for the given pin */
8273 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
8274 const char *ctlname, int idx)
8279 sprintf(name, "%s Playback Volume", ctlname);
8281 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8282 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
8286 } else if (nid == 0x15) {
8287 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8288 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
8294 sprintf(name, "%s Playback Switch", ctlname);
8295 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
8296 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
8302 /* add playback controls from the parsed DAC table */
8303 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
8304 const struct auto_pin_cfg *cfg)
8309 spec->multiout.num_dacs = 2; /* only use one dac */
8310 spec->multiout.dac_nids = spec->private_dac_nids;
8311 spec->multiout.dac_nids[0] = 2;
8312 spec->multiout.dac_nids[1] = 3;
8314 nid = cfg->line_out_pins[0];
8316 alc268_new_analog_output(spec, nid, "Front", 0);
8318 nid = cfg->speaker_pins[0];
8320 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8321 "Speaker Playback Volume",
8322 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
8326 nid = cfg->hp_pins[0];
8328 alc268_new_analog_output(spec, nid, "Headphone", 0);
8330 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
8332 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8333 "Mono Playback Switch",
8334 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
8341 /* create playback/capture controls for input pins */
8342 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
8343 const struct auto_pin_cfg *cfg)
8345 struct hda_input_mux *imux = &spec->private_imux;
8348 for (i = 0; i < AUTO_PIN_LAST; i++) {
8349 switch(cfg->input_pins[i]) {
8351 idx1 = 0; /* Mic 1 */
8354 idx1 = 1; /* Mic 2 */
8357 idx1 = 2; /* Line In */
8365 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
8366 imux->items[imux->num_items].index = idx1;
8372 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
8374 struct alc_spec *spec = codec->spec;
8375 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
8376 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
8377 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
8378 unsigned int dac_vol1, dac_vol2;
8381 snd_hda_codec_write(codec, speaker_nid, 0,
8382 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
8383 snd_hda_codec_write(codec, 0x0f, 0,
8384 AC_VERB_SET_AMP_GAIN_MUTE,
8386 snd_hda_codec_write(codec, 0x10, 0,
8387 AC_VERB_SET_AMP_GAIN_MUTE,
8390 snd_hda_codec_write(codec, 0x0f, 0,
8391 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8392 snd_hda_codec_write(codec, 0x10, 0,
8393 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8396 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
8397 if (line_nid == 0x14)
8398 dac_vol2 = AMP_OUT_ZERO;
8399 else if (line_nid == 0x15)
8400 dac_vol1 = AMP_OUT_ZERO;
8402 dac_vol2 = AMP_OUT_ZERO;
8403 else if (hp_nid == 0x15)
8404 dac_vol1 = AMP_OUT_ZERO;
8405 if (line_nid != 0x16 || hp_nid != 0x16 ||
8406 spec->autocfg.line_out_pins[1] != 0x16 ||
8407 spec->autocfg.line_out_pins[2] != 0x16)
8408 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
8410 snd_hda_codec_write(codec, 0x02, 0,
8411 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
8412 snd_hda_codec_write(codec, 0x03, 0,
8413 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
8416 /* pcm configuration: identiacal with ALC880 */
8417 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
8418 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
8419 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
8422 * BIOS auto configuration
8424 static int alc268_parse_auto_config(struct hda_codec *codec)
8426 struct alc_spec *spec = codec->spec;
8428 static hda_nid_t alc268_ignore[] = { 0 };
8430 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8434 if (!spec->autocfg.line_outs)
8435 return 0; /* can't find valid BIOS pin config */
8437 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
8440 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
8444 spec->multiout.max_channels = 2;
8446 /* digital only support output */
8447 if (spec->autocfg.dig_out_pin)
8448 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
8450 if (spec->kctl_alloc)
8451 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8453 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
8454 spec->num_mux_defs = 1;
8455 spec->input_mux = &spec->private_imux;
8460 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
8461 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
8462 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
8464 /* init callback for auto-configuration model -- overriding the default init */
8465 static void alc268_auto_init(struct hda_codec *codec)
8467 alc268_auto_init_multi_out(codec);
8468 alc268_auto_init_hp_out(codec);
8469 alc268_auto_init_mono_speaker_out(codec);
8470 alc268_auto_init_analog_input(codec);
8474 * configuration and preset
8476 static const char *alc268_models[ALC268_MODEL_LAST] = {
8477 [ALC268_3ST] = "3stack",
8478 [ALC268_AUTO] = "auto",
8481 static struct snd_pci_quirk alc268_cfg_tbl[] = {
8482 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
8486 static struct alc_config_preset alc268_presets[] = {
8488 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8489 .init_verbs = { alc268_base_init_verbs },
8490 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8491 .dac_nids = alc268_dac_nids,
8492 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8493 .adc_nids = alc268_adc_nids_alt,
8495 .dig_out_nid = ALC268_DIGOUT_NID,
8496 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8497 .channel_mode = alc268_modes,
8498 .input_mux = &alc268_capture_source,
8502 static int patch_alc268(struct hda_codec *codec)
8504 struct alc_spec *spec;
8508 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
8514 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
8518 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
8519 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
8520 "trying auto-probe from BIOS...\n");
8521 board_config = ALC268_AUTO;
8524 if (board_config == ALC268_AUTO) {
8525 /* automatic parse from the BIOS config */
8526 err = alc268_parse_auto_config(codec);
8532 "hda_codec: Cannot set up configuration "
8533 "from BIOS. Using base mode...\n");
8534 board_config = ALC268_3ST;
8538 if (board_config != ALC268_AUTO)
8539 setup_preset(spec, &alc268_presets[board_config]);
8541 spec->stream_name_analog = "ALC268 Analog";
8542 spec->stream_analog_playback = &alc268_pcm_analog_playback;
8543 spec->stream_analog_capture = &alc268_pcm_analog_capture;
8545 spec->stream_name_digital = "ALC268 Digital";
8546 spec->stream_digital_playback = &alc268_pcm_digital_playback;
8548 if (board_config == ALC268_AUTO) {
8549 if (!spec->adc_nids && spec->input_mux) {
8550 /* check whether NID 0x07 is valid */
8551 unsigned int wcap = get_wcaps(codec, 0x07);
8554 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8555 if (wcap != AC_WID_AUD_IN) {
8556 spec->adc_nids = alc268_adc_nids_alt;
8557 spec->num_adc_nids =
8558 ARRAY_SIZE(alc268_adc_nids_alt);
8559 spec->mixers[spec->num_mixers] =
8560 alc268_capture_alt_mixer;
8563 spec->adc_nids = alc268_adc_nids;
8564 spec->num_adc_nids =
8565 ARRAY_SIZE(alc268_adc_nids);
8566 spec->mixers[spec->num_mixers] =
8567 alc268_capture_mixer;
8572 codec->patch_ops = alc_patch_ops;
8573 if (board_config == ALC268_AUTO)
8574 spec->init_hook = alc268_auto_init;
8580 * ALC861 channel source setting (2/6 channel selection for 3-stack)
8584 * set the path ways for 2 channel output
8585 * need to set the codec line out and mic 1 pin widgets to inputs
8587 static struct hda_verb alc861_threestack_ch2_init[] = {
8588 /* set pin widget 1Ah (line in) for input */
8589 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8590 /* set pin widget 18h (mic1/2) for input, for mic also enable
8593 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8595 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8597 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8598 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8604 * need to set the codec line out and mic 1 pin widgets to outputs
8606 static struct hda_verb alc861_threestack_ch6_init[] = {
8607 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8608 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8609 /* set pin widget 18h (mic1) for output (CLFE)*/
8610 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8612 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8613 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8615 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8617 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8618 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8623 static struct hda_channel_mode alc861_threestack_modes[2] = {
8624 { 2, alc861_threestack_ch2_init },
8625 { 6, alc861_threestack_ch6_init },
8627 /* Set mic1 as input and unmute the mixer */
8628 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
8629 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8633 /* Set mic1 as output and mute mixer */
8634 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
8635 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8636 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8640 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
8641 { 2, alc861_uniwill_m31_ch2_init },
8642 { 4, alc861_uniwill_m31_ch4_init },
8645 /* Set mic1 and line-in as input and unmute the mixer */
8646 static struct hda_verb alc861_asus_ch2_init[] = {
8647 /* set pin widget 1Ah (line in) for input */
8648 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8649 /* set pin widget 18h (mic1/2) for input, for mic also enable
8652 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8654 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8656 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8657 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8661 /* Set mic1 nad line-in as output and mute mixer */
8662 static struct hda_verb alc861_asus_ch6_init[] = {
8663 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8664 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8665 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8666 /* set pin widget 18h (mic1) for output (CLFE)*/
8667 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8668 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8669 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8670 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8672 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8674 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8675 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8680 static struct hda_channel_mode alc861_asus_modes[2] = {
8681 { 2, alc861_asus_ch2_init },
8682 { 6, alc861_asus_ch6_init },
8687 static struct snd_kcontrol_new alc861_base_mixer[] = {
8688 /* output mixer control */
8689 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8690 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8691 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8692 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8693 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8695 /*Input mixer control */
8696 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8697 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8698 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8699 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8700 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8701 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8703 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8707 /* Capture mixer control */
8708 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8709 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8711 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8712 .name = "Capture Source",
8714 .info = alc_mux_enum_info,
8715 .get = alc_mux_enum_get,
8716 .put = alc_mux_enum_put,
8721 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
8722 /* output mixer control */
8723 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8724 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8725 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8726 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8727 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8729 /* Input mixer control */
8730 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8731 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8732 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8733 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8734 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8735 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8736 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8737 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8738 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8739 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8741 /* Capture mixer control */
8742 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8743 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8746 .name = "Capture Source",
8748 .info = alc_mux_enum_info,
8749 .get = alc_mux_enum_get,
8750 .put = alc_mux_enum_put,
8753 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8754 .name = "Channel Mode",
8755 .info = alc_ch_mode_info,
8756 .get = alc_ch_mode_get,
8757 .put = alc_ch_mode_put,
8758 .private_value = ARRAY_SIZE(alc861_threestack_modes),
8763 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
8764 /* output mixer control */
8765 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8767 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8769 /*Capture mixer control */
8770 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8771 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8774 .name = "Capture Source",
8776 .info = alc_mux_enum_info,
8777 .get = alc_mux_enum_get,
8778 .put = alc_mux_enum_put,
8784 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
8785 /* output mixer control */
8786 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8787 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8788 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8789 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8790 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8792 /* Input mixer control */
8793 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8794 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8795 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8796 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8797 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8798 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8800 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8804 /* Capture mixer control */
8805 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8806 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8809 .name = "Capture Source",
8811 .info = alc_mux_enum_info,
8812 .get = alc_mux_enum_get,
8813 .put = alc_mux_enum_put,
8816 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8817 .name = "Channel Mode",
8818 .info = alc_ch_mode_info,
8819 .get = alc_ch_mode_get,
8820 .put = alc_ch_mode_put,
8821 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
8826 static struct snd_kcontrol_new alc861_asus_mixer[] = {
8827 /* output mixer control */
8828 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8829 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8830 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8831 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8832 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8834 /* Input mixer control */
8835 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8836 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8838 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8840 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8842 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8843 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8844 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
8846 /* Capture mixer control */
8847 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8848 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8850 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8851 .name = "Capture Source",
8853 .info = alc_mux_enum_info,
8854 .get = alc_mux_enum_get,
8855 .put = alc_mux_enum_put,
8858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8859 .name = "Channel Mode",
8860 .info = alc_ch_mode_info,
8861 .get = alc_ch_mode_get,
8862 .put = alc_ch_mode_put,
8863 .private_value = ARRAY_SIZE(alc861_asus_modes),
8868 /* additional mixer */
8869 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
8870 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8871 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8872 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
8873 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
8878 * generic initialization of ADC, input mixers and output mixers
8880 static struct hda_verb alc861_base_init_verbs[] = {
8882 * Unmute ADC0 and set the default input to mic-in
8884 /* port-A for surround (rear panel) */
8885 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8886 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
8887 /* port-B for mic-in (rear panel) with vref */
8888 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8889 /* port-C for line-in (rear panel) */
8890 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8891 /* port-D for Front */
8892 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8893 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
8894 /* port-E for HP out (front panel) */
8895 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8896 /* route front PCM to HP */
8897 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8898 /* port-F for mic-in (front panel) with vref */
8899 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8900 /* port-G for CLFE (rear panel) */
8901 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8902 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8903 /* port-H for side (rear panel) */
8904 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8905 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
8907 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8908 /* route front mic to ADC1*/
8909 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8912 /* Unmute DAC0~3 & spdif out*/
8913 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8914 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8915 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8916 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8919 /* Unmute Mixer 14 (mic) 1c (Line in)*/
8920 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8921 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8922 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8923 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8925 /* Unmute Stereo Mixer 15 */
8926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
8931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8932 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8933 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8934 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8935 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8936 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8937 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8938 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8939 /* hp used DAC 3 (Front) */
8940 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8941 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8946 static struct hda_verb alc861_threestack_init_verbs[] = {
8948 * Unmute ADC0 and set the default input to mic-in
8950 /* port-A for surround (rear panel) */
8951 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8952 /* port-B for mic-in (rear panel) with vref */
8953 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8954 /* port-C for line-in (rear panel) */
8955 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8956 /* port-D for Front */
8957 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8958 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
8959 /* port-E for HP out (front panel) */
8960 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8961 /* route front PCM to HP */
8962 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
8963 /* port-F for mic-in (front panel) with vref */
8964 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8965 /* port-G for CLFE (rear panel) */
8966 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8967 /* port-H for side (rear panel) */
8968 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8970 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8971 /* route front mic to ADC1*/
8972 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8974 /* Unmute DAC0~3 & spdif out*/
8975 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8976 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8977 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8978 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8981 /* Unmute Mixer 14 (mic) 1c (Line in)*/
8982 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8983 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8984 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8985 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8987 /* Unmute Stereo Mixer 15 */
8988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
8993 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8995 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8996 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8997 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8998 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8999 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9000 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9001 /* hp used DAC 3 (Front) */
9002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9007 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
9009 * Unmute ADC0 and set the default input to mic-in
9011 /* port-A for surround (rear panel) */
9012 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9013 /* port-B for mic-in (rear panel) with vref */
9014 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9015 /* port-C for line-in (rear panel) */
9016 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9017 /* port-D for Front */
9018 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9019 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9020 /* port-E for HP out (front panel) */
9021 /* this has to be set to VREF80 */
9022 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9023 /* route front PCM to HP */
9024 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9025 /* port-F for mic-in (front panel) with vref */
9026 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9027 /* port-G for CLFE (rear panel) */
9028 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9029 /* port-H for side (rear panel) */
9030 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9032 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9033 /* route front mic to ADC1*/
9034 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9036 /* Unmute DAC0~3 & spdif out*/
9037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9038 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9039 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9040 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9043 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9044 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9045 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9046 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9047 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9049 /* Unmute Stereo Mixer 15 */
9050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9058 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9063 /* hp used DAC 3 (Front) */
9064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9065 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9069 static struct hda_verb alc861_asus_init_verbs[] = {
9071 * Unmute ADC0 and set the default input to mic-in
9073 /* port-A for surround (rear panel)
9074 * according to codec#0 this is the HP jack
9076 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
9077 /* route front PCM to HP */
9078 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
9079 /* port-B for mic-in (rear panel) with vref */
9080 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9081 /* port-C for line-in (rear panel) */
9082 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9083 /* port-D for Front */
9084 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9085 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9086 /* port-E for HP out (front panel) */
9087 /* this has to be set to VREF80 */
9088 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9089 /* route front PCM to HP */
9090 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9091 /* port-F for mic-in (front panel) with vref */
9092 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9093 /* port-G for CLFE (rear panel) */
9094 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9095 /* port-H for side (rear panel) */
9096 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9098 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9099 /* route front mic to ADC1*/
9100 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9101 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9102 /* Unmute DAC0~3 & spdif out*/
9103 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9104 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9105 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9106 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9108 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9109 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9110 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9111 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9112 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9114 /* Unmute Stereo Mixer 15 */
9115 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9120 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9121 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9122 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9123 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9125 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9127 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9128 /* hp used DAC 3 (Front) */
9129 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9130 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9134 /* additional init verbs for ASUS laptops */
9135 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
9136 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
9137 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
9142 * generic initialization of ADC, input mixers and output mixers
9144 static struct hda_verb alc861_auto_init_verbs[] = {
9146 * Unmute ADC0 and set the default input to mic-in
9148 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
9149 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9151 /* Unmute DAC0~3 & spdif out*/
9152 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9153 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9154 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9155 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9158 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9159 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9160 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9161 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9162 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9164 /* Unmute Stereo Mixer 15 */
9165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9166 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9168 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
9170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9171 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9172 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9173 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9175 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9176 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9177 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9179 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9180 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9184 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9185 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9188 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
9193 static struct hda_verb alc861_toshiba_init_verbs[] = {
9194 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9199 /* toggle speaker-output according to the hp-jack state */
9200 static void alc861_toshiba_automute(struct hda_codec *codec)
9202 unsigned int present;
9204 present = snd_hda_codec_read(codec, 0x0f, 0,
9205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9206 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0,
9207 0x80, present ? 0x80 : 0);
9208 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0,
9209 0x80, present ? 0x80 : 0);
9210 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3,
9211 0x80, present ? 0 : 0x80);
9212 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3,
9213 0x80, present ? 0 : 0x80);
9216 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
9219 if ((res >> 26) == ALC880_HP_EVENT)
9220 alc861_toshiba_automute(codec);
9223 /* pcm configuration: identiacal with ALC880 */
9224 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
9225 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
9226 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
9227 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
9230 #define ALC861_DIGOUT_NID 0x07
9232 static struct hda_channel_mode alc861_8ch_modes[1] = {
9236 static hda_nid_t alc861_dac_nids[4] = {
9237 /* front, surround, clfe, side */
9238 0x03, 0x06, 0x05, 0x04
9241 static hda_nid_t alc660_dac_nids[3] = {
9242 /* front, clfe, surround */
9246 static hda_nid_t alc861_adc_nids[1] = {
9251 static struct hda_input_mux alc861_capture_source = {
9255 { "Front Mic", 0x3 },
9262 /* fill in the dac_nids table from the parsed pin configuration */
9263 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
9264 const struct auto_pin_cfg *cfg)
9269 spec->multiout.dac_nids = spec->private_dac_nids;
9270 for (i = 0; i < cfg->line_outs; i++) {
9271 nid = cfg->line_out_pins[i];
9273 if (i >= ARRAY_SIZE(alc861_dac_nids))
9275 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
9278 spec->multiout.num_dacs = cfg->line_outs;
9282 /* add playback controls from the parsed DAC table */
9283 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
9284 const struct auto_pin_cfg *cfg)
9287 static const char *chname[4] = {
9288 "Front", "Surround", NULL /*CLFE*/, "Side"
9293 for (i = 0; i < cfg->line_outs; i++) {
9294 nid = spec->multiout.dac_nids[i];
9299 err = add_control(spec, ALC_CTL_BIND_MUTE,
9300 "Center Playback Switch",
9301 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
9305 err = add_control(spec, ALC_CTL_BIND_MUTE,
9306 "LFE Playback Switch",
9307 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9312 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
9314 if (nid == alc861_dac_nids[idx])
9316 sprintf(name, "%s Playback Switch", chname[idx]);
9317 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
9318 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9327 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
9335 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
9337 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9338 "Headphone Playback Switch",
9339 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9342 spec->multiout.hp_nid = nid;
9347 /* create playback/capture controls for input pins */
9348 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
9349 const struct auto_pin_cfg *cfg)
9351 struct hda_input_mux *imux = &spec->private_imux;
9352 int i, err, idx, idx1;
9354 for (i = 0; i < AUTO_PIN_LAST; i++) {
9355 switch (cfg->input_pins[i]) {
9358 idx = 2; /* Line In */
9362 idx = 2; /* Line In */
9366 idx = 1; /* Mic In */
9370 idx = 1; /* Mic In */
9380 err = new_analog_input(spec, cfg->input_pins[i],
9381 auto_pin_cfg_labels[i], idx, 0x15);
9385 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9386 imux->items[imux->num_items].index = idx1;
9392 static struct snd_kcontrol_new alc861_capture_mixer[] = {
9393 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9394 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9397 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9398 /* The multiple "Capture Source" controls confuse alsamixer
9399 * So call somewhat different..
9400 *FIXME: the controls appear in the "playback" view!
9402 /* .name = "Capture Source", */
9403 .name = "Input Source",
9405 .info = alc_mux_enum_info,
9406 .get = alc_mux_enum_get,
9407 .put = alc_mux_enum_put,
9412 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
9414 int pin_type, int dac_idx)
9418 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9420 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9425 static void alc861_auto_init_multi_out(struct hda_codec *codec)
9427 struct alc_spec *spec = codec->spec;
9430 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
9431 for (i = 0; i < spec->autocfg.line_outs; i++) {
9432 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9433 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9435 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
9436 spec->multiout.dac_nids[i]);
9440 static void alc861_auto_init_hp_out(struct hda_codec *codec)
9442 struct alc_spec *spec = codec->spec;
9445 pin = spec->autocfg.hp_pins[0];
9446 if (pin) /* connect to front */
9447 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
9448 spec->multiout.dac_nids[0]);
9451 static void alc861_auto_init_analog_input(struct hda_codec *codec)
9453 struct alc_spec *spec = codec->spec;
9456 for (i = 0; i < AUTO_PIN_LAST; i++) {
9457 hda_nid_t nid = spec->autocfg.input_pins[i];
9458 if (nid >= 0x0c && nid <= 0x11) {
9459 snd_hda_codec_write(codec, nid, 0,
9460 AC_VERB_SET_PIN_WIDGET_CONTROL,
9461 i <= AUTO_PIN_FRONT_MIC ?
9462 PIN_VREF80 : PIN_IN);
9467 /* parse the BIOS configuration and set up the alc_spec */
9468 /* return 1 if successful, 0 if the proper config is not found,
9469 * or a negative error code
9471 static int alc861_parse_auto_config(struct hda_codec *codec)
9473 struct alc_spec *spec = codec->spec;
9475 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9477 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9481 if (!spec->autocfg.line_outs)
9482 return 0; /* can't find valid BIOS pin config */
9484 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
9487 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
9490 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
9493 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
9497 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9499 if (spec->autocfg.dig_out_pin)
9500 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
9502 if (spec->kctl_alloc)
9503 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9505 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
9507 spec->num_mux_defs = 1;
9508 spec->input_mux = &spec->private_imux;
9510 spec->adc_nids = alc861_adc_nids;
9511 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
9512 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
9518 /* additional initialization for auto-configuration model */
9519 static void alc861_auto_init(struct hda_codec *codec)
9521 alc861_auto_init_multi_out(codec);
9522 alc861_auto_init_hp_out(codec);
9523 alc861_auto_init_analog_input(codec);
9528 * configuration and preset
9530 static const char *alc861_models[ALC861_MODEL_LAST] = {
9531 [ALC861_3ST] = "3stack",
9532 [ALC660_3ST] = "3stack-660",
9533 [ALC861_3ST_DIG] = "3stack-dig",
9534 [ALC861_6ST_DIG] = "6stack-dig",
9535 [ALC861_UNIWILL_M31] = "uniwill-m31",
9536 [ALC861_TOSHIBA] = "toshiba",
9537 [ALC861_ASUS] = "asus",
9538 [ALC861_ASUS_LAPTOP] = "asus-laptop",
9539 [ALC861_AUTO] = "auto",
9542 static struct snd_pci_quirk alc861_cfg_tbl[] = {
9543 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
9544 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9545 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9546 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
9547 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
9548 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
9549 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
9550 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
9551 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
9552 * Any other models that need this preset?
9554 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
9555 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
9556 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
9557 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
9558 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
9559 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
9563 static struct alc_config_preset alc861_presets[] = {
9565 .mixers = { alc861_3ST_mixer },
9566 .init_verbs = { alc861_threestack_init_verbs },
9567 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9568 .dac_nids = alc861_dac_nids,
9569 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9570 .channel_mode = alc861_threestack_modes,
9572 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9573 .adc_nids = alc861_adc_nids,
9574 .input_mux = &alc861_capture_source,
9576 [ALC861_3ST_DIG] = {
9577 .mixers = { alc861_base_mixer },
9578 .init_verbs = { alc861_threestack_init_verbs },
9579 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9580 .dac_nids = alc861_dac_nids,
9581 .dig_out_nid = ALC861_DIGOUT_NID,
9582 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9583 .channel_mode = alc861_threestack_modes,
9585 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9586 .adc_nids = alc861_adc_nids,
9587 .input_mux = &alc861_capture_source,
9589 [ALC861_6ST_DIG] = {
9590 .mixers = { alc861_base_mixer },
9591 .init_verbs = { alc861_base_init_verbs },
9592 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9593 .dac_nids = alc861_dac_nids,
9594 .dig_out_nid = ALC861_DIGOUT_NID,
9595 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
9596 .channel_mode = alc861_8ch_modes,
9597 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9598 .adc_nids = alc861_adc_nids,
9599 .input_mux = &alc861_capture_source,
9602 .mixers = { alc861_3ST_mixer },
9603 .init_verbs = { alc861_threestack_init_verbs },
9604 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
9605 .dac_nids = alc660_dac_nids,
9606 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9607 .channel_mode = alc861_threestack_modes,
9609 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9610 .adc_nids = alc861_adc_nids,
9611 .input_mux = &alc861_capture_source,
9613 [ALC861_UNIWILL_M31] = {
9614 .mixers = { alc861_uniwill_m31_mixer },
9615 .init_verbs = { alc861_uniwill_m31_init_verbs },
9616 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9617 .dac_nids = alc861_dac_nids,
9618 .dig_out_nid = ALC861_DIGOUT_NID,
9619 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
9620 .channel_mode = alc861_uniwill_m31_modes,
9622 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9623 .adc_nids = alc861_adc_nids,
9624 .input_mux = &alc861_capture_source,
9626 [ALC861_TOSHIBA] = {
9627 .mixers = { alc861_toshiba_mixer },
9628 .init_verbs = { alc861_base_init_verbs,
9629 alc861_toshiba_init_verbs },
9630 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9631 .dac_nids = alc861_dac_nids,
9632 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9633 .channel_mode = alc883_3ST_2ch_modes,
9634 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9635 .adc_nids = alc861_adc_nids,
9636 .input_mux = &alc861_capture_source,
9637 .unsol_event = alc861_toshiba_unsol_event,
9638 .init_hook = alc861_toshiba_automute,
9641 .mixers = { alc861_asus_mixer },
9642 .init_verbs = { alc861_asus_init_verbs },
9643 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9644 .dac_nids = alc861_dac_nids,
9645 .dig_out_nid = ALC861_DIGOUT_NID,
9646 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
9647 .channel_mode = alc861_asus_modes,
9650 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9651 .adc_nids = alc861_adc_nids,
9652 .input_mux = &alc861_capture_source,
9654 [ALC861_ASUS_LAPTOP] = {
9655 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
9656 .init_verbs = { alc861_asus_init_verbs,
9657 alc861_asus_laptop_init_verbs },
9658 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9659 .dac_nids = alc861_dac_nids,
9660 .dig_out_nid = ALC861_DIGOUT_NID,
9661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9662 .channel_mode = alc883_3ST_2ch_modes,
9664 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9665 .adc_nids = alc861_adc_nids,
9666 .input_mux = &alc861_capture_source,
9671 static int patch_alc861(struct hda_codec *codec)
9673 struct alc_spec *spec;
9677 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9683 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
9687 if (board_config < 0) {
9688 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
9689 "trying auto-probe from BIOS...\n");
9690 board_config = ALC861_AUTO;
9693 if (board_config == ALC861_AUTO) {
9694 /* automatic parse from the BIOS config */
9695 err = alc861_parse_auto_config(codec);
9701 "hda_codec: Cannot set up configuration "
9702 "from BIOS. Using base mode...\n");
9703 board_config = ALC861_3ST_DIG;
9707 if (board_config != ALC861_AUTO)
9708 setup_preset(spec, &alc861_presets[board_config]);
9710 spec->stream_name_analog = "ALC861 Analog";
9711 spec->stream_analog_playback = &alc861_pcm_analog_playback;
9712 spec->stream_analog_capture = &alc861_pcm_analog_capture;
9714 spec->stream_name_digital = "ALC861 Digital";
9715 spec->stream_digital_playback = &alc861_pcm_digital_playback;
9716 spec->stream_digital_capture = &alc861_pcm_digital_capture;
9718 codec->patch_ops = alc_patch_ops;
9719 if (board_config == ALC861_AUTO)
9720 spec->init_hook = alc861_auto_init;
9730 * In addition, an independent DAC
9732 #define ALC861VD_DIGOUT_NID 0x06
9734 static hda_nid_t alc861vd_dac_nids[4] = {
9735 /* front, surr, clfe, side surr */
9736 0x02, 0x03, 0x04, 0x05
9739 /* dac_nids for ALC660vd are in a different order - according to
9741 * This should probably tesult in a different mixer for 6stack models
9742 * of ALC660vd codecs, but for now there is only 3stack mixer
9743 * - and it is the same as in 861vd.
9744 * adc_nids in ALC660vd are (is) the same as in 861vd
9746 static hda_nid_t alc660vd_dac_nids[3] = {
9747 /* front, rear, clfe, rear_surr */
9751 static hda_nid_t alc861vd_adc_nids[1] = {
9757 /* FIXME: should be a matrix-type input source selection */
9758 static struct hda_input_mux alc861vd_capture_source = {
9762 { "Front Mic", 0x1 },
9768 static struct hda_input_mux alc861vd_dallas_capture_source = {
9771 { "Front Mic", 0x0 },
9772 { "ATAPI Mic", 0x1 },
9777 #define alc861vd_mux_enum_info alc_mux_enum_info
9778 #define alc861vd_mux_enum_get alc_mux_enum_get
9780 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
9781 struct snd_ctl_elem_value *ucontrol)
9783 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9784 struct alc_spec *spec = codec->spec;
9785 const struct hda_input_mux *imux = spec->input_mux;
9786 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9787 static hda_nid_t capture_mixers[1] = { 0x22 };
9788 hda_nid_t nid = capture_mixers[adc_idx];
9789 unsigned int *cur_val = &spec->cur_mux[adc_idx];
9790 unsigned int i, idx;
9792 idx = ucontrol->value.enumerated.item[0];
9793 if (idx >= imux->num_items)
9794 idx = imux->num_items - 1;
9795 if (*cur_val == idx && !codec->in_resume)
9797 for (i = 0; i < imux->num_items; i++) {
9798 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
9799 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9800 v | (imux->items[i].index << 8));
9809 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
9816 static struct hda_verb alc861vd_6stack_ch6_init[] = {
9817 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9818 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9819 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9820 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9827 static struct hda_verb alc861vd_6stack_ch8_init[] = {
9828 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9829 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9830 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9831 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9835 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
9836 { 6, alc861vd_6stack_ch6_init },
9837 { 8, alc861vd_6stack_ch8_init },
9840 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
9842 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9843 .name = "Channel Mode",
9844 .info = alc_ch_mode_info,
9845 .get = alc_ch_mode_get,
9846 .put = alc_ch_mode_put,
9851 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
9852 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9853 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9857 /* The multiple "Capture Source" controls confuse alsamixer
9858 * So call somewhat different..
9859 *FIXME: the controls appear in the "playback" view!
9861 /* .name = "Capture Source", */
9862 .name = "Input Source",
9864 .info = alc861vd_mux_enum_info,
9865 .get = alc861vd_mux_enum_get,
9866 .put = alc861vd_mux_enum_put,
9871 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
9872 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
9874 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
9875 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9876 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9878 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9879 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
9883 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
9885 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9886 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9888 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
9889 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9891 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9895 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9897 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9901 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9902 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9904 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9905 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9907 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
9908 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
9913 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
9914 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9915 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9919 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9923 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9933 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
9934 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
9939 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
9940 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9941 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
9942 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9946 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9948 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9950 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9951 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9954 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9955 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9960 /* Pin assignment: Front=0x14, HP = 0x15,
9961 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
9963 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
9964 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
9965 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
9967 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
9968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9970 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9971 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9972 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
9973 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
9974 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
9975 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
9977 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9978 /* .name = "Capture Source", */
9979 .name = "Input Source",
9981 .info = alc882_mux_enum_info,
9982 .get = alc882_mux_enum_get,
9983 .put = alc882_mux_enum_put,
9989 * generic initialization of ADC, input mixers and output mixers
9991 static struct hda_verb alc861vd_volume_init_verbs[] = {
9993 * Unmute ADC0 and set the default input to mic-in
9995 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9998 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
9999 * the analog-loopback mixer widget
10001 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10008 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10015 * Set up output mixers (0x02 - 0x05)
10017 /* set vol=0 to output mixers */
10018 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10019 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10020 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10021 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10023 /* set up input amps for analog loopback */
10024 /* Amp Indices: DAC = 0, mixer = 1 */
10025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10031 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10032 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10038 * 3-stack pin configuration:
10039 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10041 static struct hda_verb alc861vd_3stack_init_verbs[] = {
10043 * Set pin mode and muting
10045 /* set front pin widgets 0x14 for output */
10046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10048 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10050 /* Mic (rear) pin: input vref at 80% */
10051 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10052 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10053 /* Front Mic pin: input vref at 80% */
10054 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10056 /* Line In pin: input */
10057 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10058 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10059 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10060 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10062 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10063 /* CD pin widget for input */
10064 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10070 * 6-stack pin configuration:
10072 static struct hda_verb alc861vd_6stack_init_verbs[] = {
10074 * Set pin mode and muting
10076 /* set front pin widgets 0x14 for output */
10077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10078 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10079 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10081 /* Rear Pin: output 1 (0x0d) */
10082 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10084 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10085 /* CLFE Pin: output 2 (0x0e) */
10086 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10087 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10088 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
10089 /* Side Pin: output 3 (0x0f) */
10090 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10091 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10092 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
10094 /* Mic (rear) pin: input vref at 80% */
10095 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10096 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10097 /* Front Mic pin: input vref at 80% */
10098 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10099 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10100 /* Line In pin: input */
10101 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10102 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10103 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10104 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10105 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10106 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10107 /* CD pin widget for input */
10108 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10113 static struct hda_verb alc861vd_eapd_verbs[] = {
10114 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10118 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
10119 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10120 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10122 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10123 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10127 /* toggle speaker-output according to the hp-jack state */
10128 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10130 unsigned int present;
10131 unsigned char bits;
10133 present = snd_hda_codec_read(codec, 0x1b, 0,
10134 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10135 bits = present ? 0x80 : 0;
10136 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10138 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10142 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10144 unsigned int present;
10145 unsigned char bits;
10147 present = snd_hda_codec_read(codec, 0x18, 0,
10148 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10149 bits = present ? 0x80 : 0;
10150 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1,
10152 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
10156 static void alc861vd_lenovo_automute(struct hda_codec *codec)
10158 alc861vd_lenovo_hp_automute(codec);
10159 alc861vd_lenovo_mic_automute(codec);
10162 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
10165 switch (res >> 26) {
10166 case ALC880_HP_EVENT:
10167 alc861vd_lenovo_hp_automute(codec);
10169 case ALC880_MIC_EVENT:
10170 alc861vd_lenovo_mic_automute(codec);
10175 static struct hda_verb alc861vd_dallas_verbs[] = {
10176 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10177 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10178 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10179 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10184 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10185 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10186 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10187 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10188 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10191 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10194 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10195 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10196 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10197 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10201 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10202 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10204 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10205 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10206 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10211 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10213 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10214 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10215 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10220 /* toggle speaker-output according to the hp-jack state */
10221 static void alc861vd_dallas_automute(struct hda_codec *codec)
10223 unsigned int present;
10225 present = snd_hda_codec_read(codec, 0x15, 0,
10226 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10227 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
10228 0x80, present ? 0x80 : 0);
10229 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10230 0x80, present ? 0x80 : 0);
10233 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
10235 if ((res >> 26) == ALC880_HP_EVENT)
10236 alc861vd_dallas_automute(codec);
10239 /* pcm configuration: identiacal with ALC880 */
10240 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
10241 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
10242 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
10243 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
10246 * configuration and preset
10248 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
10249 [ALC660VD_3ST] = "3stack-660",
10250 [ALC660VD_3ST_DIG]= "3stack-660-digout",
10251 [ALC861VD_3ST] = "3stack",
10252 [ALC861VD_3ST_DIG] = "3stack-digout",
10253 [ALC861VD_6ST_DIG] = "6stack-digout",
10254 [ALC861VD_LENOVO] = "lenovo",
10255 [ALC861VD_DALLAS] = "dallas",
10256 [ALC861VD_AUTO] = "auto",
10259 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
10260 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
10261 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
10262 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
10263 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
10264 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
10266 SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),
10267 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
10268 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
10269 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
10270 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
10274 static struct alc_config_preset alc861vd_presets[] = {
10276 .mixers = { alc861vd_3st_mixer },
10277 .init_verbs = { alc861vd_volume_init_verbs,
10278 alc861vd_3stack_init_verbs },
10279 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10280 .dac_nids = alc660vd_dac_nids,
10281 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10282 .adc_nids = alc861vd_adc_nids,
10283 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10284 .channel_mode = alc861vd_3stack_2ch_modes,
10285 .input_mux = &alc861vd_capture_source,
10287 [ALC660VD_3ST_DIG] = {
10288 .mixers = { alc861vd_3st_mixer },
10289 .init_verbs = { alc861vd_volume_init_verbs,
10290 alc861vd_3stack_init_verbs },
10291 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10292 .dac_nids = alc660vd_dac_nids,
10293 .dig_out_nid = ALC861VD_DIGOUT_NID,
10294 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10295 .adc_nids = alc861vd_adc_nids,
10296 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10297 .channel_mode = alc861vd_3stack_2ch_modes,
10298 .input_mux = &alc861vd_capture_source,
10301 .mixers = { alc861vd_3st_mixer },
10302 .init_verbs = { alc861vd_volume_init_verbs,
10303 alc861vd_3stack_init_verbs },
10304 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10305 .dac_nids = alc861vd_dac_nids,
10306 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10307 .channel_mode = alc861vd_3stack_2ch_modes,
10308 .input_mux = &alc861vd_capture_source,
10310 [ALC861VD_3ST_DIG] = {
10311 .mixers = { alc861vd_3st_mixer },
10312 .init_verbs = { alc861vd_volume_init_verbs,
10313 alc861vd_3stack_init_verbs },
10314 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10315 .dac_nids = alc861vd_dac_nids,
10316 .dig_out_nid = ALC861VD_DIGOUT_NID,
10317 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10318 .channel_mode = alc861vd_3stack_2ch_modes,
10319 .input_mux = &alc861vd_capture_source,
10321 [ALC861VD_6ST_DIG] = {
10322 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
10323 .init_verbs = { alc861vd_volume_init_verbs,
10324 alc861vd_6stack_init_verbs },
10325 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10326 .dac_nids = alc861vd_dac_nids,
10327 .dig_out_nid = ALC861VD_DIGOUT_NID,
10328 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
10329 .channel_mode = alc861vd_6stack_modes,
10330 .input_mux = &alc861vd_capture_source,
10332 [ALC861VD_LENOVO] = {
10333 .mixers = { alc861vd_lenovo_mixer },
10334 .init_verbs = { alc861vd_volume_init_verbs,
10335 alc861vd_3stack_init_verbs,
10336 alc861vd_eapd_verbs,
10337 alc861vd_lenovo_unsol_verbs },
10338 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10339 .dac_nids = alc660vd_dac_nids,
10340 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10341 .adc_nids = alc861vd_adc_nids,
10342 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10343 .channel_mode = alc861vd_3stack_2ch_modes,
10344 .input_mux = &alc861vd_capture_source,
10345 .unsol_event = alc861vd_lenovo_unsol_event,
10346 .init_hook = alc861vd_lenovo_automute,
10348 [ALC861VD_DALLAS] = {
10349 .mixers = { alc861vd_dallas_mixer },
10350 .init_verbs = { alc861vd_dallas_verbs },
10351 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10352 .dac_nids = alc861vd_dac_nids,
10353 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10354 .adc_nids = alc861vd_adc_nids,
10355 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10356 .channel_mode = alc861vd_3stack_2ch_modes,
10357 .input_mux = &alc861vd_dallas_capture_source,
10358 .unsol_event = alc861vd_dallas_unsol_event,
10359 .init_hook = alc861vd_dallas_automute,
10364 * BIOS auto configuration
10366 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
10367 hda_nid_t nid, int pin_type, int dac_idx)
10369 /* set as output */
10370 snd_hda_codec_write(codec, nid, 0,
10371 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
10372 snd_hda_codec_write(codec, nid, 0,
10373 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
10376 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
10378 struct alc_spec *spec = codec->spec;
10381 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
10382 for (i = 0; i <= HDA_SIDE; i++) {
10383 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10384 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10386 alc861vd_auto_set_output_and_unmute(codec, nid,
10392 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
10394 struct alc_spec *spec = codec->spec;
10397 pin = spec->autocfg.hp_pins[0];
10398 if (pin) /* connect to front and use dac 0 */
10399 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10402 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
10403 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
10405 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
10407 struct alc_spec *spec = codec->spec;
10410 for (i = 0; i < AUTO_PIN_LAST; i++) {
10411 hda_nid_t nid = spec->autocfg.input_pins[i];
10412 if (alc861vd_is_input_pin(nid)) {
10413 snd_hda_codec_write(codec, nid, 0,
10414 AC_VERB_SET_PIN_WIDGET_CONTROL,
10415 i <= AUTO_PIN_FRONT_MIC ?
10416 PIN_VREF80 : PIN_IN);
10417 if (nid != ALC861VD_PIN_CD_NID)
10418 snd_hda_codec_write(codec, nid, 0,
10419 AC_VERB_SET_AMP_GAIN_MUTE,
10425 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
10426 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
10428 /* add playback controls from the parsed DAC table */
10429 /* Based on ALC880 version. But ALC861VD has separate,
10430 * different NIDs for mute/unmute switch and volume control */
10431 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10432 const struct auto_pin_cfg *cfg)
10435 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
10436 hda_nid_t nid_v, nid_s;
10439 for (i = 0; i < cfg->line_outs; i++) {
10440 if (!spec->multiout.dac_nids[i])
10442 nid_v = alc861vd_idx_to_mixer_vol(
10444 spec->multiout.dac_nids[i]));
10445 nid_s = alc861vd_idx_to_mixer_switch(
10447 spec->multiout.dac_nids[i]));
10451 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10452 "Center Playback Volume",
10453 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
10457 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10458 "LFE Playback Volume",
10459 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
10463 err = add_control(spec, ALC_CTL_BIND_MUTE,
10464 "Center Playback Switch",
10465 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
10469 err = add_control(spec, ALC_CTL_BIND_MUTE,
10470 "LFE Playback Switch",
10471 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
10476 sprintf(name, "%s Playback Volume", chname[i]);
10477 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10478 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
10482 sprintf(name, "%s Playback Switch", chname[i]);
10483 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10484 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
10493 /* add playback controls for speaker and HP outputs */
10494 /* Based on ALC880 version. But ALC861VD has separate,
10495 * different NIDs for mute/unmute switch and volume control */
10496 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
10497 hda_nid_t pin, const char *pfx)
10499 hda_nid_t nid_v, nid_s;
10506 if (alc880_is_fixed_pin(pin)) {
10507 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
10508 /* specify the DAC as the extra output */
10509 if (!spec->multiout.hp_nid)
10510 spec->multiout.hp_nid = nid_v;
10512 spec->multiout.extra_out_nid[0] = nid_v;
10513 /* control HP volume/switch on the output mixer amp */
10514 nid_v = alc861vd_idx_to_mixer_vol(
10515 alc880_fixed_pin_idx(pin));
10516 nid_s = alc861vd_idx_to_mixer_switch(
10517 alc880_fixed_pin_idx(pin));
10519 sprintf(name, "%s Playback Volume", pfx);
10520 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10521 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
10524 sprintf(name, "%s Playback Switch", pfx);
10525 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10526 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
10529 } else if (alc880_is_multi_pin(pin)) {
10530 /* set manual connection */
10531 /* we have only a switch on HP-out PIN */
10532 sprintf(name, "%s Playback Switch", pfx);
10533 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10534 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
10541 /* parse the BIOS configuration and set up the alc_spec
10542 * return 1 if successful, 0 if the proper config is not found,
10543 * or a negative error code
10544 * Based on ALC880 version - had to change it to override
10545 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
10546 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10548 struct alc_spec *spec = codec->spec;
10550 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10552 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10556 if (!spec->autocfg.line_outs)
10557 return 0; /* can't find valid BIOS pin config */
10559 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10562 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10565 err = alc861vd_auto_create_extra_out(spec,
10566 spec->autocfg.speaker_pins[0],
10570 err = alc861vd_auto_create_extra_out(spec,
10571 spec->autocfg.hp_pins[0],
10575 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
10579 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10581 if (spec->autocfg.dig_out_pin)
10582 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
10584 if (spec->kctl_alloc)
10585 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10587 spec->init_verbs[spec->num_init_verbs++]
10588 = alc861vd_volume_init_verbs;
10590 spec->num_mux_defs = 1;
10591 spec->input_mux = &spec->private_imux;
10596 /* additional initialization for auto-configuration model */
10597 static void alc861vd_auto_init(struct hda_codec *codec)
10599 alc861vd_auto_init_multi_out(codec);
10600 alc861vd_auto_init_hp_out(codec);
10601 alc861vd_auto_init_analog_input(codec);
10604 static int patch_alc861vd(struct hda_codec *codec)
10606 struct alc_spec *spec;
10607 int err, board_config;
10609 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10613 codec->spec = spec;
10615 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
10619 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
10620 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
10621 "ALC861VD, trying auto-probe from BIOS...\n");
10622 board_config = ALC861VD_AUTO;
10625 if (board_config == ALC861VD_AUTO) {
10626 /* automatic parse from the BIOS config */
10627 err = alc861vd_parse_auto_config(codec);
10633 "hda_codec: Cannot set up configuration "
10634 "from BIOS. Using base mode...\n");
10635 board_config = ALC861VD_3ST;
10639 if (board_config != ALC861VD_AUTO)
10640 setup_preset(spec, &alc861vd_presets[board_config]);
10642 spec->stream_name_analog = "ALC861VD Analog";
10643 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
10644 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
10646 spec->stream_name_digital = "ALC861VD Digital";
10647 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
10648 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
10650 spec->adc_nids = alc861vd_adc_nids;
10651 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
10653 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
10654 spec->num_mixers++;
10656 codec->patch_ops = alc_patch_ops;
10658 if (board_config == ALC861VD_AUTO)
10659 spec->init_hook = alc861vd_auto_init;
10667 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10668 * configuration. Each pin widget can choose any input DACs and a mixer.
10669 * Each ADC is connected from a mixer of all inputs. This makes possible
10670 * 6-channel independent captures.
10672 * In addition, an independent DAC for the multi-playback (not used in this
10675 #define ALC662_DIGOUT_NID 0x06
10676 #define ALC662_DIGIN_NID 0x0a
10678 static hda_nid_t alc662_dac_nids[4] = {
10679 /* front, rear, clfe, rear_surr */
10683 static hda_nid_t alc662_adc_nids[1] = {
10688 /* FIXME: should be a matrix-type input source selection */
10690 static struct hda_input_mux alc662_capture_source = {
10694 { "Front Mic", 0x1 },
10700 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
10707 #define alc662_mux_enum_info alc_mux_enum_info
10708 #define alc662_mux_enum_get alc_mux_enum_get
10710 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
10711 struct snd_ctl_elem_value *ucontrol)
10713 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10714 struct alc_spec *spec = codec->spec;
10715 const struct hda_input_mux *imux = spec->input_mux;
10716 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
10717 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
10718 hda_nid_t nid = capture_mixers[adc_idx];
10719 unsigned int *cur_val = &spec->cur_mux[adc_idx];
10720 unsigned int i, idx;
10722 idx = ucontrol->value.enumerated.item[0];
10723 if (idx >= imux->num_items)
10724 idx = imux->num_items - 1;
10725 if (*cur_val == idx && !codec->in_resume)
10727 for (i = 0; i < imux->num_items; i++) {
10728 unsigned int v = (i == idx) ? 0x7000 : 0x7080;
10729 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
10730 v | (imux->items[i].index << 8));
10738 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
10745 static struct hda_verb alc662_3ST_ch2_init[] = {
10746 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
10747 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10748 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
10749 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10756 static struct hda_verb alc662_3ST_ch6_init[] = {
10757 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10758 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10759 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
10760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10761 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10762 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
10766 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
10767 { 2, alc662_3ST_ch2_init },
10768 { 6, alc662_3ST_ch6_init },
10774 static struct hda_verb alc662_sixstack_ch6_init[] = {
10775 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10776 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10777 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10784 static struct hda_verb alc662_sixstack_ch8_init[] = {
10785 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10786 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10787 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10791 static struct hda_channel_mode alc662_5stack_modes[2] = {
10792 { 2, alc662_sixstack_ch6_init },
10793 { 6, alc662_sixstack_ch8_init },
10796 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10797 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10800 static struct snd_kcontrol_new alc662_base_mixer[] = {
10801 /* output mixer control */
10802 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
10803 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
10804 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
10805 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
10806 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
10807 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
10808 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
10809 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
10810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10812 /*Input mixer control */
10813 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
10814 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
10815 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
10816 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
10817 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
10818 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
10819 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
10820 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
10822 /* Capture mixer control */
10823 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10824 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10826 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10827 .name = "Capture Source",
10829 .info = alc_mux_enum_info,
10830 .get = alc_mux_enum_get,
10831 .put = alc_mux_enum_put,
10836 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
10837 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10838 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10839 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10840 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10841 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10842 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10843 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10848 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10849 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10850 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10851 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10854 /* .name = "Capture Source", */
10855 .name = "Input Source",
10857 .info = alc662_mux_enum_info,
10858 .get = alc662_mux_enum_get,
10859 .put = alc662_mux_enum_put,
10864 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
10865 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10866 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10867 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10868 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
10869 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
10870 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
10871 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
10872 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
10873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10882 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10883 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10884 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10885 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10887 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10888 /* .name = "Capture Source", */
10889 .name = "Input Source",
10891 .info = alc662_mux_enum_info,
10892 .get = alc662_mux_enum_get,
10893 .put = alc662_mux_enum_put,
10898 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
10899 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10900 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
10901 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10902 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
10903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10904 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10905 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10908 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10909 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10912 /* .name = "Capture Source", */
10913 .name = "Input Source",
10915 .info = alc662_mux_enum_info,
10916 .get = alc662_mux_enum_get,
10917 .put = alc662_mux_enum_put,
10922 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
10924 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10925 .name = "Channel Mode",
10926 .info = alc_ch_mode_info,
10927 .get = alc_ch_mode_get,
10928 .put = alc_ch_mode_put,
10933 static struct hda_verb alc662_init_verbs[] = {
10934 /* ADC: mute amp left and right */
10935 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10936 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10937 /* Front mixer: unmute input/output amp left and right (volume = 0) */
10939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
10943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10945 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10946 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10947 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10948 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10949 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10950 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10952 /* Front Pin: output 0 (0x0c) */
10953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10956 /* Rear Pin: output 1 (0x0d) */
10957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10960 /* CLFE Pin: output 2 (0x0e) */
10961 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10962 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10964 /* Mic (rear) pin: input vref at 80% */
10965 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10966 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10967 /* Front Mic pin: input vref at 80% */
10968 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10969 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10970 /* Line In pin: input */
10971 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10972 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10973 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10974 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10975 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10976 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10977 /* CD pin widget for input */
10978 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10980 /* FIXME: use matrix-type input source selection */
10981 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10985 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10990 static struct hda_verb alc662_sue_init_verbs[] = {
10991 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
10992 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
10997 * generic initialization of ADC, input mixers and output mixers
10999 static struct hda_verb alc662_auto_init_verbs[] = {
11001 * Unmute ADC and set the default input to mic-in
11003 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11006 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11008 * Note: PASD motherboards uses the Line In 2 as the input for front
11009 * panel mic (mic 2)
11011 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
11016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11019 * Set up output mixers (0x0c - 0x0f)
11021 /* set vol=0 to output mixers */
11022 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11023 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11024 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11026 /* set up input amps for analog loopback */
11027 /* Amp Indices: DAC = 0, mixer = 1 */
11028 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11029 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11030 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11031 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11032 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11033 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11036 /* FIXME: use matrix-type input source selection */
11037 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11042 /*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
11043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11048 /* capture mixer elements */
11049 static struct snd_kcontrol_new alc662_capture_mixer[] = {
11050 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11051 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11053 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11054 /* The multiple "Capture Source" controls confuse alsamixer
11055 * So call somewhat different..
11056 * FIXME: the controls appear in the "playback" view!
11058 /* .name = "Capture Source", */
11059 .name = "Input Source",
11061 .info = alc882_mux_enum_info,
11062 .get = alc882_mux_enum_get,
11063 .put = alc882_mux_enum_put,
11068 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11070 unsigned int present;
11071 unsigned char bits;
11073 present = snd_hda_codec_read(codec, 0x14, 0,
11074 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11075 bits = present ? 0x80 : 0;
11076 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
11078 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11082 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11084 unsigned int present;
11085 unsigned char bits;
11087 present = snd_hda_codec_read(codec, 0x1b, 0,
11088 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11089 bits = present ? 0x80 : 0;
11090 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
11092 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11094 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11096 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11100 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
11103 if ((res >> 26) == ALC880_HP_EVENT)
11104 alc662_lenovo_101e_all_automute(codec);
11105 if ((res >> 26) == ALC880_FRONT_EVENT)
11106 alc662_lenovo_101e_ispeaker_automute(codec);
11110 /* pcm configuration: identiacal with ALC880 */
11111 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
11112 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
11113 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
11114 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
11117 * configuration and preset
11119 static const char *alc662_models[ALC662_MODEL_LAST] = {
11120 [ALC662_3ST_2ch_DIG] = "3stack-dig",
11121 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
11122 [ALC662_3ST_6ch] = "3stack-6ch",
11123 [ALC662_5ST_DIG] = "6stack-dig",
11124 [ALC662_LENOVO_101E] = "lenovo-101e",
11125 [ALC662_AUTO] = "auto",
11128 static struct snd_pci_quirk alc662_cfg_tbl[] = {
11129 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
11133 static struct alc_config_preset alc662_presets[] = {
11134 [ALC662_3ST_2ch_DIG] = {
11135 .mixers = { alc662_3ST_2ch_mixer },
11136 .init_verbs = { alc662_init_verbs },
11137 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11138 .dac_nids = alc662_dac_nids,
11139 .dig_out_nid = ALC662_DIGOUT_NID,
11140 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11141 .adc_nids = alc662_adc_nids,
11142 .dig_in_nid = ALC662_DIGIN_NID,
11143 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11144 .channel_mode = alc662_3ST_2ch_modes,
11145 .input_mux = &alc662_capture_source,
11147 [ALC662_3ST_6ch_DIG] = {
11148 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11149 .init_verbs = { alc662_init_verbs },
11150 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11151 .dac_nids = alc662_dac_nids,
11152 .dig_out_nid = ALC662_DIGOUT_NID,
11153 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11154 .adc_nids = alc662_adc_nids,
11155 .dig_in_nid = ALC662_DIGIN_NID,
11156 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11157 .channel_mode = alc662_3ST_6ch_modes,
11159 .input_mux = &alc662_capture_source,
11161 [ALC662_3ST_6ch] = {
11162 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11163 .init_verbs = { alc662_init_verbs },
11164 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11165 .dac_nids = alc662_dac_nids,
11166 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11167 .adc_nids = alc662_adc_nids,
11168 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11169 .channel_mode = alc662_3ST_6ch_modes,
11171 .input_mux = &alc662_capture_source,
11173 [ALC662_5ST_DIG] = {
11174 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
11175 .init_verbs = { alc662_init_verbs },
11176 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11177 .dac_nids = alc662_dac_nids,
11178 .dig_out_nid = ALC662_DIGOUT_NID,
11179 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11180 .adc_nids = alc662_adc_nids,
11181 .dig_in_nid = ALC662_DIGIN_NID,
11182 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
11183 .channel_mode = alc662_5stack_modes,
11184 .input_mux = &alc662_capture_source,
11186 [ALC662_LENOVO_101E] = {
11187 .mixers = { alc662_lenovo_101e_mixer },
11188 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
11189 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11190 .dac_nids = alc662_dac_nids,
11191 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11192 .adc_nids = alc662_adc_nids,
11193 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11194 .channel_mode = alc662_3ST_2ch_modes,
11195 .input_mux = &alc662_lenovo_101e_capture_source,
11196 .unsol_event = alc662_lenovo_101e_unsol_event,
11197 .init_hook = alc662_lenovo_101e_all_automute,
11204 * BIOS auto configuration
11207 /* add playback controls from the parsed DAC table */
11208 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
11209 const struct auto_pin_cfg *cfg)
11212 static const char *chname[4] = {
11213 "Front", "Surround", NULL /*CLFE*/, "Side"
11218 for (i = 0; i < cfg->line_outs; i++) {
11219 if (!spec->multiout.dac_nids[i])
11221 nid = alc880_idx_to_mixer(i);
11224 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11225 "Center Playback Volume",
11226 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11230 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11231 "LFE Playback Volume",
11232 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11236 err = add_control(spec, ALC_CTL_BIND_MUTE,
11237 "Center Playback Switch",
11238 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
11242 err = add_control(spec, ALC_CTL_BIND_MUTE,
11243 "LFE Playback Switch",
11244 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
11249 sprintf(name, "%s Playback Volume", chname[i]);
11250 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11251 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11255 sprintf(name, "%s Playback Switch", chname[i]);
11256 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11257 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
11266 /* add playback controls for speaker and HP outputs */
11267 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
11277 if (alc880_is_fixed_pin(pin)) {
11278 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11279 /* printk("DAC nid=%x\n",nid); */
11280 /* specify the DAC as the extra output */
11281 if (!spec->multiout.hp_nid)
11282 spec->multiout.hp_nid = nid;
11284 spec->multiout.extra_out_nid[0] = nid;
11285 /* control HP volume/switch on the output mixer amp */
11286 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11287 sprintf(name, "%s Playback Volume", pfx);
11288 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11289 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11292 sprintf(name, "%s Playback Switch", pfx);
11293 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11294 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
11297 } else if (alc880_is_multi_pin(pin)) {
11298 /* set manual connection */
11299 /* we have only a switch on HP-out PIN */
11300 sprintf(name, "%s Playback Switch", pfx);
11301 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11302 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11309 /* create playback/capture controls for input pins */
11310 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
11311 const struct auto_pin_cfg *cfg)
11313 struct hda_input_mux *imux = &spec->private_imux;
11316 for (i = 0; i < AUTO_PIN_LAST; i++) {
11317 if (alc880_is_input_pin(cfg->input_pins[i])) {
11318 idx = alc880_input_pin_idx(cfg->input_pins[i]);
11319 err = new_analog_input(spec, cfg->input_pins[i],
11320 auto_pin_cfg_labels[i],
11324 imux->items[imux->num_items].label =
11325 auto_pin_cfg_labels[i];
11326 imux->items[imux->num_items].index =
11327 alc880_input_pin_idx(cfg->input_pins[i]);
11334 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
11335 hda_nid_t nid, int pin_type,
11338 /* set as output */
11339 snd_hda_codec_write(codec, nid, 0,
11340 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11341 snd_hda_codec_write(codec, nid, 0,
11342 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11343 /* need the manual connection? */
11344 if (alc880_is_multi_pin(nid)) {
11345 struct alc_spec *spec = codec->spec;
11346 int idx = alc880_multi_pin_idx(nid);
11347 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
11348 AC_VERB_SET_CONNECT_SEL,
11349 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
11353 static void alc662_auto_init_multi_out(struct hda_codec *codec)
11355 struct alc_spec *spec = codec->spec;
11358 for (i = 0; i <= HDA_SIDE; i++) {
11359 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11360 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11362 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
11367 static void alc662_auto_init_hp_out(struct hda_codec *codec)
11369 struct alc_spec *spec = codec->spec;
11372 pin = spec->autocfg.hp_pins[0];
11373 if (pin) /* connect to front */
11375 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11378 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
11379 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
11381 static void alc662_auto_init_analog_input(struct hda_codec *codec)
11383 struct alc_spec *spec = codec->spec;
11386 for (i = 0; i < AUTO_PIN_LAST; i++) {
11387 hda_nid_t nid = spec->autocfg.input_pins[i];
11388 if (alc662_is_input_pin(nid)) {
11389 snd_hda_codec_write(codec, nid, 0,
11390 AC_VERB_SET_PIN_WIDGET_CONTROL,
11391 (i <= AUTO_PIN_FRONT_MIC ?
11392 PIN_VREF80 : PIN_IN));
11393 if (nid != ALC662_PIN_CD_NID)
11394 snd_hda_codec_write(codec, nid, 0,
11395 AC_VERB_SET_AMP_GAIN_MUTE,
11401 static int alc662_parse_auto_config(struct hda_codec *codec)
11403 struct alc_spec *spec = codec->spec;
11405 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11407 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11411 if (!spec->autocfg.line_outs)
11412 return 0; /* can't find valid BIOS pin config */
11414 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11417 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
11420 err = alc662_auto_create_extra_out(spec,
11421 spec->autocfg.speaker_pins[0],
11425 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11429 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
11433 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11435 if (spec->autocfg.dig_out_pin)
11436 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
11438 if (spec->kctl_alloc)
11439 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11441 spec->num_mux_defs = 1;
11442 spec->input_mux = &spec->private_imux;
11444 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
11445 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
11446 spec->num_mixers++;
11450 /* additional initialization for auto-configuration model */
11451 static void alc662_auto_init(struct hda_codec *codec)
11453 alc662_auto_init_multi_out(codec);
11454 alc662_auto_init_hp_out(codec);
11455 alc662_auto_init_analog_input(codec);
11458 static int patch_alc662(struct hda_codec *codec)
11460 struct alc_spec *spec;
11461 int err, board_config;
11463 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11467 codec->spec = spec;
11469 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
11472 if (board_config < 0) {
11473 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
11474 "trying auto-probe from BIOS...\n");
11475 board_config = ALC662_AUTO;
11478 if (board_config == ALC662_AUTO) {
11479 /* automatic parse from the BIOS config */
11480 err = alc662_parse_auto_config(codec);
11486 "hda_codec: Cannot set up configuration "
11487 "from BIOS. Using base mode...\n");
11488 board_config = ALC662_3ST_2ch_DIG;
11492 if (board_config != ALC662_AUTO)
11493 setup_preset(spec, &alc662_presets[board_config]);
11495 spec->stream_name_analog = "ALC662 Analog";
11496 spec->stream_analog_playback = &alc662_pcm_analog_playback;
11497 spec->stream_analog_capture = &alc662_pcm_analog_capture;
11499 spec->stream_name_digital = "ALC662 Digital";
11500 spec->stream_digital_playback = &alc662_pcm_digital_playback;
11501 spec->stream_digital_capture = &alc662_pcm_digital_capture;
11503 if (!spec->adc_nids && spec->input_mux) {
11504 spec->adc_nids = alc662_adc_nids;
11505 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
11508 codec->patch_ops = alc_patch_ops;
11509 if (board_config == ALC662_AUTO)
11510 spec->init_hook = alc662_auto_init;
11518 struct hda_codec_preset snd_hda_preset_realtek[] = {
11519 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
11520 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
11521 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
11522 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
11523 .patch = patch_alc861 },
11524 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
11525 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
11526 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
11527 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
11528 .patch = patch_alc883 },
11529 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
11530 .patch = patch_alc662 },
11531 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
11532 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
11533 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
11534 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
11535 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
11536 {} /* terminator */