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 */
107 ALC268_MODEL_LAST /* last tag */
124 /* ALC861-VD models */
170 ALC883_TARGA_2ch_DIG,
176 ALC883_LENOVO_101E_2ch,
177 ALC883_LENOVO_NB0763,
178 ALC888_LENOVO_MS7195_DIG,
186 #define GPIO_MASK 0x03
189 /* codec parameterization */
190 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
191 unsigned int num_mixers;
193 const struct hda_verb *init_verbs[5]; /* initialization verbs
197 unsigned int num_init_verbs;
199 char *stream_name_analog; /* analog PCM stream */
200 struct hda_pcm_stream *stream_analog_playback;
201 struct hda_pcm_stream *stream_analog_capture;
203 char *stream_name_digital; /* digital PCM stream */
204 struct hda_pcm_stream *stream_digital_playback;
205 struct hda_pcm_stream *stream_digital_capture;
208 struct hda_multi_out multiout; /* playback set-up
209 * max_channels, dacs must be set
210 * dig_out_nid and hp_nid are optional
214 unsigned int num_adc_nids;
216 hda_nid_t dig_in_nid; /* digital-in NID; optional */
219 unsigned int num_mux_defs;
220 const struct hda_input_mux *input_mux;
221 unsigned int cur_mux[3];
224 const struct hda_channel_mode *channel_mode;
225 int num_channel_mode;
228 /* PCM information */
229 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
231 /* dynamic controls, init_verbs and input_mux */
232 struct auto_pin_cfg autocfg;
233 unsigned int num_kctl_alloc, num_kctl_used;
234 struct snd_kcontrol_new *kctl_alloc;
235 struct hda_input_mux private_imux;
236 hda_nid_t private_dac_nids[5];
239 void (*init_hook)(struct hda_codec *codec);
240 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
242 /* for pin sensing */
243 unsigned int sense_updated: 1;
244 unsigned int jack_present: 1;
246 #ifdef CONFIG_SND_HDA_POWER_SAVE
247 struct hda_loopback_check loopback;
252 * configuration template - to be copied to the spec instance
254 struct alc_config_preset {
255 struct snd_kcontrol_new *mixers[5]; /* should be identical size
258 const struct hda_verb *init_verbs[5];
259 unsigned int num_dacs;
261 hda_nid_t dig_out_nid; /* optional */
262 hda_nid_t hp_nid; /* optional */
263 unsigned int num_adc_nids;
265 hda_nid_t dig_in_nid;
266 unsigned int num_channel_mode;
267 const struct hda_channel_mode *channel_mode;
269 unsigned int num_mux_defs;
270 const struct hda_input_mux *input_mux;
271 void (*unsol_event)(struct hda_codec *, unsigned int);
272 void (*init_hook)(struct hda_codec *);
273 #ifdef CONFIG_SND_HDA_POWER_SAVE
274 struct hda_amp_list *loopbacks;
282 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
283 struct snd_ctl_elem_info *uinfo)
285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
286 struct alc_spec *spec = codec->spec;
287 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
288 if (mux_idx >= spec->num_mux_defs)
290 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
293 static int alc_mux_enum_get(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);
300 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
304 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
305 struct snd_ctl_elem_value *ucontrol)
307 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
308 struct alc_spec *spec = codec->spec;
309 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
310 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
311 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
312 spec->adc_nids[adc_idx],
313 &spec->cur_mux[adc_idx]);
318 * channel mode setting
320 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
321 struct snd_ctl_elem_info *uinfo)
323 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
324 struct alc_spec *spec = codec->spec;
325 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
326 spec->num_channel_mode);
329 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
330 struct snd_ctl_elem_value *ucontrol)
332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
333 struct alc_spec *spec = codec->spec;
334 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
335 spec->num_channel_mode,
336 spec->multiout.max_channels);
339 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
340 struct snd_ctl_elem_value *ucontrol)
342 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
343 struct alc_spec *spec = codec->spec;
344 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
345 spec->num_channel_mode,
346 &spec->multiout.max_channels);
347 if (err >= 0 && spec->need_dac_fix)
348 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
353 * Control the mode of pin widget settings via the mixer. "pc" is used
354 * instead of "%" to avoid consequences of accidently treating the % as
355 * being part of a format specifier. Maximum allowed length of a value is
356 * 63 characters plus NULL terminator.
358 * Note: some retasking pin complexes seem to ignore requests for input
359 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
360 * are requested. Therefore order this list so that this behaviour will not
361 * cause problems when mixer clients move through the enum sequentially.
362 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
365 static char *alc_pin_mode_names[] = {
366 "Mic 50pc bias", "Mic 80pc bias",
367 "Line in", "Line out", "Headphone out",
369 static unsigned char alc_pin_mode_values[] = {
370 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
372 /* The control can present all 5 options, or it can limit the options based
373 * in the pin being assumed to be exclusively an input or an output pin. In
374 * addition, "input" pins may or may not process the mic bias option
375 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
376 * accept requests for bias as of chip versions up to March 2006) and/or
377 * wiring in the computer.
379 #define ALC_PIN_DIR_IN 0x00
380 #define ALC_PIN_DIR_OUT 0x01
381 #define ALC_PIN_DIR_INOUT 0x02
382 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
383 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
385 /* Info about the pin modes supported by the different pin direction modes.
386 * For each direction the minimum and maximum values are given.
388 static signed char alc_pin_mode_dir_info[5][2] = {
389 { 0, 2 }, /* ALC_PIN_DIR_IN */
390 { 3, 4 }, /* ALC_PIN_DIR_OUT */
391 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
392 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
393 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
395 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
396 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
397 #define alc_pin_mode_n_items(_dir) \
398 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
400 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
401 struct snd_ctl_elem_info *uinfo)
403 unsigned int item_num = uinfo->value.enumerated.item;
404 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
406 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
408 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
410 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
411 item_num = alc_pin_mode_min(dir);
412 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
416 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_value *ucontrol)
420 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
421 hda_nid_t nid = kcontrol->private_value & 0xffff;
422 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
423 long *valp = ucontrol->value.integer.value;
424 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
425 AC_VERB_GET_PIN_WIDGET_CONTROL,
428 /* Find enumerated value for current pinctl setting */
429 i = alc_pin_mode_min(dir);
430 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
432 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
436 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
437 struct snd_ctl_elem_value *ucontrol)
440 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
441 hda_nid_t nid = kcontrol->private_value & 0xffff;
442 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
443 long val = *ucontrol->value.integer.value;
444 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
445 AC_VERB_GET_PIN_WIDGET_CONTROL,
448 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
449 val = alc_pin_mode_min(dir);
451 change = pinctl != alc_pin_mode_values[val];
453 /* Set pin mode to that requested */
454 snd_hda_codec_write_cache(codec, nid, 0,
455 AC_VERB_SET_PIN_WIDGET_CONTROL,
456 alc_pin_mode_values[val]);
458 /* Also enable the retasking pin's input/output as required
459 * for the requested pin mode. Enum values of 2 or less are
462 * Dynamically switching the input/output buffers probably
463 * reduces noise slightly (particularly on input) so we'll
464 * do it. However, having both input and output buffers
465 * enabled simultaneously doesn't seem to be problematic if
466 * this turns out to be necessary in the future.
469 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
470 HDA_AMP_MUTE, HDA_AMP_MUTE);
471 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
474 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
475 HDA_AMP_MUTE, HDA_AMP_MUTE);
476 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
483 #define ALC_PIN_MODE(xname, nid, dir) \
484 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
485 .info = alc_pin_mode_info, \
486 .get = alc_pin_mode_get, \
487 .put = alc_pin_mode_put, \
488 .private_value = nid | (dir<<16) }
490 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
491 * together using a mask with more than one bit set. This control is
492 * currently used only by the ALC260 test model. At this stage they are not
493 * needed for any "production" models.
495 #ifdef CONFIG_SND_DEBUG
496 #define alc_gpio_data_info snd_ctl_boolean_mono_info
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_cache(codec, nid, 0,
530 AC_VERB_SET_GPIO_DATA, gpio_data);
534 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
535 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
536 .info = alc_gpio_data_info, \
537 .get = alc_gpio_data_get, \
538 .put = alc_gpio_data_put, \
539 .private_value = nid | (mask<<16) }
540 #endif /* CONFIG_SND_DEBUG */
542 /* A switch control to allow the enabling of the digital IO pins on the
543 * ALC260. This is incredibly simplistic; the intention of this control is
544 * to provide something in the test model allowing digital outputs to be
545 * identified if present. If models are found which can utilise these
546 * outputs a more complete mixer control can be devised for those models if
549 #ifdef CONFIG_SND_DEBUG
550 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
552 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 hda_nid_t nid = kcontrol->private_value & 0xffff;
557 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
558 long *valp = ucontrol->value.integer.value;
559 unsigned int val = snd_hda_codec_read(codec, nid, 0,
560 AC_VERB_GET_DIGI_CONVERT, 0x00);
562 *valp = (val & mask) != 0;
565 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
566 struct snd_ctl_elem_value *ucontrol)
569 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
570 hda_nid_t nid = kcontrol->private_value & 0xffff;
571 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
572 long val = *ucontrol->value.integer.value;
573 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
574 AC_VERB_GET_DIGI_CONVERT,
577 /* Set/unset the masked control bit(s) as needed */
578 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
583 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
588 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
589 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
590 .info = alc_spdif_ctrl_info, \
591 .get = alc_spdif_ctrl_get, \
592 .put = alc_spdif_ctrl_put, \
593 .private_value = nid | (mask<<16) }
594 #endif /* CONFIG_SND_DEBUG */
597 * set up from the preset table
599 static void setup_preset(struct alc_spec *spec,
600 const struct alc_config_preset *preset)
604 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
605 spec->mixers[spec->num_mixers++] = preset->mixers[i];
606 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
608 spec->init_verbs[spec->num_init_verbs++] =
609 preset->init_verbs[i];
611 spec->channel_mode = preset->channel_mode;
612 spec->num_channel_mode = preset->num_channel_mode;
613 spec->need_dac_fix = preset->need_dac_fix;
615 spec->multiout.max_channels = spec->channel_mode[0].channels;
617 spec->multiout.num_dacs = preset->num_dacs;
618 spec->multiout.dac_nids = preset->dac_nids;
619 spec->multiout.dig_out_nid = preset->dig_out_nid;
620 spec->multiout.hp_nid = preset->hp_nid;
622 spec->num_mux_defs = preset->num_mux_defs;
623 if (!spec->num_mux_defs)
624 spec->num_mux_defs = 1;
625 spec->input_mux = preset->input_mux;
627 spec->num_adc_nids = preset->num_adc_nids;
628 spec->adc_nids = preset->adc_nids;
629 spec->dig_in_nid = preset->dig_in_nid;
631 spec->unsol_event = preset->unsol_event;
632 spec->init_hook = preset->init_hook;
633 #ifdef CONFIG_SND_HDA_POWER_SAVE
634 spec->loopback.amplist = preset->loopbacks;
638 /* Enable GPIO mask and set output */
639 static struct hda_verb alc_gpio1_init_verbs[] = {
640 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
641 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
642 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
646 static struct hda_verb alc_gpio2_init_verbs[] = {
647 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
648 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
649 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
653 static struct hda_verb alc_gpio3_init_verbs[] = {
654 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
655 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
656 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
660 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
661 * 31 ~ 16 : Manufacture ID
663 * 7 ~ 0 : Assembly ID
664 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
666 static void alc_subsystem_id(struct hda_codec *codec,
667 unsigned int porta, unsigned int porte,
670 unsigned int ass, tmp;
672 ass = codec->subsystem_id;
677 tmp = (ass & 0x38) >> 3; /* external Amp control */
680 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
683 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
686 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
689 switch (codec->vendor_id) {
695 snd_hda_codec_write(codec, 0x14, 0,
696 AC_VERB_SET_EAPD_BTLENABLE, 2);
697 snd_hda_codec_write(codec, 0x15, 0,
698 AC_VERB_SET_EAPD_BTLENABLE, 2);
702 if (ass & 4) { /* bit 2 : 0 = Desktop, 1 = Laptop */
704 tmp = (ass & 0x1800) >> 11;
706 case 0: port = porta; break;
707 case 1: port = porte; break;
708 case 2: port = portd; break;
711 snd_hda_codec_write(codec, port, 0,
712 AC_VERB_SET_EAPD_BTLENABLE,
715 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
716 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF,
717 (tmp == 5 ? 0x3040 : 0x3050));
723 * Fix-up pin default configurations
731 static void alc_fix_pincfg(struct hda_codec *codec,
732 const struct snd_pci_quirk *quirk,
733 const struct alc_pincfg **pinfix)
735 const struct alc_pincfg *cfg;
737 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
741 cfg = pinfix[quirk->value];
742 for (; cfg->nid; cfg++) {
745 for (i = 0; i < 4; i++) {
746 snd_hda_codec_write(codec, cfg->nid, 0,
747 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
755 * ALC880 3-stack model
757 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
758 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
759 * F-Mic = 0x1b, HP = 0x19
762 static hda_nid_t alc880_dac_nids[4] = {
763 /* front, rear, clfe, rear_surr */
764 0x02, 0x05, 0x04, 0x03
767 static hda_nid_t alc880_adc_nids[3] = {
772 /* The datasheet says the node 0x07 is connected from inputs,
773 * but it shows zero connection in the real implementation on some devices.
774 * Note: this is a 915GAV bug, fixed on 915GLV
776 static hda_nid_t alc880_adc_nids_alt[2] = {
781 #define ALC880_DIGOUT_NID 0x06
782 #define ALC880_DIGIN_NID 0x0a
784 static struct hda_input_mux alc880_capture_source = {
788 { "Front Mic", 0x3 },
794 /* channel source setting (2/6 channel selection for 3-stack) */
796 static struct hda_verb alc880_threestack_ch2_init[] = {
797 /* set line-in to input, mute it */
798 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
799 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
800 /* set mic-in to input vref 80%, mute it */
801 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
802 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
807 static struct hda_verb alc880_threestack_ch6_init[] = {
808 /* set line-in to output, unmute it */
809 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
810 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
811 /* set mic-in to output, unmute it */
812 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
813 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
817 static struct hda_channel_mode alc880_threestack_modes[2] = {
818 { 2, alc880_threestack_ch2_init },
819 { 6, alc880_threestack_ch6_init },
822 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
823 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
824 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
825 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
826 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
827 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
828 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
830 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
831 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
832 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
833 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
834 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
837 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
838 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
839 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
840 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
844 .name = "Channel Mode",
845 .info = alc_ch_mode_info,
846 .get = alc_ch_mode_get,
847 .put = alc_ch_mode_put,
852 /* capture mixer elements */
853 static struct snd_kcontrol_new alc880_capture_mixer[] = {
854 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
855 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
856 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
857 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
858 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
859 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
861 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
862 /* The multiple "Capture Source" controls confuse alsamixer
863 * So call somewhat different..
864 * FIXME: the controls appear in the "playback" view!
866 /* .name = "Capture Source", */
867 .name = "Input Source",
869 .info = alc_mux_enum_info,
870 .get = alc_mux_enum_get,
871 .put = alc_mux_enum_put,
876 /* capture mixer elements (in case NID 0x07 not available) */
877 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = {
878 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
879 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
880 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
881 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
883 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
884 /* The multiple "Capture Source" controls confuse alsamixer
885 * So call somewhat different..
886 * FIXME: the controls appear in the "playback" view!
888 /* .name = "Capture Source", */
889 .name = "Input Source",
891 .info = alc_mux_enum_info,
892 .get = alc_mux_enum_get,
893 .put = alc_mux_enum_put,
901 * ALC880 5-stack model
903 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
905 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
906 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
909 /* additional mixers to alc880_three_stack_mixer */
910 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
911 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
912 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
916 /* channel source setting (6/8 channel selection for 5-stack) */
918 static struct hda_verb alc880_fivestack_ch6_init[] = {
919 /* set line-in to input, mute it */
920 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
921 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
926 static struct hda_verb alc880_fivestack_ch8_init[] = {
927 /* set line-in to output, unmute it */
928 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
929 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
933 static struct hda_channel_mode alc880_fivestack_modes[2] = {
934 { 6, alc880_fivestack_ch6_init },
935 { 8, alc880_fivestack_ch8_init },
940 * ALC880 6-stack model
942 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
944 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
945 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
948 static hda_nid_t alc880_6st_dac_nids[4] = {
949 /* front, rear, clfe, rear_surr */
950 0x02, 0x03, 0x04, 0x05
953 static struct hda_input_mux alc880_6stack_capture_source = {
957 { "Front Mic", 0x1 },
963 /* fixed 8-channels */
964 static struct hda_channel_mode alc880_sixstack_modes[1] = {
968 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
969 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
970 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
971 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
972 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
973 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
974 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
975 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
976 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
977 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
978 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
987 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
988 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
990 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
991 .name = "Channel Mode",
992 .info = alc_ch_mode_info,
993 .get = alc_ch_mode_get,
994 .put = alc_ch_mode_put,
1003 * W810 has rear IO for:
1006 * Center/LFE (DAC 04)
1009 * The system also has a pair of internal speakers, and a headphone jack.
1010 * These are both connected to Line2 on the codec, hence to DAC 02.
1012 * There is a variable resistor to control the speaker or headphone
1013 * volume. This is a hardware-only device without a software API.
1015 * Plugging headphones in will disable the internal speakers. This is
1016 * implemented in hardware, not via the driver using jack sense. In
1017 * a similar fashion, plugging into the rear socket marked "front" will
1018 * disable both the speakers and headphones.
1020 * For input, there's a microphone jack, and an "audio in" jack.
1021 * These may not do anything useful with this driver yet, because I
1022 * haven't setup any initialization verbs for these yet...
1025 static hda_nid_t alc880_w810_dac_nids[3] = {
1026 /* front, rear/surround, clfe */
1030 /* fixed 6 channels */
1031 static struct hda_channel_mode alc880_w810_modes[1] = {
1035 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1036 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1038 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1039 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1040 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1041 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1042 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1043 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1044 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1053 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1054 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1058 static hda_nid_t alc880_z71v_dac_nids[1] = {
1061 #define ALC880_Z71V_HP_DAC 0x03
1063 /* fixed 2 channels */
1064 static struct hda_channel_mode alc880_2_jack_modes[1] = {
1068 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
1069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1071 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1072 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
1073 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1074 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1083 * ALC880 F1734 model
1085 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1086 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1089 static hda_nid_t alc880_f1734_dac_nids[1] = {
1092 #define ALC880_F1734_HP_DAC 0x02
1094 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
1095 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1096 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1097 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1098 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1111 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1112 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1113 * Mic = 0x18, Line = 0x1a
1116 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1117 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1119 static struct snd_kcontrol_new alc880_asus_mixer[] = {
1120 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1121 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1122 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1123 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1124 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1125 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1126 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1127 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1136 .name = "Channel Mode",
1137 .info = alc_ch_mode_info,
1138 .get = alc_ch_mode_get,
1139 .put = alc_ch_mode_put,
1146 * ALC880 ASUS W1V model
1148 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1149 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1150 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1153 /* additional mixers to alc880_asus_mixer */
1154 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
1155 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
1156 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
1160 /* additional mixers to alc880_asus_mixer */
1161 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {
1162 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1163 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1168 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
1169 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1170 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1172 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
1173 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
1174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
1175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
1176 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
1177 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
1179 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1180 /* The multiple "Capture Source" controls confuse alsamixer
1181 * So call somewhat different..
1182 * FIXME: the controls appear in the "playback" view!
1184 /* .name = "Capture Source", */
1185 .name = "Input Source",
1187 .info = alc_mux_enum_info,
1188 .get = alc_mux_enum_get,
1189 .put = alc_mux_enum_put,
1195 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
1196 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1197 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1198 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1199 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1200 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1201 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1202 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1203 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1204 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1205 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1210 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1211 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1212 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
1213 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
1215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1216 .name = "Channel Mode",
1217 .info = alc_ch_mode_info,
1218 .get = alc_ch_mode_get,
1219 .put = alc_ch_mode_put,
1224 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
1225 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1226 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1227 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1228 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1229 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1230 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1231 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1232 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1233 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1234 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1238 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
1239 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1240 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT),
1241 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1242 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
1243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1249 * build control elements
1251 static int alc_build_controls(struct hda_codec *codec)
1253 struct alc_spec *spec = codec->spec;
1257 for (i = 0; i < spec->num_mixers; i++) {
1258 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
1263 if (spec->multiout.dig_out_nid) {
1264 err = snd_hda_create_spdif_out_ctls(codec,
1265 spec->multiout.dig_out_nid);
1269 if (spec->dig_in_nid) {
1270 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
1279 * initialize the codec volumes, etc
1283 * generic initialization of ADC, input mixers and output mixers
1285 static struct hda_verb alc880_volume_init_verbs[] = {
1287 * Unmute ADC0-2 and set the default input to mic-in
1289 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1291 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1293 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1296 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1298 * Note: PASD motherboards uses the Line In 2 as the input for front
1301 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1311 * Set up output mixers (0x0c - 0x0f)
1313 /* set vol=0 to output mixers */
1314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1318 /* set up input amps for analog loopback */
1319 /* Amp Indices: DAC = 0, mixer = 1 */
1320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1324 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1326 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1327 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1333 * 3-stack pin configuration:
1334 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1336 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
1338 * preset connection lists of input pins
1339 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1341 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1342 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1343 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1346 * Set pin mode and muting
1348 /* set front pin widgets 0x14 for output */
1349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1350 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1351 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1352 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1353 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1354 /* Mic2 (as headphone out) for HP output */
1355 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1357 /* Line In pin widget for input */
1358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1360 /* Line2 (as front mic) pin widget for input and vref at 80% */
1361 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1362 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1363 /* CD pin widget for input */
1364 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1370 * 5-stack pin configuration:
1371 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1372 * line-in/side = 0x1a, f-mic = 0x1b
1374 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
1376 * preset connection lists of input pins
1377 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1379 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1380 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
1383 * Set pin mode and muting
1385 /* set pin widgets 0x14-0x17 for output */
1386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1389 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1390 /* unmute pins for output (no gain on this amp) */
1391 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1394 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1396 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1397 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1398 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1399 /* Mic2 (as headphone out) for HP output */
1400 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1401 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1402 /* Line In pin widget for input */
1403 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1404 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1405 /* Line2 (as front mic) pin widget for input and vref at 80% */
1406 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1407 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1408 /* CD pin widget for input */
1409 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1415 * W810 pin configuration:
1416 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1418 static struct hda_verb alc880_pin_w810_init_verbs[] = {
1419 /* hphone/speaker input selector: front DAC */
1420 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
1422 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1423 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1426 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1427 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1430 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1436 * Z71V pin configuration:
1437 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1439 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
1440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1447 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1448 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1454 * 6-stack pin configuration:
1455 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1456 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1458 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
1459 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1462 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1464 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1465 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1466 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1467 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1468 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1470 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1471 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1475 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1478 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1484 * Uniwill pin configuration:
1485 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1488 static struct hda_verb alc880_uniwill_init_verbs[] = {
1489 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1492 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1496 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1508 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1509 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1510 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1511 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1512 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1513 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1514 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1516 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
1524 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1526 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
1527 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1532 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1533 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1534 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1539 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
1540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
1542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1544 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1545 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1546 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1547 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1549 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
1550 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
1555 static struct hda_verb alc880_beep_init_verbs[] = {
1556 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
1560 /* toggle speaker-output according to the hp-jack state */
1561 static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1563 unsigned int present;
1566 present = snd_hda_codec_read(codec, 0x14, 0,
1567 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1568 bits = present ? HDA_AMP_MUTE : 0;
1569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1570 HDA_AMP_MUTE, bits);
1571 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1572 HDA_AMP_MUTE, bits);
1575 /* auto-toggle front mic */
1576 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1578 unsigned int present;
1581 present = snd_hda_codec_read(codec, 0x18, 0,
1582 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1583 bits = present ? HDA_AMP_MUTE : 0;
1584 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1587 static void alc880_uniwill_automute(struct hda_codec *codec)
1589 alc880_uniwill_hp_automute(codec);
1590 alc880_uniwill_mic_automute(codec);
1593 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
1596 /* Looks like the unsol event is incompatible with the standard
1597 * definition. 4bit tag is placed at 28 bit!
1599 switch (res >> 28) {
1600 case ALC880_HP_EVENT:
1601 alc880_uniwill_hp_automute(codec);
1603 case ALC880_MIC_EVENT:
1604 alc880_uniwill_mic_automute(codec);
1609 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1611 unsigned int present;
1614 present = snd_hda_codec_read(codec, 0x14, 0,
1615 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1616 bits = present ? HDA_AMP_MUTE : 0;
1617 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1620 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1622 unsigned int present;
1624 present = snd_hda_codec_read(codec, 0x21, 0,
1625 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1626 present &= HDA_AMP_VOLMASK;
1627 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1628 HDA_AMP_VOLMASK, present);
1629 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1630 HDA_AMP_VOLMASK, present);
1633 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1636 /* Looks like the unsol event is incompatible with the standard
1637 * definition. 4bit tag is placed at 28 bit!
1639 if ((res >> 28) == ALC880_HP_EVENT)
1640 alc880_uniwill_p53_hp_automute(codec);
1641 if ((res >> 28) == ALC880_DCVOL_EVENT)
1642 alc880_uniwill_p53_dcvol_automute(codec);
1647 * F1734 pin configuration:
1648 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1650 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
1651 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1652 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1653 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1654 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1656 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1661 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1662 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1663 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1665 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1668 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1669 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1676 * ASUS pin configuration:
1677 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1679 static struct hda_verb alc880_pin_asus_init_verbs[] = {
1680 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1681 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1682 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1683 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1689 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1691 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1692 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1695 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1697 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1701 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1702 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1707 /* Enable GPIO mask and set output */
1708 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1709 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1711 /* Clevo m520g init */
1712 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1713 /* headphone output */
1714 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1719 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1720 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1722 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1723 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1724 /* Mic1 (rear panel) */
1725 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1726 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1727 /* Mic2 (front panel) */
1728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1731 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1732 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 /* change to EAPD mode */
1734 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1735 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1740 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1741 /* change to EAPD mode */
1742 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1743 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1745 /* Headphone output */
1746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1748 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1749 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1751 /* Line In pin widget for input */
1752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1753 /* CD pin widget for input */
1754 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1755 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1756 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1758 /* change to EAPD mode */
1759 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1760 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1766 * LG m1 express dual
1769 * Rear Line-In/Out (blue): 0x14
1770 * Build-in Mic-In: 0x15
1772 * HP-Out (green): 0x1b
1773 * Mic-In/Out (red): 0x19
1777 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1778 static hda_nid_t alc880_lg_dac_nids[3] = {
1782 /* seems analog CD is not working */
1783 static struct hda_input_mux alc880_lg_capture_source = {
1788 { "Internal Mic", 0x6 },
1792 /* 2,4,6 channel modes */
1793 static struct hda_verb alc880_lg_ch2_init[] = {
1794 /* set line-in and mic-in to input */
1795 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1796 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1800 static struct hda_verb alc880_lg_ch4_init[] = {
1801 /* set line-in to out and mic-in to input */
1802 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1803 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1807 static struct hda_verb alc880_lg_ch6_init[] = {
1808 /* set line-in and mic-in to output */
1809 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1810 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1814 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
1815 { 2, alc880_lg_ch2_init },
1816 { 4, alc880_lg_ch4_init },
1817 { 6, alc880_lg_ch6_init },
1820 static struct snd_kcontrol_new alc880_lg_mixer[] = {
1821 /* FIXME: it's not really "master" but front channels */
1822 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1823 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),
1824 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1825 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
1826 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
1827 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
1828 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
1829 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
1830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1832 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
1833 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
1834 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
1835 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
1837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1838 .name = "Channel Mode",
1839 .info = alc_ch_mode_info,
1840 .get = alc_ch_mode_get,
1841 .put = alc_ch_mode_put,
1846 static struct hda_verb alc880_lg_init_verbs[] = {
1847 /* set capture source to mic-in */
1848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1849 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1850 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1851 /* mute all amp mixer inputs */
1852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
1853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
1854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1855 /* line-in to input */
1856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1862 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1863 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1864 /* mic-in to input */
1865 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
1866 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1869 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
1870 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1871 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1873 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1877 /* toggle speaker-output according to the hp-jack state */
1878 static void alc880_lg_automute(struct hda_codec *codec)
1880 unsigned int present;
1883 present = snd_hda_codec_read(codec, 0x1b, 0,
1884 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1885 bits = present ? HDA_AMP_MUTE : 0;
1886 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
1887 HDA_AMP_MUTE, bits);
1890 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
1892 /* Looks like the unsol event is incompatible with the standard
1893 * definition. 4bit tag is placed at 28 bit!
1895 if ((res >> 28) == 0x01)
1896 alc880_lg_automute(codec);
1905 * Built-in Mic-In: 0x19
1911 static struct hda_input_mux alc880_lg_lw_capture_source = {
1915 { "Internal Mic", 0x1 },
1920 #define alc880_lg_lw_modes alc880_threestack_modes
1922 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
1923 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1924 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1926 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1927 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1928 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1929 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1930 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1936 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1939 .name = "Channel Mode",
1940 .info = alc_ch_mode_info,
1941 .get = alc_ch_mode_get,
1942 .put = alc_ch_mode_put,
1947 static struct hda_verb alc880_lg_lw_init_verbs[] = {
1948 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1949 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1950 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1952 /* set capture source to mic-in */
1953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1955 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1956 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1963 /* mic-in to input */
1964 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1965 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1967 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1968 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1970 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},
1974 /* toggle speaker-output according to the hp-jack state */
1975 static void alc880_lg_lw_automute(struct hda_codec *codec)
1977 unsigned int present;
1980 present = snd_hda_codec_read(codec, 0x1b, 0,
1981 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1982 bits = present ? HDA_AMP_MUTE : 0;
1983 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1984 HDA_AMP_MUTE, bits);
1987 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
1989 /* Looks like the unsol event is incompatible with the standard
1990 * definition. 4bit tag is placed at 28 bit!
1992 if ((res >> 28) == 0x01)
1993 alc880_lg_lw_automute(codec);
1996 #ifdef CONFIG_SND_HDA_POWER_SAVE
1997 static struct hda_amp_list alc880_loopbacks[] = {
1998 { 0x0b, HDA_INPUT, 0 },
1999 { 0x0b, HDA_INPUT, 1 },
2000 { 0x0b, HDA_INPUT, 2 },
2001 { 0x0b, HDA_INPUT, 3 },
2002 { 0x0b, HDA_INPUT, 4 },
2006 static struct hda_amp_list alc880_lg_loopbacks[] = {
2007 { 0x0b, HDA_INPUT, 1 },
2008 { 0x0b, HDA_INPUT, 6 },
2009 { 0x0b, HDA_INPUT, 7 },
2018 static int alc_init(struct hda_codec *codec)
2020 struct alc_spec *spec = codec->spec;
2023 for (i = 0; i < spec->num_init_verbs; i++)
2024 snd_hda_sequence_write(codec, spec->init_verbs[i]);
2026 if (spec->init_hook)
2027 spec->init_hook(codec);
2032 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
2034 struct alc_spec *spec = codec->spec;
2036 if (spec->unsol_event)
2037 spec->unsol_event(codec, res);
2040 #ifdef CONFIG_SND_HDA_POWER_SAVE
2041 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2043 struct alc_spec *spec = codec->spec;
2044 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
2049 * Analog playback callbacks
2051 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
2052 struct hda_codec *codec,
2053 struct snd_pcm_substream *substream)
2055 struct alc_spec *spec = codec->spec;
2056 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
2059 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2060 struct hda_codec *codec,
2061 unsigned int stream_tag,
2062 unsigned int format,
2063 struct snd_pcm_substream *substream)
2065 struct alc_spec *spec = codec->spec;
2066 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2067 stream_tag, format, substream);
2070 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2071 struct hda_codec *codec,
2072 struct snd_pcm_substream *substream)
2074 struct alc_spec *spec = codec->spec;
2075 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2081 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
2082 struct hda_codec *codec,
2083 struct snd_pcm_substream *substream)
2085 struct alc_spec *spec = codec->spec;
2086 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
2089 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2090 struct hda_codec *codec,
2091 unsigned int stream_tag,
2092 unsigned int format,
2093 struct snd_pcm_substream *substream)
2095 struct alc_spec *spec = codec->spec;
2096 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
2097 stream_tag, format, substream);
2100 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
2101 struct hda_codec *codec,
2102 struct snd_pcm_substream *substream)
2104 struct alc_spec *spec = codec->spec;
2105 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
2111 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
2112 struct hda_codec *codec,
2113 unsigned int stream_tag,
2114 unsigned int format,
2115 struct snd_pcm_substream *substream)
2117 struct alc_spec *spec = codec->spec;
2119 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2120 stream_tag, 0, format);
2124 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2125 struct hda_codec *codec,
2126 struct snd_pcm_substream *substream)
2128 struct alc_spec *spec = codec->spec;
2130 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
2138 static struct hda_pcm_stream alc880_pcm_analog_playback = {
2142 /* NID is set in alc_build_pcms */
2144 .open = alc880_playback_pcm_open,
2145 .prepare = alc880_playback_pcm_prepare,
2146 .cleanup = alc880_playback_pcm_cleanup
2150 static struct hda_pcm_stream alc880_pcm_analog_capture = {
2154 /* NID is set in alc_build_pcms */
2156 .prepare = alc880_capture_pcm_prepare,
2157 .cleanup = alc880_capture_pcm_cleanup
2161 static struct hda_pcm_stream alc880_pcm_digital_playback = {
2165 /* NID is set in alc_build_pcms */
2167 .open = alc880_dig_playback_pcm_open,
2168 .close = alc880_dig_playback_pcm_close,
2169 .prepare = alc880_dig_playback_pcm_prepare
2173 static struct hda_pcm_stream alc880_pcm_digital_capture = {
2177 /* NID is set in alc_build_pcms */
2180 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2181 static struct hda_pcm_stream alc_pcm_null_playback = {
2187 static int alc_build_pcms(struct hda_codec *codec)
2189 struct alc_spec *spec = codec->spec;
2190 struct hda_pcm *info = spec->pcm_rec;
2193 codec->num_pcms = 1;
2194 codec->pcm_info = info;
2196 info->name = spec->stream_name_analog;
2197 if (spec->stream_analog_playback) {
2198 snd_assert(spec->multiout.dac_nids, return -EINVAL);
2199 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
2200 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2202 if (spec->stream_analog_capture) {
2203 snd_assert(spec->adc_nids, return -EINVAL);
2204 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2205 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2208 if (spec->channel_mode) {
2209 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
2210 for (i = 0; i < spec->num_channel_mode; i++) {
2211 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
2212 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
2217 /* SPDIF for stream index #1 */
2218 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
2219 codec->num_pcms = 2;
2220 info = spec->pcm_rec + 1;
2221 info->name = spec->stream_name_digital;
2222 if (spec->multiout.dig_out_nid &&
2223 spec->stream_digital_playback) {
2224 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
2225 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
2227 if (spec->dig_in_nid &&
2228 spec->stream_digital_capture) {
2229 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
2230 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
2234 /* If the use of more than one ADC is requested for the current
2235 * model, configure a second analog capture-only PCM.
2237 /* Additional Analaog capture for index #2 */
2238 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
2240 codec->num_pcms = 3;
2241 info = spec->pcm_rec + 2;
2242 info->name = spec->stream_name_analog;
2243 /* No playback stream for second PCM */
2244 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
2245 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2246 if (spec->stream_analog_capture) {
2247 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
2248 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
2255 static void alc_free(struct hda_codec *codec)
2257 struct alc_spec *spec = codec->spec;
2263 if (spec->kctl_alloc) {
2264 for (i = 0; i < spec->num_kctl_used; i++)
2265 kfree(spec->kctl_alloc[i].name);
2266 kfree(spec->kctl_alloc);
2273 static struct hda_codec_ops alc_patch_ops = {
2274 .build_controls = alc_build_controls,
2275 .build_pcms = alc_build_pcms,
2278 .unsol_event = alc_unsol_event,
2279 #ifdef CONFIG_SND_HDA_POWER_SAVE
2280 .check_power_status = alc_check_power_status,
2286 * Test configuration for debugging
2288 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2291 #ifdef CONFIG_SND_DEBUG
2292 static hda_nid_t alc880_test_dac_nids[4] = {
2293 0x02, 0x03, 0x04, 0x05
2296 static struct hda_input_mux alc880_test_capture_source = {
2305 { "Surround", 0x6 },
2309 static struct hda_channel_mode alc880_test_modes[4] = {
2316 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
2317 struct snd_ctl_elem_info *uinfo)
2319 static char *texts[] = {
2320 "N/A", "Line Out", "HP Out",
2321 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2323 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2325 uinfo->value.enumerated.items = 8;
2326 if (uinfo->value.enumerated.item >= 8)
2327 uinfo->value.enumerated.item = 7;
2328 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2332 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
2333 struct snd_ctl_elem_value *ucontrol)
2335 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2336 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2337 unsigned int pin_ctl, item = 0;
2339 pin_ctl = snd_hda_codec_read(codec, nid, 0,
2340 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2341 if (pin_ctl & AC_PINCTL_OUT_EN) {
2342 if (pin_ctl & AC_PINCTL_HP_EN)
2346 } else if (pin_ctl & AC_PINCTL_IN_EN) {
2347 switch (pin_ctl & AC_PINCTL_VREFEN) {
2348 case AC_PINCTL_VREF_HIZ: item = 3; break;
2349 case AC_PINCTL_VREF_50: item = 4; break;
2350 case AC_PINCTL_VREF_GRD: item = 5; break;
2351 case AC_PINCTL_VREF_80: item = 6; break;
2352 case AC_PINCTL_VREF_100: item = 7; break;
2355 ucontrol->value.enumerated.item[0] = item;
2359 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2360 struct snd_ctl_elem_value *ucontrol)
2362 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2363 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2364 static unsigned int ctls[] = {
2365 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
2366 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
2367 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
2368 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
2369 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
2370 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
2372 unsigned int old_ctl, new_ctl;
2374 old_ctl = snd_hda_codec_read(codec, nid, 0,
2375 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
2376 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
2377 if (old_ctl != new_ctl) {
2379 snd_hda_codec_write_cache(codec, nid, 0,
2380 AC_VERB_SET_PIN_WIDGET_CONTROL,
2382 val = ucontrol->value.enumerated.item[0] >= 3 ?
2384 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2391 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
2392 struct snd_ctl_elem_info *uinfo)
2394 static char *texts[] = {
2395 "Front", "Surround", "CLFE", "Side"
2397 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2399 uinfo->value.enumerated.items = 4;
2400 if (uinfo->value.enumerated.item >= 4)
2401 uinfo->value.enumerated.item = 3;
2402 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
2406 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
2407 struct snd_ctl_elem_value *ucontrol)
2409 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2410 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
2413 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
2414 ucontrol->value.enumerated.item[0] = sel & 3;
2418 static int alc_test_pin_src_put(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) & 3;
2426 if (ucontrol->value.enumerated.item[0] != sel) {
2427 sel = ucontrol->value.enumerated.item[0] & 3;
2428 snd_hda_codec_write_cache(codec, nid, 0,
2429 AC_VERB_SET_CONNECT_SEL, sel);
2435 #define PIN_CTL_TEST(xname,nid) { \
2436 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2438 .info = alc_test_pin_ctl_info, \
2439 .get = alc_test_pin_ctl_get, \
2440 .put = alc_test_pin_ctl_put, \
2441 .private_value = nid \
2444 #define PIN_SRC_TEST(xname,nid) { \
2445 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2447 .info = alc_test_pin_src_info, \
2448 .get = alc_test_pin_src_get, \
2449 .put = alc_test_pin_src_put, \
2450 .private_value = nid \
2453 static struct snd_kcontrol_new alc880_test_mixer[] = {
2454 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2455 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2456 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2457 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2459 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2460 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
2461 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2462 PIN_CTL_TEST("Front Pin Mode", 0x14),
2463 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2464 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2465 PIN_CTL_TEST("Side Pin Mode", 0x17),
2466 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2467 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2468 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2469 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2470 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2471 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2472 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2473 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2474 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
2475 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
2476 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
2477 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
2478 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
2479 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
2480 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
2481 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
2482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
2483 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
2485 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2486 .name = "Channel Mode",
2487 .info = alc_ch_mode_info,
2488 .get = alc_ch_mode_get,
2489 .put = alc_ch_mode_put,
2494 static struct hda_verb alc880_test_init_verbs[] = {
2495 /* Unmute inputs of 0x0c - 0x0f */
2496 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2498 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2499 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2500 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2502 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2503 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2504 /* Vol output for 0x0c-0x0f */
2505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2509 /* Set output pins 0x14-0x17 */
2510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2513 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2514 /* Unmute output pins 0x14-0x17 */
2515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2517 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2518 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2519 /* Set input pins 0x18-0x1c */
2520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2522 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2523 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2524 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2525 /* Mute input pins 0x18-0x1b */
2526 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2528 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2529 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2532 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2534 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2537 /* Analog input/passthru */
2538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2542 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2550 static const char *alc880_models[ALC880_MODEL_LAST] = {
2551 [ALC880_3ST] = "3stack",
2552 [ALC880_TCL_S700] = "tcl",
2553 [ALC880_3ST_DIG] = "3stack-digout",
2554 [ALC880_CLEVO] = "clevo",
2555 [ALC880_5ST] = "5stack",
2556 [ALC880_5ST_DIG] = "5stack-digout",
2557 [ALC880_W810] = "w810",
2558 [ALC880_Z71V] = "z71v",
2559 [ALC880_6ST] = "6stack",
2560 [ALC880_6ST_DIG] = "6stack-digout",
2561 [ALC880_ASUS] = "asus",
2562 [ALC880_ASUS_W1V] = "asus-w1v",
2563 [ALC880_ASUS_DIG] = "asus-dig",
2564 [ALC880_ASUS_DIG2] = "asus-dig2",
2565 [ALC880_UNIWILL_DIG] = "uniwill",
2566 [ALC880_UNIWILL_P53] = "uniwill-p53",
2567 [ALC880_FUJITSU] = "fujitsu",
2568 [ALC880_F1734] = "F1734",
2570 [ALC880_LG_LW] = "lg-lw",
2571 #ifdef CONFIG_SND_DEBUG
2572 [ALC880_TEST] = "test",
2574 [ALC880_AUTO] = "auto",
2577 static struct snd_pci_quirk alc880_cfg_tbl[] = {
2578 /* Broken BIOS configuration */
2579 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG),
2580 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
2582 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
2583 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
2584 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
2585 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
2586 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
2587 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
2588 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
2589 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
2590 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
2592 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
2593 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
2595 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
2596 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
2597 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
2598 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
2599 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
2600 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
2601 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
2602 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2603 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
2604 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
2605 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS),
2606 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
2607 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
2608 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
2609 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS),
2611 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
2612 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
2613 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
2614 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
2615 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
2616 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
2617 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
2618 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
2619 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
2620 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
2621 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
2622 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
2623 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
2624 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
2625 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
2626 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
2627 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
2628 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
2630 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
2631 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
2632 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
2633 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
2635 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
2636 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
2637 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
2638 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
2640 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
2641 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
2642 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
2643 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
2645 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
2646 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
2647 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
2648 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
2649 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
2650 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
2651 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
2652 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
2653 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
2654 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
2655 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST),
2661 * ALC880 codec presets
2663 static struct alc_config_preset alc880_presets[] = {
2665 .mixers = { alc880_three_stack_mixer },
2666 .init_verbs = { alc880_volume_init_verbs,
2667 alc880_pin_3stack_init_verbs },
2668 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2669 .dac_nids = alc880_dac_nids,
2670 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2671 .channel_mode = alc880_threestack_modes,
2673 .input_mux = &alc880_capture_source,
2675 [ALC880_3ST_DIG] = {
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 .dig_out_nid = ALC880_DIGOUT_NID,
2682 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2683 .channel_mode = alc880_threestack_modes,
2685 .input_mux = &alc880_capture_source,
2687 [ALC880_TCL_S700] = {
2688 .mixers = { alc880_tcl_s700_mixer },
2689 .init_verbs = { alc880_volume_init_verbs,
2690 alc880_pin_tcl_S700_init_verbs,
2691 alc880_gpio2_init_verbs },
2692 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2693 .dac_nids = alc880_dac_nids,
2695 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2696 .channel_mode = alc880_2_jack_modes,
2697 .input_mux = &alc880_capture_source,
2700 .mixers = { alc880_three_stack_mixer,
2701 alc880_five_stack_mixer},
2702 .init_verbs = { alc880_volume_init_verbs,
2703 alc880_pin_5stack_init_verbs },
2704 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2705 .dac_nids = alc880_dac_nids,
2706 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2707 .channel_mode = alc880_fivestack_modes,
2708 .input_mux = &alc880_capture_source,
2710 [ALC880_5ST_DIG] = {
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 .dig_out_nid = ALC880_DIGOUT_NID,
2718 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
2719 .channel_mode = alc880_fivestack_modes,
2720 .input_mux = &alc880_capture_source,
2723 .mixers = { alc880_six_stack_mixer },
2724 .init_verbs = { alc880_volume_init_verbs,
2725 alc880_pin_6stack_init_verbs },
2726 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2727 .dac_nids = alc880_6st_dac_nids,
2728 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2729 .channel_mode = alc880_sixstack_modes,
2730 .input_mux = &alc880_6stack_capture_source,
2732 [ALC880_6ST_DIG] = {
2733 .mixers = { alc880_six_stack_mixer },
2734 .init_verbs = { alc880_volume_init_verbs,
2735 alc880_pin_6stack_init_verbs },
2736 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
2737 .dac_nids = alc880_6st_dac_nids,
2738 .dig_out_nid = ALC880_DIGOUT_NID,
2739 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
2740 .channel_mode = alc880_sixstack_modes,
2741 .input_mux = &alc880_6stack_capture_source,
2744 .mixers = { alc880_w810_base_mixer },
2745 .init_verbs = { alc880_volume_init_verbs,
2746 alc880_pin_w810_init_verbs,
2747 alc880_gpio2_init_verbs },
2748 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2749 .dac_nids = alc880_w810_dac_nids,
2750 .dig_out_nid = ALC880_DIGOUT_NID,
2751 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2752 .channel_mode = alc880_w810_modes,
2753 .input_mux = &alc880_capture_source,
2756 .mixers = { alc880_z71v_mixer },
2757 .init_verbs = { alc880_volume_init_verbs,
2758 alc880_pin_z71v_init_verbs },
2759 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
2760 .dac_nids = alc880_z71v_dac_nids,
2761 .dig_out_nid = ALC880_DIGOUT_NID,
2763 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2764 .channel_mode = alc880_2_jack_modes,
2765 .input_mux = &alc880_capture_source,
2768 .mixers = { alc880_f1734_mixer },
2769 .init_verbs = { alc880_volume_init_verbs,
2770 alc880_pin_f1734_init_verbs },
2771 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
2772 .dac_nids = alc880_f1734_dac_nids,
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_asus_mixer },
2780 .init_verbs = { alc880_volume_init_verbs,
2781 alc880_pin_asus_init_verbs,
2782 alc880_gpio1_init_verbs },
2783 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2784 .dac_nids = alc880_asus_dac_nids,
2785 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2786 .channel_mode = alc880_asus_modes,
2788 .input_mux = &alc880_capture_source,
2790 [ALC880_ASUS_DIG] = {
2791 .mixers = { alc880_asus_mixer },
2792 .init_verbs = { alc880_volume_init_verbs,
2793 alc880_pin_asus_init_verbs,
2794 alc880_gpio1_init_verbs },
2795 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2796 .dac_nids = alc880_asus_dac_nids,
2797 .dig_out_nid = ALC880_DIGOUT_NID,
2798 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2799 .channel_mode = alc880_asus_modes,
2801 .input_mux = &alc880_capture_source,
2803 [ALC880_ASUS_DIG2] = {
2804 .mixers = { alc880_asus_mixer },
2805 .init_verbs = { alc880_volume_init_verbs,
2806 alc880_pin_asus_init_verbs,
2807 alc880_gpio2_init_verbs }, /* use GPIO2 */
2808 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2809 .dac_nids = alc880_asus_dac_nids,
2810 .dig_out_nid = ALC880_DIGOUT_NID,
2811 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2812 .channel_mode = alc880_asus_modes,
2814 .input_mux = &alc880_capture_source,
2816 [ALC880_ASUS_W1V] = {
2817 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
2818 .init_verbs = { alc880_volume_init_verbs,
2819 alc880_pin_asus_init_verbs,
2820 alc880_gpio1_init_verbs },
2821 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2822 .dac_nids = alc880_asus_dac_nids,
2823 .dig_out_nid = ALC880_DIGOUT_NID,
2824 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2825 .channel_mode = alc880_asus_modes,
2827 .input_mux = &alc880_capture_source,
2829 [ALC880_UNIWILL_DIG] = {
2830 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
2831 .init_verbs = { alc880_volume_init_verbs,
2832 alc880_pin_asus_init_verbs },
2833 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2834 .dac_nids = alc880_asus_dac_nids,
2835 .dig_out_nid = ALC880_DIGOUT_NID,
2836 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2837 .channel_mode = alc880_asus_modes,
2839 .input_mux = &alc880_capture_source,
2841 [ALC880_UNIWILL] = {
2842 .mixers = { alc880_uniwill_mixer },
2843 .init_verbs = { alc880_volume_init_verbs,
2844 alc880_uniwill_init_verbs },
2845 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2846 .dac_nids = alc880_asus_dac_nids,
2847 .dig_out_nid = ALC880_DIGOUT_NID,
2848 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2849 .channel_mode = alc880_threestack_modes,
2851 .input_mux = &alc880_capture_source,
2852 .unsol_event = alc880_uniwill_unsol_event,
2853 .init_hook = alc880_uniwill_automute,
2855 [ALC880_UNIWILL_P53] = {
2856 .mixers = { alc880_uniwill_p53_mixer },
2857 .init_verbs = { alc880_volume_init_verbs,
2858 alc880_uniwill_p53_init_verbs },
2859 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
2860 .dac_nids = alc880_asus_dac_nids,
2861 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
2862 .channel_mode = alc880_threestack_modes,
2863 .input_mux = &alc880_capture_source,
2864 .unsol_event = alc880_uniwill_p53_unsol_event,
2865 .init_hook = alc880_uniwill_p53_hp_automute,
2867 [ALC880_FUJITSU] = {
2868 .mixers = { alc880_fujitsu_mixer,
2869 alc880_pcbeep_mixer, },
2870 .init_verbs = { alc880_volume_init_verbs,
2871 alc880_uniwill_p53_init_verbs,
2872 alc880_beep_init_verbs },
2873 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2874 .dac_nids = alc880_dac_nids,
2875 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
2876 .channel_mode = alc880_2_jack_modes,
2877 .input_mux = &alc880_capture_source,
2878 .unsol_event = alc880_uniwill_p53_unsol_event,
2879 .init_hook = alc880_uniwill_p53_hp_automute,
2882 .mixers = { alc880_three_stack_mixer },
2883 .init_verbs = { alc880_volume_init_verbs,
2884 alc880_pin_clevo_init_verbs },
2885 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2886 .dac_nids = alc880_dac_nids,
2888 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2889 .channel_mode = alc880_threestack_modes,
2891 .input_mux = &alc880_capture_source,
2894 .mixers = { alc880_lg_mixer },
2895 .init_verbs = { alc880_volume_init_verbs,
2896 alc880_lg_init_verbs },
2897 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
2898 .dac_nids = alc880_lg_dac_nids,
2899 .dig_out_nid = ALC880_DIGOUT_NID,
2900 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
2901 .channel_mode = alc880_lg_ch_modes,
2903 .input_mux = &alc880_lg_capture_source,
2904 .unsol_event = alc880_lg_unsol_event,
2905 .init_hook = alc880_lg_automute,
2906 #ifdef CONFIG_SND_HDA_POWER_SAVE
2907 .loopbacks = alc880_lg_loopbacks,
2911 .mixers = { alc880_lg_lw_mixer },
2912 .init_verbs = { alc880_volume_init_verbs,
2913 alc880_lg_lw_init_verbs },
2914 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2915 .dac_nids = alc880_dac_nids,
2916 .dig_out_nid = ALC880_DIGOUT_NID,
2917 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
2918 .channel_mode = alc880_lg_lw_modes,
2919 .input_mux = &alc880_lg_lw_capture_source,
2920 .unsol_event = alc880_lg_lw_unsol_event,
2921 .init_hook = alc880_lg_lw_automute,
2923 #ifdef CONFIG_SND_DEBUG
2925 .mixers = { alc880_test_mixer },
2926 .init_verbs = { alc880_test_init_verbs },
2927 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
2928 .dac_nids = alc880_test_dac_nids,
2929 .dig_out_nid = ALC880_DIGOUT_NID,
2930 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
2931 .channel_mode = alc880_test_modes,
2932 .input_mux = &alc880_test_capture_source,
2938 * Automatic parse of I/O pins from the BIOS configuration
2941 #define NUM_CONTROL_ALLOC 32
2942 #define NUM_VERB_ALLOC 32
2946 ALC_CTL_WIDGET_MUTE,
2949 static struct snd_kcontrol_new alc880_control_templates[] = {
2950 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2951 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2952 HDA_BIND_MUTE(NULL, 0, 0, 0),
2955 /* add dynamic controls */
2956 static int add_control(struct alc_spec *spec, int type, const char *name,
2959 struct snd_kcontrol_new *knew;
2961 if (spec->num_kctl_used >= spec->num_kctl_alloc) {
2962 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC;
2964 /* array + terminator */
2965 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL);
2968 if (spec->kctl_alloc) {
2969 memcpy(knew, spec->kctl_alloc,
2970 sizeof(*knew) * spec->num_kctl_alloc);
2971 kfree(spec->kctl_alloc);
2973 spec->kctl_alloc = knew;
2974 spec->num_kctl_alloc = num;
2977 knew = &spec->kctl_alloc[spec->num_kctl_used];
2978 *knew = alc880_control_templates[type];
2979 knew->name = kstrdup(name, GFP_KERNEL);
2982 knew->private_value = val;
2983 spec->num_kctl_used++;
2987 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2988 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2989 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2990 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2991 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
2992 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
2993 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
2994 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
2995 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
2996 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
2997 #define ALC880_PIN_CD_NID 0x1c
2999 /* fill in the dac_nids table from the parsed pin configuration */
3000 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
3001 const struct auto_pin_cfg *cfg)
3007 memset(assigned, 0, sizeof(assigned));
3008 spec->multiout.dac_nids = spec->private_dac_nids;
3010 /* check the pins hardwired to audio widget */
3011 for (i = 0; i < cfg->line_outs; i++) {
3012 nid = cfg->line_out_pins[i];
3013 if (alc880_is_fixed_pin(nid)) {
3014 int idx = alc880_fixed_pin_idx(nid);
3015 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
3019 /* left pins can be connect to any audio widget */
3020 for (i = 0; i < cfg->line_outs; i++) {
3021 nid = cfg->line_out_pins[i];
3022 if (alc880_is_fixed_pin(nid))
3024 /* search for an empty channel */
3025 for (j = 0; j < cfg->line_outs; j++) {
3027 spec->multiout.dac_nids[i] =
3028 alc880_idx_to_dac(j);
3034 spec->multiout.num_dacs = cfg->line_outs;
3038 /* add playback controls from the parsed DAC table */
3039 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
3040 const struct auto_pin_cfg *cfg)
3043 static const char *chname[4] = {
3044 "Front", "Surround", NULL /*CLFE*/, "Side"
3049 for (i = 0; i < cfg->line_outs; i++) {
3050 if (!spec->multiout.dac_nids[i])
3052 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
3055 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3056 "Center Playback Volume",
3057 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
3061 err = add_control(spec, ALC_CTL_WIDGET_VOL,
3062 "LFE Playback Volume",
3063 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
3067 err = add_control(spec, ALC_CTL_BIND_MUTE,
3068 "Center Playback Switch",
3069 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
3073 err = add_control(spec, ALC_CTL_BIND_MUTE,
3074 "LFE Playback Switch",
3075 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
3080 sprintf(name, "%s Playback Volume", chname[i]);
3081 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3082 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
3086 sprintf(name, "%s Playback Switch", chname[i]);
3087 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3088 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
3097 /* add playback controls for speaker and HP outputs */
3098 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
3108 if (alc880_is_fixed_pin(pin)) {
3109 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
3110 /* specify the DAC as the extra output */
3111 if (!spec->multiout.hp_nid)
3112 spec->multiout.hp_nid = nid;
3114 spec->multiout.extra_out_nid[0] = nid;
3115 /* control HP volume/switch on the output mixer amp */
3116 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
3117 sprintf(name, "%s Playback Volume", pfx);
3118 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3119 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
3122 sprintf(name, "%s Playback Switch", pfx);
3123 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
3124 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
3127 } else if (alc880_is_multi_pin(pin)) {
3128 /* set manual connection */
3129 /* we have only a switch on HP-out PIN */
3130 sprintf(name, "%s Playback Switch", pfx);
3131 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3132 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
3139 /* create input playback/capture controls for the given pin */
3140 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
3141 const char *ctlname,
3142 int idx, hda_nid_t mix_nid)
3147 sprintf(name, "%s Playback Volume", ctlname);
3148 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
3149 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3152 sprintf(name, "%s Playback Switch", ctlname);
3153 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
3154 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
3160 /* create playback/capture controls for input pins */
3161 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
3162 const struct auto_pin_cfg *cfg)
3164 struct hda_input_mux *imux = &spec->private_imux;
3167 for (i = 0; i < AUTO_PIN_LAST; i++) {
3168 if (alc880_is_input_pin(cfg->input_pins[i])) {
3169 idx = alc880_input_pin_idx(cfg->input_pins[i]);
3170 err = new_analog_input(spec, cfg->input_pins[i],
3171 auto_pin_cfg_labels[i],
3175 imux->items[imux->num_items].label =
3176 auto_pin_cfg_labels[i];
3177 imux->items[imux->num_items].index =
3178 alc880_input_pin_idx(cfg->input_pins[i]);
3185 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
3186 hda_nid_t nid, int pin_type,
3190 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3192 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3194 /* need the manual connection? */
3195 if (alc880_is_multi_pin(nid)) {
3196 struct alc_spec *spec = codec->spec;
3197 int idx = alc880_multi_pin_idx(nid);
3198 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
3199 AC_VERB_SET_CONNECT_SEL,
3200 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
3204 static int get_pin_type(int line_out_type)
3206 if (line_out_type == AUTO_PIN_HP_OUT)
3212 static void alc880_auto_init_multi_out(struct hda_codec *codec)
3214 struct alc_spec *spec = codec->spec;
3217 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
3218 for (i = 0; i < spec->autocfg.line_outs; i++) {
3219 hda_nid_t nid = spec->autocfg.line_out_pins[i];
3220 int pin_type = get_pin_type(spec->autocfg.line_out_type);
3221 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
3225 static void alc880_auto_init_extra_out(struct hda_codec *codec)
3227 struct alc_spec *spec = codec->spec;
3230 pin = spec->autocfg.speaker_pins[0];
3231 if (pin) /* connect to front */
3232 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
3233 pin = spec->autocfg.hp_pins[0];
3234 if (pin) /* connect to front */
3235 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
3238 static void alc880_auto_init_analog_input(struct hda_codec *codec)
3240 struct alc_spec *spec = codec->spec;
3243 for (i = 0; i < AUTO_PIN_LAST; i++) {
3244 hda_nid_t nid = spec->autocfg.input_pins[i];
3245 if (alc880_is_input_pin(nid)) {
3246 snd_hda_codec_write(codec, nid, 0,
3247 AC_VERB_SET_PIN_WIDGET_CONTROL,
3248 i <= AUTO_PIN_FRONT_MIC ?
3249 PIN_VREF80 : PIN_IN);
3250 if (nid != ALC880_PIN_CD_NID)
3251 snd_hda_codec_write(codec, nid, 0,
3252 AC_VERB_SET_AMP_GAIN_MUTE,
3258 /* parse the BIOS configuration and set up the alc_spec */
3259 /* return 1 if successful, 0 if the proper config is not found,
3260 * or a negative error code
3262 static int alc880_parse_auto_config(struct hda_codec *codec)
3264 struct alc_spec *spec = codec->spec;
3266 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
3268 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
3272 if (!spec->autocfg.line_outs)
3273 return 0; /* can't find valid BIOS pin config */
3275 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
3278 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
3281 err = alc880_auto_create_extra_out(spec,
3282 spec->autocfg.speaker_pins[0],
3286 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
3290 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
3294 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3296 if (spec->autocfg.dig_out_pin)
3297 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
3298 if (spec->autocfg.dig_in_pin)
3299 spec->dig_in_nid = ALC880_DIGIN_NID;
3301 if (spec->kctl_alloc)
3302 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3304 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs;
3306 spec->num_mux_defs = 1;
3307 spec->input_mux = &spec->private_imux;
3312 /* additional initialization for auto-configuration model */
3313 static void alc880_auto_init(struct hda_codec *codec)
3315 alc880_auto_init_multi_out(codec);
3316 alc880_auto_init_extra_out(codec);
3317 alc880_auto_init_analog_input(codec);
3321 * OK, here we have finally the patch for ALC880
3324 static int patch_alc880(struct hda_codec *codec)
3326 struct alc_spec *spec;
3330 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3336 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
3339 if (board_config < 0) {
3340 printk(KERN_INFO "hda_codec: Unknown model for ALC880, "
3341 "trying auto-probe from BIOS...\n");
3342 board_config = ALC880_AUTO;
3345 if (board_config == ALC880_AUTO) {
3346 /* automatic parse from the BIOS config */
3347 err = alc880_parse_auto_config(codec);
3353 "hda_codec: Cannot set up configuration "
3354 "from BIOS. Using 3-stack mode...\n");
3355 board_config = ALC880_3ST;
3359 if (board_config != ALC880_AUTO)
3360 setup_preset(spec, &alc880_presets[board_config]);
3362 spec->stream_name_analog = "ALC880 Analog";
3363 spec->stream_analog_playback = &alc880_pcm_analog_playback;
3364 spec->stream_analog_capture = &alc880_pcm_analog_capture;
3366 spec->stream_name_digital = "ALC880 Digital";
3367 spec->stream_digital_playback = &alc880_pcm_digital_playback;
3368 spec->stream_digital_capture = &alc880_pcm_digital_capture;
3370 if (!spec->adc_nids && spec->input_mux) {
3371 /* check whether NID 0x07 is valid */
3372 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
3374 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3375 if (wcap != AC_WID_AUD_IN) {
3376 spec->adc_nids = alc880_adc_nids_alt;
3377 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
3378 spec->mixers[spec->num_mixers] =
3379 alc880_capture_alt_mixer;
3382 spec->adc_nids = alc880_adc_nids;
3383 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
3384 spec->mixers[spec->num_mixers] = alc880_capture_mixer;
3389 codec->patch_ops = alc_patch_ops;
3390 if (board_config == ALC880_AUTO)
3391 spec->init_hook = alc880_auto_init;
3392 #ifdef CONFIG_SND_HDA_POWER_SAVE
3393 if (!spec->loopback.amplist)
3394 spec->loopback.amplist = alc880_loopbacks;
3405 static hda_nid_t alc260_dac_nids[1] = {
3410 static hda_nid_t alc260_adc_nids[1] = {
3415 static hda_nid_t alc260_adc_nids_alt[1] = {
3420 static hda_nid_t alc260_hp_adc_nids[2] = {
3425 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3426 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3428 static hda_nid_t alc260_dual_adc_nids[2] = {
3433 #define ALC260_DIGOUT_NID 0x03
3434 #define ALC260_DIGIN_NID 0x06
3436 static struct hda_input_mux alc260_capture_source = {
3440 { "Front Mic", 0x1 },
3446 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3447 * headphone jack and the internal CD lines since these are the only pins at
3448 * which audio can appear. For flexibility, also allow the option of
3449 * recording the mixer output on the second ADC (ADC0 doesn't have a
3450 * connection to the mixer output).
3452 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
3456 { "Mic/Line", 0x0 },
3458 { "Headphone", 0x2 },
3464 { "Mic/Line", 0x0 },
3466 { "Headphone", 0x2 },
3473 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3474 * the Fujitsu S702x, but jacks are marked differently.
3476 static struct hda_input_mux alc260_acer_capture_sources[2] = {
3483 { "Headphone", 0x5 },
3492 { "Headphone", 0x6 },
3498 * This is just place-holder, so there's something for alc_build_pcms to look
3499 * at when it calculates the maximum number of channels. ALC260 has no mixer
3500 * element which allows changing the channel mode, so the verb list is
3503 static struct hda_channel_mode alc260_modes[1] = {
3508 /* Mixer combinations
3510 * basic: base_output + input + pc_beep + capture
3511 * HP: base_output + input + capture_alt
3512 * HP_3013: hp_3013 + input + capture
3513 * fujitsu: fujitsu + capture
3514 * acer: acer + capture
3517 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
3518 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3519 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
3520 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3521 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
3522 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3523 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
3527 static struct snd_kcontrol_new alc260_input_mixer[] = {
3528 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3529 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3530 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3531 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3533 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3534 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
3535 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
3539 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {
3540 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
3541 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
3545 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
3546 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3547 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
3548 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
3549 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
3550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
3552 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
3553 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
3557 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3558 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3560 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
3561 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3562 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
3563 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3564 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3565 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3566 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
3567 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
3568 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
3569 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3570 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3571 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
3572 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
3576 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3577 * versions of the ALC260 don't act on requests to enable mic bias from NID
3578 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3579 * datasheet doesn't mention this restriction. At this stage it's not clear
3580 * whether this behaviour is intentional or is a hardware bug in chip
3581 * revisions available in early 2006. Therefore for now allow the
3582 * "Headphone Jack Mode" control to span all choices, but if it turns out
3583 * that the lack of mic bias for this NID is intentional we could change the
3584 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3586 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3587 * don't appear to make the mic bias available from the "line" jack, even
3588 * though the NID used for this jack (0x14) can supply it. The theory is
3589 * that perhaps Acer have included blocking capacitors between the ALC260
3590 * and the output jack. If this turns out to be the case for all such
3591 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3592 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3594 * The C20x Tablet series have a mono internal speaker which is controlled
3595 * via the chip's Mono sum widget and pin complex, so include the necessary
3596 * controls for such models. On models without a "mono speaker" the control
3597 * won't do anything.
3599 static struct snd_kcontrol_new alc260_acer_mixer[] = {
3600 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3601 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
3602 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
3603 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3605 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3607 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3608 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3609 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3610 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3611 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3612 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3613 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3614 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3615 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3616 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3620 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3621 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3623 static struct snd_kcontrol_new alc260_will_mixer[] = {
3624 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3625 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3627 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3628 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3629 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3630 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3631 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3632 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
3633 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
3634 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
3635 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
3639 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3640 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3642 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
3643 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
3644 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
3645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
3646 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
3647 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
3648 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
3649 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
3650 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
3651 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
3652 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
3656 /* capture mixer elements */
3657 static struct snd_kcontrol_new alc260_capture_mixer[] = {
3658 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
3659 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
3660 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT),
3661 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT),
3663 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3664 /* The multiple "Capture Source" controls confuse alsamixer
3665 * So call somewhat different..
3666 * FIXME: the controls appear in the "playback" view!
3668 /* .name = "Capture Source", */
3669 .name = "Input Source",
3671 .info = alc_mux_enum_info,
3672 .get = alc_mux_enum_get,
3673 .put = alc_mux_enum_put,
3678 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = {
3679 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
3680 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
3682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3683 /* The multiple "Capture Source" controls confuse alsamixer
3684 * So call somewhat different..
3685 * FIXME: the controls appear in the "playback" view!
3687 /* .name = "Capture Source", */
3688 .name = "Input Source",
3690 .info = alc_mux_enum_info,
3691 .get = alc_mux_enum_get,
3692 .put = alc_mux_enum_put,
3698 * initialization verbs
3700 static struct hda_verb alc260_init_verbs[] = {
3701 /* Line In pin widget for input */
3702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3703 /* CD pin widget for input */
3704 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3705 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3706 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3707 /* Mic2 (front panel) pin widget for input and vref at 80% */
3708 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3709 /* LINE-2 is used for line-out in rear */
3710 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3711 /* select line-out */
3712 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
3714 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3716 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3718 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3719 /* mute capture amp left and right */
3720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3721 /* set connection select to line in (default select for this ADC) */
3722 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3723 /* mute capture amp left and right */
3724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3725 /* set connection select to line in (default select for this ADC) */
3726 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
3727 /* set vol=0 Line-Out mixer amp left and right */
3728 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3729 /* unmute pin widget amp left and right (no gain on this amp) */
3730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3731 /* set vol=0 HP mixer amp left and right */
3732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3733 /* unmute pin widget amp left and right (no gain on this amp) */
3734 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3735 /* set vol=0 Mono mixer amp left and right */
3736 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3737 /* unmute pin widget amp left and right (no gain on this amp) */
3738 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3739 /* unmute LINE-2 out pin */
3740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3741 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3744 /* mute analog inputs */
3745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3750 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3751 /* mute Front out path */
3752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3754 /* mute Headphone out path */
3755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3757 /* mute Mono out path */
3758 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3763 #if 0 /* should be identical with alc260_init_verbs? */
3764 static struct hda_verb alc260_hp_init_verbs[] = {
3765 /* Headphone and output */
3766 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3768 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3769 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3770 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3771 /* Mic2 (front panel) pin widget for input and vref at 80% */
3772 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3773 /* Line In pin widget for input */
3774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3775 /* Line-2 pin widget for output */
3776 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3777 /* CD pin widget for input */
3778 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3779 /* unmute amp left and right */
3780 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3781 /* set connection select to line in (default select for this ADC) */
3782 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3783 /* unmute Line-Out mixer amp left and right (volume = 0) */
3784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3785 /* mute pin widget amp left and right (no gain on this amp) */
3786 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3787 /* unmute HP mixer amp left and right (volume = 0) */
3788 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3789 /* mute pin widget amp left and right (no gain on this amp) */
3790 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3791 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3794 /* mute analog inputs */
3795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3800 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3801 /* Unmute Front out path */
3802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3804 /* Unmute Headphone out path */
3805 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3807 /* Unmute Mono out path */
3808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3814 static struct hda_verb alc260_hp_3013_init_verbs[] = {
3815 /* Line out and output */
3816 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3818 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
3819 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3820 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3821 /* Mic2 (front panel) pin widget for input and vref at 80% */
3822 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
3823 /* Line In pin widget for input */
3824 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3825 /* Headphone pin widget for output */
3826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
3827 /* CD pin widget for input */
3828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
3829 /* unmute amp left and right */
3830 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
3831 /* set connection select to line in (default select for this ADC) */
3832 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
3833 /* unmute Line-Out mixer amp left and right (volume = 0) */
3834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3835 /* mute pin widget amp left and right (no gain on this amp) */
3836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3837 /* unmute HP mixer amp left and right (volume = 0) */
3838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
3839 /* mute pin widget amp left and right (no gain on this amp) */
3840 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
3841 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3844 /* mute analog inputs */
3845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3850 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3851 /* Unmute Front out path */
3852 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3853 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3854 /* Unmute Headphone out path */
3855 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3856 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3857 /* Unmute Mono out path */
3858 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3859 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3863 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3864 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3865 * audio = 0x16, internal speaker = 0x10.
3867 static struct hda_verb alc260_fujitsu_init_verbs[] = {
3868 /* Disable all GPIOs */
3869 {0x01, AC_VERB_SET_GPIO_MASK, 0},
3870 /* Internal speaker is connected to headphone pin */
3871 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3872 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3874 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3875 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3876 /* Ensure all other unused pins are disabled and muted. */
3877 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3879 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3880 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3881 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3882 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3886 /* Disable digital (SPDIF) pins */
3887 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3888 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3890 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3891 * when acting as an output.
3893 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3895 /* Start with output sum widgets muted and their output gains at min */
3896 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3898 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3899 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3901 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3902 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3904 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3906 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3907 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3908 /* Unmute Line1 pin widget output buffer since it starts as an output.
3909 * If the pin mode is changed by the user the pin mode control will
3910 * take care of enabling the pin's input/output buffers as needed.
3911 * Therefore there's no need to enable the input buffer at this
3914 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3915 /* Unmute input buffer of pin widget used for Line-in (no equiv
3918 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3920 /* Mute capture amp left and right */
3921 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3922 /* Set ADC connection select to match default mixer setting - line
3925 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
3927 /* Do the same for the second ADC: mute capture input amp and
3928 * set ADC connection to line in (on mic1 pin)
3930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
3933 /* Mute all inputs to mixer widget (even unconnected ones) */
3934 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
3935 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
3936 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
3937 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
3938 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
3939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
3941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
3946 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3947 * similar laptops (adapted from Fujitsu init verbs).
3949 static struct hda_verb alc260_acer_init_verbs[] = {
3950 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3951 * the headphone jack. Turn this on and rely on the standard mute
3952 * methods whenever the user wants to turn these outputs off.
3954 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
3955 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
3956 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
3957 /* Internal speaker/Headphone jack is connected to Line-out pin */
3958 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3959 /* Internal microphone/Mic jack is connected to Mic1 pin */
3960 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3961 /* Line In jack is connected to Line1 pin */
3962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3963 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
3964 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3965 /* Ensure all other unused pins are disabled and muted. */
3966 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3967 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3968 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3969 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
3971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3972 /* Disable digital (SPDIF) pins */
3973 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
3974 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
3976 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3977 * bus when acting as outputs.
3979 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
3980 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
3982 /* Start with output sum widgets muted and their output gains at min */
3983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3993 /* Unmute Line-out pin widget amp left and right
3994 * (no equiv mixer ctrl)
3996 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3997 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
3998 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3999 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4000 * inputs. If the pin mode is changed by the user the pin mode control
4001 * will take care of enabling the pin's input/output buffers as needed.
4002 * Therefore there's no need to enable the input buffer at this
4005 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4008 /* Mute capture amp left and right */
4009 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4010 /* Set ADC connection select to match default mixer setting - mic
4013 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
4015 /* Do similar with the second ADC: mute capture input amp and
4016 * set ADC connection to mic to match ALSA's default state.
4018 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4019 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
4021 /* Mute all inputs to mixer widget (even unconnected ones) */
4022 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
4023 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
4024 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
4025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
4026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
4027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
4029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
4034 static struct hda_verb alc260_will_verbs[] = {
4035 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4036 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
4037 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
4038 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4039 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4040 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
4044 static struct hda_verb alc260_replacer_672v_verbs[] = {
4045 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
4046 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
4047 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
4049 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
4050 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
4051 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4053 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4057 /* toggle speaker-output according to the hp-jack state */
4058 static void alc260_replacer_672v_automute(struct hda_codec *codec)
4060 unsigned int present;
4062 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4063 present = snd_hda_codec_read(codec, 0x0f, 0,
4064 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
4066 snd_hda_codec_write_cache(codec, 0x01, 0,
4067 AC_VERB_SET_GPIO_DATA, 1);
4068 snd_hda_codec_write_cache(codec, 0x0f, 0,
4069 AC_VERB_SET_PIN_WIDGET_CONTROL,
4072 snd_hda_codec_write_cache(codec, 0x01, 0,
4073 AC_VERB_SET_GPIO_DATA, 0);
4074 snd_hda_codec_write_cache(codec, 0x0f, 0,
4075 AC_VERB_SET_PIN_WIDGET_CONTROL,
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 /* mute analog inputs */
4472 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4479 * Set up output mixers (0x08 - 0x0a)
4481 /* set vol=0 to output mixers */
4482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4484 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4485 /* set up input amps for analog loopback */
4486 /* Amp Indices: DAC = 0, mixer = 1 */
4487 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4489 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4490 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4492 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4497 static int alc260_parse_auto_config(struct hda_codec *codec)
4499 struct alc_spec *spec = codec->spec;
4502 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
4504 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4508 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
4511 if (!spec->kctl_alloc)
4512 return 0; /* can't find valid BIOS pin config */
4513 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
4517 spec->multiout.max_channels = 2;
4519 if (spec->autocfg.dig_out_pin)
4520 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
4521 if (spec->kctl_alloc)
4522 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
4524 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs;
4526 spec->num_mux_defs = 1;
4527 spec->input_mux = &spec->private_imux;
4529 /* check whether NID 0x04 is valid */
4530 wcap = get_wcaps(codec, 0x04);
4531 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */
4532 if (wcap != AC_WID_AUD_IN) {
4533 spec->adc_nids = alc260_adc_nids_alt;
4534 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
4535 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer;
4537 spec->adc_nids = alc260_adc_nids;
4538 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
4539 spec->mixers[spec->num_mixers] = alc260_capture_mixer;
4546 /* additional initialization for auto-configuration model */
4547 static void alc260_auto_init(struct hda_codec *codec)
4549 alc260_auto_init_multi_out(codec);
4550 alc260_auto_init_analog_input(codec);
4553 #ifdef CONFIG_SND_HDA_POWER_SAVE
4554 static struct hda_amp_list alc260_loopbacks[] = {
4555 { 0x07, HDA_INPUT, 0 },
4556 { 0x07, HDA_INPUT, 1 },
4557 { 0x07, HDA_INPUT, 2 },
4558 { 0x07, HDA_INPUT, 3 },
4559 { 0x07, HDA_INPUT, 4 },
4565 * ALC260 configurations
4567 static const char *alc260_models[ALC260_MODEL_LAST] = {
4568 [ALC260_BASIC] = "basic",
4570 [ALC260_HP_3013] = "hp-3013",
4571 [ALC260_FUJITSU_S702X] = "fujitsu",
4572 [ALC260_ACER] = "acer",
4573 [ALC260_WILL] = "will",
4574 [ALC260_REPLACER_672V] = "replacer",
4575 #ifdef CONFIG_SND_DEBUG
4576 [ALC260_TEST] = "test",
4578 [ALC260_AUTO] = "auto",
4581 static struct snd_pci_quirk alc260_cfg_tbl[] = {
4582 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
4583 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
4584 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
4585 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
4586 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
4587 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP),
4588 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013),
4589 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
4590 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
4591 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
4592 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
4593 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
4594 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
4595 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
4596 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
4597 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
4598 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
4599 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
4603 static struct alc_config_preset alc260_presets[] = {
4605 .mixers = { alc260_base_output_mixer,
4607 alc260_pc_beep_mixer,
4608 alc260_capture_mixer },
4609 .init_verbs = { alc260_init_verbs },
4610 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4611 .dac_nids = alc260_dac_nids,
4612 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4613 .adc_nids = alc260_adc_nids,
4614 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4615 .channel_mode = alc260_modes,
4616 .input_mux = &alc260_capture_source,
4619 .mixers = { alc260_base_output_mixer,
4621 alc260_capture_alt_mixer },
4622 .init_verbs = { alc260_init_verbs },
4623 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4624 .dac_nids = alc260_dac_nids,
4625 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4626 .adc_nids = alc260_hp_adc_nids,
4627 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4628 .channel_mode = alc260_modes,
4629 .input_mux = &alc260_capture_source,
4631 [ALC260_HP_3013] = {
4632 .mixers = { alc260_hp_3013_mixer,
4634 alc260_capture_alt_mixer },
4635 .init_verbs = { alc260_hp_3013_init_verbs },
4636 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4637 .dac_nids = alc260_dac_nids,
4638 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids),
4639 .adc_nids = alc260_hp_adc_nids,
4640 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4641 .channel_mode = alc260_modes,
4642 .input_mux = &alc260_capture_source,
4644 [ALC260_FUJITSU_S702X] = {
4645 .mixers = { alc260_fujitsu_mixer,
4646 alc260_capture_mixer },
4647 .init_verbs = { alc260_fujitsu_init_verbs },
4648 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4649 .dac_nids = alc260_dac_nids,
4650 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4651 .adc_nids = alc260_dual_adc_nids,
4652 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4653 .channel_mode = alc260_modes,
4654 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
4655 .input_mux = alc260_fujitsu_capture_sources,
4658 .mixers = { alc260_acer_mixer,
4659 alc260_capture_mixer },
4660 .init_verbs = { alc260_acer_init_verbs },
4661 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4662 .dac_nids = alc260_dac_nids,
4663 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
4664 .adc_nids = alc260_dual_adc_nids,
4665 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4666 .channel_mode = alc260_modes,
4667 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
4668 .input_mux = alc260_acer_capture_sources,
4671 .mixers = { alc260_will_mixer,
4672 alc260_capture_mixer },
4673 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
4674 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4675 .dac_nids = alc260_dac_nids,
4676 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4677 .adc_nids = alc260_adc_nids,
4678 .dig_out_nid = ALC260_DIGOUT_NID,
4679 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4680 .channel_mode = alc260_modes,
4681 .input_mux = &alc260_capture_source,
4683 [ALC260_REPLACER_672V] = {
4684 .mixers = { alc260_replacer_672v_mixer,
4685 alc260_capture_mixer },
4686 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
4687 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
4688 .dac_nids = alc260_dac_nids,
4689 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
4690 .adc_nids = alc260_adc_nids,
4691 .dig_out_nid = ALC260_DIGOUT_NID,
4692 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4693 .channel_mode = alc260_modes,
4694 .input_mux = &alc260_capture_source,
4695 .unsol_event = alc260_replacer_672v_unsol_event,
4696 .init_hook = alc260_replacer_672v_automute,
4698 #ifdef CONFIG_SND_DEBUG
4700 .mixers = { alc260_test_mixer,
4701 alc260_capture_mixer },
4702 .init_verbs = { alc260_test_init_verbs },
4703 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
4704 .dac_nids = alc260_test_dac_nids,
4705 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
4706 .adc_nids = alc260_test_adc_nids,
4707 .num_channel_mode = ARRAY_SIZE(alc260_modes),
4708 .channel_mode = alc260_modes,
4709 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
4710 .input_mux = alc260_test_capture_sources,
4715 static int patch_alc260(struct hda_codec *codec)
4717 struct alc_spec *spec;
4718 int err, board_config;
4720 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4726 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
4729 if (board_config < 0) {
4730 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, "
4731 "trying auto-probe from BIOS...\n");
4732 board_config = ALC260_AUTO;
4735 if (board_config == ALC260_AUTO) {
4736 /* automatic parse from the BIOS config */
4737 err = alc260_parse_auto_config(codec);
4743 "hda_codec: Cannot set up configuration "
4744 "from BIOS. Using base mode...\n");
4745 board_config = ALC260_BASIC;
4749 if (board_config != ALC260_AUTO)
4750 setup_preset(spec, &alc260_presets[board_config]);
4752 spec->stream_name_analog = "ALC260 Analog";
4753 spec->stream_analog_playback = &alc260_pcm_analog_playback;
4754 spec->stream_analog_capture = &alc260_pcm_analog_capture;
4756 spec->stream_name_digital = "ALC260 Digital";
4757 spec->stream_digital_playback = &alc260_pcm_digital_playback;
4758 spec->stream_digital_capture = &alc260_pcm_digital_capture;
4760 codec->patch_ops = alc_patch_ops;
4761 if (board_config == ALC260_AUTO)
4762 spec->init_hook = alc260_auto_init;
4763 #ifdef CONFIG_SND_HDA_POWER_SAVE
4764 if (!spec->loopback.amplist)
4765 spec->loopback.amplist = alc260_loopbacks;
4775 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4776 * configuration. Each pin widget can choose any input DACs and a mixer.
4777 * Each ADC is connected from a mixer of all inputs. This makes possible
4778 * 6-channel independent captures.
4780 * In addition, an independent DAC for the multi-playback (not used in this
4783 #define ALC882_DIGOUT_NID 0x06
4784 #define ALC882_DIGIN_NID 0x0a
4786 static struct hda_channel_mode alc882_ch_modes[1] = {
4790 static hda_nid_t alc882_dac_nids[4] = {
4791 /* front, rear, clfe, rear_surr */
4792 0x02, 0x03, 0x04, 0x05
4795 /* identical with ALC880 */
4796 #define alc882_adc_nids alc880_adc_nids
4797 #define alc882_adc_nids_alt alc880_adc_nids_alt
4800 /* FIXME: should be a matrix-type input source selection */
4802 static struct hda_input_mux alc882_capture_source = {
4806 { "Front Mic", 0x1 },
4811 #define alc882_mux_enum_info alc_mux_enum_info
4812 #define alc882_mux_enum_get alc_mux_enum_get
4814 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4815 struct snd_ctl_elem_value *ucontrol)
4817 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4818 struct alc_spec *spec = codec->spec;
4819 const struct hda_input_mux *imux = spec->input_mux;
4820 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
4821 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
4822 hda_nid_t nid = capture_mixers[adc_idx];
4823 unsigned int *cur_val = &spec->cur_mux[adc_idx];
4824 unsigned int i, idx;
4826 idx = ucontrol->value.enumerated.item[0];
4827 if (idx >= imux->num_items)
4828 idx = imux->num_items - 1;
4829 if (*cur_val == idx)
4831 for (i = 0; i < imux->num_items; i++) {
4832 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4833 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4834 imux->items[i].index,
4844 static struct hda_verb alc882_3ST_ch2_init[] = {
4845 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
4846 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
4848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
4855 static struct hda_verb alc882_3ST_ch6_init[] = {
4856 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4857 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4858 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
4859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
4861 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
4865 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
4866 { 2, alc882_3ST_ch2_init },
4867 { 6, alc882_3ST_ch6_init },
4873 static struct hda_verb alc882_sixstack_ch6_init[] = {
4874 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
4875 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4876 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4877 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4884 static struct hda_verb alc882_sixstack_ch8_init[] = {
4885 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4886 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4887 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4888 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
4892 static struct hda_channel_mode alc882_sixstack_modes[2] = {
4893 { 6, alc882_sixstack_ch6_init },
4894 { 8, alc882_sixstack_ch8_init },
4897 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4898 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4900 static struct snd_kcontrol_new alc882_base_mixer[] = {
4901 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4902 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4903 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4904 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4905 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
4906 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
4907 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4908 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4909 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4910 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4911 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4912 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4913 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4914 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4915 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4917 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4919 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4920 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
4921 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4922 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4923 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4927 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
4928 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4929 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4932 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4933 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4935 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
4936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4937 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
4938 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
4942 static struct snd_kcontrol_new alc882_targa_mixer[] = {
4943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4944 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
4946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4948 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4949 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4950 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4952 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4953 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
4957 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
4958 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
4960 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
4961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4962 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
4963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4964 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
4966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
4967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4969 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
4970 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
4971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4976 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
4978 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4979 .name = "Channel Mode",
4980 .info = alc_ch_mode_info,
4981 .get = alc_ch_mode_get,
4982 .put = alc_ch_mode_put,
4987 static struct hda_verb alc882_init_verbs[] = {
4988 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4993 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4994 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4995 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4997 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4998 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5001 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5002 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5003 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5005 /* Front Pin: output 0 (0x0c) */
5006 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5008 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5009 /* Rear Pin: output 1 (0x0d) */
5010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5013 /* CLFE Pin: output 2 (0x0e) */
5014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5016 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
5017 /* Side Pin: output 3 (0x0f) */
5018 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5020 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
5021 /* Mic (rear) pin: input vref at 80% */
5022 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5023 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5024 /* Front Mic pin: input vref at 80% */
5025 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5026 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5027 /* Line In pin: input */
5028 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5030 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5032 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5033 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
5034 /* CD pin widget for input */
5035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5037 /* FIXME: use matrix-type input source selection */
5038 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5039 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5046 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5047 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5048 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5054 /* ADC1: mute amp left and right */
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5056 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5057 /* ADC2: mute amp left and right */
5058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5059 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5060 /* ADC3: mute amp left and right */
5061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5062 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5067 static struct hda_verb alc882_eapd_verbs[] = {
5068 /* change to EAPD mode */
5069 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5070 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
5075 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
5076 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5077 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5078 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
5079 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
5080 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
5081 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
5082 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
5086 static struct hda_verb alc882_macpro_init_verbs[] = {
5087 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5091 /* Front Pin: output 0 (0x0c) */
5092 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5094 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
5095 /* Front Mic pin: input vref at 80% */
5096 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5098 /* Speaker: output */
5099 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5100 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5101 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
5102 /* Headphone output (output 0 - 0x0c) */
5103 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5104 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5105 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5107 /* FIXME: use matrix-type input source selection */
5108 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5109 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5118 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5124 /* ADC1: mute amp left and right */
5125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5126 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5127 /* ADC2: mute amp left and right */
5128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5129 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5130 /* ADC3: mute amp left and right */
5131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5132 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5137 /* iMac 24 mixer. */
5138 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
5139 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
5140 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
5144 /* iMac 24 init verbs. */
5145 static struct hda_verb alc885_imac24_init_verbs[] = {
5146 /* Internal speakers: output 0 (0x0c) */
5147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5149 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
5150 /* Internal speakers: output 0 (0x0c) */
5151 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5153 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
5154 /* Headphone: output 0 (0x0c) */
5155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5157 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
5158 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5159 /* Front Mic: input vref at 80% */
5160 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5161 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
5165 /* Toggle speaker-output according to the hp-jack state */
5166 static void alc885_imac24_automute(struct hda_codec *codec)
5168 unsigned int present;
5170 present = snd_hda_codec_read(codec, 0x14, 0,
5171 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5172 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5173 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5174 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5175 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5178 /* Processes unsolicited events. */
5179 static void alc885_imac24_unsol_event(struct hda_codec *codec,
5182 /* Headphone insertion or removal. */
5183 if ((res >> 26) == ALC880_HP_EVENT)
5184 alc885_imac24_automute(codec);
5187 static struct hda_verb alc882_targa_verbs[] = {
5188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5194 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5195 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5196 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5198 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
5199 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5200 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
5201 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
5205 /* toggle speaker-output according to the hp-jack state */
5206 static void alc882_targa_automute(struct hda_codec *codec)
5208 unsigned int present;
5210 present = snd_hda_codec_read(codec, 0x14, 0,
5211 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5212 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5213 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5214 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5218 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
5220 /* Looks like the unsol event is incompatible with the standard
5221 * definition. 4bit tag is placed at 26 bit!
5223 if (((res >> 26) == ALC880_HP_EVENT)) {
5224 alc882_targa_automute(codec);
5228 static struct hda_verb alc882_asus_a7j_verbs[] = {
5229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5232 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5233 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5234 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5236 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5237 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5238 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
5240 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
5241 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
5242 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
5246 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
5248 unsigned int gpiostate, gpiomask, gpiodir;
5250 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
5251 AC_VERB_GET_GPIO_DATA, 0);
5254 gpiostate |= (1 << pin);
5256 gpiostate &= ~(1 << pin);
5258 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
5259 AC_VERB_GET_GPIO_MASK, 0);
5260 gpiomask |= (1 << pin);
5262 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
5263 AC_VERB_GET_GPIO_DIRECTION, 0);
5264 gpiodir |= (1 << pin);
5267 snd_hda_codec_write(codec, codec->afg, 0,
5268 AC_VERB_SET_GPIO_MASK, gpiomask);
5269 snd_hda_codec_write(codec, codec->afg, 0,
5270 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
5274 snd_hda_codec_write(codec, codec->afg, 0,
5275 AC_VERB_SET_GPIO_DATA, gpiostate);
5279 * generic initialization of ADC, input mixers and output mixers
5281 static struct hda_verb alc882_auto_init_verbs[] = {
5283 * Unmute ADC0-2 and set the default input to mic-in
5285 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
5286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5287 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
5288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5289 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
5290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5292 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5294 * Note: PASD motherboards uses the Line In 2 as the input for
5295 * front panel mic (mic 2)
5297 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5305 * Set up output mixers (0x0c - 0x0f)
5307 /* set vol=0 to output mixers */
5308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5311 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5312 /* set up input amps for analog loopback */
5313 /* Amp Indices: DAC = 0, mixer = 1 */
5314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5322 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5323 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5325 /* FIXME: use matrix-type input source selection */
5326 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5327 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5329 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5330 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5334 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5335 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5339 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
5340 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
5341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
5346 /* capture mixer elements */
5347 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = {
5348 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5349 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5350 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5351 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5354 /* The multiple "Capture Source" controls confuse alsamixer
5355 * So call somewhat different..
5356 * FIXME: the controls appear in the "playback" view!
5358 /* .name = "Capture Source", */
5359 .name = "Input Source",
5361 .info = alc882_mux_enum_info,
5362 .get = alc882_mux_enum_get,
5363 .put = alc882_mux_enum_put,
5368 static struct snd_kcontrol_new alc882_capture_mixer[] = {
5369 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
5370 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
5371 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
5372 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
5373 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
5374 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
5376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5377 /* The multiple "Capture Source" controls confuse alsamixer
5378 * So call somewhat different..
5379 * FIXME: the controls appear in the "playback" view!
5381 /* .name = "Capture Source", */
5382 .name = "Input Source",
5384 .info = alc882_mux_enum_info,
5385 .get = alc882_mux_enum_get,
5386 .put = alc882_mux_enum_put,
5391 #ifdef CONFIG_SND_HDA_POWER_SAVE
5392 #define alc882_loopbacks alc880_loopbacks
5395 /* pcm configuration: identiacal with ALC880 */
5396 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5397 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5398 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5399 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5402 * configuration and preset
5404 static const char *alc882_models[ALC882_MODEL_LAST] = {
5405 [ALC882_3ST_DIG] = "3stack-dig",
5406 [ALC882_6ST_DIG] = "6stack-dig",
5407 [ALC882_ARIMA] = "arima",
5408 [ALC882_W2JC] = "w2jc",
5409 [ALC885_MACPRO] = "macpro",
5410 [ALC885_IMAC24] = "imac24",
5411 [ALC882_AUTO] = "auto",
5414 static struct snd_pci_quirk alc882_cfg_tbl[] = {
5415 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
5416 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
5417 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
5418 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
5419 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
5420 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
5421 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
5422 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
5423 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
5427 static struct alc_config_preset alc882_presets[] = {
5428 [ALC882_3ST_DIG] = {
5429 .mixers = { alc882_base_mixer },
5430 .init_verbs = { alc882_init_verbs },
5431 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5432 .dac_nids = alc882_dac_nids,
5433 .dig_out_nid = ALC882_DIGOUT_NID,
5434 .dig_in_nid = ALC882_DIGIN_NID,
5435 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5436 .channel_mode = alc882_ch_modes,
5438 .input_mux = &alc882_capture_source,
5440 [ALC882_6ST_DIG] = {
5441 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5442 .init_verbs = { alc882_init_verbs },
5443 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5444 .dac_nids = alc882_dac_nids,
5445 .dig_out_nid = ALC882_DIGOUT_NID,
5446 .dig_in_nid = ALC882_DIGIN_NID,
5447 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5448 .channel_mode = alc882_sixstack_modes,
5449 .input_mux = &alc882_capture_source,
5452 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
5453 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
5454 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5455 .dac_nids = alc882_dac_nids,
5456 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
5457 .channel_mode = alc882_sixstack_modes,
5458 .input_mux = &alc882_capture_source,
5461 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
5462 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
5463 alc880_gpio1_init_verbs },
5464 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5465 .dac_nids = alc882_dac_nids,
5466 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5467 .channel_mode = alc880_threestack_modes,
5469 .input_mux = &alc882_capture_source,
5470 .dig_out_nid = ALC882_DIGOUT_NID,
5473 .mixers = { alc882_macpro_mixer },
5474 .init_verbs = { alc882_macpro_init_verbs },
5475 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5476 .dac_nids = alc882_dac_nids,
5477 .dig_out_nid = ALC882_DIGOUT_NID,
5478 .dig_in_nid = ALC882_DIGIN_NID,
5479 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5480 .channel_mode = alc882_ch_modes,
5481 .input_mux = &alc882_capture_source,
5484 .mixers = { alc885_imac24_mixer },
5485 .init_verbs = { alc885_imac24_init_verbs },
5486 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5487 .dac_nids = alc882_dac_nids,
5488 .dig_out_nid = ALC882_DIGOUT_NID,
5489 .dig_in_nid = ALC882_DIGIN_NID,
5490 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
5491 .channel_mode = alc882_ch_modes,
5492 .input_mux = &alc882_capture_source,
5493 .unsol_event = alc885_imac24_unsol_event,
5494 .init_hook = alc885_imac24_automute,
5497 .mixers = { alc882_targa_mixer, alc882_chmode_mixer,
5498 alc882_capture_mixer },
5499 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
5500 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5501 .dac_nids = alc882_dac_nids,
5502 .dig_out_nid = ALC882_DIGOUT_NID,
5503 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5504 .adc_nids = alc882_adc_nids,
5505 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5506 .channel_mode = alc882_3ST_6ch_modes,
5508 .input_mux = &alc882_capture_source,
5509 .unsol_event = alc882_targa_unsol_event,
5510 .init_hook = alc882_targa_automute,
5512 [ALC882_ASUS_A7J] = {
5513 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer,
5514 alc882_capture_mixer },
5515 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
5516 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
5517 .dac_nids = alc882_dac_nids,
5518 .dig_out_nid = ALC882_DIGOUT_NID,
5519 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
5520 .adc_nids = alc882_adc_nids,
5521 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
5522 .channel_mode = alc882_3ST_6ch_modes,
5524 .input_mux = &alc882_capture_source,
5533 PINFIX_ABIT_AW9D_MAX
5536 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
5537 { 0x15, 0x01080104 }, /* side */
5538 { 0x16, 0x01011012 }, /* rear */
5539 { 0x17, 0x01016011 }, /* clfe */
5543 static const struct alc_pincfg *alc882_pin_fixes[] = {
5544 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
5547 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
5548 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
5553 * BIOS auto configuration
5555 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
5556 hda_nid_t nid, int pin_type,
5560 struct alc_spec *spec = codec->spec;
5563 if (spec->multiout.dac_nids[dac_idx] == 0x25)
5566 idx = spec->multiout.dac_nids[dac_idx] - 2;
5568 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5570 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5572 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
5576 static void alc882_auto_init_multi_out(struct hda_codec *codec)
5578 struct alc_spec *spec = codec->spec;
5581 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
5582 for (i = 0; i <= HDA_SIDE; i++) {
5583 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5584 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5586 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
5591 static void alc882_auto_init_hp_out(struct hda_codec *codec)
5593 struct alc_spec *spec = codec->spec;
5596 pin = spec->autocfg.hp_pins[0];
5597 if (pin) /* connect to front */
5599 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5602 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5603 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5605 static void alc882_auto_init_analog_input(struct hda_codec *codec)
5607 struct alc_spec *spec = codec->spec;
5610 for (i = 0; i < AUTO_PIN_LAST; i++) {
5611 hda_nid_t nid = spec->autocfg.input_pins[i];
5612 if (alc882_is_input_pin(nid)) {
5613 snd_hda_codec_write(codec, nid, 0,
5614 AC_VERB_SET_PIN_WIDGET_CONTROL,
5615 i <= AUTO_PIN_FRONT_MIC ?
5616 PIN_VREF80 : PIN_IN);
5617 if (nid != ALC882_PIN_CD_NID)
5618 snd_hda_codec_write(codec, nid, 0,
5619 AC_VERB_SET_AMP_GAIN_MUTE,
5625 /* almost identical with ALC880 parser... */
5626 static int alc882_parse_auto_config(struct hda_codec *codec)
5628 struct alc_spec *spec = codec->spec;
5629 int err = alc880_parse_auto_config(codec);
5634 /* hack - override the init verbs */
5635 spec->init_verbs[0] = alc882_auto_init_verbs;
5639 /* additional initialization for auto-configuration model */
5640 static void alc882_auto_init(struct hda_codec *codec)
5642 alc882_auto_init_multi_out(codec);
5643 alc882_auto_init_hp_out(codec);
5644 alc882_auto_init_analog_input(codec);
5647 static int patch_alc882(struct hda_codec *codec)
5649 struct alc_spec *spec;
5650 int err, board_config;
5652 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5658 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
5662 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
5663 /* Pick up systems that don't supply PCI SSID */
5664 switch (codec->subsystem_id) {
5665 case 0x106b0c00: /* Mac Pro */
5666 board_config = ALC885_MACPRO;
5668 case 0x106b1000: /* iMac 24 */
5669 board_config = ALC885_IMAC24;
5672 printk(KERN_INFO "hda_codec: Unknown model for ALC882, "
5673 "trying auto-probe from BIOS...\n");
5674 board_config = ALC882_AUTO;
5678 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
5680 if (board_config == ALC882_AUTO) {
5681 /* automatic parse from the BIOS config */
5682 err = alc882_parse_auto_config(codec);
5688 "hda_codec: Cannot set up configuration "
5689 "from BIOS. Using base mode...\n");
5690 board_config = ALC882_3ST_DIG;
5694 if (board_config != ALC882_AUTO)
5695 setup_preset(spec, &alc882_presets[board_config]);
5697 if (board_config == ALC885_MACPRO || board_config == ALC885_IMAC24) {
5698 alc882_gpio_mute(codec, 0, 0);
5699 alc882_gpio_mute(codec, 1, 0);
5702 spec->stream_name_analog = "ALC882 Analog";
5703 spec->stream_analog_playback = &alc882_pcm_analog_playback;
5704 spec->stream_analog_capture = &alc882_pcm_analog_capture;
5706 spec->stream_name_digital = "ALC882 Digital";
5707 spec->stream_digital_playback = &alc882_pcm_digital_playback;
5708 spec->stream_digital_capture = &alc882_pcm_digital_capture;
5710 if (!spec->adc_nids && spec->input_mux) {
5711 /* check whether NID 0x07 is valid */
5712 unsigned int wcap = get_wcaps(codec, 0x07);
5714 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
5715 if (wcap != AC_WID_AUD_IN) {
5716 spec->adc_nids = alc882_adc_nids_alt;
5717 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
5718 spec->mixers[spec->num_mixers] =
5719 alc882_capture_alt_mixer;
5722 spec->adc_nids = alc882_adc_nids;
5723 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
5724 spec->mixers[spec->num_mixers] = alc882_capture_mixer;
5729 codec->patch_ops = alc_patch_ops;
5730 if (board_config == ALC882_AUTO)
5731 spec->init_hook = alc882_auto_init;
5732 #ifdef CONFIG_SND_HDA_POWER_SAVE
5733 if (!spec->loopback.amplist)
5734 spec->loopback.amplist = alc882_loopbacks;
5743 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
5744 * configuration. Each pin widget can choose any input DACs and a mixer.
5745 * Each ADC is connected from a mixer of all inputs. This makes possible
5746 * 6-channel independent captures.
5748 * In addition, an independent DAC for the multi-playback (not used in this
5751 #define ALC883_DIGOUT_NID 0x06
5752 #define ALC883_DIGIN_NID 0x0a
5754 static hda_nid_t alc883_dac_nids[4] = {
5755 /* front, rear, clfe, rear_surr */
5756 0x02, 0x04, 0x03, 0x05
5759 static hda_nid_t alc883_adc_nids[2] = {
5765 /* FIXME: should be a matrix-type input source selection */
5767 static struct hda_input_mux alc883_capture_source = {
5771 { "Front Mic", 0x1 },
5777 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
5785 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
5795 #define alc883_mux_enum_info alc_mux_enum_info
5796 #define alc883_mux_enum_get alc_mux_enum_get
5798 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5799 struct snd_ctl_elem_value *ucontrol)
5801 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5802 struct alc_spec *spec = codec->spec;
5803 const struct hda_input_mux *imux = spec->input_mux;
5804 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5805 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5806 hda_nid_t nid = capture_mixers[adc_idx];
5807 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5808 unsigned int i, idx;
5810 idx = ucontrol->value.enumerated.item[0];
5811 if (idx >= imux->num_items)
5812 idx = imux->num_items - 1;
5813 if (*cur_val == idx)
5815 for (i = 0; i < imux->num_items; i++) {
5816 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5817 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5818 imux->items[i].index,
5828 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
5835 static struct hda_verb alc883_3ST_ch2_init[] = {
5836 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
5837 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
5839 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
5846 static struct hda_verb alc883_3ST_ch6_init[] = {
5847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5849 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
5850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
5852 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
5856 static struct hda_channel_mode alc883_3ST_6ch_modes[2] = {
5857 { 2, alc883_3ST_ch2_init },
5858 { 6, alc883_3ST_ch6_init },
5864 static struct hda_verb alc883_sixstack_ch6_init[] = {
5865 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
5866 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5867 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5868 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5875 static struct hda_verb alc883_sixstack_ch8_init[] = {
5876 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5877 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5878 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5879 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
5883 static struct hda_channel_mode alc883_sixstack_modes[2] = {
5884 { 6, alc883_sixstack_ch6_init },
5885 { 8, alc883_sixstack_ch8_init },
5888 static struct hda_verb alc883_medion_eapd_verbs[] = {
5889 /* eanable EAPD on medion laptop */
5890 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5891 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
5895 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5896 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5899 static struct snd_kcontrol_new alc883_base_mixer[] = {
5900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5902 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5903 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5904 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5905 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5906 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5907 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5908 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
5909 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
5910 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5911 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5912 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5913 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5914 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5916 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5918 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5919 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5920 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5921 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5922 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5923 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5924 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5925 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5926 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5929 /* .name = "Capture Source", */
5930 .name = "Input Source",
5932 .info = alc883_mux_enum_info,
5933 .get = alc883_mux_enum_get,
5934 .put = alc883_mux_enum_put,
5939 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
5940 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5941 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5942 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5943 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5944 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5953 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5954 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5955 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5956 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5957 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5958 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5961 /* .name = "Capture Source", */
5962 .name = "Input Source",
5964 .info = alc883_mux_enum_info,
5965 .get = alc883_mux_enum_get,
5966 .put = alc883_mux_enum_put,
5971 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
5972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
5973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
5974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
5975 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
5976 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
5977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
5978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
5979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
5980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
5981 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
5982 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
5983 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
5984 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
5985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
5986 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
5987 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
5988 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
5989 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
5990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
5991 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
5992 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
5993 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
5994 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
5995 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
5996 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
5998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5999 /* .name = "Capture Source", */
6000 .name = "Input Source",
6002 .info = alc883_mux_enum_info,
6003 .get = alc883_mux_enum_get,
6004 .put = alc883_mux_enum_put,
6009 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
6010 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6011 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6012 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6013 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6014 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6015 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6016 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT),
6017 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
6018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6019 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6020 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6024 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6026 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6027 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6028 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6029 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6030 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6031 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6032 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6035 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6036 /* .name = "Capture Source", */
6037 .name = "Input Source",
6039 .info = alc883_mux_enum_info,
6040 .get = alc883_mux_enum_get,
6041 .put = alc883_mux_enum_put,
6046 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
6047 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6048 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6049 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6050 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6051 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6052 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6053 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6054 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6055 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6056 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6057 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6058 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6059 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6063 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6064 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6065 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6066 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6068 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6069 /* .name = "Capture Source", */
6070 .name = "Input Source",
6072 .info = alc883_mux_enum_info,
6073 .get = alc883_mux_enum_get,
6074 .put = alc883_mux_enum_put,
6079 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
6080 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6081 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6082 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6083 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6084 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6087 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6088 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6089 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6090 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6091 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6094 /* .name = "Capture Source", */
6095 .name = "Input Source",
6097 .info = alc883_mux_enum_info,
6098 .get = alc883_mux_enum_get,
6099 .put = alc883_mux_enum_put,
6104 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
6105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6106 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6107 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6108 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT),
6109 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6113 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6114 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6116 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6117 /* .name = "Capture Source", */
6118 .name = "Input Source",
6120 .info = alc883_mux_enum_info,
6121 .get = alc883_mux_enum_get,
6122 .put = alc883_mux_enum_put,
6127 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
6128 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6129 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
6130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6135 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6136 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6137 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6138 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6139 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6140 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6142 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6143 /* .name = "Capture Source", */
6144 .name = "Input Source",
6146 .info = alc883_mux_enum_info,
6147 .get = alc883_mux_enum_get,
6148 .put = alc883_mux_enum_put,
6153 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
6154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6155 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6156 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6157 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6158 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6163 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6164 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6165 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6166 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6169 /* .name = "Capture Source", */
6170 .name = "Input Source",
6172 .info = alc883_mux_enum_info,
6173 .get = alc883_mux_enum_get,
6174 .put = alc883_mux_enum_put,
6179 static struct snd_kcontrol_new alc888_6st_hp_mixer[] = {
6180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6181 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6182 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6183 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6184 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6185 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6186 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6187 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6188 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6189 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6191 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6192 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6196 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6198 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6199 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6201 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6202 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6203 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6204 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6205 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6206 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6209 /* .name = "Capture Source", */
6210 .name = "Input Source",
6212 .info = alc883_mux_enum_info,
6213 .get = alc883_mux_enum_get,
6214 .put = alc883_mux_enum_put,
6219 static struct snd_kcontrol_new alc888_3st_hp_mixer[] = {
6220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
6223 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
6224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
6225 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
6226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
6227 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
6228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6229 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6230 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6237 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6238 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6239 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
6240 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
6241 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6242 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6243 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6244 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6247 /* .name = "Capture Source", */
6248 .name = "Input Source",
6250 .info = alc883_mux_enum_info,
6251 .get = alc883_mux_enum_get,
6252 .put = alc883_mux_enum_put,
6257 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
6258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6264 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6266 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6267 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6268 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6269 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6271 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6272 /* .name = "Capture Source", */
6273 .name = "Input Source",
6275 .info = alc883_mux_enum_info,
6276 .get = alc883_mux_enum_get,
6277 .put = alc883_mux_enum_put,
6282 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
6284 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6285 .name = "Channel Mode",
6286 .info = alc_ch_mode_info,
6287 .get = alc_ch_mode_get,
6288 .put = alc_ch_mode_put,
6293 static struct hda_verb alc883_init_verbs[] = {
6294 /* ADC1: mute amp left and right */
6295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6296 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6297 /* ADC2: mute amp left and right */
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6299 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6300 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6309 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6317 /* mute analog input loopbacks */
6318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6324 /* Front Pin: output 0 (0x0c) */
6325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6327 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6328 /* Rear Pin: output 1 (0x0d) */
6329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6332 /* CLFE Pin: output 2 (0x0e) */
6333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6334 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6335 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6336 /* Side Pin: output 3 (0x0f) */
6337 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6338 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6339 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6340 /* Mic (rear) pin: input vref at 80% */
6341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6342 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6343 /* Front Mic pin: input vref at 80% */
6344 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6345 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6346 /* Line In pin: input */
6347 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6348 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6349 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6351 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6352 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6353 /* CD pin widget for input */
6354 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6356 /* FIXME: use matrix-type input source selection */
6357 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6371 static struct hda_verb alc883_tagra_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},
6376 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6378 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6379 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6380 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6382 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6383 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6384 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6385 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6390 static struct hda_verb alc883_lenovo_101e_verbs[] = {
6391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6392 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
6393 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
6397 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
6398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6399 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6400 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6405 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
6406 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6407 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6409 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
6410 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6414 static struct hda_verb alc888_6st_hp_verbs[] = {
6415 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6416 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */
6417 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */
6418 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */
6422 static struct hda_verb alc888_3st_hp_verbs[] = {
6423 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
6424 {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
6425 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
6429 static struct hda_verb alc888_3st_hp_2ch_init[] = {
6430 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6431 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6432 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6433 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6437 static struct hda_verb alc888_3st_hp_6ch_init[] = {
6438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6440 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6441 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6445 static struct hda_channel_mode alc888_3st_hp_modes[2] = {
6446 { 2, alc888_3st_hp_2ch_init },
6447 { 6, alc888_3st_hp_6ch_init },
6450 /* toggle front-jack and RCA according to the hp-jack state */
6451 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6453 unsigned int present;
6455 present = snd_hda_codec_read(codec, 0x1b, 0,
6456 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6457 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6459 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6460 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6463 /* toggle RCA according to the front-jack state */
6464 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6466 unsigned int present;
6468 present = snd_hda_codec_read(codec, 0x14, 0,
6469 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6470 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6471 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6474 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6477 if ((res >> 26) == ALC880_HP_EVENT)
6478 alc888_lenovo_ms7195_front_automute(codec);
6479 if ((res >> 26) == ALC880_FRONT_EVENT)
6480 alc888_lenovo_ms7195_rca_automute(codec);
6483 static struct hda_verb alc883_medion_md2_verbs[] = {
6484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6489 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6493 /* toggle speaker-output according to the hp-jack state */
6494 static void alc883_medion_md2_automute(struct hda_codec *codec)
6496 unsigned int present;
6498 present = snd_hda_codec_read(codec, 0x14, 0,
6499 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6500 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6501 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6504 static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
6507 if ((res >> 26) == ALC880_HP_EVENT)
6508 alc883_medion_md2_automute(codec);
6511 /* toggle speaker-output according to the hp-jack state */
6512 static void alc883_tagra_automute(struct hda_codec *codec)
6514 unsigned int present;
6517 present = snd_hda_codec_read(codec, 0x14, 0,
6518 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6519 bits = present ? HDA_AMP_MUTE : 0;
6520 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6521 HDA_AMP_MUTE, bits);
6522 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6526 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res)
6528 if ((res >> 26) == ALC880_HP_EVENT)
6529 alc883_tagra_automute(codec);
6532 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6534 unsigned int present;
6537 present = snd_hda_codec_read(codec, 0x14, 0,
6538 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6539 bits = present ? HDA_AMP_MUTE : 0;
6540 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6541 HDA_AMP_MUTE, bits);
6544 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6546 unsigned int present;
6549 present = snd_hda_codec_read(codec, 0x1b, 0,
6550 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6551 bits = present ? HDA_AMP_MUTE : 0;
6552 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6553 HDA_AMP_MUTE, bits);
6554 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6555 HDA_AMP_MUTE, bits);
6558 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
6561 if ((res >> 26) == ALC880_HP_EVENT)
6562 alc883_lenovo_101e_all_automute(codec);
6563 if ((res >> 26) == ALC880_FRONT_EVENT)
6564 alc883_lenovo_101e_ispeaker_automute(codec);
6567 static struct hda_verb alc883_acer_eapd_verbs[] = {
6568 /* HP Pin: output 0 (0x0c) */
6569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6571 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6572 /* Front Pin: output 0 (0x0c) */
6573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6574 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6575 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
6576 /* eanable EAPD on medion laptop */
6577 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6578 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
6583 * generic initialization of ADC, input mixers and output mixers
6585 static struct hda_verb alc883_auto_init_verbs[] = {
6587 * Unmute ADC0-2 and set the default input to mic-in
6589 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6590 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6591 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6592 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6594 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6596 * Note: PASD motherboards uses the Line In 2 as the input for
6597 * front panel mic (mic 2)
6599 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6601 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6607 * Set up output mixers (0x0c - 0x0f)
6609 /* set vol=0 to output mixers */
6610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6611 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6613 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6614 /* set up input amps for analog loopback */
6615 /* Amp Indices: DAC = 0, mixer = 1 */
6616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6623 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6624 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6625 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6627 /* FIXME: use matrix-type input source selection */
6628 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6630 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6631 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6632 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6633 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6636 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6637 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6638 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6639 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
6640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
6645 /* capture mixer elements */
6646 static struct snd_kcontrol_new alc883_capture_mixer[] = {
6647 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6648 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6649 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6650 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6653 /* The multiple "Capture Source" controls confuse alsamixer
6654 * So call somewhat different..
6655 * FIXME: the controls appear in the "playback" view!
6657 /* .name = "Capture Source", */
6658 .name = "Input Source",
6660 .info = alc882_mux_enum_info,
6661 .get = alc882_mux_enum_get,
6662 .put = alc882_mux_enum_put,
6667 #ifdef CONFIG_SND_HDA_POWER_SAVE
6668 #define alc883_loopbacks alc880_loopbacks
6671 /* pcm configuration: identiacal with ALC880 */
6672 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
6673 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
6674 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
6675 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
6678 * configuration and preset
6680 static const char *alc883_models[ALC883_MODEL_LAST] = {
6681 [ALC883_3ST_2ch_DIG] = "3stack-dig",
6682 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
6683 [ALC883_3ST_6ch] = "3stack-6ch",
6684 [ALC883_6ST_DIG] = "6stack-dig",
6685 [ALC883_TARGA_DIG] = "targa-dig",
6686 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
6687 [ALC883_ACER] = "acer",
6688 [ALC883_ACER_ASPIRE] = "acer-aspire",
6689 [ALC883_MEDION] = "medion",
6690 [ALC883_MEDION_MD2] = "medion-md2",
6691 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
6692 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
6693 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
6694 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
6695 [ALC888_6ST_HP] = "6stack-hp",
6696 [ALC888_3ST_HP] = "3stack-hp",
6697 [ALC883_AUTO] = "auto",
6700 static struct snd_pci_quirk alc883_cfg_tbl[] = {
6701 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
6702 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
6703 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
6704 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
6705 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
6706 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
6707 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
6708 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
6709 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
6710 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
6711 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
6712 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
6713 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
6714 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
6715 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
6716 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
6717 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
6718 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
6719 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
6720 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
6721 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
6722 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
6723 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
6724 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
6725 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
6726 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
6727 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
6728 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
6729 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
6730 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
6731 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
6732 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6733 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
6734 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP),
6735 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
6736 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
6737 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
6741 static struct alc_config_preset alc883_presets[] = {
6742 [ALC883_3ST_2ch_DIG] = {
6743 .mixers = { alc883_3ST_2ch_mixer },
6744 .init_verbs = { alc883_init_verbs },
6745 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6746 .dac_nids = alc883_dac_nids,
6747 .dig_out_nid = ALC883_DIGOUT_NID,
6748 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6749 .adc_nids = alc883_adc_nids,
6750 .dig_in_nid = ALC883_DIGIN_NID,
6751 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6752 .channel_mode = alc883_3ST_2ch_modes,
6753 .input_mux = &alc883_capture_source,
6755 [ALC883_3ST_6ch_DIG] = {
6756 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6757 .init_verbs = { alc883_init_verbs },
6758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6759 .dac_nids = alc883_dac_nids,
6760 .dig_out_nid = ALC883_DIGOUT_NID,
6761 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6762 .adc_nids = alc883_adc_nids,
6763 .dig_in_nid = ALC883_DIGIN_NID,
6764 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6765 .channel_mode = alc883_3ST_6ch_modes,
6767 .input_mux = &alc883_capture_source,
6769 [ALC883_3ST_6ch] = {
6770 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6771 .init_verbs = { alc883_init_verbs },
6772 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6773 .dac_nids = alc883_dac_nids,
6774 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6775 .adc_nids = alc883_adc_nids,
6776 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6777 .channel_mode = alc883_3ST_6ch_modes,
6779 .input_mux = &alc883_capture_source,
6781 [ALC883_6ST_DIG] = {
6782 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
6783 .init_verbs = { alc883_init_verbs },
6784 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6785 .dac_nids = alc883_dac_nids,
6786 .dig_out_nid = ALC883_DIGOUT_NID,
6787 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6788 .adc_nids = alc883_adc_nids,
6789 .dig_in_nid = ALC883_DIGIN_NID,
6790 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6791 .channel_mode = alc883_sixstack_modes,
6792 .input_mux = &alc883_capture_source,
6794 [ALC883_TARGA_DIG] = {
6795 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
6796 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6797 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6798 .dac_nids = alc883_dac_nids,
6799 .dig_out_nid = ALC883_DIGOUT_NID,
6800 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6801 .adc_nids = alc883_adc_nids,
6802 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6803 .channel_mode = alc883_3ST_6ch_modes,
6805 .input_mux = &alc883_capture_source,
6806 .unsol_event = alc883_tagra_unsol_event,
6807 .init_hook = alc883_tagra_automute,
6809 [ALC883_TARGA_2ch_DIG] = {
6810 .mixers = { alc883_tagra_2ch_mixer},
6811 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
6812 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6813 .dac_nids = alc883_dac_nids,
6814 .dig_out_nid = ALC883_DIGOUT_NID,
6815 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6816 .adc_nids = alc883_adc_nids,
6817 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6818 .channel_mode = alc883_3ST_2ch_modes,
6819 .input_mux = &alc883_capture_source,
6820 .unsol_event = alc883_tagra_unsol_event,
6821 .init_hook = alc883_tagra_automute,
6824 .mixers = { alc883_base_mixer,
6825 alc883_chmode_mixer },
6826 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6827 * and the headphone jack. Turn this on and rely on the
6828 * standard mute methods whenever the user wants to turn
6829 * these outputs off.
6831 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
6832 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6833 .dac_nids = alc883_dac_nids,
6834 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6835 .adc_nids = alc883_adc_nids,
6836 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6837 .channel_mode = alc883_3ST_2ch_modes,
6838 .input_mux = &alc883_capture_source,
6840 [ALC883_ACER_ASPIRE] = {
6841 .mixers = { alc883_acer_aspire_mixer, alc883_chmode_mixer },
6842 /* On TravelMate laptops, GPIO 0 enables the internal speaker
6843 * and the headphone jack. Turn this on and rely on the
6844 * standard mute methods whenever the user wants to turn
6845 * these outputs off.
6847 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
6848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6849 .dac_nids = alc883_dac_nids,
6850 .dig_out_nid = ALC883_DIGOUT_NID,
6851 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6852 .adc_nids = alc883_adc_nids,
6853 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6854 .channel_mode = alc883_3ST_2ch_modes,
6855 .input_mux = &alc883_capture_source,
6858 .mixers = { alc883_fivestack_mixer,
6859 alc883_chmode_mixer },
6860 .init_verbs = { alc883_init_verbs,
6861 alc883_medion_eapd_verbs },
6862 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6863 .dac_nids = alc883_dac_nids,
6864 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6865 .adc_nids = alc883_adc_nids,
6866 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6867 .channel_mode = alc883_sixstack_modes,
6868 .input_mux = &alc883_capture_source,
6870 [ALC883_MEDION_MD2] = {
6871 .mixers = { alc883_medion_md2_mixer},
6872 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
6873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6874 .dac_nids = alc883_dac_nids,
6875 .dig_out_nid = ALC883_DIGOUT_NID,
6876 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6877 .adc_nids = alc883_adc_nids,
6878 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6879 .channel_mode = alc883_3ST_2ch_modes,
6880 .input_mux = &alc883_capture_source,
6881 .unsol_event = alc883_medion_md2_unsol_event,
6882 .init_hook = alc883_medion_md2_automute,
6884 [ALC883_LAPTOP_EAPD] = {
6885 .mixers = { alc883_base_mixer,
6886 alc883_chmode_mixer },
6887 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
6888 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6889 .dac_nids = alc883_dac_nids,
6890 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6891 .adc_nids = alc883_adc_nids,
6892 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6893 .channel_mode = alc883_3ST_2ch_modes,
6894 .input_mux = &alc883_capture_source,
6896 [ALC883_LENOVO_101E_2ch] = {
6897 .mixers = { alc883_lenovo_101e_2ch_mixer},
6898 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
6899 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6900 .dac_nids = alc883_dac_nids,
6901 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6902 .adc_nids = alc883_adc_nids,
6903 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6904 .channel_mode = alc883_3ST_2ch_modes,
6905 .input_mux = &alc883_lenovo_101e_capture_source,
6906 .unsol_event = alc883_lenovo_101e_unsol_event,
6907 .init_hook = alc883_lenovo_101e_all_automute,
6909 [ALC883_LENOVO_NB0763] = {
6910 .mixers = { alc883_lenovo_nb0763_mixer },
6911 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
6912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6913 .dac_nids = alc883_dac_nids,
6914 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6915 .adc_nids = alc883_adc_nids,
6916 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
6917 .channel_mode = alc883_3ST_2ch_modes,
6919 .input_mux = &alc883_lenovo_nb0763_capture_source,
6920 .unsol_event = alc883_medion_md2_unsol_event,
6921 .init_hook = alc883_medion_md2_automute,
6923 [ALC888_LENOVO_MS7195_DIG] = {
6924 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
6925 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
6926 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6927 .dac_nids = alc883_dac_nids,
6928 .dig_out_nid = ALC883_DIGOUT_NID,
6929 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6930 .adc_nids = alc883_adc_nids,
6931 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
6932 .channel_mode = alc883_3ST_6ch_modes,
6934 .input_mux = &alc883_capture_source,
6935 .unsol_event = alc883_lenovo_ms7195_unsol_event,
6936 .init_hook = alc888_lenovo_ms7195_front_automute,
6939 .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer },
6940 .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs },
6941 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6942 .dac_nids = alc883_dac_nids,
6943 .dig_out_nid = ALC883_DIGOUT_NID,
6944 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6945 .adc_nids = alc883_adc_nids,
6946 .dig_in_nid = ALC883_DIGIN_NID,
6947 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
6948 .channel_mode = alc883_sixstack_modes,
6949 .input_mux = &alc883_capture_source,
6952 .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer },
6953 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
6954 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
6955 .dac_nids = alc883_dac_nids,
6956 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
6957 .adc_nids = alc883_adc_nids,
6958 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
6959 .channel_mode = alc888_3st_hp_modes,
6961 .input_mux = &alc883_capture_source,
6967 * BIOS auto configuration
6969 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
6970 hda_nid_t nid, int pin_type,
6974 struct alc_spec *spec = codec->spec;
6977 if (spec->multiout.dac_nids[dac_idx] == 0x25)
6980 idx = spec->multiout.dac_nids[dac_idx] - 2;
6982 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6984 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
6986 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
6990 static void alc883_auto_init_multi_out(struct hda_codec *codec)
6992 struct alc_spec *spec = codec->spec;
6995 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
6996 for (i = 0; i <= HDA_SIDE; i++) {
6997 hda_nid_t nid = spec->autocfg.line_out_pins[i];
6998 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7000 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
7005 static void alc883_auto_init_hp_out(struct hda_codec *codec)
7007 struct alc_spec *spec = codec->spec;
7010 pin = spec->autocfg.hp_pins[0];
7011 if (pin) /* connect to front */
7013 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7016 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7017 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7019 static void alc883_auto_init_analog_input(struct hda_codec *codec)
7021 struct alc_spec *spec = codec->spec;
7024 for (i = 0; i < AUTO_PIN_LAST; i++) {
7025 hda_nid_t nid = spec->autocfg.input_pins[i];
7026 if (alc883_is_input_pin(nid)) {
7027 snd_hda_codec_write(codec, nid, 0,
7028 AC_VERB_SET_PIN_WIDGET_CONTROL,
7029 (i <= AUTO_PIN_FRONT_MIC ?
7030 PIN_VREF80 : PIN_IN));
7031 if (nid != ALC883_PIN_CD_NID)
7032 snd_hda_codec_write(codec, nid, 0,
7033 AC_VERB_SET_AMP_GAIN_MUTE,
7039 /* almost identical with ALC880 parser... */
7040 static int alc883_parse_auto_config(struct hda_codec *codec)
7042 struct alc_spec *spec = codec->spec;
7043 int err = alc880_parse_auto_config(codec);
7048 /* hack - override the init verbs */
7049 spec->init_verbs[0] = alc883_auto_init_verbs;
7050 spec->mixers[spec->num_mixers] = alc883_capture_mixer;
7055 /* additional initialization for auto-configuration model */
7056 static void alc883_auto_init(struct hda_codec *codec)
7058 alc883_auto_init_multi_out(codec);
7059 alc883_auto_init_hp_out(codec);
7060 alc883_auto_init_analog_input(codec);
7063 static int patch_alc883(struct hda_codec *codec)
7065 struct alc_spec *spec;
7066 int err, board_config;
7068 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7074 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
7077 if (board_config < 0) {
7078 printk(KERN_INFO "hda_codec: Unknown model for ALC883, "
7079 "trying auto-probe from BIOS...\n");
7080 board_config = ALC883_AUTO;
7083 if (board_config == ALC883_AUTO) {
7084 /* automatic parse from the BIOS config */
7085 err = alc883_parse_auto_config(codec);
7091 "hda_codec: Cannot set up configuration "
7092 "from BIOS. Using base mode...\n");
7093 board_config = ALC883_3ST_2ch_DIG;
7097 if (board_config != ALC883_AUTO)
7098 setup_preset(spec, &alc883_presets[board_config]);
7100 spec->stream_name_analog = "ALC883 Analog";
7101 spec->stream_analog_playback = &alc883_pcm_analog_playback;
7102 spec->stream_analog_capture = &alc883_pcm_analog_capture;
7104 spec->stream_name_digital = "ALC883 Digital";
7105 spec->stream_digital_playback = &alc883_pcm_digital_playback;
7106 spec->stream_digital_capture = &alc883_pcm_digital_capture;
7108 if (!spec->adc_nids && spec->input_mux) {
7109 spec->adc_nids = alc883_adc_nids;
7110 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
7113 codec->patch_ops = alc_patch_ops;
7114 if (board_config == ALC883_AUTO)
7115 spec->init_hook = alc883_auto_init;
7116 #ifdef CONFIG_SND_HDA_POWER_SAVE
7117 if (!spec->loopback.amplist)
7118 spec->loopback.amplist = alc883_loopbacks;
7128 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7129 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7131 #define alc262_dac_nids alc260_dac_nids
7132 #define alc262_adc_nids alc882_adc_nids
7133 #define alc262_adc_nids_alt alc882_adc_nids_alt
7135 #define alc262_modes alc260_modes
7136 #define alc262_capture_source alc882_capture_source
7138 static struct snd_kcontrol_new alc262_base_mixer[] = {
7139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7140 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7151 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7152 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
7154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7155 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7156 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7160 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
7161 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7162 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7163 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7164 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7165 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7166 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7169 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7170 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7171 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7172 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7173 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7174 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7175 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7180 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
7181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7182 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7184 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7185 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7195 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7196 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7197 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7198 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7199 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
7200 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
7204 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
7205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7206 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7207 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7209 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7210 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
7211 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
7212 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7218 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7219 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),
7223 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7224 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7225 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
7230 static struct hda_bind_ctls alc262_sony_bind_sw = {
7231 .ops = &snd_hda_bind_sw,
7233 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7234 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7239 static struct snd_kcontrol_new alc262_sony_mixer[] = {
7240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7241 HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw),
7242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7244 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7245 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7249 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
7250 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7251 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7255 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7256 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7260 #define alc262_capture_mixer alc882_capture_mixer
7261 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7264 * generic initialization of ADC, input mixers and output mixers
7266 static struct hda_verb alc262_init_verbs[] = {
7268 * Unmute ADC0-2 and set the default input to mic-in
7270 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7272 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7274 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7277 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7279 * Note: PASD motherboards uses the Line In 2 as the input for
7280 * front panel mic (mic 2)
7282 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7290 * Set up output mixers (0x0c - 0x0e)
7292 /* set vol=0 to output mixers */
7293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7296 /* set up input amps for analog loopback */
7297 /* Amp Indices: DAC = 0, mixer = 1 */
7298 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7300 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7301 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7302 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7307 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
7308 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7309 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7310 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7314 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7318 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7321 /* FIXME: use matrix-type input source selection */
7322 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7323 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7342 static struct hda_verb alc262_hippo_unsol_verbs[] = {
7343 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7348 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
7349 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7350 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7351 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
7353 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7358 static struct hda_verb alc262_sony_unsol_verbs[] = {
7359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7361 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
7363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7367 /* mute/unmute internal speaker according to the hp jack and mute state */
7368 static void alc262_hippo_automute(struct hda_codec *codec)
7370 struct alc_spec *spec = codec->spec;
7372 unsigned int present;
7374 /* need to execute and sync at first */
7375 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7376 present = snd_hda_codec_read(codec, 0x15, 0,
7377 AC_VERB_GET_PIN_SENSE, 0);
7378 spec->jack_present = (present & 0x80000000) != 0;
7379 if (spec->jack_present) {
7380 /* mute internal speaker */
7381 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7382 HDA_AMP_MUTE, HDA_AMP_MUTE);
7384 /* unmute internal speaker if necessary */
7385 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7386 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7387 HDA_AMP_MUTE, mute);
7391 /* unsolicited event for HP jack sensing */
7392 static void alc262_hippo_unsol_event(struct hda_codec *codec,
7395 if ((res >> 26) != ALC880_HP_EVENT)
7397 alc262_hippo_automute(codec);
7400 static void alc262_hippo1_automute(struct hda_codec *codec)
7403 unsigned int present;
7405 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7406 present = snd_hda_codec_read(codec, 0x1b, 0,
7407 AC_VERB_GET_PIN_SENSE, 0);
7408 present = (present & 0x80000000) != 0;
7410 /* mute internal speaker */
7411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7412 HDA_AMP_MUTE, HDA_AMP_MUTE);
7414 /* unmute internal speaker if necessary */
7415 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7416 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7417 HDA_AMP_MUTE, mute);
7421 /* unsolicited event for HP jack sensing */
7422 static void alc262_hippo1_unsol_event(struct hda_codec *codec,
7425 if ((res >> 26) != ALC880_HP_EVENT)
7427 alc262_hippo1_automute(codec);
7432 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7435 #define ALC_HP_EVENT 0x37
7437 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
7438 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
7439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7443 static struct hda_input_mux alc262_fujitsu_capture_source = {
7451 static struct hda_input_mux alc262_HP_capture_source = {
7455 { "Front Mic", 0x3 },
7462 /* mute/unmute internal speaker according to the hp jack and mute state */
7463 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7465 struct alc_spec *spec = codec->spec;
7468 if (force || !spec->sense_updated) {
7469 unsigned int present;
7470 /* need to execute and sync at first */
7471 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
7472 present = snd_hda_codec_read(codec, 0x14, 0,
7473 AC_VERB_GET_PIN_SENSE, 0);
7474 spec->jack_present = (present & 0x80000000) != 0;
7475 spec->sense_updated = 1;
7477 if (spec->jack_present) {
7478 /* mute internal speaker */
7479 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7480 HDA_AMP_MUTE, HDA_AMP_MUTE);
7482 /* unmute internal speaker if necessary */
7483 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7484 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7485 HDA_AMP_MUTE, mute);
7489 /* unsolicited event for HP jack sensing */
7490 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
7493 if ((res >> 26) != ALC_HP_EVENT)
7495 alc262_fujitsu_automute(codec, 1);
7498 /* bind volumes of both NID 0x0c and 0x0d */
7499 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
7500 .ops = &snd_hda_bind_vol,
7502 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
7503 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
7508 /* bind hp and internal speaker mute (with plug check) */
7509 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7510 struct snd_ctl_elem_value *ucontrol)
7512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
7513 long *valp = ucontrol->value.integer.value;
7516 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7518 valp[0] ? 0 : HDA_AMP_MUTE);
7519 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7521 valp[1] ? 0 : HDA_AMP_MUTE);
7523 alc262_fujitsu_automute(codec, 0);
7527 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
7528 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
7530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7531 .name = "Master Playback Switch",
7532 .info = snd_hda_mixer_amp_switch_info,
7533 .get = snd_hda_mixer_amp_switch_get,
7534 .put = alc262_fujitsu_master_sw_put,
7535 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
7537 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7545 /* additional init verbs for Benq laptops */
7546 static struct hda_verb alc262_EAPD_verbs[] = {
7547 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7548 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7552 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
7553 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7556 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7557 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
7561 /* add playback controls from the parsed DAC table */
7562 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
7563 const struct auto_pin_cfg *cfg)
7568 spec->multiout.num_dacs = 1; /* only use one dac */
7569 spec->multiout.dac_nids = spec->private_dac_nids;
7570 spec->multiout.dac_nids[0] = 2;
7572 nid = cfg->line_out_pins[0];
7574 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7575 "Front Playback Volume",
7576 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
7579 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7580 "Front Playback Switch",
7581 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
7586 nid = cfg->speaker_pins[0];
7589 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7590 "Speaker Playback Volume",
7591 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7595 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7596 "Speaker Playback Switch",
7597 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7602 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7603 "Speaker Playback Switch",
7604 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7610 nid = cfg->hp_pins[0];
7612 /* spec->multiout.hp_nid = 2; */
7614 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7615 "Headphone Playback Volume",
7616 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
7620 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7621 "Headphone Playback Switch",
7622 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
7627 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
7628 "Headphone Playback Switch",
7629 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
7638 /* identical with ALC880 */
7639 #define alc262_auto_create_analog_input_ctls \
7640 alc880_auto_create_analog_input_ctls
7643 * generic initialization of ADC, input mixers and output mixers
7645 static struct hda_verb alc262_volume_init_verbs[] = {
7647 * Unmute ADC0-2 and set the default input to mic-in
7649 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7651 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7653 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7656 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7658 * Note: PASD motherboards uses the Line In 2 as the input for
7659 * front panel mic (mic 2)
7661 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7669 * Set up output mixers (0x0c - 0x0f)
7671 /* set vol=0 to output mixers */
7672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7676 /* set up input amps for analog loopback */
7677 /* Amp Indices: DAC = 0, mixer = 1 */
7678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7681 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7685 /* FIXME: use matrix-type input source selection */
7686 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7687 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7690 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7693 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7694 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7695 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7696 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7700 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7701 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7706 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
7708 * Unmute ADC0-2 and set the default input to mic-in
7710 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7712 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7713 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7714 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7717 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7719 * Note: PASD motherboards uses the Line In 2 as the input for
7720 * front panel mic (mic 2)
7722 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
7729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
7732 * Set up output mixers (0x0c - 0x0e)
7734 /* set vol=0 to output mixers */
7735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7739 /* set up input amps for analog loopback */
7740 /* Amp Indices: DAC = 0, mixer = 1 */
7741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7748 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
7749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7750 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7753 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7755 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7756 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7760 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7762 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
7764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7768 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7769 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7772 /* FIXME: use matrix-type input source selection */
7773 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7774 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7793 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
7795 * Unmute ADC0-2 and set the default input to mic-in
7797 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7799 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7801 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7802 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7804 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7806 * Note: PASD motherboards uses the Line In 2 as the input for front
7809 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7812 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7813 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7814 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7815 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
7816 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
7817 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
7819 * Set up output mixers (0x0c - 0x0e)
7821 /* set vol=0 to output mixers */
7822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7823 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7826 /* set up input amps for analog loopback */
7827 /* Amp Indices: DAC = 0, mixer = 1 */
7828 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7830 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7832 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7836 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
7837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
7838 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
7839 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
7840 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
7841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
7842 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
7844 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7845 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7847 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7848 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7850 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
7851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7853 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
7854 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7855 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
7857 /* FIXME: use matrix-type input source selection */
7858 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7859 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
7861 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
7862 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
7863 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
7864 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
7865 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7866 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
7868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7869 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7873 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7874 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
7878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
7879 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
7880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
7881 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
7882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
7887 #ifdef CONFIG_SND_HDA_POWER_SAVE
7888 #define alc262_loopbacks alc880_loopbacks
7891 /* pcm configuration: identiacal with ALC880 */
7892 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
7893 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
7894 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
7895 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
7898 * BIOS auto configuration
7900 static int alc262_parse_auto_config(struct hda_codec *codec)
7902 struct alc_spec *spec = codec->spec;
7904 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
7906 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7910 if (!spec->autocfg.line_outs)
7911 return 0; /* can't find valid BIOS pin config */
7912 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
7915 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
7919 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
7921 if (spec->autocfg.dig_out_pin)
7922 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
7923 if (spec->autocfg.dig_in_pin)
7924 spec->dig_in_nid = ALC262_DIGIN_NID;
7926 if (spec->kctl_alloc)
7927 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
7929 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs;
7930 spec->num_mux_defs = 1;
7931 spec->input_mux = &spec->private_imux;
7936 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
7937 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
7938 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
7941 /* init callback for auto-configuration model -- overriding the default init */
7942 static void alc262_auto_init(struct hda_codec *codec)
7944 alc262_auto_init_multi_out(codec);
7945 alc262_auto_init_hp_out(codec);
7946 alc262_auto_init_analog_input(codec);
7950 * configuration and preset
7952 static const char *alc262_models[ALC262_MODEL_LAST] = {
7953 [ALC262_BASIC] = "basic",
7954 [ALC262_HIPPO] = "hippo",
7955 [ALC262_HIPPO_1] = "hippo_1",
7956 [ALC262_FUJITSU] = "fujitsu",
7957 [ALC262_HP_BPC] = "hp-bpc",
7958 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
7959 [ALC262_BENQ_ED8] = "benq",
7960 [ALC262_BENQ_T31] = "benq-t31",
7961 [ALC262_SONY_ASSAMD] = "sony-assamd",
7962 [ALC262_AUTO] = "auto",
7965 static struct snd_pci_quirk alc262_cfg_tbl[] = {
7966 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
7967 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
7968 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
7969 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
7970 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC),
7971 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
7972 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC),
7973 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
7974 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
7975 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
7976 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
7977 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
7978 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
7979 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
7980 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
7981 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
7982 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
7983 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
7984 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
7985 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
7986 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
7987 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
7988 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7989 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
7990 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7991 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7995 static struct alc_config_preset alc262_presets[] = {
7997 .mixers = { alc262_base_mixer },
7998 .init_verbs = { alc262_init_verbs },
7999 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8000 .dac_nids = alc262_dac_nids,
8002 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8003 .channel_mode = alc262_modes,
8004 .input_mux = &alc262_capture_source,
8007 .mixers = { alc262_base_mixer },
8008 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
8009 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8010 .dac_nids = alc262_dac_nids,
8012 .dig_out_nid = ALC262_DIGOUT_NID,
8013 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8014 .channel_mode = alc262_modes,
8015 .input_mux = &alc262_capture_source,
8016 .unsol_event = alc262_hippo_unsol_event,
8017 .init_hook = alc262_hippo_automute,
8019 [ALC262_HIPPO_1] = {
8020 .mixers = { alc262_hippo1_mixer },
8021 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
8022 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8023 .dac_nids = alc262_dac_nids,
8025 .dig_out_nid = ALC262_DIGOUT_NID,
8026 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8027 .channel_mode = alc262_modes,
8028 .input_mux = &alc262_capture_source,
8029 .unsol_event = alc262_hippo1_unsol_event,
8030 .init_hook = alc262_hippo1_automute,
8032 [ALC262_FUJITSU] = {
8033 .mixers = { alc262_fujitsu_mixer },
8034 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs },
8035 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8036 .dac_nids = alc262_dac_nids,
8038 .dig_out_nid = ALC262_DIGOUT_NID,
8039 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8040 .channel_mode = alc262_modes,
8041 .input_mux = &alc262_fujitsu_capture_source,
8042 .unsol_event = alc262_fujitsu_unsol_event,
8045 .mixers = { alc262_HP_BPC_mixer },
8046 .init_verbs = { alc262_HP_BPC_init_verbs },
8047 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8048 .dac_nids = alc262_dac_nids,
8050 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8051 .channel_mode = alc262_modes,
8052 .input_mux = &alc262_HP_capture_source,
8054 [ALC262_HP_BPC_D7000_WF] = {
8055 .mixers = { alc262_HP_BPC_WildWest_mixer },
8056 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8057 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8058 .dac_nids = alc262_dac_nids,
8060 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8061 .channel_mode = alc262_modes,
8062 .input_mux = &alc262_HP_capture_source,
8064 [ALC262_HP_BPC_D7000_WL] = {
8065 .mixers = { alc262_HP_BPC_WildWest_mixer,
8066 alc262_HP_BPC_WildWest_option_mixer },
8067 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
8068 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8069 .dac_nids = alc262_dac_nids,
8071 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8072 .channel_mode = alc262_modes,
8073 .input_mux = &alc262_HP_capture_source,
8075 [ALC262_BENQ_ED8] = {
8076 .mixers = { alc262_base_mixer },
8077 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
8078 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8079 .dac_nids = alc262_dac_nids,
8081 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8082 .channel_mode = alc262_modes,
8083 .input_mux = &alc262_capture_source,
8085 [ALC262_SONY_ASSAMD] = {
8086 .mixers = { alc262_sony_mixer },
8087 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
8088 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8089 .dac_nids = alc262_dac_nids,
8091 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8092 .channel_mode = alc262_modes,
8093 .input_mux = &alc262_capture_source,
8094 .unsol_event = alc262_hippo_unsol_event,
8095 .init_hook = alc262_hippo_automute,
8097 [ALC262_BENQ_T31] = {
8098 .mixers = { alc262_benq_t31_mixer },
8099 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
8100 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
8101 .dac_nids = alc262_dac_nids,
8103 .num_channel_mode = ARRAY_SIZE(alc262_modes),
8104 .channel_mode = alc262_modes,
8105 .input_mux = &alc262_capture_source,
8106 .unsol_event = alc262_hippo_unsol_event,
8107 .init_hook = alc262_hippo_automute,
8111 static int patch_alc262(struct hda_codec *codec)
8113 struct alc_spec *spec;
8117 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
8123 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8128 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8129 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
8130 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
8131 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
8135 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
8139 if (board_config < 0) {
8140 printk(KERN_INFO "hda_codec: Unknown model for ALC262, "
8141 "trying auto-probe from BIOS...\n");
8142 board_config = ALC262_AUTO;
8145 if (board_config == ALC262_AUTO) {
8146 /* automatic parse from the BIOS config */
8147 err = alc262_parse_auto_config(codec);
8153 "hda_codec: Cannot set up configuration "
8154 "from BIOS. Using base mode...\n");
8155 board_config = ALC262_BASIC;
8159 if (board_config != ALC262_AUTO)
8160 setup_preset(spec, &alc262_presets[board_config]);
8162 spec->stream_name_analog = "ALC262 Analog";
8163 spec->stream_analog_playback = &alc262_pcm_analog_playback;
8164 spec->stream_analog_capture = &alc262_pcm_analog_capture;
8166 spec->stream_name_digital = "ALC262 Digital";
8167 spec->stream_digital_playback = &alc262_pcm_digital_playback;
8168 spec->stream_digital_capture = &alc262_pcm_digital_capture;
8170 if (!spec->adc_nids && spec->input_mux) {
8171 /* check whether NID 0x07 is valid */
8172 unsigned int wcap = get_wcaps(codec, 0x07);
8175 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8176 if (wcap != AC_WID_AUD_IN) {
8177 spec->adc_nids = alc262_adc_nids_alt;
8178 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
8179 spec->mixers[spec->num_mixers] =
8180 alc262_capture_alt_mixer;
8183 spec->adc_nids = alc262_adc_nids;
8184 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
8185 spec->mixers[spec->num_mixers] = alc262_capture_mixer;
8190 codec->patch_ops = alc_patch_ops;
8191 if (board_config == ALC262_AUTO)
8192 spec->init_hook = alc262_auto_init;
8193 #ifdef CONFIG_SND_HDA_POWER_SAVE
8194 if (!spec->loopback.amplist)
8195 spec->loopback.amplist = alc262_loopbacks;
8202 * ALC268 channel source setting (2 channel)
8204 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8205 #define alc268_modes alc260_modes
8207 static hda_nid_t alc268_dac_nids[2] = {
8212 static hda_nid_t alc268_adc_nids[2] = {
8217 static hda_nid_t alc268_adc_nids_alt[1] = {
8222 static struct snd_kcontrol_new alc268_base_mixer[] = {
8223 /* output mixer control */
8224 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
8225 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
8227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8231 static struct hda_verb alc268_eapd_verbs[] = {
8232 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8233 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8238 * generic initialization of ADC, input mixers and output mixers
8240 static struct hda_verb alc268_base_init_verbs[] = {
8241 /* Unmute DAC0-1 and set vol = 0 */
8242 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8243 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8244 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8245 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8246 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8247 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8250 * Set up output mixers (0x0c - 0x0e)
8252 /* set vol=0 to output mixers */
8253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8256 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
8258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8259 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
8263 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
8264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8267 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8268 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8272 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8273 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8274 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8275 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8276 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8277 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8279 /* FIXME: use matrix-type input source selection */
8280 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
8281 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
8290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
8291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
8296 * generic initialization of ADC, input mixers and output mixers
8298 static struct hda_verb alc268_volume_init_verbs[] = {
8299 /* set output DAC */
8300 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8301 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8302 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8306 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8307 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8308 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8309 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
8311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8313 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8315 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8320 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8322 /* set PCBEEP vol = 0 */
8323 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))},
8328 #define alc268_mux_enum_info alc_mux_enum_info
8329 #define alc268_mux_enum_get alc_mux_enum_get
8331 static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8332 struct snd_ctl_elem_value *ucontrol)
8334 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
8335 struct alc_spec *spec = codec->spec;
8336 const struct hda_input_mux *imux = spec->input_mux;
8337 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
8338 static hda_nid_t capture_mixers[3] = { 0x23, 0x24 };
8339 hda_nid_t nid = capture_mixers[adc_idx];
8340 unsigned int *cur_val = &spec->cur_mux[adc_idx];
8341 unsigned int i, idx;
8343 idx = ucontrol->value.enumerated.item[0];
8344 if (idx >= imux->num_items)
8345 idx = imux->num_items - 1;
8346 if (*cur_val == idx)
8348 for (i = 0; i < imux->num_items; i++) {
8349 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
8350 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
8351 imux->items[i].index,
8353 snd_hda_codec_write_cache(codec, nid, 0,
8354 AC_VERB_SET_CONNECT_SEL,
8361 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
8362 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8363 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8365 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8366 /* The multiple "Capture Source" controls confuse alsamixer
8367 * So call somewhat different..
8368 * FIXME: the controls appear in the "playback" view!
8370 /* .name = "Capture Source", */
8371 .name = "Input Source",
8373 .info = alc268_mux_enum_info,
8374 .get = alc268_mux_enum_get,
8375 .put = alc268_mux_enum_put,
8380 static struct snd_kcontrol_new alc268_capture_mixer[] = {
8381 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
8382 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
8383 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
8384 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
8386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8387 /* The multiple "Capture Source" controls confuse alsamixer
8388 * So call somewhat different..
8389 * FIXME: the controls appear in the "playback" view!
8391 /* .name = "Capture Source", */
8392 .name = "Input Source",
8394 .info = alc268_mux_enum_info,
8395 .get = alc268_mux_enum_get,
8396 .put = alc268_mux_enum_put,
8401 static struct hda_input_mux alc268_capture_source = {
8405 { "Front Mic", 0x1 },
8411 /* create input playback/capture controls for the given pin */
8412 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
8413 const char *ctlname, int idx)
8418 sprintf(name, "%s Playback Volume", ctlname);
8420 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8421 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
8425 } else if (nid == 0x15) {
8426 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
8427 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
8433 sprintf(name, "%s Playback Switch", ctlname);
8434 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
8435 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
8441 /* add playback controls from the parsed DAC table */
8442 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
8443 const struct auto_pin_cfg *cfg)
8448 spec->multiout.num_dacs = 2; /* only use one dac */
8449 spec->multiout.dac_nids = spec->private_dac_nids;
8450 spec->multiout.dac_nids[0] = 2;
8451 spec->multiout.dac_nids[1] = 3;
8453 nid = cfg->line_out_pins[0];
8455 alc268_new_analog_output(spec, nid, "Front", 0);
8457 nid = cfg->speaker_pins[0];
8459 err = add_control(spec, ALC_CTL_WIDGET_VOL,
8460 "Speaker Playback Volume",
8461 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
8465 nid = cfg->hp_pins[0];
8467 alc268_new_analog_output(spec, nid, "Headphone", 0);
8469 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
8471 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
8472 "Mono Playback Switch",
8473 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
8480 /* create playback/capture controls for input pins */
8481 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
8482 const struct auto_pin_cfg *cfg)
8484 struct hda_input_mux *imux = &spec->private_imux;
8487 for (i = 0; i < AUTO_PIN_LAST; i++) {
8488 switch(cfg->input_pins[i]) {
8490 idx1 = 0; /* Mic 1 */
8493 idx1 = 1; /* Mic 2 */
8496 idx1 = 2; /* Line In */
8504 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
8505 imux->items[imux->num_items].index = idx1;
8511 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
8513 struct alc_spec *spec = codec->spec;
8514 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
8515 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
8516 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
8517 unsigned int dac_vol1, dac_vol2;
8520 snd_hda_codec_write(codec, speaker_nid, 0,
8521 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
8522 snd_hda_codec_write(codec, 0x0f, 0,
8523 AC_VERB_SET_AMP_GAIN_MUTE,
8525 snd_hda_codec_write(codec, 0x10, 0,
8526 AC_VERB_SET_AMP_GAIN_MUTE,
8529 snd_hda_codec_write(codec, 0x0f, 0,
8530 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8531 snd_hda_codec_write(codec, 0x10, 0,
8532 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
8535 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
8536 if (line_nid == 0x14)
8537 dac_vol2 = AMP_OUT_ZERO;
8538 else if (line_nid == 0x15)
8539 dac_vol1 = AMP_OUT_ZERO;
8541 dac_vol2 = AMP_OUT_ZERO;
8542 else if (hp_nid == 0x15)
8543 dac_vol1 = AMP_OUT_ZERO;
8544 if (line_nid != 0x16 || hp_nid != 0x16 ||
8545 spec->autocfg.line_out_pins[1] != 0x16 ||
8546 spec->autocfg.line_out_pins[2] != 0x16)
8547 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
8549 snd_hda_codec_write(codec, 0x02, 0,
8550 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
8551 snd_hda_codec_write(codec, 0x03, 0,
8552 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
8555 /* pcm configuration: identiacal with ALC880 */
8556 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
8557 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
8558 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
8561 * BIOS auto configuration
8563 static int alc268_parse_auto_config(struct hda_codec *codec)
8565 struct alc_spec *spec = codec->spec;
8567 static hda_nid_t alc268_ignore[] = { 0 };
8569 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
8573 if (!spec->autocfg.line_outs)
8574 return 0; /* can't find valid BIOS pin config */
8576 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
8579 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
8583 spec->multiout.max_channels = 2;
8585 /* digital only support output */
8586 if (spec->autocfg.dig_out_pin)
8587 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
8589 if (spec->kctl_alloc)
8590 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
8592 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
8593 spec->num_mux_defs = 1;
8594 spec->input_mux = &spec->private_imux;
8599 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
8600 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
8601 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
8603 /* init callback for auto-configuration model -- overriding the default init */
8604 static void alc268_auto_init(struct hda_codec *codec)
8606 alc268_auto_init_multi_out(codec);
8607 alc268_auto_init_hp_out(codec);
8608 alc268_auto_init_mono_speaker_out(codec);
8609 alc268_auto_init_analog_input(codec);
8612 #ifdef CONFIG_SND_HDA_POWER_SAVE
8613 #define alc883_loopbacks alc880_loopbacks
8617 * configuration and preset
8619 static const char *alc268_models[ALC268_MODEL_LAST] = {
8620 [ALC268_3ST] = "3stack",
8621 [ALC268_AUTO] = "auto",
8624 static struct snd_pci_quirk alc268_cfg_tbl[] = {
8625 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
8626 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
8630 static struct alc_config_preset alc268_presets[] = {
8632 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8633 .init_verbs = { alc268_base_init_verbs },
8634 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8635 .dac_nids = alc268_dac_nids,
8636 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8637 .adc_nids = alc268_adc_nids_alt,
8639 .dig_out_nid = ALC268_DIGOUT_NID,
8640 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8641 .channel_mode = alc268_modes,
8642 .input_mux = &alc268_capture_source,
8644 [ALC268_TOSHIBA] = {
8645 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer },
8646 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs },
8647 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
8648 .dac_nids = alc268_dac_nids,
8649 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
8650 .adc_nids = alc268_adc_nids_alt,
8652 .num_channel_mode = ARRAY_SIZE(alc268_modes),
8653 .channel_mode = alc268_modes,
8654 .input_mux = &alc268_capture_source,
8658 static int patch_alc268(struct hda_codec *codec)
8660 struct alc_spec *spec;
8664 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
8670 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
8674 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
8675 printk(KERN_INFO "hda_codec: Unknown model for ALC268, "
8676 "trying auto-probe from BIOS...\n");
8677 board_config = ALC268_AUTO;
8680 if (board_config == ALC268_AUTO) {
8681 /* automatic parse from the BIOS config */
8682 err = alc268_parse_auto_config(codec);
8688 "hda_codec: Cannot set up configuration "
8689 "from BIOS. Using base mode...\n");
8690 board_config = ALC268_3ST;
8694 if (board_config != ALC268_AUTO)
8695 setup_preset(spec, &alc268_presets[board_config]);
8697 spec->stream_name_analog = "ALC268 Analog";
8698 spec->stream_analog_playback = &alc268_pcm_analog_playback;
8699 spec->stream_analog_capture = &alc268_pcm_analog_capture;
8701 spec->stream_name_digital = "ALC268 Digital";
8702 spec->stream_digital_playback = &alc268_pcm_digital_playback;
8704 if (board_config == ALC268_AUTO) {
8705 if (!spec->adc_nids && spec->input_mux) {
8706 /* check whether NID 0x07 is valid */
8707 unsigned int wcap = get_wcaps(codec, 0x07);
8710 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8711 if (wcap != AC_WID_AUD_IN) {
8712 spec->adc_nids = alc268_adc_nids_alt;
8713 spec->num_adc_nids =
8714 ARRAY_SIZE(alc268_adc_nids_alt);
8715 spec->mixers[spec->num_mixers] =
8716 alc268_capture_alt_mixer;
8719 spec->adc_nids = alc268_adc_nids;
8720 spec->num_adc_nids =
8721 ARRAY_SIZE(alc268_adc_nids);
8722 spec->mixers[spec->num_mixers] =
8723 alc268_capture_mixer;
8728 codec->patch_ops = alc_patch_ops;
8729 if (board_config == ALC268_AUTO)
8730 spec->init_hook = alc268_auto_init;
8736 * ALC861 channel source setting (2/6 channel selection for 3-stack)
8740 * set the path ways for 2 channel output
8741 * need to set the codec line out and mic 1 pin widgets to inputs
8743 static struct hda_verb alc861_threestack_ch2_init[] = {
8744 /* set pin widget 1Ah (line in) for input */
8745 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8746 /* set pin widget 18h (mic1/2) for input, for mic also enable
8749 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8751 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8753 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8754 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8760 * need to set the codec line out and mic 1 pin widgets to outputs
8762 static struct hda_verb alc861_threestack_ch6_init[] = {
8763 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8764 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8765 /* set pin widget 18h (mic1) for output (CLFE)*/
8766 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8768 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8769 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8771 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8773 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8774 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8779 static struct hda_channel_mode alc861_threestack_modes[2] = {
8780 { 2, alc861_threestack_ch2_init },
8781 { 6, alc861_threestack_ch6_init },
8783 /* Set mic1 as input and unmute the mixer */
8784 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
8785 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8786 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8789 /* Set mic1 as output and mute mixer */
8790 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
8791 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8796 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
8797 { 2, alc861_uniwill_m31_ch2_init },
8798 { 4, alc861_uniwill_m31_ch4_init },
8801 /* Set mic1 and line-in as input and unmute the mixer */
8802 static struct hda_verb alc861_asus_ch2_init[] = {
8803 /* set pin widget 1Ah (line in) for input */
8804 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
8805 /* set pin widget 18h (mic1/2) for input, for mic also enable
8808 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8810 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
8812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
8813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
8817 /* Set mic1 nad line-in as output and mute mixer */
8818 static struct hda_verb alc861_asus_ch6_init[] = {
8819 /* set pin widget 1Ah (line in) for output (Back Surround)*/
8820 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8821 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8822 /* set pin widget 18h (mic1) for output (CLFE)*/
8823 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
8824 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
8825 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
8826 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
8828 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
8830 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
8831 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
8836 static struct hda_channel_mode alc861_asus_modes[2] = {
8837 { 2, alc861_asus_ch2_init },
8838 { 6, alc861_asus_ch6_init },
8843 static struct snd_kcontrol_new alc861_base_mixer[] = {
8844 /* output mixer control */
8845 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8846 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8847 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8848 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8849 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8851 /*Input mixer control */
8852 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8853 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8854 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8855 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8856 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8857 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8859 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8860 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8863 /* Capture mixer control */
8864 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8865 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8867 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8868 .name = "Capture Source",
8870 .info = alc_mux_enum_info,
8871 .get = alc_mux_enum_get,
8872 .put = alc_mux_enum_put,
8877 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
8878 /* output mixer control */
8879 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8880 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8881 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8882 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8883 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8885 /* Input mixer control */
8886 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8887 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8888 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8889 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8891 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8893 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8894 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8897 /* Capture mixer control */
8898 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8899 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8902 .name = "Capture Source",
8904 .info = alc_mux_enum_info,
8905 .get = alc_mux_enum_get,
8906 .put = alc_mux_enum_put,
8909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8910 .name = "Channel Mode",
8911 .info = alc_ch_mode_info,
8912 .get = alc_ch_mode_get,
8913 .put = alc_ch_mode_put,
8914 .private_value = ARRAY_SIZE(alc861_threestack_modes),
8919 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
8920 /* output mixer control */
8921 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8922 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8923 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8925 /*Capture mixer control */
8926 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8927 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8930 .name = "Capture Source",
8932 .info = alc_mux_enum_info,
8933 .get = alc_mux_enum_get,
8934 .put = alc_mux_enum_put,
8940 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
8941 /* output mixer control */
8942 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8943 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8944 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8945 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8946 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
8948 /* Input mixer control */
8949 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8950 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
8951 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8952 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8954 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8956 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8957 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
8958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
8960 /* Capture mixer control */
8961 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8962 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8965 .name = "Capture Source",
8967 .info = alc_mux_enum_info,
8968 .get = alc_mux_enum_get,
8969 .put = alc_mux_enum_put,
8972 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8973 .name = "Channel Mode",
8974 .info = alc_ch_mode_info,
8975 .get = alc_ch_mode_get,
8976 .put = alc_ch_mode_put,
8977 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
8982 static struct snd_kcontrol_new alc861_asus_mixer[] = {
8983 /* output mixer control */
8984 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
8985 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
8986 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
8987 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
8988 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
8990 /* Input mixer control */
8991 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
8992 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8993 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
8994 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
8995 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
8996 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
8998 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
8999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
9000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
9002 /* Capture mixer control */
9003 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9004 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9007 .name = "Capture Source",
9009 .info = alc_mux_enum_info,
9010 .get = alc_mux_enum_get,
9011 .put = alc_mux_enum_put,
9014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9015 .name = "Channel Mode",
9016 .info = alc_ch_mode_info,
9017 .get = alc_ch_mode_get,
9018 .put = alc_ch_mode_put,
9019 .private_value = ARRAY_SIZE(alc861_asus_modes),
9024 /* additional mixer */
9025 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
9026 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
9027 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
9028 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),
9029 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),
9034 * generic initialization of ADC, input mixers and output mixers
9036 static struct hda_verb alc861_base_init_verbs[] = {
9038 * Unmute ADC0 and set the default input to mic-in
9040 /* port-A for surround (rear panel) */
9041 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9042 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
9043 /* port-B for mic-in (rear panel) with vref */
9044 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9045 /* port-C for line-in (rear panel) */
9046 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9047 /* port-D for Front */
9048 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9049 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9050 /* port-E for HP out (front panel) */
9051 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9052 /* route front PCM to HP */
9053 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9054 /* port-F for mic-in (front panel) with vref */
9055 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9056 /* port-G for CLFE (rear panel) */
9057 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9058 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9059 /* port-H for side (rear panel) */
9060 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9061 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
9063 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9064 /* route front mic to ADC1*/
9065 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9066 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9068 /* Unmute DAC0~3 & spdif out*/
9069 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9070 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9071 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9072 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9073 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9075 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9076 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9077 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9078 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9079 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9081 /* Unmute Stereo Mixer 15 */
9082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9084 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9087 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9088 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9089 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9090 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9091 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9092 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9093 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9094 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9095 /* hp used DAC 3 (Front) */
9096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9097 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9102 static struct hda_verb alc861_threestack_init_verbs[] = {
9104 * Unmute ADC0 and set the default input to mic-in
9106 /* port-A for surround (rear panel) */
9107 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9108 /* port-B for mic-in (rear panel) with vref */
9109 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9110 /* port-C for line-in (rear panel) */
9111 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9112 /* port-D for Front */
9113 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9114 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9115 /* port-E for HP out (front panel) */
9116 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9117 /* route front PCM to HP */
9118 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9119 /* port-F for mic-in (front panel) with vref */
9120 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9121 /* port-G for CLFE (rear panel) */
9122 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9123 /* port-H for side (rear panel) */
9124 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9126 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9127 /* route front mic to ADC1*/
9128 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9130 /* Unmute DAC0~3 & spdif out*/
9131 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9132 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9133 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9134 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9137 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9138 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9139 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9140 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9141 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9143 /* Unmute Stereo Mixer 15 */
9144 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9145 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9146 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9147 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9149 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9150 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9151 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9152 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9153 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9154 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9155 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9156 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9157 /* hp used DAC 3 (Front) */
9158 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9159 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9163 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
9165 * Unmute ADC0 and set the default input to mic-in
9167 /* port-A for surround (rear panel) */
9168 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9169 /* port-B for mic-in (rear panel) with vref */
9170 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9171 /* port-C for line-in (rear panel) */
9172 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9173 /* port-D for Front */
9174 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9175 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9176 /* port-E for HP out (front panel) */
9177 /* this has to be set to VREF80 */
9178 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9179 /* route front PCM to HP */
9180 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9181 /* port-F for mic-in (front panel) with vref */
9182 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9183 /* port-G for CLFE (rear panel) */
9184 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9185 /* port-H for side (rear panel) */
9186 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9188 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9189 /* route front mic to ADC1*/
9190 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9192 /* Unmute DAC0~3 & spdif out*/
9193 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9194 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9195 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9196 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9199 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9200 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9201 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9202 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9203 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9205 /* Unmute Stereo Mixer 15 */
9206 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9208 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9209 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9211 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9212 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9213 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9215 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9216 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9218 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9219 /* hp used DAC 3 (Front) */
9220 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9221 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9225 static struct hda_verb alc861_asus_init_verbs[] = {
9227 * Unmute ADC0 and set the default input to mic-in
9229 /* port-A for surround (rear panel)
9230 * according to codec#0 this is the HP jack
9232 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
9233 /* route front PCM to HP */
9234 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
9235 /* port-B for mic-in (rear panel) with vref */
9236 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9237 /* port-C for line-in (rear panel) */
9238 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9239 /* port-D for Front */
9240 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9241 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
9242 /* port-E for HP out (front panel) */
9243 /* this has to be set to VREF80 */
9244 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9245 /* route front PCM to HP */
9246 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
9247 /* port-F for mic-in (front panel) with vref */
9248 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9249 /* port-G for CLFE (rear panel) */
9250 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9251 /* port-H for side (rear panel) */
9252 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
9254 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
9255 /* route front mic to ADC1*/
9256 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9257 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9258 /* Unmute DAC0~3 & spdif out*/
9259 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9260 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9261 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9262 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9263 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9264 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9265 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9266 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9267 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9268 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9270 /* Unmute Stereo Mixer 15 */
9271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9272 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
9276 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9277 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9278 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9279 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9280 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9281 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9284 /* hp used DAC 3 (Front) */
9285 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9286 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9290 /* additional init verbs for ASUS laptops */
9291 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
9292 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
9293 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
9298 * generic initialization of ADC, input mixers and output mixers
9300 static struct hda_verb alc861_auto_init_verbs[] = {
9302 * Unmute ADC0 and set the default input to mic-in
9304 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
9305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9307 /* Unmute DAC0~3 & spdif out*/
9308 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9309 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9310 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9311 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9314 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9315 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9316 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9317 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9318 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9320 /* Unmute Stereo Mixer 15 */
9321 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9323 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
9326 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9327 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9328 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9329 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9330 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9336 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9337 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9338 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9339 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9340 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9341 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
9342 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
9344 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
9349 static struct hda_verb alc861_toshiba_init_verbs[] = {
9350 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9355 /* toggle speaker-output according to the hp-jack state */
9356 static void alc861_toshiba_automute(struct hda_codec *codec)
9358 unsigned int present;
9360 present = snd_hda_codec_read(codec, 0x0f, 0,
9361 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9362 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
9363 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9364 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
9365 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
9368 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
9371 if ((res >> 26) == ALC880_HP_EVENT)
9372 alc861_toshiba_automute(codec);
9375 /* pcm configuration: identiacal with ALC880 */
9376 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
9377 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
9378 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
9379 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
9382 #define ALC861_DIGOUT_NID 0x07
9384 static struct hda_channel_mode alc861_8ch_modes[1] = {
9388 static hda_nid_t alc861_dac_nids[4] = {
9389 /* front, surround, clfe, side */
9390 0x03, 0x06, 0x05, 0x04
9393 static hda_nid_t alc660_dac_nids[3] = {
9394 /* front, clfe, surround */
9398 static hda_nid_t alc861_adc_nids[1] = {
9403 static struct hda_input_mux alc861_capture_source = {
9407 { "Front Mic", 0x3 },
9414 /* fill in the dac_nids table from the parsed pin configuration */
9415 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
9416 const struct auto_pin_cfg *cfg)
9421 spec->multiout.dac_nids = spec->private_dac_nids;
9422 for (i = 0; i < cfg->line_outs; i++) {
9423 nid = cfg->line_out_pins[i];
9425 if (i >= ARRAY_SIZE(alc861_dac_nids))
9427 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
9430 spec->multiout.num_dacs = cfg->line_outs;
9434 /* add playback controls from the parsed DAC table */
9435 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
9436 const struct auto_pin_cfg *cfg)
9439 static const char *chname[4] = {
9440 "Front", "Surround", NULL /*CLFE*/, "Side"
9445 for (i = 0; i < cfg->line_outs; i++) {
9446 nid = spec->multiout.dac_nids[i];
9451 err = add_control(spec, ALC_CTL_BIND_MUTE,
9452 "Center Playback Switch",
9453 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
9457 err = add_control(spec, ALC_CTL_BIND_MUTE,
9458 "LFE Playback Switch",
9459 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
9464 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
9466 if (nid == alc861_dac_nids[idx])
9468 sprintf(name, "%s Playback Switch", chname[idx]);
9469 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
9470 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
9479 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
9487 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
9489 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
9490 "Headphone Playback Switch",
9491 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
9494 spec->multiout.hp_nid = nid;
9499 /* create playback/capture controls for input pins */
9500 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
9501 const struct auto_pin_cfg *cfg)
9503 struct hda_input_mux *imux = &spec->private_imux;
9504 int i, err, idx, idx1;
9506 for (i = 0; i < AUTO_PIN_LAST; i++) {
9507 switch (cfg->input_pins[i]) {
9510 idx = 2; /* Line In */
9514 idx = 2; /* Line In */
9518 idx = 1; /* Mic In */
9522 idx = 1; /* Mic In */
9532 err = new_analog_input(spec, cfg->input_pins[i],
9533 auto_pin_cfg_labels[i], idx, 0x15);
9537 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
9538 imux->items[imux->num_items].index = idx1;
9544 static struct snd_kcontrol_new alc861_capture_mixer[] = {
9545 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
9546 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
9549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9550 /* The multiple "Capture Source" controls confuse alsamixer
9551 * So call somewhat different..
9552 *FIXME: the controls appear in the "playback" view!
9554 /* .name = "Capture Source", */
9555 .name = "Input Source",
9557 .info = alc_mux_enum_info,
9558 .get = alc_mux_enum_get,
9559 .put = alc_mux_enum_put,
9564 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
9566 int pin_type, int dac_idx)
9570 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9572 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
9577 static void alc861_auto_init_multi_out(struct hda_codec *codec)
9579 struct alc_spec *spec = codec->spec;
9582 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
9583 for (i = 0; i < spec->autocfg.line_outs; i++) {
9584 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9585 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9587 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
9588 spec->multiout.dac_nids[i]);
9592 static void alc861_auto_init_hp_out(struct hda_codec *codec)
9594 struct alc_spec *spec = codec->spec;
9597 pin = spec->autocfg.hp_pins[0];
9598 if (pin) /* connect to front */
9599 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
9600 spec->multiout.dac_nids[0]);
9603 static void alc861_auto_init_analog_input(struct hda_codec *codec)
9605 struct alc_spec *spec = codec->spec;
9608 for (i = 0; i < AUTO_PIN_LAST; i++) {
9609 hda_nid_t nid = spec->autocfg.input_pins[i];
9610 if (nid >= 0x0c && nid <= 0x11) {
9611 snd_hda_codec_write(codec, nid, 0,
9612 AC_VERB_SET_PIN_WIDGET_CONTROL,
9613 i <= AUTO_PIN_FRONT_MIC ?
9614 PIN_VREF80 : PIN_IN);
9619 /* parse the BIOS configuration and set up the alc_spec */
9620 /* return 1 if successful, 0 if the proper config is not found,
9621 * or a negative error code
9623 static int alc861_parse_auto_config(struct hda_codec *codec)
9625 struct alc_spec *spec = codec->spec;
9627 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9629 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9633 if (!spec->autocfg.line_outs)
9634 return 0; /* can't find valid BIOS pin config */
9636 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
9639 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
9642 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
9645 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
9649 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9651 if (spec->autocfg.dig_out_pin)
9652 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
9654 if (spec->kctl_alloc)
9655 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
9657 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs;
9659 spec->num_mux_defs = 1;
9660 spec->input_mux = &spec->private_imux;
9662 spec->adc_nids = alc861_adc_nids;
9663 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
9664 spec->mixers[spec->num_mixers] = alc861_capture_mixer;
9670 /* additional initialization for auto-configuration model */
9671 static void alc861_auto_init(struct hda_codec *codec)
9673 alc861_auto_init_multi_out(codec);
9674 alc861_auto_init_hp_out(codec);
9675 alc861_auto_init_analog_input(codec);
9678 #ifdef CONFIG_SND_HDA_POWER_SAVE
9679 static struct hda_amp_list alc861_loopbacks[] = {
9680 { 0x15, HDA_INPUT, 0 },
9681 { 0x15, HDA_INPUT, 1 },
9682 { 0x15, HDA_INPUT, 2 },
9683 { 0x15, HDA_INPUT, 3 },
9690 * configuration and preset
9692 static const char *alc861_models[ALC861_MODEL_LAST] = {
9693 [ALC861_3ST] = "3stack",
9694 [ALC660_3ST] = "3stack-660",
9695 [ALC861_3ST_DIG] = "3stack-dig",
9696 [ALC861_6ST_DIG] = "6stack-dig",
9697 [ALC861_UNIWILL_M31] = "uniwill-m31",
9698 [ALC861_TOSHIBA] = "toshiba",
9699 [ALC861_ASUS] = "asus",
9700 [ALC861_ASUS_LAPTOP] = "asus-laptop",
9701 [ALC861_AUTO] = "auto",
9704 static struct snd_pci_quirk alc861_cfg_tbl[] = {
9705 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
9706 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9707 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
9708 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
9709 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
9710 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
9711 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
9712 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
9713 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
9714 * Any other models that need this preset?
9716 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
9717 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
9718 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31),
9719 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
9720 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
9721 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
9722 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
9723 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
9727 static struct alc_config_preset alc861_presets[] = {
9729 .mixers = { alc861_3ST_mixer },
9730 .init_verbs = { alc861_threestack_init_verbs },
9731 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9732 .dac_nids = alc861_dac_nids,
9733 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9734 .channel_mode = alc861_threestack_modes,
9736 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9737 .adc_nids = alc861_adc_nids,
9738 .input_mux = &alc861_capture_source,
9740 [ALC861_3ST_DIG] = {
9741 .mixers = { alc861_base_mixer },
9742 .init_verbs = { alc861_threestack_init_verbs },
9743 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9744 .dac_nids = alc861_dac_nids,
9745 .dig_out_nid = ALC861_DIGOUT_NID,
9746 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9747 .channel_mode = alc861_threestack_modes,
9749 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9750 .adc_nids = alc861_adc_nids,
9751 .input_mux = &alc861_capture_source,
9753 [ALC861_6ST_DIG] = {
9754 .mixers = { alc861_base_mixer },
9755 .init_verbs = { alc861_base_init_verbs },
9756 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9757 .dac_nids = alc861_dac_nids,
9758 .dig_out_nid = ALC861_DIGOUT_NID,
9759 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
9760 .channel_mode = alc861_8ch_modes,
9761 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9762 .adc_nids = alc861_adc_nids,
9763 .input_mux = &alc861_capture_source,
9766 .mixers = { alc861_3ST_mixer },
9767 .init_verbs = { alc861_threestack_init_verbs },
9768 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
9769 .dac_nids = alc660_dac_nids,
9770 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
9771 .channel_mode = alc861_threestack_modes,
9773 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9774 .adc_nids = alc861_adc_nids,
9775 .input_mux = &alc861_capture_source,
9777 [ALC861_UNIWILL_M31] = {
9778 .mixers = { alc861_uniwill_m31_mixer },
9779 .init_verbs = { alc861_uniwill_m31_init_verbs },
9780 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9781 .dac_nids = alc861_dac_nids,
9782 .dig_out_nid = ALC861_DIGOUT_NID,
9783 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
9784 .channel_mode = alc861_uniwill_m31_modes,
9786 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9787 .adc_nids = alc861_adc_nids,
9788 .input_mux = &alc861_capture_source,
9790 [ALC861_TOSHIBA] = {
9791 .mixers = { alc861_toshiba_mixer },
9792 .init_verbs = { alc861_base_init_verbs,
9793 alc861_toshiba_init_verbs },
9794 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9795 .dac_nids = alc861_dac_nids,
9796 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9797 .channel_mode = alc883_3ST_2ch_modes,
9798 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9799 .adc_nids = alc861_adc_nids,
9800 .input_mux = &alc861_capture_source,
9801 .unsol_event = alc861_toshiba_unsol_event,
9802 .init_hook = alc861_toshiba_automute,
9805 .mixers = { alc861_asus_mixer },
9806 .init_verbs = { alc861_asus_init_verbs },
9807 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9808 .dac_nids = alc861_dac_nids,
9809 .dig_out_nid = ALC861_DIGOUT_NID,
9810 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
9811 .channel_mode = alc861_asus_modes,
9814 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9815 .adc_nids = alc861_adc_nids,
9816 .input_mux = &alc861_capture_source,
9818 [ALC861_ASUS_LAPTOP] = {
9819 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
9820 .init_verbs = { alc861_asus_init_verbs,
9821 alc861_asus_laptop_init_verbs },
9822 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
9823 .dac_nids = alc861_dac_nids,
9824 .dig_out_nid = ALC861_DIGOUT_NID,
9825 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9826 .channel_mode = alc883_3ST_2ch_modes,
9828 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
9829 .adc_nids = alc861_adc_nids,
9830 .input_mux = &alc861_capture_source,
9835 static int patch_alc861(struct hda_codec *codec)
9837 struct alc_spec *spec;
9841 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9847 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
9851 if (board_config < 0) {
9852 printk(KERN_INFO "hda_codec: Unknown model for ALC861, "
9853 "trying auto-probe from BIOS...\n");
9854 board_config = ALC861_AUTO;
9857 if (board_config == ALC861_AUTO) {
9858 /* automatic parse from the BIOS config */
9859 err = alc861_parse_auto_config(codec);
9865 "hda_codec: Cannot set up configuration "
9866 "from BIOS. Using base mode...\n");
9867 board_config = ALC861_3ST_DIG;
9871 if (board_config != ALC861_AUTO)
9872 setup_preset(spec, &alc861_presets[board_config]);
9874 spec->stream_name_analog = "ALC861 Analog";
9875 spec->stream_analog_playback = &alc861_pcm_analog_playback;
9876 spec->stream_analog_capture = &alc861_pcm_analog_capture;
9878 spec->stream_name_digital = "ALC861 Digital";
9879 spec->stream_digital_playback = &alc861_pcm_digital_playback;
9880 spec->stream_digital_capture = &alc861_pcm_digital_capture;
9882 codec->patch_ops = alc_patch_ops;
9883 if (board_config == ALC861_AUTO)
9884 spec->init_hook = alc861_auto_init;
9885 #ifdef CONFIG_SND_HDA_POWER_SAVE
9886 if (!spec->loopback.amplist)
9887 spec->loopback.amplist = alc861_loopbacks;
9898 * In addition, an independent DAC
9900 #define ALC861VD_DIGOUT_NID 0x06
9902 static hda_nid_t alc861vd_dac_nids[4] = {
9903 /* front, surr, clfe, side surr */
9904 0x02, 0x03, 0x04, 0x05
9907 /* dac_nids for ALC660vd are in a different order - according to
9909 * This should probably tesult in a different mixer for 6stack models
9910 * of ALC660vd codecs, but for now there is only 3stack mixer
9911 * - and it is the same as in 861vd.
9912 * adc_nids in ALC660vd are (is) the same as in 861vd
9914 static hda_nid_t alc660vd_dac_nids[3] = {
9915 /* front, rear, clfe, rear_surr */
9919 static hda_nid_t alc861vd_adc_nids[1] = {
9925 /* FIXME: should be a matrix-type input source selection */
9926 static struct hda_input_mux alc861vd_capture_source = {
9930 { "Front Mic", 0x1 },
9936 static struct hda_input_mux alc861vd_dallas_capture_source = {
9939 { "Front Mic", 0x0 },
9940 { "ATAPI Mic", 0x1 },
9945 static struct hda_input_mux alc861vd_hp_capture_source = {
9948 { "Front Mic", 0x0 },
9949 { "ATAPI Mic", 0x1 },
9953 #define alc861vd_mux_enum_info alc_mux_enum_info
9954 #define alc861vd_mux_enum_get alc_mux_enum_get
9956 static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
9957 struct snd_ctl_elem_value *ucontrol)
9959 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9960 struct alc_spec *spec = codec->spec;
9961 const struct hda_input_mux *imux = spec->input_mux;
9962 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
9963 static hda_nid_t capture_mixers[1] = { 0x22 };
9964 hda_nid_t nid = capture_mixers[adc_idx];
9965 unsigned int *cur_val = &spec->cur_mux[adc_idx];
9966 unsigned int i, idx;
9968 idx = ucontrol->value.enumerated.item[0];
9969 if (idx >= imux->num_items)
9970 idx = imux->num_items - 1;
9971 if (*cur_val == idx)
9973 for (i = 0; i < imux->num_items; i++) {
9974 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
9975 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
9976 imux->items[i].index,
9986 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
9993 static struct hda_verb alc861vd_6stack_ch6_init[] = {
9994 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
9995 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9996 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9997 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10004 static struct hda_verb alc861vd_6stack_ch8_init[] = {
10005 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10006 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10007 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10008 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10012 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
10013 { 6, alc861vd_6stack_ch6_init },
10014 { 8, alc861vd_6stack_ch8_init },
10017 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
10019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10020 .name = "Channel Mode",
10021 .info = alc_ch_mode_info,
10022 .get = alc_ch_mode_get,
10023 .put = alc_ch_mode_put,
10028 static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
10029 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
10030 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
10033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10034 /* The multiple "Capture Source" controls confuse alsamixer
10035 * So call somewhat different..
10036 *FIXME: the controls appear in the "playback" view!
10038 /* .name = "Capture Source", */
10039 .name = "Input Source",
10041 .info = alc861vd_mux_enum_info,
10042 .get = alc861vd_mux_enum_get,
10043 .put = alc861vd_mux_enum_put,
10048 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10049 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10051 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
10052 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10055 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10056 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
10058 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
10060 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
10062 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
10063 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
10065 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
10066 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
10068 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10070 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10074 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10075 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10076 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10084 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10085 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10090 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
10091 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10092 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10100 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10101 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10104 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10105 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10107 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10108 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10110 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
10111 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
10116 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
10117 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10118 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
10119 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10127 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10137 /* Pin assignment: Front=0x14, HP = 0x15,
10138 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
10140 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
10141 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10142 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10144 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10147 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10148 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT),
10150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT),
10154 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
10155 * Front Mic=0x18, ATAPI Mic = 0x19,
10157 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
10158 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
10159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
10160 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
10161 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
10162 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10163 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10164 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10165 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10171 * generic initialization of ADC, input mixers and output mixers
10173 static struct hda_verb alc861vd_volume_init_verbs[] = {
10175 * Unmute ADC0 and set the default input to mic-in
10177 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10178 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10180 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
10181 * the analog-loopback mixer widget
10183 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10190 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
10194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
10197 * Set up output mixers (0x02 - 0x05)
10199 /* set vol=0 to output mixers */
10200 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10201 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10202 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10203 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10205 /* set up input amps for analog loopback */
10206 /* Amp Indices: DAC = 0, mixer = 1 */
10207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10210 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10213 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10220 * 3-stack pin configuration:
10221 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10223 static struct hda_verb alc861vd_3stack_init_verbs[] = {
10225 * Set pin mode and muting
10227 /* set front pin widgets 0x14 for output */
10228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10229 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10230 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10232 /* Mic (rear) pin: input vref at 80% */
10233 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10234 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10235 /* Front Mic pin: input vref at 80% */
10236 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10237 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10238 /* Line In pin: input */
10239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10240 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10241 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10244 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10245 /* CD pin widget for input */
10246 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10252 * 6-stack pin configuration:
10254 static struct hda_verb alc861vd_6stack_init_verbs[] = {
10256 * Set pin mode and muting
10258 /* set front pin widgets 0x14 for output */
10259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10260 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10261 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10263 /* Rear Pin: output 1 (0x0d) */
10264 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10267 /* CLFE Pin: output 2 (0x0e) */
10268 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10269 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10270 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
10271 /* Side Pin: output 3 (0x0f) */
10272 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10274 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
10276 /* Mic (rear) pin: input vref at 80% */
10277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10279 /* Front Mic pin: input vref at 80% */
10280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10282 /* Line In pin: input */
10283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10285 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10286 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10287 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10288 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10289 /* CD pin widget for input */
10290 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10295 static struct hda_verb alc861vd_eapd_verbs[] = {
10296 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10300 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
10301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10304 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10305 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10309 /* toggle speaker-output according to the hp-jack state */
10310 static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10312 unsigned int present;
10313 unsigned char bits;
10315 present = snd_hda_codec_read(codec, 0x1b, 0,
10316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10317 bits = present ? HDA_AMP_MUTE : 0;
10318 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10319 HDA_AMP_MUTE, bits);
10322 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10324 unsigned int present;
10325 unsigned char bits;
10327 present = snd_hda_codec_read(codec, 0x18, 0,
10328 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10329 bits = present ? HDA_AMP_MUTE : 0;
10330 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
10331 HDA_AMP_MUTE, bits);
10334 static void alc861vd_lenovo_automute(struct hda_codec *codec)
10336 alc861vd_lenovo_hp_automute(codec);
10337 alc861vd_lenovo_mic_automute(codec);
10340 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
10343 switch (res >> 26) {
10344 case ALC880_HP_EVENT:
10345 alc861vd_lenovo_hp_automute(codec);
10347 case ALC880_MIC_EVENT:
10348 alc861vd_lenovo_mic_automute(codec);
10353 static struct hda_verb alc861vd_dallas_verbs[] = {
10354 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10355 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10356 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10357 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10365 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10366 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10369 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10371 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10372 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10373 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10374 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10375 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10377 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10378 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10379 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10380 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10381 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10383 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10384 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10391 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10392 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10393 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10398 /* toggle speaker-output according to the hp-jack state */
10399 static void alc861vd_dallas_automute(struct hda_codec *codec)
10401 unsigned int present;
10403 present = snd_hda_codec_read(codec, 0x15, 0,
10404 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10405 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10406 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10409 static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
10411 if ((res >> 26) == ALC880_HP_EVENT)
10412 alc861vd_dallas_automute(codec);
10415 #ifdef CONFIG_SND_HDA_POWER_SAVE
10416 #define alc861vd_loopbacks alc880_loopbacks
10419 /* pcm configuration: identiacal with ALC880 */
10420 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
10421 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
10422 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
10423 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
10426 * configuration and preset
10428 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
10429 [ALC660VD_3ST] = "3stack-660",
10430 [ALC660VD_3ST_DIG]= "3stack-660-digout",
10431 [ALC861VD_3ST] = "3stack",
10432 [ALC861VD_3ST_DIG] = "3stack-digout",
10433 [ALC861VD_6ST_DIG] = "6stack-digout",
10434 [ALC861VD_LENOVO] = "lenovo",
10435 [ALC861VD_DALLAS] = "dallas",
10436 [ALC861VD_AUTO] = "auto",
10439 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
10440 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
10441 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
10442 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
10443 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
10444 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
10446 SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),
10447 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
10448 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO),
10449 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO),
10450 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
10451 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
10452 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
10453 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
10457 static struct alc_config_preset alc861vd_presets[] = {
10459 .mixers = { alc861vd_3st_mixer },
10460 .init_verbs = { alc861vd_volume_init_verbs,
10461 alc861vd_3stack_init_verbs },
10462 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10463 .dac_nids = alc660vd_dac_nids,
10464 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10465 .adc_nids = alc861vd_adc_nids,
10466 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10467 .channel_mode = alc861vd_3stack_2ch_modes,
10468 .input_mux = &alc861vd_capture_source,
10470 [ALC660VD_3ST_DIG] = {
10471 .mixers = { alc861vd_3st_mixer },
10472 .init_verbs = { alc861vd_volume_init_verbs,
10473 alc861vd_3stack_init_verbs },
10474 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10475 .dac_nids = alc660vd_dac_nids,
10476 .dig_out_nid = ALC861VD_DIGOUT_NID,
10477 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10478 .adc_nids = alc861vd_adc_nids,
10479 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10480 .channel_mode = alc861vd_3stack_2ch_modes,
10481 .input_mux = &alc861vd_capture_source,
10484 .mixers = { alc861vd_3st_mixer },
10485 .init_verbs = { alc861vd_volume_init_verbs,
10486 alc861vd_3stack_init_verbs },
10487 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10488 .dac_nids = alc861vd_dac_nids,
10489 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10490 .channel_mode = alc861vd_3stack_2ch_modes,
10491 .input_mux = &alc861vd_capture_source,
10493 [ALC861VD_3ST_DIG] = {
10494 .mixers = { alc861vd_3st_mixer },
10495 .init_verbs = { alc861vd_volume_init_verbs,
10496 alc861vd_3stack_init_verbs },
10497 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10498 .dac_nids = alc861vd_dac_nids,
10499 .dig_out_nid = ALC861VD_DIGOUT_NID,
10500 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10501 .channel_mode = alc861vd_3stack_2ch_modes,
10502 .input_mux = &alc861vd_capture_source,
10504 [ALC861VD_6ST_DIG] = {
10505 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
10506 .init_verbs = { alc861vd_volume_init_verbs,
10507 alc861vd_6stack_init_verbs },
10508 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10509 .dac_nids = alc861vd_dac_nids,
10510 .dig_out_nid = ALC861VD_DIGOUT_NID,
10511 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
10512 .channel_mode = alc861vd_6stack_modes,
10513 .input_mux = &alc861vd_capture_source,
10515 [ALC861VD_LENOVO] = {
10516 .mixers = { alc861vd_lenovo_mixer },
10517 .init_verbs = { alc861vd_volume_init_verbs,
10518 alc861vd_3stack_init_verbs,
10519 alc861vd_eapd_verbs,
10520 alc861vd_lenovo_unsol_verbs },
10521 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
10522 .dac_nids = alc660vd_dac_nids,
10523 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10524 .adc_nids = alc861vd_adc_nids,
10525 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10526 .channel_mode = alc861vd_3stack_2ch_modes,
10527 .input_mux = &alc861vd_capture_source,
10528 .unsol_event = alc861vd_lenovo_unsol_event,
10529 .init_hook = alc861vd_lenovo_automute,
10531 [ALC861VD_DALLAS] = {
10532 .mixers = { alc861vd_dallas_mixer },
10533 .init_verbs = { alc861vd_dallas_verbs },
10534 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10535 .dac_nids = alc861vd_dac_nids,
10536 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10537 .adc_nids = alc861vd_adc_nids,
10538 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10539 .channel_mode = alc861vd_3stack_2ch_modes,
10540 .input_mux = &alc861vd_dallas_capture_source,
10541 .unsol_event = alc861vd_dallas_unsol_event,
10542 .init_hook = alc861vd_dallas_automute,
10545 .mixers = { alc861vd_hp_mixer },
10546 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
10547 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
10548 .dac_nids = alc861vd_dac_nids,
10549 .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids),
10550 .dig_out_nid = ALC861VD_DIGOUT_NID,
10551 .adc_nids = alc861vd_adc_nids,
10552 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
10553 .channel_mode = alc861vd_3stack_2ch_modes,
10554 .input_mux = &alc861vd_hp_capture_source,
10555 .unsol_event = alc861vd_dallas_unsol_event,
10556 .init_hook = alc861vd_dallas_automute,
10561 * BIOS auto configuration
10563 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
10564 hda_nid_t nid, int pin_type, int dac_idx)
10566 /* set as output */
10567 snd_hda_codec_write(codec, nid, 0,
10568 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
10569 snd_hda_codec_write(codec, nid, 0,
10570 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
10573 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
10575 struct alc_spec *spec = codec->spec;
10578 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
10579 for (i = 0; i <= HDA_SIDE; i++) {
10580 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10581 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10583 alc861vd_auto_set_output_and_unmute(codec, nid,
10589 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
10591 struct alc_spec *spec = codec->spec;
10594 pin = spec->autocfg.hp_pins[0];
10595 if (pin) /* connect to front and use dac 0 */
10596 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10599 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
10600 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
10602 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
10604 struct alc_spec *spec = codec->spec;
10607 for (i = 0; i < AUTO_PIN_LAST; i++) {
10608 hda_nid_t nid = spec->autocfg.input_pins[i];
10609 if (alc861vd_is_input_pin(nid)) {
10610 snd_hda_codec_write(codec, nid, 0,
10611 AC_VERB_SET_PIN_WIDGET_CONTROL,
10612 i <= AUTO_PIN_FRONT_MIC ?
10613 PIN_VREF80 : PIN_IN);
10614 if (nid != ALC861VD_PIN_CD_NID)
10615 snd_hda_codec_write(codec, nid, 0,
10616 AC_VERB_SET_AMP_GAIN_MUTE,
10622 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
10623 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
10625 /* add playback controls from the parsed DAC table */
10626 /* Based on ALC880 version. But ALC861VD has separate,
10627 * different NIDs for mute/unmute switch and volume control */
10628 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10629 const struct auto_pin_cfg *cfg)
10632 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
10633 hda_nid_t nid_v, nid_s;
10636 for (i = 0; i < cfg->line_outs; i++) {
10637 if (!spec->multiout.dac_nids[i])
10639 nid_v = alc861vd_idx_to_mixer_vol(
10641 spec->multiout.dac_nids[i]));
10642 nid_s = alc861vd_idx_to_mixer_switch(
10644 spec->multiout.dac_nids[i]));
10648 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10649 "Center Playback Volume",
10650 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
10654 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10655 "LFE Playback Volume",
10656 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
10660 err = add_control(spec, ALC_CTL_BIND_MUTE,
10661 "Center Playback Switch",
10662 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
10666 err = add_control(spec, ALC_CTL_BIND_MUTE,
10667 "LFE Playback Switch",
10668 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
10673 sprintf(name, "%s Playback Volume", chname[i]);
10674 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10675 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
10679 sprintf(name, "%s Playback Switch", chname[i]);
10680 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10681 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
10690 /* add playback controls for speaker and HP outputs */
10691 /* Based on ALC880 version. But ALC861VD has separate,
10692 * different NIDs for mute/unmute switch and volume control */
10693 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
10694 hda_nid_t pin, const char *pfx)
10696 hda_nid_t nid_v, nid_s;
10703 if (alc880_is_fixed_pin(pin)) {
10704 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
10705 /* specify the DAC as the extra output */
10706 if (!spec->multiout.hp_nid)
10707 spec->multiout.hp_nid = nid_v;
10709 spec->multiout.extra_out_nid[0] = nid_v;
10710 /* control HP volume/switch on the output mixer amp */
10711 nid_v = alc861vd_idx_to_mixer_vol(
10712 alc880_fixed_pin_idx(pin));
10713 nid_s = alc861vd_idx_to_mixer_switch(
10714 alc880_fixed_pin_idx(pin));
10716 sprintf(name, "%s Playback Volume", pfx);
10717 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
10718 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
10721 sprintf(name, "%s Playback Switch", pfx);
10722 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
10723 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
10726 } else if (alc880_is_multi_pin(pin)) {
10727 /* set manual connection */
10728 /* we have only a switch on HP-out PIN */
10729 sprintf(name, "%s Playback Switch", pfx);
10730 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
10731 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
10738 /* parse the BIOS configuration and set up the alc_spec
10739 * return 1 if successful, 0 if the proper config is not found,
10740 * or a negative error code
10741 * Based on ALC880 version - had to change it to override
10742 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
10743 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10745 struct alc_spec *spec = codec->spec;
10747 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10749 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10753 if (!spec->autocfg.line_outs)
10754 return 0; /* can't find valid BIOS pin config */
10756 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10759 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10762 err = alc861vd_auto_create_extra_out(spec,
10763 spec->autocfg.speaker_pins[0],
10767 err = alc861vd_auto_create_extra_out(spec,
10768 spec->autocfg.hp_pins[0],
10772 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
10776 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10778 if (spec->autocfg.dig_out_pin)
10779 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
10781 if (spec->kctl_alloc)
10782 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10784 spec->init_verbs[spec->num_init_verbs++]
10785 = alc861vd_volume_init_verbs;
10787 spec->num_mux_defs = 1;
10788 spec->input_mux = &spec->private_imux;
10793 /* additional initialization for auto-configuration model */
10794 static void alc861vd_auto_init(struct hda_codec *codec)
10796 alc861vd_auto_init_multi_out(codec);
10797 alc861vd_auto_init_hp_out(codec);
10798 alc861vd_auto_init_analog_input(codec);
10801 static int patch_alc861vd(struct hda_codec *codec)
10803 struct alc_spec *spec;
10804 int err, board_config;
10806 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10810 codec->spec = spec;
10812 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
10816 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
10817 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/"
10818 "ALC861VD, trying auto-probe from BIOS...\n");
10819 board_config = ALC861VD_AUTO;
10822 if (board_config == ALC861VD_AUTO) {
10823 /* automatic parse from the BIOS config */
10824 err = alc861vd_parse_auto_config(codec);
10830 "hda_codec: Cannot set up configuration "
10831 "from BIOS. Using base mode...\n");
10832 board_config = ALC861VD_3ST;
10836 if (board_config != ALC861VD_AUTO)
10837 setup_preset(spec, &alc861vd_presets[board_config]);
10839 spec->stream_name_analog = "ALC861VD Analog";
10840 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
10841 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
10843 spec->stream_name_digital = "ALC861VD Digital";
10844 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
10845 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
10847 spec->adc_nids = alc861vd_adc_nids;
10848 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
10850 spec->mixers[spec->num_mixers] = alc861vd_capture_mixer;
10851 spec->num_mixers++;
10853 codec->patch_ops = alc_patch_ops;
10855 if (board_config == ALC861VD_AUTO)
10856 spec->init_hook = alc861vd_auto_init;
10857 #ifdef CONFIG_SND_HDA_POWER_SAVE
10858 if (!spec->loopback.amplist)
10859 spec->loopback.amplist = alc861vd_loopbacks;
10868 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10869 * configuration. Each pin widget can choose any input DACs and a mixer.
10870 * Each ADC is connected from a mixer of all inputs. This makes possible
10871 * 6-channel independent captures.
10873 * In addition, an independent DAC for the multi-playback (not used in this
10876 #define ALC662_DIGOUT_NID 0x06
10877 #define ALC662_DIGIN_NID 0x0a
10879 static hda_nid_t alc662_dac_nids[4] = {
10880 /* front, rear, clfe, rear_surr */
10884 static hda_nid_t alc662_adc_nids[1] = {
10889 /* FIXME: should be a matrix-type input source selection */
10891 static struct hda_input_mux alc662_capture_source = {
10895 { "Front Mic", 0x1 },
10901 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
10908 #define alc662_mux_enum_info alc_mux_enum_info
10909 #define alc662_mux_enum_get alc_mux_enum_get
10911 static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
10912 struct snd_ctl_elem_value *ucontrol)
10914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10915 struct alc_spec *spec = codec->spec;
10916 const struct hda_input_mux *imux = spec->input_mux;
10917 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
10918 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
10919 hda_nid_t nid = capture_mixers[adc_idx];
10920 unsigned int *cur_val = &spec->cur_mux[adc_idx];
10921 unsigned int i, idx;
10923 idx = ucontrol->value.enumerated.item[0];
10924 if (idx >= imux->num_items)
10925 idx = imux->num_items - 1;
10926 if (*cur_val == idx)
10928 for (i = 0; i < imux->num_items; i++) {
10929 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
10930 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
10931 imux->items[i].index,
10940 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
10947 static struct hda_verb alc662_3ST_ch2_init[] = {
10948 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
10949 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10950 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
10951 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
10958 static struct hda_verb alc662_3ST_ch6_init[] = {
10959 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10960 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10961 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
10962 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10963 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10964 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
10968 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
10969 { 2, alc662_3ST_ch2_init },
10970 { 6, alc662_3ST_ch6_init },
10976 static struct hda_verb alc662_sixstack_ch6_init[] = {
10977 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10978 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
10979 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10986 static struct hda_verb alc662_sixstack_ch8_init[] = {
10987 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10988 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10989 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10993 static struct hda_channel_mode alc662_5stack_modes[2] = {
10994 { 2, alc662_sixstack_ch6_init },
10995 { 6, alc662_sixstack_ch8_init },
10998 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10999 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11002 static struct snd_kcontrol_new alc662_base_mixer[] = {
11003 /* output mixer control */
11004 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11005 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT),
11006 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11007 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT),
11008 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
11009 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
11010 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
11011 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
11012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11014 /*Input mixer control */
11015 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
11016 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
11017 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
11018 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
11019 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
11020 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
11021 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
11022 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
11024 /* Capture mixer control */
11025 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11026 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11029 .name = "Capture Source",
11031 .info = alc_mux_enum_info,
11032 .get = alc_mux_enum_get,
11033 .put = alc_mux_enum_put,
11038 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
11039 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11040 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11047 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11048 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11049 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11050 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11051 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11052 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11053 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11056 /* .name = "Capture Source", */
11057 .name = "Input Source",
11059 .info = alc662_mux_enum_info,
11060 .get = alc662_mux_enum_get,
11061 .put = alc662_mux_enum_put,
11066 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
11067 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11068 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11069 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11070 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
11071 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
11072 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
11073 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
11074 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
11075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11076 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11077 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11078 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11079 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11084 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
11085 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
11086 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11087 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11089 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11090 /* .name = "Capture Source", */
11091 .name = "Input Source",
11093 .info = alc662_mux_enum_info,
11094 .get = alc662_mux_enum_get,
11095 .put = alc662_mux_enum_put,
11100 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
11101 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11102 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
11103 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11104 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT),
11105 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11111 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11114 /* .name = "Capture Source", */
11115 .name = "Input Source",
11117 .info = alc662_mux_enum_info,
11118 .get = alc662_mux_enum_get,
11119 .put = alc662_mux_enum_put,
11124 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
11126 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11127 .name = "Channel Mode",
11128 .info = alc_ch_mode_info,
11129 .get = alc_ch_mode_get,
11130 .put = alc_ch_mode_put,
11135 static struct hda_verb alc662_init_verbs[] = {
11136 /* ADC: mute amp left and right */
11137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11138 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11139 /* Front mixer: unmute input/output amp left and right (volume = 0) */
11141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11147 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11149 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11150 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11151 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11152 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11154 /* Front Pin: output 0 (0x0c) */
11155 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11158 /* Rear Pin: output 1 (0x0d) */
11159 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11162 /* CLFE Pin: output 2 (0x0e) */
11163 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11164 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11166 /* Mic (rear) pin: input vref at 80% */
11167 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11168 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11169 /* Front Mic pin: input vref at 80% */
11170 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11171 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11172 /* Line In pin: input */
11173 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11175 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11177 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11178 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11179 /* CD pin widget for input */
11180 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11182 /* FIXME: use matrix-type input source selection */
11183 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
11188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
11192 static struct hda_verb alc662_sue_init_verbs[] = {
11193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
11194 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
11199 * generic initialization of ADC, input mixers and output mixers
11201 static struct hda_verb alc662_auto_init_verbs[] = {
11203 * Unmute ADC and set the default input to mic-in
11205 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11208 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11210 * Note: PASD motherboards uses the Line In 2 as the input for front
11211 * panel mic (mic 2)
11213 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11214 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11215 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11221 * Set up output mixers (0x0c - 0x0f)
11223 /* set vol=0 to output mixers */
11224 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11225 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11226 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11228 /* set up input amps for analog loopback */
11229 /* Amp Indices: DAC = 0, mixer = 1 */
11230 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11231 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11232 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11233 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11234 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11235 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11238 /* FIXME: use matrix-type input source selection */
11239 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11246 /* capture mixer elements */
11247 static struct snd_kcontrol_new alc662_capture_mixer[] = {
11248 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
11249 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
11251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11252 /* The multiple "Capture Source" controls confuse alsamixer
11253 * So call somewhat different..
11254 * FIXME: the controls appear in the "playback" view!
11256 /* .name = "Capture Source", */
11257 .name = "Input Source",
11259 .info = alc882_mux_enum_info,
11260 .get = alc882_mux_enum_get,
11261 .put = alc882_mux_enum_put,
11266 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11268 unsigned int present;
11269 unsigned char bits;
11271 present = snd_hda_codec_read(codec, 0x14, 0,
11272 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11273 bits = present ? HDA_AMP_MUTE : 0;
11274 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11275 HDA_AMP_MUTE, bits);
11278 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11280 unsigned int present;
11281 unsigned char bits;
11283 present = snd_hda_codec_read(codec, 0x1b, 0,
11284 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11285 bits = present ? HDA_AMP_MUTE : 0;
11286 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11287 HDA_AMP_MUTE, bits);
11288 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11289 HDA_AMP_MUTE, bits);
11292 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
11295 if ((res >> 26) == ALC880_HP_EVENT)
11296 alc662_lenovo_101e_all_automute(codec);
11297 if ((res >> 26) == ALC880_FRONT_EVENT)
11298 alc662_lenovo_101e_ispeaker_automute(codec);
11301 #ifdef CONFIG_SND_HDA_POWER_SAVE
11302 #define alc662_loopbacks alc880_loopbacks
11306 /* pcm configuration: identiacal with ALC880 */
11307 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
11308 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
11309 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
11310 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
11313 * configuration and preset
11315 static const char *alc662_models[ALC662_MODEL_LAST] = {
11316 [ALC662_3ST_2ch_DIG] = "3stack-dig",
11317 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
11318 [ALC662_3ST_6ch] = "3stack-6ch",
11319 [ALC662_5ST_DIG] = "6stack-dig",
11320 [ALC662_LENOVO_101E] = "lenovo-101e",
11321 [ALC662_AUTO] = "auto",
11324 static struct snd_pci_quirk alc662_cfg_tbl[] = {
11325 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
11329 static struct alc_config_preset alc662_presets[] = {
11330 [ALC662_3ST_2ch_DIG] = {
11331 .mixers = { alc662_3ST_2ch_mixer },
11332 .init_verbs = { alc662_init_verbs },
11333 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11334 .dac_nids = alc662_dac_nids,
11335 .dig_out_nid = ALC662_DIGOUT_NID,
11336 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11337 .adc_nids = alc662_adc_nids,
11338 .dig_in_nid = ALC662_DIGIN_NID,
11339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11340 .channel_mode = alc662_3ST_2ch_modes,
11341 .input_mux = &alc662_capture_source,
11343 [ALC662_3ST_6ch_DIG] = {
11344 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11345 .init_verbs = { alc662_init_verbs },
11346 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11347 .dac_nids = alc662_dac_nids,
11348 .dig_out_nid = ALC662_DIGOUT_NID,
11349 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11350 .adc_nids = alc662_adc_nids,
11351 .dig_in_nid = ALC662_DIGIN_NID,
11352 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11353 .channel_mode = alc662_3ST_6ch_modes,
11355 .input_mux = &alc662_capture_source,
11357 [ALC662_3ST_6ch] = {
11358 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
11359 .init_verbs = { alc662_init_verbs },
11360 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11361 .dac_nids = alc662_dac_nids,
11362 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11363 .adc_nids = alc662_adc_nids,
11364 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
11365 .channel_mode = alc662_3ST_6ch_modes,
11367 .input_mux = &alc662_capture_source,
11369 [ALC662_5ST_DIG] = {
11370 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
11371 .init_verbs = { alc662_init_verbs },
11372 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11373 .dac_nids = alc662_dac_nids,
11374 .dig_out_nid = ALC662_DIGOUT_NID,
11375 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11376 .adc_nids = alc662_adc_nids,
11377 .dig_in_nid = ALC662_DIGIN_NID,
11378 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
11379 .channel_mode = alc662_5stack_modes,
11380 .input_mux = &alc662_capture_source,
11382 [ALC662_LENOVO_101E] = {
11383 .mixers = { alc662_lenovo_101e_mixer },
11384 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
11385 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
11386 .dac_nids = alc662_dac_nids,
11387 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
11388 .adc_nids = alc662_adc_nids,
11389 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
11390 .channel_mode = alc662_3ST_2ch_modes,
11391 .input_mux = &alc662_lenovo_101e_capture_source,
11392 .unsol_event = alc662_lenovo_101e_unsol_event,
11393 .init_hook = alc662_lenovo_101e_all_automute,
11400 * BIOS auto configuration
11403 /* add playback controls from the parsed DAC table */
11404 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
11405 const struct auto_pin_cfg *cfg)
11408 static const char *chname[4] = {
11409 "Front", "Surround", NULL /*CLFE*/, "Side"
11414 for (i = 0; i < cfg->line_outs; i++) {
11415 if (!spec->multiout.dac_nids[i])
11417 nid = alc880_idx_to_mixer(i);
11420 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11421 "Center Playback Volume",
11422 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
11426 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11427 "LFE Playback Volume",
11428 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
11432 err = add_control(spec, ALC_CTL_BIND_MUTE,
11433 "Center Playback Switch",
11434 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
11438 err = add_control(spec, ALC_CTL_BIND_MUTE,
11439 "LFE Playback Switch",
11440 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
11445 sprintf(name, "%s Playback Volume", chname[i]);
11446 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11447 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
11451 sprintf(name, "%s Playback Switch", chname[i]);
11452 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11453 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
11462 /* add playback controls for speaker and HP outputs */
11463 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
11473 if (alc880_is_fixed_pin(pin)) {
11474 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11475 /* printk("DAC nid=%x\n",nid); */
11476 /* specify the DAC as the extra output */
11477 if (!spec->multiout.hp_nid)
11478 spec->multiout.hp_nid = nid;
11480 spec->multiout.extra_out_nid[0] = nid;
11481 /* control HP volume/switch on the output mixer amp */
11482 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
11483 sprintf(name, "%s Playback Volume", pfx);
11484 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11485 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
11488 sprintf(name, "%s Playback Switch", pfx);
11489 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
11490 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
11493 } else if (alc880_is_multi_pin(pin)) {
11494 /* set manual connection */
11495 /* we have only a switch on HP-out PIN */
11496 sprintf(name, "%s Playback Switch", pfx);
11497 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11498 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
11505 /* create playback/capture controls for input pins */
11506 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
11507 const struct auto_pin_cfg *cfg)
11509 struct hda_input_mux *imux = &spec->private_imux;
11512 for (i = 0; i < AUTO_PIN_LAST; i++) {
11513 if (alc880_is_input_pin(cfg->input_pins[i])) {
11514 idx = alc880_input_pin_idx(cfg->input_pins[i]);
11515 err = new_analog_input(spec, cfg->input_pins[i],
11516 auto_pin_cfg_labels[i],
11520 imux->items[imux->num_items].label =
11521 auto_pin_cfg_labels[i];
11522 imux->items[imux->num_items].index =
11523 alc880_input_pin_idx(cfg->input_pins[i]);
11530 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
11531 hda_nid_t nid, int pin_type,
11534 /* set as output */
11535 snd_hda_codec_write(codec, nid, 0,
11536 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
11537 snd_hda_codec_write(codec, nid, 0,
11538 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
11539 /* need the manual connection? */
11540 if (alc880_is_multi_pin(nid)) {
11541 struct alc_spec *spec = codec->spec;
11542 int idx = alc880_multi_pin_idx(nid);
11543 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
11544 AC_VERB_SET_CONNECT_SEL,
11545 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
11549 static void alc662_auto_init_multi_out(struct hda_codec *codec)
11551 struct alc_spec *spec = codec->spec;
11554 for (i = 0; i <= HDA_SIDE; i++) {
11555 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11556 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11558 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
11563 static void alc662_auto_init_hp_out(struct hda_codec *codec)
11565 struct alc_spec *spec = codec->spec;
11568 pin = spec->autocfg.hp_pins[0];
11569 if (pin) /* connect to front */
11571 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
11574 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
11575 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
11577 static void alc662_auto_init_analog_input(struct hda_codec *codec)
11579 struct alc_spec *spec = codec->spec;
11582 for (i = 0; i < AUTO_PIN_LAST; i++) {
11583 hda_nid_t nid = spec->autocfg.input_pins[i];
11584 if (alc662_is_input_pin(nid)) {
11585 snd_hda_codec_write(codec, nid, 0,
11586 AC_VERB_SET_PIN_WIDGET_CONTROL,
11587 (i <= AUTO_PIN_FRONT_MIC ?
11588 PIN_VREF80 : PIN_IN));
11589 if (nid != ALC662_PIN_CD_NID)
11590 snd_hda_codec_write(codec, nid, 0,
11591 AC_VERB_SET_AMP_GAIN_MUTE,
11597 static int alc662_parse_auto_config(struct hda_codec *codec)
11599 struct alc_spec *spec = codec->spec;
11601 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11603 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11607 if (!spec->autocfg.line_outs)
11608 return 0; /* can't find valid BIOS pin config */
11610 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11613 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
11616 err = alc662_auto_create_extra_out(spec,
11617 spec->autocfg.speaker_pins[0],
11621 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11625 err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
11629 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11631 if (spec->autocfg.dig_out_pin)
11632 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
11634 if (spec->kctl_alloc)
11635 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
11637 spec->num_mux_defs = 1;
11638 spec->input_mux = &spec->private_imux;
11640 spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
11641 spec->mixers[spec->num_mixers] = alc662_capture_mixer;
11642 spec->num_mixers++;
11646 /* additional initialization for auto-configuration model */
11647 static void alc662_auto_init(struct hda_codec *codec)
11649 alc662_auto_init_multi_out(codec);
11650 alc662_auto_init_hp_out(codec);
11651 alc662_auto_init_analog_input(codec);
11654 static int patch_alc662(struct hda_codec *codec)
11656 struct alc_spec *spec;
11657 int err, board_config;
11659 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11663 codec->spec = spec;
11665 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
11668 if (board_config < 0) {
11669 printk(KERN_INFO "hda_codec: Unknown model for ALC662, "
11670 "trying auto-probe from BIOS...\n");
11671 board_config = ALC662_AUTO;
11674 if (board_config == ALC662_AUTO) {
11675 /* automatic parse from the BIOS config */
11676 err = alc662_parse_auto_config(codec);
11682 "hda_codec: Cannot set up configuration "
11683 "from BIOS. Using base mode...\n");
11684 board_config = ALC662_3ST_2ch_DIG;
11688 if (board_config != ALC662_AUTO)
11689 setup_preset(spec, &alc662_presets[board_config]);
11691 spec->stream_name_analog = "ALC662 Analog";
11692 spec->stream_analog_playback = &alc662_pcm_analog_playback;
11693 spec->stream_analog_capture = &alc662_pcm_analog_capture;
11695 spec->stream_name_digital = "ALC662 Digital";
11696 spec->stream_digital_playback = &alc662_pcm_digital_playback;
11697 spec->stream_digital_capture = &alc662_pcm_digital_capture;
11699 if (!spec->adc_nids && spec->input_mux) {
11700 spec->adc_nids = alc662_adc_nids;
11701 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
11704 codec->patch_ops = alc_patch_ops;
11705 if (board_config == ALC662_AUTO)
11706 spec->init_hook = alc662_auto_init;
11707 #ifdef CONFIG_SND_HDA_POWER_SAVE
11708 if (!spec->loopback.amplist)
11709 spec->loopback.amplist = alc662_loopbacks;
11718 struct hda_codec_preset snd_hda_preset_realtek[] = {
11719 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
11720 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
11721 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
11722 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
11723 .patch = patch_alc861 },
11724 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
11725 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
11726 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
11727 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
11728 .patch = patch_alc883 },
11729 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
11730 .patch = patch_alc662 },
11731 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
11732 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
11733 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
11734 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
11735 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
11736 {} /* terminator */