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 <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.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 */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST
/* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST
/* last tag */
94 ALC262_HP_BPC_D7000_WL
,
95 ALC262_HP_BPC_D7000_WF
,
105 ALC262_MODEL_LAST
/* last tag */
116 #ifdef CONFIG_SND_DEBUG
120 ALC268_MODEL_LAST
/* last tag */
126 ALC269_ASUS_EEEPC_P703
,
127 ALC269_ASUS_EEEPC_P901
,
129 ALC269_MODEL_LAST
/* last tag */
146 /* ALC861-VD models */
167 ALC662_ASUS_EEEPC_P701
,
168 ALC662_ASUS_EEEPC_EP20
,
200 ALC883_TARGA_2ch_DIG
,
206 ALC883_LENOVO_101E_2ch
,
207 ALC883_LENOVO_NB0763
,
208 ALC888_LENOVO_MS7195_DIG
,
214 ALC883_FUJITSU_PI2515
,
215 ALC883_3ST_6ch_INTEL
,
221 #define GPIO_MASK 0x03
224 /* codec parameterization */
225 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
226 unsigned int num_mixers
;
228 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
232 unsigned int num_init_verbs
;
234 char *stream_name_analog
; /* analog PCM stream */
235 struct hda_pcm_stream
*stream_analog_playback
;
236 struct hda_pcm_stream
*stream_analog_capture
;
237 struct hda_pcm_stream
*stream_analog_alt_playback
;
238 struct hda_pcm_stream
*stream_analog_alt_capture
;
240 char *stream_name_digital
; /* digital PCM stream */
241 struct hda_pcm_stream
*stream_digital_playback
;
242 struct hda_pcm_stream
*stream_digital_capture
;
245 struct hda_multi_out multiout
; /* playback set-up
246 * max_channels, dacs must be set
247 * dig_out_nid and hp_nid are optional
249 hda_nid_t alt_dac_nid
;
252 unsigned int num_adc_nids
;
254 hda_nid_t
*capsrc_nids
;
255 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
258 unsigned int num_mux_defs
;
259 const struct hda_input_mux
*input_mux
;
260 unsigned int cur_mux
[3];
263 const struct hda_channel_mode
*channel_mode
;
264 int num_channel_mode
;
267 /* PCM information */
268 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
270 /* dynamic controls, init_verbs and input_mux */
271 struct auto_pin_cfg autocfg
;
272 unsigned int num_kctl_alloc
, num_kctl_used
;
273 struct snd_kcontrol_new
*kctl_alloc
;
274 struct hda_input_mux private_imux
;
275 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
278 void (*init_hook
)(struct hda_codec
*codec
);
279 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
281 /* for pin sensing */
282 unsigned int sense_updated
: 1;
283 unsigned int jack_present
: 1;
284 unsigned int master_sw
: 1;
286 /* for virtual master */
287 hda_nid_t vmaster_nid
;
288 #ifdef CONFIG_SND_HDA_POWER_SAVE
289 struct hda_loopback_check loopback
;
294 unsigned int pll_coef_idx
, pll_coef_bit
;
298 * configuration template - to be copied to the spec instance
300 struct alc_config_preset
{
301 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
304 const struct hda_verb
*init_verbs
[5];
305 unsigned int num_dacs
;
307 hda_nid_t dig_out_nid
; /* optional */
308 hda_nid_t hp_nid
; /* optional */
309 unsigned int num_adc_nids
;
311 hda_nid_t
*capsrc_nids
;
312 hda_nid_t dig_in_nid
;
313 unsigned int num_channel_mode
;
314 const struct hda_channel_mode
*channel_mode
;
316 unsigned int num_mux_defs
;
317 const struct hda_input_mux
*input_mux
;
318 void (*unsol_event
)(struct hda_codec
*, unsigned int);
319 void (*init_hook
)(struct hda_codec
*);
320 #ifdef CONFIG_SND_HDA_POWER_SAVE
321 struct hda_amp_list
*loopbacks
;
329 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
330 struct snd_ctl_elem_info
*uinfo
)
332 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
333 struct alc_spec
*spec
= codec
->spec
;
334 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
335 if (mux_idx
>= spec
->num_mux_defs
)
337 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
340 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
341 struct snd_ctl_elem_value
*ucontrol
)
343 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
344 struct alc_spec
*spec
= codec
->spec
;
345 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
347 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
351 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
352 struct snd_ctl_elem_value
*ucontrol
)
354 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
355 struct alc_spec
*spec
= codec
->spec
;
356 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
357 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
358 hda_nid_t nid
= spec
->capsrc_nids
?
359 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
360 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
361 nid
, &spec
->cur_mux
[adc_idx
]);
366 * channel mode setting
368 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
369 struct snd_ctl_elem_info
*uinfo
)
371 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
372 struct alc_spec
*spec
= codec
->spec
;
373 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
374 spec
->num_channel_mode
);
377 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
378 struct snd_ctl_elem_value
*ucontrol
)
380 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
381 struct alc_spec
*spec
= codec
->spec
;
382 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
383 spec
->num_channel_mode
,
384 spec
->multiout
.max_channels
);
387 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
388 struct snd_ctl_elem_value
*ucontrol
)
390 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
391 struct alc_spec
*spec
= codec
->spec
;
392 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
393 spec
->num_channel_mode
,
394 &spec
->multiout
.max_channels
);
395 if (err
>= 0 && spec
->need_dac_fix
)
396 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
401 * Control the mode of pin widget settings via the mixer. "pc" is used
402 * instead of "%" to avoid consequences of accidently treating the % as
403 * being part of a format specifier. Maximum allowed length of a value is
404 * 63 characters plus NULL terminator.
406 * Note: some retasking pin complexes seem to ignore requests for input
407 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
408 * are requested. Therefore order this list so that this behaviour will not
409 * cause problems when mixer clients move through the enum sequentially.
410 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
413 static char *alc_pin_mode_names
[] = {
414 "Mic 50pc bias", "Mic 80pc bias",
415 "Line in", "Line out", "Headphone out",
417 static unsigned char alc_pin_mode_values
[] = {
418 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
420 /* The control can present all 5 options, or it can limit the options based
421 * in the pin being assumed to be exclusively an input or an output pin. In
422 * addition, "input" pins may or may not process the mic bias option
423 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
424 * accept requests for bias as of chip versions up to March 2006) and/or
425 * wiring in the computer.
427 #define ALC_PIN_DIR_IN 0x00
428 #define ALC_PIN_DIR_OUT 0x01
429 #define ALC_PIN_DIR_INOUT 0x02
430 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
431 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
433 /* Info about the pin modes supported by the different pin direction modes.
434 * For each direction the minimum and maximum values are given.
436 static signed char alc_pin_mode_dir_info
[5][2] = {
437 { 0, 2 }, /* ALC_PIN_DIR_IN */
438 { 3, 4 }, /* ALC_PIN_DIR_OUT */
439 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
440 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
441 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
443 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
444 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
445 #define alc_pin_mode_n_items(_dir) \
446 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
448 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
449 struct snd_ctl_elem_info
*uinfo
)
451 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
452 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
454 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
456 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
458 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
459 item_num
= alc_pin_mode_min(dir
);
460 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
464 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
465 struct snd_ctl_elem_value
*ucontrol
)
468 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
469 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
470 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
471 long *valp
= ucontrol
->value
.integer
.value
;
472 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
473 AC_VERB_GET_PIN_WIDGET_CONTROL
,
476 /* Find enumerated value for current pinctl setting */
477 i
= alc_pin_mode_min(dir
);
478 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
480 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
484 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
485 struct snd_ctl_elem_value
*ucontrol
)
488 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
489 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
490 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
491 long val
= *ucontrol
->value
.integer
.value
;
492 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
493 AC_VERB_GET_PIN_WIDGET_CONTROL
,
496 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
497 val
= alc_pin_mode_min(dir
);
499 change
= pinctl
!= alc_pin_mode_values
[val
];
501 /* Set pin mode to that requested */
502 snd_hda_codec_write_cache(codec
, nid
, 0,
503 AC_VERB_SET_PIN_WIDGET_CONTROL
,
504 alc_pin_mode_values
[val
]);
506 /* Also enable the retasking pin's input/output as required
507 * for the requested pin mode. Enum values of 2 or less are
510 * Dynamically switching the input/output buffers probably
511 * reduces noise slightly (particularly on input) so we'll
512 * do it. However, having both input and output buffers
513 * enabled simultaneously doesn't seem to be problematic if
514 * this turns out to be necessary in the future.
517 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
518 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
519 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
522 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
523 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
524 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
531 #define ALC_PIN_MODE(xname, nid, dir) \
532 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
533 .info = alc_pin_mode_info, \
534 .get = alc_pin_mode_get, \
535 .put = alc_pin_mode_put, \
536 .private_value = nid | (dir<<16) }
538 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
539 * together using a mask with more than one bit set. This control is
540 * currently used only by the ALC260 test model. At this stage they are not
541 * needed for any "production" models.
543 #ifdef CONFIG_SND_DEBUG
544 #define alc_gpio_data_info snd_ctl_boolean_mono_info
546 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
547 struct snd_ctl_elem_value
*ucontrol
)
549 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
550 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
551 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
552 long *valp
= ucontrol
->value
.integer
.value
;
553 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
554 AC_VERB_GET_GPIO_DATA
, 0x00);
556 *valp
= (val
& mask
) != 0;
559 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
560 struct snd_ctl_elem_value
*ucontrol
)
563 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
564 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
565 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
566 long val
= *ucontrol
->value
.integer
.value
;
567 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
568 AC_VERB_GET_GPIO_DATA
,
571 /* Set/unset the masked GPIO bit(s) as needed */
572 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
577 snd_hda_codec_write_cache(codec
, nid
, 0,
578 AC_VERB_SET_GPIO_DATA
, gpio_data
);
582 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
583 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
584 .info = alc_gpio_data_info, \
585 .get = alc_gpio_data_get, \
586 .put = alc_gpio_data_put, \
587 .private_value = nid | (mask<<16) }
588 #endif /* CONFIG_SND_DEBUG */
590 /* A switch control to allow the enabling of the digital IO pins on the
591 * ALC260. This is incredibly simplistic; the intention of this control is
592 * to provide something in the test model allowing digital outputs to be
593 * identified if present. If models are found which can utilise these
594 * outputs a more complete mixer control can be devised for those models if
597 #ifdef CONFIG_SND_DEBUG
598 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
600 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
601 struct snd_ctl_elem_value
*ucontrol
)
603 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
604 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
605 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
606 long *valp
= ucontrol
->value
.integer
.value
;
607 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
608 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
610 *valp
= (val
& mask
) != 0;
613 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
614 struct snd_ctl_elem_value
*ucontrol
)
617 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
618 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
619 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
620 long val
= *ucontrol
->value
.integer
.value
;
621 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
622 AC_VERB_GET_DIGI_CONVERT_1
,
625 /* Set/unset the masked control bit(s) as needed */
626 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
631 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
636 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
637 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
638 .info = alc_spdif_ctrl_info, \
639 .get = alc_spdif_ctrl_get, \
640 .put = alc_spdif_ctrl_put, \
641 .private_value = nid | (mask<<16) }
642 #endif /* CONFIG_SND_DEBUG */
644 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
645 * Again, this is only used in the ALC26x test models to help identify when
646 * the EAPD line must be asserted for features to work.
648 #ifdef CONFIG_SND_DEBUG
649 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
651 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
652 struct snd_ctl_elem_value
*ucontrol
)
654 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
655 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
656 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
657 long *valp
= ucontrol
->value
.integer
.value
;
658 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
659 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
661 *valp
= (val
& mask
) != 0;
665 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
666 struct snd_ctl_elem_value
*ucontrol
)
669 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
670 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
671 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
672 long val
= *ucontrol
->value
.integer
.value
;
673 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
674 AC_VERB_GET_EAPD_BTLENABLE
,
677 /* Set/unset the masked control bit(s) as needed */
678 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
683 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
689 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .info = alc_eapd_ctrl_info, \
692 .get = alc_eapd_ctrl_get, \
693 .put = alc_eapd_ctrl_put, \
694 .private_value = nid | (mask<<16) }
695 #endif /* CONFIG_SND_DEBUG */
698 * set up from the preset table
700 static void setup_preset(struct alc_spec
*spec
,
701 const struct alc_config_preset
*preset
)
705 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
706 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
707 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
709 spec
->init_verbs
[spec
->num_init_verbs
++] =
710 preset
->init_verbs
[i
];
712 spec
->channel_mode
= preset
->channel_mode
;
713 spec
->num_channel_mode
= preset
->num_channel_mode
;
714 spec
->need_dac_fix
= preset
->need_dac_fix
;
716 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
718 spec
->multiout
.num_dacs
= preset
->num_dacs
;
719 spec
->multiout
.dac_nids
= preset
->dac_nids
;
720 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
721 spec
->multiout
.hp_nid
= preset
->hp_nid
;
723 spec
->num_mux_defs
= preset
->num_mux_defs
;
724 if (!spec
->num_mux_defs
)
725 spec
->num_mux_defs
= 1;
726 spec
->input_mux
= preset
->input_mux
;
728 spec
->num_adc_nids
= preset
->num_adc_nids
;
729 spec
->adc_nids
= preset
->adc_nids
;
730 spec
->capsrc_nids
= preset
->capsrc_nids
;
731 spec
->dig_in_nid
= preset
->dig_in_nid
;
733 spec
->unsol_event
= preset
->unsol_event
;
734 spec
->init_hook
= preset
->init_hook
;
735 #ifdef CONFIG_SND_HDA_POWER_SAVE
736 spec
->loopback
.amplist
= preset
->loopbacks
;
740 /* Enable GPIO mask and set output */
741 static struct hda_verb alc_gpio1_init_verbs
[] = {
742 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
743 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
744 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
748 static struct hda_verb alc_gpio2_init_verbs
[] = {
749 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
750 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
751 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
755 static struct hda_verb alc_gpio3_init_verbs
[] = {
756 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
757 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
758 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
763 * Fix hardware PLL issue
764 * On some codecs, the analog PLL gating control must be off while
765 * the default value is 1.
767 static void alc_fix_pll(struct hda_codec
*codec
)
769 struct alc_spec
*spec
= codec
->spec
;
774 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
776 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
777 AC_VERB_GET_PROC_COEF
, 0);
778 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
780 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
781 val
& ~(1 << spec
->pll_coef_bit
));
784 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
785 unsigned int coef_idx
, unsigned int coef_bit
)
787 struct alc_spec
*spec
= codec
->spec
;
789 spec
->pll_coef_idx
= coef_idx
;
790 spec
->pll_coef_bit
= coef_bit
;
794 static void alc_sku_automute(struct hda_codec
*codec
)
796 struct alc_spec
*spec
= codec
->spec
;
797 unsigned int present
;
798 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
799 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
801 /* need to execute and sync at first */
802 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
803 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
804 AC_VERB_GET_PIN_SENSE
, 0);
805 spec
->jack_present
= (present
& 0x80000000) != 0;
806 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
807 spec
->jack_present
? 0 : PIN_OUT
);
810 /* unsolicited event for HP jack sensing */
811 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
813 if (codec
->vendor_id
== 0x10ec0880)
817 if (res
!= ALC880_HP_EVENT
)
820 alc_sku_automute(codec
);
823 /* additional initialization for ALC888 variants */
824 static void alc888_coef_init(struct hda_codec
*codec
)
828 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
829 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
830 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
831 if ((tmp
& 0xf0) == 2)
833 snd_hda_codec_read(codec
, 0x20, 0,
834 AC_VERB_SET_PROC_COEF
, 0x830);
837 snd_hda_codec_read(codec
, 0x20, 0,
838 AC_VERB_SET_PROC_COEF
, 0x3030);
841 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
842 * 31 ~ 16 : Manufacture ID
844 * 7 ~ 0 : Assembly ID
845 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
847 static void alc_subsystem_id(struct hda_codec
*codec
,
848 unsigned int porta
, unsigned int porte
,
851 unsigned int ass
, tmp
, i
;
853 struct alc_spec
*spec
= codec
->spec
;
855 ass
= codec
->subsystem_id
& 0xffff;
856 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
860 * 31~30 : port conetcivity
863 * 19~16 : Check sum (15:1)
868 if (codec
->vendor_id
== 0x10ec0260)
870 ass
= snd_hda_codec_read(codec
, nid
, 0,
871 AC_VERB_GET_CONFIG_DEFAULT
, 0);
872 if (!(ass
& 1) && !(ass
& 0x100000))
874 if ((ass
>> 30) != 1) /* no physical connection */
879 for (i
= 1; i
< 16; i
++) {
883 if (((ass
>> 16) & 0xf) != tmp
)
889 * 2 : 0 --> Desktop, 1 --> Laptop
890 * 3~5 : External Amplifier control
893 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
896 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
899 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
902 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
904 case 5: /* set EAPD output high */
905 switch (codec
->vendor_id
) {
907 snd_hda_codec_write(codec
, 0x0f, 0,
908 AC_VERB_SET_EAPD_BTLENABLE
, 2);
909 snd_hda_codec_write(codec
, 0x10, 0,
910 AC_VERB_SET_EAPD_BTLENABLE
, 2);
921 snd_hda_codec_write(codec
, 0x14, 0,
922 AC_VERB_SET_EAPD_BTLENABLE
, 2);
923 snd_hda_codec_write(codec
, 0x15, 0,
924 AC_VERB_SET_EAPD_BTLENABLE
, 2);
927 switch (codec
->vendor_id
) {
929 snd_hda_codec_write(codec
, 0x1a, 0,
930 AC_VERB_SET_COEF_INDEX
, 7);
931 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
932 AC_VERB_GET_PROC_COEF
, 0);
933 snd_hda_codec_write(codec
, 0x1a, 0,
934 AC_VERB_SET_COEF_INDEX
, 7);
935 snd_hda_codec_write(codec
, 0x1a, 0,
936 AC_VERB_SET_PROC_COEF
,
945 snd_hda_codec_write(codec
, 0x20, 0,
946 AC_VERB_SET_COEF_INDEX
, 7);
947 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
948 AC_VERB_GET_PROC_COEF
, 0);
949 snd_hda_codec_write(codec
, 0x20, 0,
950 AC_VERB_SET_COEF_INDEX
, 7);
951 snd_hda_codec_write(codec
, 0x20, 0,
952 AC_VERB_SET_PROC_COEF
,
956 /*alc888_coef_init(codec);*/ /* called in alc_init() */
960 snd_hda_codec_write(codec
, 0x20, 0,
961 AC_VERB_SET_COEF_INDEX
, 7);
962 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
963 AC_VERB_GET_PROC_COEF
, 0);
964 snd_hda_codec_write(codec
, 0x20, 0,
965 AC_VERB_SET_COEF_INDEX
, 7);
966 snd_hda_codec_write(codec
, 0x20, 0,
967 AC_VERB_SET_PROC_COEF
,
975 /* is laptop or Desktop and enable the function "Mute internal speaker
976 * when the external headphone out jack is plugged"
981 * 10~8 : Jack location
982 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
984 * 15 : 1 --> enable the function "Mute internal speaker
985 * when the external headphone out jack is plugged"
987 if (!spec
->autocfg
.speaker_pins
[0]) {
988 if (spec
->autocfg
.line_out_pins
[0])
989 spec
->autocfg
.speaker_pins
[0] =
990 spec
->autocfg
.line_out_pins
[0];
995 if (!spec
->autocfg
.hp_pins
[0]) {
996 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
998 spec
->autocfg
.hp_pins
[0] = porta
;
1000 spec
->autocfg
.hp_pins
[0] = porte
;
1002 spec
->autocfg
.hp_pins
[0] = portd
;
1007 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
1008 AC_VERB_SET_UNSOLICITED_ENABLE
,
1009 AC_USRSP_EN
| ALC880_HP_EVENT
);
1010 spec
->unsol_event
= alc_sku_unsol_event
;
1014 * Fix-up pin default configurations
1022 static void alc_fix_pincfg(struct hda_codec
*codec
,
1023 const struct snd_pci_quirk
*quirk
,
1024 const struct alc_pincfg
**pinfix
)
1026 const struct alc_pincfg
*cfg
;
1028 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1032 cfg
= pinfix
[quirk
->value
];
1033 for (; cfg
->nid
; cfg
++) {
1036 for (i
= 0; i
< 4; i
++) {
1037 snd_hda_codec_write(codec
, cfg
->nid
, 0,
1038 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
1046 * ALC880 3-stack model
1048 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1049 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1050 * F-Mic = 0x1b, HP = 0x19
1053 static hda_nid_t alc880_dac_nids
[4] = {
1054 /* front, rear, clfe, rear_surr */
1055 0x02, 0x05, 0x04, 0x03
1058 static hda_nid_t alc880_adc_nids
[3] = {
1063 /* The datasheet says the node 0x07 is connected from inputs,
1064 * but it shows zero connection in the real implementation on some devices.
1065 * Note: this is a 915GAV bug, fixed on 915GLV
1067 static hda_nid_t alc880_adc_nids_alt
[2] = {
1072 #define ALC880_DIGOUT_NID 0x06
1073 #define ALC880_DIGIN_NID 0x0a
1075 static struct hda_input_mux alc880_capture_source
= {
1079 { "Front Mic", 0x3 },
1085 /* channel source setting (2/6 channel selection for 3-stack) */
1087 static struct hda_verb alc880_threestack_ch2_init
[] = {
1088 /* set line-in to input, mute it */
1089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1091 /* set mic-in to input vref 80%, mute it */
1092 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1093 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1098 static struct hda_verb alc880_threestack_ch6_init
[] = {
1099 /* set line-in to output, unmute it */
1100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1102 /* set mic-in to output, unmute it */
1103 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1104 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1108 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1109 { 2, alc880_threestack_ch2_init
},
1110 { 6, alc880_threestack_ch6_init
},
1113 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1116 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1117 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1118 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1121 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1130 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1131 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1134 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1135 .name
= "Channel Mode",
1136 .info
= alc_ch_mode_info
,
1137 .get
= alc_ch_mode_get
,
1138 .put
= alc_ch_mode_put
,
1143 /* capture mixer elements */
1144 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1145 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1146 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1147 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1148 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1149 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1150 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1152 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1153 /* The multiple "Capture Source" controls confuse alsamixer
1154 * So call somewhat different..
1156 /* .name = "Capture Source", */
1157 .name
= "Input Source",
1159 .info
= alc_mux_enum_info
,
1160 .get
= alc_mux_enum_get
,
1161 .put
= alc_mux_enum_put
,
1166 /* capture mixer elements (in case NID 0x07 not available) */
1167 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1168 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1169 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1170 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1171 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1173 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1174 /* The multiple "Capture Source" controls confuse alsamixer
1175 * So call somewhat different..
1177 /* .name = "Capture Source", */
1178 .name
= "Input Source",
1180 .info
= alc_mux_enum_info
,
1181 .get
= alc_mux_enum_get
,
1182 .put
= alc_mux_enum_put
,
1190 * ALC880 5-stack model
1192 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1194 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1195 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1198 /* additional mixers to alc880_three_stack_mixer */
1199 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1200 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1201 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1205 /* channel source setting (6/8 channel selection for 5-stack) */
1207 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1208 /* set line-in to input, mute it */
1209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1215 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1216 /* set line-in to output, unmute it */
1217 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1218 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1222 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1223 { 6, alc880_fivestack_ch6_init
},
1224 { 8, alc880_fivestack_ch8_init
},
1229 * ALC880 6-stack model
1231 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1232 * Side = 0x05 (0x0f)
1233 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1234 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1237 static hda_nid_t alc880_6st_dac_nids
[4] = {
1238 /* front, rear, clfe, rear_surr */
1239 0x02, 0x03, 0x04, 0x05
1242 static struct hda_input_mux alc880_6stack_capture_source
= {
1246 { "Front Mic", 0x1 },
1252 /* fixed 8-channels */
1253 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1257 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1266 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1267 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1276 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1277 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1279 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1280 .name
= "Channel Mode",
1281 .info
= alc_ch_mode_info
,
1282 .get
= alc_ch_mode_get
,
1283 .put
= alc_ch_mode_put
,
1292 * W810 has rear IO for:
1295 * Center/LFE (DAC 04)
1298 * The system also has a pair of internal speakers, and a headphone jack.
1299 * These are both connected to Line2 on the codec, hence to DAC 02.
1301 * There is a variable resistor to control the speaker or headphone
1302 * volume. This is a hardware-only device without a software API.
1304 * Plugging headphones in will disable the internal speakers. This is
1305 * implemented in hardware, not via the driver using jack sense. In
1306 * a similar fashion, plugging into the rear socket marked "front" will
1307 * disable both the speakers and headphones.
1309 * For input, there's a microphone jack, and an "audio in" jack.
1310 * These may not do anything useful with this driver yet, because I
1311 * haven't setup any initialization verbs for these yet...
1314 static hda_nid_t alc880_w810_dac_nids
[3] = {
1315 /* front, rear/surround, clfe */
1319 /* fixed 6 channels */
1320 static struct hda_channel_mode alc880_w810_modes
[1] = {
1324 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1325 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1327 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1328 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1329 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1330 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1332 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1333 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1342 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1343 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1347 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1350 #define ALC880_Z71V_HP_DAC 0x03
1352 /* fixed 2 channels */
1353 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1357 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1371 * ALC880 F1734 model
1373 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1374 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1377 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1380 #define ALC880_F1734_HP_DAC 0x02
1382 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1394 static struct hda_input_mux alc880_f1734_capture_source
= {
1406 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1407 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1408 * Mic = 0x18, Line = 0x1a
1411 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1412 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1414 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1418 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1419 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1420 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1421 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1422 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1423 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1424 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1430 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1431 .name
= "Channel Mode",
1432 .info
= alc_ch_mode_info
,
1433 .get
= alc_ch_mode_get
,
1434 .put
= alc_ch_mode_put
,
1440 * ALC880 ASUS W1V model
1442 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1443 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1444 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1447 /* additional mixers to alc880_asus_mixer */
1448 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1449 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1450 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1454 /* additional mixers to alc880_asus_mixer */
1455 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1456 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1457 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1462 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1464 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1467 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1470 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1471 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1473 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1474 /* The multiple "Capture Source" controls confuse alsamixer
1475 * So call somewhat different..
1477 /* .name = "Capture Source", */
1478 .name
= "Input Source",
1480 .info
= alc_mux_enum_info
,
1481 .get
= alc_mux_enum_get
,
1482 .put
= alc_mux_enum_put
,
1488 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1490 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1491 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1492 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1493 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1494 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1495 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1496 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1505 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1506 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1508 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1509 .name
= "Channel Mode",
1510 .info
= alc_ch_mode_info
,
1511 .get
= alc_ch_mode_get
,
1512 .put
= alc_ch_mode_put
,
1517 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1518 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1519 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1520 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1521 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1524 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1525 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1526 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1527 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1531 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1532 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1533 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1534 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1535 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1542 * virtual master controls
1546 * slave controls for virtual master
1548 static const char *alc_slave_vols
[] = {
1549 "Front Playback Volume",
1550 "Surround Playback Volume",
1551 "Center Playback Volume",
1552 "LFE Playback Volume",
1553 "Side Playback Volume",
1554 "Headphone Playback Volume",
1555 "Speaker Playback Volume",
1556 "Mono Playback Volume",
1557 "Line-Out Playback Volume",
1561 static const char *alc_slave_sws
[] = {
1562 "Front Playback Switch",
1563 "Surround Playback Switch",
1564 "Center Playback Switch",
1565 "LFE Playback Switch",
1566 "Side Playback Switch",
1567 "Headphone Playback Switch",
1568 "Speaker Playback Switch",
1569 "Mono Playback Switch",
1570 "IEC958 Playback Switch",
1575 * build control elements
1577 static int alc_build_controls(struct hda_codec
*codec
)
1579 struct alc_spec
*spec
= codec
->spec
;
1583 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1584 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1589 if (spec
->multiout
.dig_out_nid
) {
1590 err
= snd_hda_create_spdif_out_ctls(codec
,
1591 spec
->multiout
.dig_out_nid
);
1594 err
= snd_hda_create_spdif_share_sw(codec
,
1598 spec
->multiout
.share_spdif
= 1;
1600 if (spec
->dig_in_nid
) {
1601 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1606 /* if we have no master control, let's create it */
1607 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1608 unsigned int vmaster_tlv
[4];
1609 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
1610 HDA_OUTPUT
, vmaster_tlv
);
1611 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1612 vmaster_tlv
, alc_slave_vols
);
1616 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1617 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1618 NULL
, alc_slave_sws
);
1628 * initialize the codec volumes, etc
1632 * generic initialization of ADC, input mixers and output mixers
1634 static struct hda_verb alc880_volume_init_verbs
[] = {
1636 * Unmute ADC0-2 and set the default input to mic-in
1638 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1640 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1642 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1643 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1645 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1647 * Note: PASD motherboards uses the Line In 2 as the input for front
1650 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1660 * Set up output mixers (0x0c - 0x0f)
1662 /* set vol=0 to output mixers */
1663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1667 /* set up input amps for analog loopback */
1668 /* Amp Indices: DAC = 0, mixer = 1 */
1669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1682 * 3-stack pin configuration:
1683 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1685 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1687 * preset connection lists of input pins
1688 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1690 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1691 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1692 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1695 * Set pin mode and muting
1697 /* set front pin widgets 0x14 for output */
1698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1700 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1703 /* Mic2 (as headphone out) for HP output */
1704 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1706 /* Line In pin widget for input */
1707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1709 /* Line2 (as front mic) pin widget for input and vref at 80% */
1710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1712 /* CD pin widget for input */
1713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1719 * 5-stack pin configuration:
1720 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1721 * line-in/side = 0x1a, f-mic = 0x1b
1723 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1725 * preset connection lists of input pins
1726 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1728 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1729 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1732 * Set pin mode and muting
1734 /* set pin widgets 0x14-0x17 for output */
1735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1739 /* unmute pins for output (no gain on this amp) */
1740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1745 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1748 /* Mic2 (as headphone out) for HP output */
1749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1751 /* Line In pin widget for input */
1752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1754 /* Line2 (as front mic) pin widget for input and vref at 80% */
1755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1757 /* CD pin widget for input */
1758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1764 * W810 pin configuration:
1765 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1767 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1768 /* hphone/speaker input selector: front DAC */
1769 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1779 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1785 * Z71V pin configuration:
1786 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1788 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1797 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1803 * 6-stack pin configuration:
1804 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1805 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1807 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1808 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1833 * Uniwill pin configuration:
1834 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1837 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1838 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1846 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1861 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1862 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1863 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1873 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1875 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1876 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1882 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1891 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1893 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1895 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1899 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1904 static struct hda_verb alc880_beep_init_verbs
[] = {
1905 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1909 /* toggle speaker-output according to the hp-jack state */
1910 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1912 unsigned int present
;
1915 present
= snd_hda_codec_read(codec
, 0x14, 0,
1916 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1917 bits
= present
? HDA_AMP_MUTE
: 0;
1918 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1919 HDA_AMP_MUTE
, bits
);
1920 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1921 HDA_AMP_MUTE
, bits
);
1924 /* auto-toggle front mic */
1925 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1927 unsigned int present
;
1930 present
= snd_hda_codec_read(codec
, 0x18, 0,
1931 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1932 bits
= present
? HDA_AMP_MUTE
: 0;
1933 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1936 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1938 alc880_uniwill_hp_automute(codec
);
1939 alc880_uniwill_mic_automute(codec
);
1942 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1945 /* Looks like the unsol event is incompatible with the standard
1946 * definition. 4bit tag is placed at 28 bit!
1948 switch (res
>> 28) {
1949 case ALC880_HP_EVENT
:
1950 alc880_uniwill_hp_automute(codec
);
1952 case ALC880_MIC_EVENT
:
1953 alc880_uniwill_mic_automute(codec
);
1958 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1960 unsigned int present
;
1963 present
= snd_hda_codec_read(codec
, 0x14, 0,
1964 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1965 bits
= present
? HDA_AMP_MUTE
: 0;
1966 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0, HDA_AMP_MUTE
, bits
);
1969 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1971 unsigned int present
;
1973 present
= snd_hda_codec_read(codec
, 0x21, 0,
1974 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1975 present
&= HDA_AMP_VOLMASK
;
1976 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1977 HDA_AMP_VOLMASK
, present
);
1978 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1979 HDA_AMP_VOLMASK
, present
);
1982 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1985 /* Looks like the unsol event is incompatible with the standard
1986 * definition. 4bit tag is placed at 28 bit!
1988 if ((res
>> 28) == ALC880_HP_EVENT
)
1989 alc880_uniwill_p53_hp_automute(codec
);
1990 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1991 alc880_uniwill_p53_dcvol_automute(codec
);
1995 * F1734 pin configuration:
1996 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1998 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1999 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2000 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2001 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2002 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2003 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2011 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2016 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2017 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2020 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2021 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2027 * ASUS pin configuration:
2028 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2030 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2031 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2032 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2033 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2034 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2039 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2042 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2052 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2058 /* Enable GPIO mask and set output */
2059 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2060 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2062 /* Clevo m520g init */
2063 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2064 /* headphone output */
2065 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2073 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2074 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2075 /* Mic1 (rear panel) */
2076 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2078 /* Mic2 (front panel) */
2079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2082 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2084 /* change to EAPD mode */
2085 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2086 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2091 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2092 /* change to EAPD mode */
2093 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2094 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2096 /* Headphone output */
2097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2100 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2102 /* Line In pin widget for input */
2103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2104 /* CD pin widget for input */
2105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2106 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2107 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2109 /* change to EAPD mode */
2110 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2111 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2117 * LG m1 express dual
2120 * Rear Line-In/Out (blue): 0x14
2121 * Build-in Mic-In: 0x15
2123 * HP-Out (green): 0x1b
2124 * Mic-In/Out (red): 0x19
2128 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2129 static hda_nid_t alc880_lg_dac_nids
[3] = {
2133 /* seems analog CD is not working */
2134 static struct hda_input_mux alc880_lg_capture_source
= {
2139 { "Internal Mic", 0x6 },
2143 /* 2,4,6 channel modes */
2144 static struct hda_verb alc880_lg_ch2_init
[] = {
2145 /* set line-in and mic-in to input */
2146 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2147 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2151 static struct hda_verb alc880_lg_ch4_init
[] = {
2152 /* set line-in to out and mic-in to input */
2153 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2154 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2158 static struct hda_verb alc880_lg_ch6_init
[] = {
2159 /* set line-in and mic-in to output */
2160 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2161 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2165 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2166 { 2, alc880_lg_ch2_init
},
2167 { 4, alc880_lg_ch4_init
},
2168 { 6, alc880_lg_ch6_init
},
2171 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2173 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2174 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2175 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2184 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2185 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2187 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2188 .name
= "Channel Mode",
2189 .info
= alc_ch_mode_info
,
2190 .get
= alc_ch_mode_get
,
2191 .put
= alc_ch_mode_put
,
2196 static struct hda_verb alc880_lg_init_verbs
[] = {
2197 /* set capture source to mic-in */
2198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2201 /* mute all amp mixer inputs */
2202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2205 /* line-in to input */
2206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2212 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2213 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2214 /* mic-in to input */
2215 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2219 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2221 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2227 /* toggle speaker-output according to the hp-jack state */
2228 static void alc880_lg_automute(struct hda_codec
*codec
)
2230 unsigned int present
;
2233 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2234 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2235 bits
= present
? HDA_AMP_MUTE
: 0;
2236 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2237 HDA_AMP_MUTE
, bits
);
2240 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2242 /* Looks like the unsol event is incompatible with the standard
2243 * definition. 4bit tag is placed at 28 bit!
2245 if ((res
>> 28) == 0x01)
2246 alc880_lg_automute(codec
);
2255 * Built-in Mic-In: 0x19
2261 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2265 { "Internal Mic", 0x1 },
2270 #define alc880_lg_lw_modes alc880_threestack_modes
2272 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2275 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2276 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2277 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2278 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2279 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2280 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2283 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2285 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2286 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2288 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2289 .name
= "Channel Mode",
2290 .info
= alc_ch_mode_info
,
2291 .get
= alc_ch_mode_get
,
2292 .put
= alc_ch_mode_put
,
2297 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2298 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2299 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2300 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2302 /* set capture source to mic-in */
2303 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2312 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2313 /* mic-in to input */
2314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2320 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2324 /* toggle speaker-output according to the hp-jack state */
2325 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2327 unsigned int present
;
2330 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2331 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2332 bits
= present
? HDA_AMP_MUTE
: 0;
2333 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2334 HDA_AMP_MUTE
, bits
);
2337 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2339 /* Looks like the unsol event is incompatible with the standard
2340 * definition. 4bit tag is placed at 28 bit!
2342 if ((res
>> 28) == 0x01)
2343 alc880_lg_lw_automute(codec
);
2346 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
2347 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2348 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2351 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2352 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2356 static struct hda_input_mux alc880_medion_rim_capture_source
= {
2360 { "Internal Mic", 0x1 },
2364 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
2365 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2368 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2370 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2373 /* Mic2 (as headphone out) for HP output */
2374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2376 /* Internal Speaker */
2377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2380 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2381 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2387 /* toggle speaker-output according to the hp-jack state */
2388 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
2390 unsigned int present
;
2393 present
= snd_hda_codec_read(codec
, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE
, 0)
2395 & AC_PINSENSE_PRESENCE
;
2396 bits
= present
? HDA_AMP_MUTE
: 0;
2397 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
2398 HDA_AMP_MUTE
, bits
);
2400 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
2402 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
2405 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
2408 /* Looks like the unsol event is incompatible with the standard
2409 * definition. 4bit tag is placed at 28 bit!
2411 if ((res
>> 28) == ALC880_HP_EVENT
)
2412 alc880_medion_rim_automute(codec
);
2415 #ifdef CONFIG_SND_HDA_POWER_SAVE
2416 static struct hda_amp_list alc880_loopbacks
[] = {
2417 { 0x0b, HDA_INPUT
, 0 },
2418 { 0x0b, HDA_INPUT
, 1 },
2419 { 0x0b, HDA_INPUT
, 2 },
2420 { 0x0b, HDA_INPUT
, 3 },
2421 { 0x0b, HDA_INPUT
, 4 },
2425 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2426 { 0x0b, HDA_INPUT
, 1 },
2427 { 0x0b, HDA_INPUT
, 6 },
2428 { 0x0b, HDA_INPUT
, 7 },
2437 static int alc_init(struct hda_codec
*codec
)
2439 struct alc_spec
*spec
= codec
->spec
;
2443 if (codec
->vendor_id
== 0x10ec0888)
2444 alc888_coef_init(codec
);
2446 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2447 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2449 if (spec
->init_hook
)
2450 spec
->init_hook(codec
);
2455 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2457 struct alc_spec
*spec
= codec
->spec
;
2459 if (spec
->unsol_event
)
2460 spec
->unsol_event(codec
, res
);
2463 #ifdef CONFIG_SND_HDA_POWER_SAVE
2464 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2466 struct alc_spec
*spec
= codec
->spec
;
2467 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2472 * Analog playback callbacks
2474 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2475 struct hda_codec
*codec
,
2476 struct snd_pcm_substream
*substream
)
2478 struct alc_spec
*spec
= codec
->spec
;
2479 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2483 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2484 struct hda_codec
*codec
,
2485 unsigned int stream_tag
,
2486 unsigned int format
,
2487 struct snd_pcm_substream
*substream
)
2489 struct alc_spec
*spec
= codec
->spec
;
2490 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2491 stream_tag
, format
, substream
);
2494 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2495 struct hda_codec
*codec
,
2496 struct snd_pcm_substream
*substream
)
2498 struct alc_spec
*spec
= codec
->spec
;
2499 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2505 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2506 struct hda_codec
*codec
,
2507 struct snd_pcm_substream
*substream
)
2509 struct alc_spec
*spec
= codec
->spec
;
2510 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2513 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2514 struct hda_codec
*codec
,
2515 unsigned int stream_tag
,
2516 unsigned int format
,
2517 struct snd_pcm_substream
*substream
)
2519 struct alc_spec
*spec
= codec
->spec
;
2520 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2521 stream_tag
, format
, substream
);
2524 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2525 struct hda_codec
*codec
,
2526 struct snd_pcm_substream
*substream
)
2528 struct alc_spec
*spec
= codec
->spec
;
2529 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2535 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2536 struct hda_codec
*codec
,
2537 unsigned int stream_tag
,
2538 unsigned int format
,
2539 struct snd_pcm_substream
*substream
)
2541 struct alc_spec
*spec
= codec
->spec
;
2543 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2544 stream_tag
, 0, format
);
2548 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2549 struct hda_codec
*codec
,
2550 struct snd_pcm_substream
*substream
)
2552 struct alc_spec
*spec
= codec
->spec
;
2554 snd_hda_codec_cleanup_stream(codec
,
2555 spec
->adc_nids
[substream
->number
+ 1]);
2562 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2566 /* NID is set in alc_build_pcms */
2568 .open
= alc880_playback_pcm_open
,
2569 .prepare
= alc880_playback_pcm_prepare
,
2570 .cleanup
= alc880_playback_pcm_cleanup
2574 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2578 /* NID is set in alc_build_pcms */
2581 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2585 /* NID is set in alc_build_pcms */
2588 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2589 .substreams
= 2, /* can be overridden */
2592 /* NID is set in alc_build_pcms */
2594 .prepare
= alc880_alt_capture_pcm_prepare
,
2595 .cleanup
= alc880_alt_capture_pcm_cleanup
2599 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2603 /* NID is set in alc_build_pcms */
2605 .open
= alc880_dig_playback_pcm_open
,
2606 .close
= alc880_dig_playback_pcm_close
,
2607 .prepare
= alc880_dig_playback_pcm_prepare
2611 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2615 /* NID is set in alc_build_pcms */
2618 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2619 static struct hda_pcm_stream alc_pcm_null_stream
= {
2625 static int alc_build_pcms(struct hda_codec
*codec
)
2627 struct alc_spec
*spec
= codec
->spec
;
2628 struct hda_pcm
*info
= spec
->pcm_rec
;
2631 codec
->num_pcms
= 1;
2632 codec
->pcm_info
= info
;
2634 info
->name
= spec
->stream_name_analog
;
2635 if (spec
->stream_analog_playback
) {
2636 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
2637 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2638 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2640 if (spec
->stream_analog_capture
) {
2641 snd_assert(spec
->adc_nids
, return -EINVAL
);
2642 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2643 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2646 if (spec
->channel_mode
) {
2647 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2648 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2649 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2650 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2655 /* SPDIF for stream index #1 */
2656 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2657 codec
->num_pcms
= 2;
2658 info
= spec
->pcm_rec
+ 1;
2659 info
->name
= spec
->stream_name_digital
;
2660 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2661 if (spec
->multiout
.dig_out_nid
&&
2662 spec
->stream_digital_playback
) {
2663 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2664 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2666 if (spec
->dig_in_nid
&&
2667 spec
->stream_digital_capture
) {
2668 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2669 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2673 /* If the use of more than one ADC is requested for the current
2674 * model, configure a second analog capture-only PCM.
2676 /* Additional Analaog capture for index #2 */
2677 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
2678 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
2679 codec
->num_pcms
= 3;
2680 info
= spec
->pcm_rec
+ 2;
2681 info
->name
= spec
->stream_name_analog
;
2682 if (spec
->alt_dac_nid
) {
2683 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2684 *spec
->stream_analog_alt_playback
;
2685 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2688 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2689 alc_pcm_null_stream
;
2690 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2692 if (spec
->num_adc_nids
> 1) {
2693 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2694 *spec
->stream_analog_alt_capture
;
2695 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
2697 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
2698 spec
->num_adc_nids
- 1;
2700 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2701 alc_pcm_null_stream
;
2702 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
2709 static void alc_free(struct hda_codec
*codec
)
2711 struct alc_spec
*spec
= codec
->spec
;
2717 if (spec
->kctl_alloc
) {
2718 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2719 kfree(spec
->kctl_alloc
[i
].name
);
2720 kfree(spec
->kctl_alloc
);
2723 codec
->spec
= NULL
; /* to be sure */
2728 static struct hda_codec_ops alc_patch_ops
= {
2729 .build_controls
= alc_build_controls
,
2730 .build_pcms
= alc_build_pcms
,
2733 .unsol_event
= alc_unsol_event
,
2734 #ifdef CONFIG_SND_HDA_POWER_SAVE
2735 .check_power_status
= alc_check_power_status
,
2741 * Test configuration for debugging
2743 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2746 #ifdef CONFIG_SND_DEBUG
2747 static hda_nid_t alc880_test_dac_nids
[4] = {
2748 0x02, 0x03, 0x04, 0x05
2751 static struct hda_input_mux alc880_test_capture_source
= {
2760 { "Surround", 0x6 },
2764 static struct hda_channel_mode alc880_test_modes
[4] = {
2771 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2772 struct snd_ctl_elem_info
*uinfo
)
2774 static char *texts
[] = {
2775 "N/A", "Line Out", "HP Out",
2776 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2778 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2780 uinfo
->value
.enumerated
.items
= 8;
2781 if (uinfo
->value
.enumerated
.item
>= 8)
2782 uinfo
->value
.enumerated
.item
= 7;
2783 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2787 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2788 struct snd_ctl_elem_value
*ucontrol
)
2790 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2791 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2792 unsigned int pin_ctl
, item
= 0;
2794 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2795 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2796 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2797 if (pin_ctl
& AC_PINCTL_HP_EN
)
2801 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2802 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2803 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2804 case AC_PINCTL_VREF_50
: item
= 4; break;
2805 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2806 case AC_PINCTL_VREF_80
: item
= 6; break;
2807 case AC_PINCTL_VREF_100
: item
= 7; break;
2810 ucontrol
->value
.enumerated
.item
[0] = item
;
2814 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2815 struct snd_ctl_elem_value
*ucontrol
)
2817 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2818 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2819 static unsigned int ctls
[] = {
2820 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2821 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2822 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2823 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2824 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2825 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2827 unsigned int old_ctl
, new_ctl
;
2829 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2830 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2831 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2832 if (old_ctl
!= new_ctl
) {
2834 snd_hda_codec_write_cache(codec
, nid
, 0,
2835 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2837 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2839 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2846 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2847 struct snd_ctl_elem_info
*uinfo
)
2849 static char *texts
[] = {
2850 "Front", "Surround", "CLFE", "Side"
2852 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2854 uinfo
->value
.enumerated
.items
= 4;
2855 if (uinfo
->value
.enumerated
.item
>= 4)
2856 uinfo
->value
.enumerated
.item
= 3;
2857 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2861 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2862 struct snd_ctl_elem_value
*ucontrol
)
2864 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2865 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2868 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2869 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2873 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2874 struct snd_ctl_elem_value
*ucontrol
)
2876 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2877 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2880 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2881 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2882 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2883 snd_hda_codec_write_cache(codec
, nid
, 0,
2884 AC_VERB_SET_CONNECT_SEL
, sel
);
2890 #define PIN_CTL_TEST(xname,nid) { \
2891 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2893 .info = alc_test_pin_ctl_info, \
2894 .get = alc_test_pin_ctl_get, \
2895 .put = alc_test_pin_ctl_put, \
2896 .private_value = nid \
2899 #define PIN_SRC_TEST(xname,nid) { \
2900 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2902 .info = alc_test_pin_src_info, \
2903 .get = alc_test_pin_src_get, \
2904 .put = alc_test_pin_src_put, \
2905 .private_value = nid \
2908 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2910 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2911 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2912 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2914 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2915 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2916 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2917 PIN_CTL_TEST("Front Pin Mode", 0x14),
2918 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2919 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2920 PIN_CTL_TEST("Side Pin Mode", 0x17),
2921 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2922 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2923 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2924 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2925 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2926 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2927 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2928 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2929 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2930 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2931 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2932 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2933 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2934 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2935 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2936 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2940 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2941 .name
= "Channel Mode",
2942 .info
= alc_ch_mode_info
,
2943 .get
= alc_ch_mode_get
,
2944 .put
= alc_ch_mode_put
,
2949 static struct hda_verb alc880_test_init_verbs
[] = {
2950 /* Unmute inputs of 0x0c - 0x0f */
2951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2954 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2956 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2957 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2958 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2959 /* Vol output for 0x0c-0x0f */
2960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2961 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2963 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2964 /* Set output pins 0x14-0x17 */
2965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2967 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2968 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2969 /* Unmute output pins 0x14-0x17 */
2970 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2971 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2972 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2973 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2974 /* Set input pins 0x18-0x1c */
2975 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2978 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2979 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2980 /* Mute input pins 0x18-0x1b */
2981 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2982 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2983 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2984 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2987 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2989 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2991 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2992 /* Analog input/passthru */
2993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3005 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3006 [ALC880_3ST
] = "3stack",
3007 [ALC880_TCL_S700
] = "tcl",
3008 [ALC880_3ST_DIG
] = "3stack-digout",
3009 [ALC880_CLEVO
] = "clevo",
3010 [ALC880_5ST
] = "5stack",
3011 [ALC880_5ST_DIG
] = "5stack-digout",
3012 [ALC880_W810
] = "w810",
3013 [ALC880_Z71V
] = "z71v",
3014 [ALC880_6ST
] = "6stack",
3015 [ALC880_6ST_DIG
] = "6stack-digout",
3016 [ALC880_ASUS
] = "asus",
3017 [ALC880_ASUS_W1V
] = "asus-w1v",
3018 [ALC880_ASUS_DIG
] = "asus-dig",
3019 [ALC880_ASUS_DIG2
] = "asus-dig2",
3020 [ALC880_UNIWILL_DIG
] = "uniwill",
3021 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3022 [ALC880_FUJITSU
] = "fujitsu",
3023 [ALC880_F1734
] = "F1734",
3025 [ALC880_LG_LW
] = "lg-lw",
3026 [ALC880_MEDION_RIM
] = "medion",
3027 #ifdef CONFIG_SND_DEBUG
3028 [ALC880_TEST
] = "test",
3030 [ALC880_AUTO
] = "auto",
3033 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3034 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3035 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3036 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3037 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3038 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3039 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3040 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3041 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3042 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3043 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3044 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3045 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3046 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3047 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3048 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3049 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3050 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3051 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3052 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3053 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3054 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3055 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3056 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3057 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3058 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3059 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
3060 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3061 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3062 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3063 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3064 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3065 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3066 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3067 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3068 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3069 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3070 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3071 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3072 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3073 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3074 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3075 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3076 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3077 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3078 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3079 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3080 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3081 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3082 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3083 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3084 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3085 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3086 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3087 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3088 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3089 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3090 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3091 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3092 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3093 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3094 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3095 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3096 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3097 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3098 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3099 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3100 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3101 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3102 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
3103 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3104 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3109 * ALC880 codec presets
3111 static struct alc_config_preset alc880_presets
[] = {
3113 .mixers
= { alc880_three_stack_mixer
},
3114 .init_verbs
= { alc880_volume_init_verbs
,
3115 alc880_pin_3stack_init_verbs
},
3116 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3117 .dac_nids
= alc880_dac_nids
,
3118 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3119 .channel_mode
= alc880_threestack_modes
,
3121 .input_mux
= &alc880_capture_source
,
3123 [ALC880_3ST_DIG
] = {
3124 .mixers
= { alc880_three_stack_mixer
},
3125 .init_verbs
= { alc880_volume_init_verbs
,
3126 alc880_pin_3stack_init_verbs
},
3127 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3128 .dac_nids
= alc880_dac_nids
,
3129 .dig_out_nid
= ALC880_DIGOUT_NID
,
3130 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3131 .channel_mode
= alc880_threestack_modes
,
3133 .input_mux
= &alc880_capture_source
,
3135 [ALC880_TCL_S700
] = {
3136 .mixers
= { alc880_tcl_s700_mixer
},
3137 .init_verbs
= { alc880_volume_init_verbs
,
3138 alc880_pin_tcl_S700_init_verbs
,
3139 alc880_gpio2_init_verbs
},
3140 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3141 .dac_nids
= alc880_dac_nids
,
3143 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3144 .channel_mode
= alc880_2_jack_modes
,
3145 .input_mux
= &alc880_capture_source
,
3148 .mixers
= { alc880_three_stack_mixer
,
3149 alc880_five_stack_mixer
},
3150 .init_verbs
= { alc880_volume_init_verbs
,
3151 alc880_pin_5stack_init_verbs
},
3152 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3153 .dac_nids
= alc880_dac_nids
,
3154 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3155 .channel_mode
= alc880_fivestack_modes
,
3156 .input_mux
= &alc880_capture_source
,
3158 [ALC880_5ST_DIG
] = {
3159 .mixers
= { alc880_three_stack_mixer
,
3160 alc880_five_stack_mixer
},
3161 .init_verbs
= { alc880_volume_init_verbs
,
3162 alc880_pin_5stack_init_verbs
},
3163 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3164 .dac_nids
= alc880_dac_nids
,
3165 .dig_out_nid
= ALC880_DIGOUT_NID
,
3166 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3167 .channel_mode
= alc880_fivestack_modes
,
3168 .input_mux
= &alc880_capture_source
,
3171 .mixers
= { alc880_six_stack_mixer
},
3172 .init_verbs
= { alc880_volume_init_verbs
,
3173 alc880_pin_6stack_init_verbs
},
3174 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3175 .dac_nids
= alc880_6st_dac_nids
,
3176 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3177 .channel_mode
= alc880_sixstack_modes
,
3178 .input_mux
= &alc880_6stack_capture_source
,
3180 [ALC880_6ST_DIG
] = {
3181 .mixers
= { alc880_six_stack_mixer
},
3182 .init_verbs
= { alc880_volume_init_verbs
,
3183 alc880_pin_6stack_init_verbs
},
3184 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3185 .dac_nids
= alc880_6st_dac_nids
,
3186 .dig_out_nid
= ALC880_DIGOUT_NID
,
3187 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3188 .channel_mode
= alc880_sixstack_modes
,
3189 .input_mux
= &alc880_6stack_capture_source
,
3192 .mixers
= { alc880_w810_base_mixer
},
3193 .init_verbs
= { alc880_volume_init_verbs
,
3194 alc880_pin_w810_init_verbs
,
3195 alc880_gpio2_init_verbs
},
3196 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3197 .dac_nids
= alc880_w810_dac_nids
,
3198 .dig_out_nid
= ALC880_DIGOUT_NID
,
3199 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3200 .channel_mode
= alc880_w810_modes
,
3201 .input_mux
= &alc880_capture_source
,
3204 .mixers
= { alc880_z71v_mixer
},
3205 .init_verbs
= { alc880_volume_init_verbs
,
3206 alc880_pin_z71v_init_verbs
},
3207 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3208 .dac_nids
= alc880_z71v_dac_nids
,
3209 .dig_out_nid
= ALC880_DIGOUT_NID
,
3211 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3212 .channel_mode
= alc880_2_jack_modes
,
3213 .input_mux
= &alc880_capture_source
,
3216 .mixers
= { alc880_f1734_mixer
},
3217 .init_verbs
= { alc880_volume_init_verbs
,
3218 alc880_pin_f1734_init_verbs
},
3219 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3220 .dac_nids
= alc880_f1734_dac_nids
,
3222 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3223 .channel_mode
= alc880_2_jack_modes
,
3224 .input_mux
= &alc880_f1734_capture_source
,
3225 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3226 .init_hook
= alc880_uniwill_p53_hp_automute
,
3229 .mixers
= { alc880_asus_mixer
},
3230 .init_verbs
= { alc880_volume_init_verbs
,
3231 alc880_pin_asus_init_verbs
,
3232 alc880_gpio1_init_verbs
},
3233 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3234 .dac_nids
= alc880_asus_dac_nids
,
3235 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3236 .channel_mode
= alc880_asus_modes
,
3238 .input_mux
= &alc880_capture_source
,
3240 [ALC880_ASUS_DIG
] = {
3241 .mixers
= { alc880_asus_mixer
},
3242 .init_verbs
= { alc880_volume_init_verbs
,
3243 alc880_pin_asus_init_verbs
,
3244 alc880_gpio1_init_verbs
},
3245 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3246 .dac_nids
= alc880_asus_dac_nids
,
3247 .dig_out_nid
= ALC880_DIGOUT_NID
,
3248 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3249 .channel_mode
= alc880_asus_modes
,
3251 .input_mux
= &alc880_capture_source
,
3253 [ALC880_ASUS_DIG2
] = {
3254 .mixers
= { alc880_asus_mixer
},
3255 .init_verbs
= { alc880_volume_init_verbs
,
3256 alc880_pin_asus_init_verbs
,
3257 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3258 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3259 .dac_nids
= alc880_asus_dac_nids
,
3260 .dig_out_nid
= ALC880_DIGOUT_NID
,
3261 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3262 .channel_mode
= alc880_asus_modes
,
3264 .input_mux
= &alc880_capture_source
,
3266 [ALC880_ASUS_W1V
] = {
3267 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3268 .init_verbs
= { alc880_volume_init_verbs
,
3269 alc880_pin_asus_init_verbs
,
3270 alc880_gpio1_init_verbs
},
3271 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3272 .dac_nids
= alc880_asus_dac_nids
,
3273 .dig_out_nid
= ALC880_DIGOUT_NID
,
3274 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3275 .channel_mode
= alc880_asus_modes
,
3277 .input_mux
= &alc880_capture_source
,
3279 [ALC880_UNIWILL_DIG
] = {
3280 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3281 .init_verbs
= { alc880_volume_init_verbs
,
3282 alc880_pin_asus_init_verbs
},
3283 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3284 .dac_nids
= alc880_asus_dac_nids
,
3285 .dig_out_nid
= ALC880_DIGOUT_NID
,
3286 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3287 .channel_mode
= alc880_asus_modes
,
3289 .input_mux
= &alc880_capture_source
,
3291 [ALC880_UNIWILL
] = {
3292 .mixers
= { alc880_uniwill_mixer
},
3293 .init_verbs
= { alc880_volume_init_verbs
,
3294 alc880_uniwill_init_verbs
},
3295 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3296 .dac_nids
= alc880_asus_dac_nids
,
3297 .dig_out_nid
= ALC880_DIGOUT_NID
,
3298 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3299 .channel_mode
= alc880_threestack_modes
,
3301 .input_mux
= &alc880_capture_source
,
3302 .unsol_event
= alc880_uniwill_unsol_event
,
3303 .init_hook
= alc880_uniwill_automute
,
3305 [ALC880_UNIWILL_P53
] = {
3306 .mixers
= { alc880_uniwill_p53_mixer
},
3307 .init_verbs
= { alc880_volume_init_verbs
,
3308 alc880_uniwill_p53_init_verbs
},
3309 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3310 .dac_nids
= alc880_asus_dac_nids
,
3311 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3312 .channel_mode
= alc880_threestack_modes
,
3313 .input_mux
= &alc880_capture_source
,
3314 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3315 .init_hook
= alc880_uniwill_p53_hp_automute
,
3317 [ALC880_FUJITSU
] = {
3318 .mixers
= { alc880_fujitsu_mixer
,
3319 alc880_pcbeep_mixer
, },
3320 .init_verbs
= { alc880_volume_init_verbs
,
3321 alc880_uniwill_p53_init_verbs
,
3322 alc880_beep_init_verbs
},
3323 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3324 .dac_nids
= alc880_dac_nids
,
3325 .dig_out_nid
= ALC880_DIGOUT_NID
,
3326 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3327 .channel_mode
= alc880_2_jack_modes
,
3328 .input_mux
= &alc880_capture_source
,
3329 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3330 .init_hook
= alc880_uniwill_p53_hp_automute
,
3333 .mixers
= { alc880_three_stack_mixer
},
3334 .init_verbs
= { alc880_volume_init_verbs
,
3335 alc880_pin_clevo_init_verbs
},
3336 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3337 .dac_nids
= alc880_dac_nids
,
3339 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3340 .channel_mode
= alc880_threestack_modes
,
3342 .input_mux
= &alc880_capture_source
,
3345 .mixers
= { alc880_lg_mixer
},
3346 .init_verbs
= { alc880_volume_init_verbs
,
3347 alc880_lg_init_verbs
},
3348 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3349 .dac_nids
= alc880_lg_dac_nids
,
3350 .dig_out_nid
= ALC880_DIGOUT_NID
,
3351 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3352 .channel_mode
= alc880_lg_ch_modes
,
3354 .input_mux
= &alc880_lg_capture_source
,
3355 .unsol_event
= alc880_lg_unsol_event
,
3356 .init_hook
= alc880_lg_automute
,
3357 #ifdef CONFIG_SND_HDA_POWER_SAVE
3358 .loopbacks
= alc880_lg_loopbacks
,
3362 .mixers
= { alc880_lg_lw_mixer
},
3363 .init_verbs
= { alc880_volume_init_verbs
,
3364 alc880_lg_lw_init_verbs
},
3365 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3366 .dac_nids
= alc880_dac_nids
,
3367 .dig_out_nid
= ALC880_DIGOUT_NID
,
3368 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3369 .channel_mode
= alc880_lg_lw_modes
,
3370 .input_mux
= &alc880_lg_lw_capture_source
,
3371 .unsol_event
= alc880_lg_lw_unsol_event
,
3372 .init_hook
= alc880_lg_lw_automute
,
3374 [ALC880_MEDION_RIM
] = {
3375 .mixers
= { alc880_medion_rim_mixer
},
3376 .init_verbs
= { alc880_volume_init_verbs
,
3377 alc880_medion_rim_init_verbs
,
3378 alc_gpio2_init_verbs
},
3379 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3380 .dac_nids
= alc880_dac_nids
,
3381 .dig_out_nid
= ALC880_DIGOUT_NID
,
3382 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3383 .channel_mode
= alc880_2_jack_modes
,
3384 .input_mux
= &alc880_medion_rim_capture_source
,
3385 .unsol_event
= alc880_medion_rim_unsol_event
,
3386 .init_hook
= alc880_medion_rim_automute
,
3388 #ifdef CONFIG_SND_DEBUG
3390 .mixers
= { alc880_test_mixer
},
3391 .init_verbs
= { alc880_test_init_verbs
},
3392 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3393 .dac_nids
= alc880_test_dac_nids
,
3394 .dig_out_nid
= ALC880_DIGOUT_NID
,
3395 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3396 .channel_mode
= alc880_test_modes
,
3397 .input_mux
= &alc880_test_capture_source
,
3403 * Automatic parse of I/O pins from the BIOS configuration
3406 #define NUM_CONTROL_ALLOC 32
3407 #define NUM_VERB_ALLOC 32
3411 ALC_CTL_WIDGET_MUTE
,
3414 static struct snd_kcontrol_new alc880_control_templates
[] = {
3415 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3416 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3417 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3420 /* add dynamic controls */
3421 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3424 struct snd_kcontrol_new
*knew
;
3426 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3427 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3429 /* array + terminator */
3430 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3433 if (spec
->kctl_alloc
) {
3434 memcpy(knew
, spec
->kctl_alloc
,
3435 sizeof(*knew
) * spec
->num_kctl_alloc
);
3436 kfree(spec
->kctl_alloc
);
3438 spec
->kctl_alloc
= knew
;
3439 spec
->num_kctl_alloc
= num
;
3442 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3443 *knew
= alc880_control_templates
[type
];
3444 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3447 knew
->private_value
= val
;
3448 spec
->num_kctl_used
++;
3452 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3453 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3454 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3455 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3456 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3457 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3458 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3459 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3460 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3461 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3462 #define ALC880_PIN_CD_NID 0x1c
3464 /* fill in the dac_nids table from the parsed pin configuration */
3465 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3466 const struct auto_pin_cfg
*cfg
)
3472 memset(assigned
, 0, sizeof(assigned
));
3473 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3475 /* check the pins hardwired to audio widget */
3476 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3477 nid
= cfg
->line_out_pins
[i
];
3478 if (alc880_is_fixed_pin(nid
)) {
3479 int idx
= alc880_fixed_pin_idx(nid
);
3480 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3484 /* left pins can be connect to any audio widget */
3485 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3486 nid
= cfg
->line_out_pins
[i
];
3487 if (alc880_is_fixed_pin(nid
))
3489 /* search for an empty channel */
3490 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3492 spec
->multiout
.dac_nids
[i
] =
3493 alc880_idx_to_dac(j
);
3499 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3503 /* add playback controls from the parsed DAC table */
3504 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3505 const struct auto_pin_cfg
*cfg
)
3508 static const char *chname
[4] = {
3509 "Front", "Surround", NULL
/*CLFE*/, "Side"
3514 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3515 if (!spec
->multiout
.dac_nids
[i
])
3517 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3520 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3521 "Center Playback Volume",
3522 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3526 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3527 "LFE Playback Volume",
3528 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3532 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3533 "Center Playback Switch",
3534 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3538 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3539 "LFE Playback Switch",
3540 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3545 sprintf(name
, "%s Playback Volume", chname
[i
]);
3546 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3547 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3551 sprintf(name
, "%s Playback Switch", chname
[i
]);
3552 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3553 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3562 /* add playback controls for speaker and HP outputs */
3563 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3573 if (alc880_is_fixed_pin(pin
)) {
3574 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3575 /* specify the DAC as the extra output */
3576 if (!spec
->multiout
.hp_nid
)
3577 spec
->multiout
.hp_nid
= nid
;
3579 spec
->multiout
.extra_out_nid
[0] = nid
;
3580 /* control HP volume/switch on the output mixer amp */
3581 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3582 sprintf(name
, "%s Playback Volume", pfx
);
3583 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3584 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3587 sprintf(name
, "%s Playback Switch", pfx
);
3588 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3589 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3592 } else if (alc880_is_multi_pin(pin
)) {
3593 /* set manual connection */
3594 /* we have only a switch on HP-out PIN */
3595 sprintf(name
, "%s Playback Switch", pfx
);
3596 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3597 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3604 /* create input playback/capture controls for the given pin */
3605 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3606 const char *ctlname
,
3607 int idx
, hda_nid_t mix_nid
)
3612 sprintf(name
, "%s Playback Volume", ctlname
);
3613 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3614 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3617 sprintf(name
, "%s Playback Switch", ctlname
);
3618 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3619 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3625 /* create playback/capture controls for input pins */
3626 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3627 const struct auto_pin_cfg
*cfg
)
3629 struct hda_input_mux
*imux
= &spec
->private_imux
;
3632 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3633 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3634 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3635 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3636 auto_pin_cfg_labels
[i
],
3640 imux
->items
[imux
->num_items
].label
=
3641 auto_pin_cfg_labels
[i
];
3642 imux
->items
[imux
->num_items
].index
=
3643 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3650 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
3651 unsigned int pin_type
)
3653 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3656 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3660 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3661 hda_nid_t nid
, int pin_type
,
3664 alc_set_pin_output(codec
, nid
, pin_type
);
3665 /* need the manual connection? */
3666 if (alc880_is_multi_pin(nid
)) {
3667 struct alc_spec
*spec
= codec
->spec
;
3668 int idx
= alc880_multi_pin_idx(nid
);
3669 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3670 AC_VERB_SET_CONNECT_SEL
,
3671 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3675 static int get_pin_type(int line_out_type
)
3677 if (line_out_type
== AUTO_PIN_HP_OUT
)
3683 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3685 struct alc_spec
*spec
= codec
->spec
;
3688 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3689 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3690 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3691 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3692 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3696 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3698 struct alc_spec
*spec
= codec
->spec
;
3701 pin
= spec
->autocfg
.speaker_pins
[0];
3702 if (pin
) /* connect to front */
3703 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3704 pin
= spec
->autocfg
.hp_pins
[0];
3705 if (pin
) /* connect to front */
3706 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3709 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3711 struct alc_spec
*spec
= codec
->spec
;
3714 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3715 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3716 if (alc880_is_input_pin(nid
)) {
3717 snd_hda_codec_write(codec
, nid
, 0,
3718 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3719 i
<= AUTO_PIN_FRONT_MIC
?
3720 PIN_VREF80
: PIN_IN
);
3721 if (nid
!= ALC880_PIN_CD_NID
)
3722 snd_hda_codec_write(codec
, nid
, 0,
3723 AC_VERB_SET_AMP_GAIN_MUTE
,
3729 /* parse the BIOS configuration and set up the alc_spec */
3730 /* return 1 if successful, 0 if the proper config is not found,
3731 * or a negative error code
3733 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3735 struct alc_spec
*spec
= codec
->spec
;
3737 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3739 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3743 if (!spec
->autocfg
.line_outs
)
3744 return 0; /* can't find valid BIOS pin config */
3746 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3749 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3752 err
= alc880_auto_create_extra_out(spec
,
3753 spec
->autocfg
.speaker_pins
[0],
3757 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3761 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3765 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3767 if (spec
->autocfg
.dig_out_pin
)
3768 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3769 if (spec
->autocfg
.dig_in_pin
)
3770 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3772 if (spec
->kctl_alloc
)
3773 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3775 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3777 spec
->num_mux_defs
= 1;
3778 spec
->input_mux
= &spec
->private_imux
;
3783 /* additional initialization for auto-configuration model */
3784 static void alc880_auto_init(struct hda_codec
*codec
)
3786 struct alc_spec
*spec
= codec
->spec
;
3787 alc880_auto_init_multi_out(codec
);
3788 alc880_auto_init_extra_out(codec
);
3789 alc880_auto_init_analog_input(codec
);
3790 if (spec
->unsol_event
)
3791 alc_sku_automute(codec
);
3795 * OK, here we have finally the patch for ALC880
3798 static int patch_alc880(struct hda_codec
*codec
)
3800 struct alc_spec
*spec
;
3804 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3810 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3813 if (board_config
< 0) {
3814 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3815 "trying auto-probe from BIOS...\n");
3816 board_config
= ALC880_AUTO
;
3819 if (board_config
== ALC880_AUTO
) {
3820 /* automatic parse from the BIOS config */
3821 err
= alc880_parse_auto_config(codec
);
3827 "hda_codec: Cannot set up configuration "
3828 "from BIOS. Using 3-stack mode...\n");
3829 board_config
= ALC880_3ST
;
3833 if (board_config
!= ALC880_AUTO
)
3834 setup_preset(spec
, &alc880_presets
[board_config
]);
3836 spec
->stream_name_analog
= "ALC880 Analog";
3837 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3838 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3839 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
3841 spec
->stream_name_digital
= "ALC880 Digital";
3842 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3843 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3845 if (!spec
->adc_nids
&& spec
->input_mux
) {
3846 /* check whether NID 0x07 is valid */
3847 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3849 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3850 if (wcap
!= AC_WID_AUD_IN
) {
3851 spec
->adc_nids
= alc880_adc_nids_alt
;
3852 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3853 spec
->mixers
[spec
->num_mixers
] =
3854 alc880_capture_alt_mixer
;
3857 spec
->adc_nids
= alc880_adc_nids
;
3858 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3859 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3864 spec
->vmaster_nid
= 0x0c;
3866 codec
->patch_ops
= alc_patch_ops
;
3867 if (board_config
== ALC880_AUTO
)
3868 spec
->init_hook
= alc880_auto_init
;
3869 #ifdef CONFIG_SND_HDA_POWER_SAVE
3870 if (!spec
->loopback
.amplist
)
3871 spec
->loopback
.amplist
= alc880_loopbacks
;
3882 static hda_nid_t alc260_dac_nids
[1] = {
3887 static hda_nid_t alc260_adc_nids
[1] = {
3892 static hda_nid_t alc260_adc_nids_alt
[1] = {
3897 static hda_nid_t alc260_hp_adc_nids
[2] = {
3902 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3903 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3905 static hda_nid_t alc260_dual_adc_nids
[2] = {
3910 #define ALC260_DIGOUT_NID 0x03
3911 #define ALC260_DIGIN_NID 0x06
3913 static struct hda_input_mux alc260_capture_source
= {
3917 { "Front Mic", 0x1 },
3923 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3924 * headphone jack and the internal CD lines since these are the only pins at
3925 * which audio can appear. For flexibility, also allow the option of
3926 * recording the mixer output on the second ADC (ADC0 doesn't have a
3927 * connection to the mixer output).
3929 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3933 { "Mic/Line", 0x0 },
3935 { "Headphone", 0x2 },
3941 { "Mic/Line", 0x0 },
3943 { "Headphone", 0x2 },
3950 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3951 * the Fujitsu S702x, but jacks are marked differently.
3953 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3960 { "Headphone", 0x5 },
3969 { "Headphone", 0x6 },
3975 * This is just place-holder, so there's something for alc_build_pcms to look
3976 * at when it calculates the maximum number of channels. ALC260 has no mixer
3977 * element which allows changing the channel mode, so the verb list is
3980 static struct hda_channel_mode alc260_modes
[1] = {
3985 /* Mixer combinations
3987 * basic: base_output + input + pc_beep + capture
3988 * HP: base_output + input + capture_alt
3989 * HP_3013: hp_3013 + input + capture
3990 * fujitsu: fujitsu + capture
3991 * acer: acer + capture
3994 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3995 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3996 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3997 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3998 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3999 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4000 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4004 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4005 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4006 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4007 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4008 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4010 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4011 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4012 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4016 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
4017 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
4018 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
4022 /* update HP, line and mono out pins according to the master switch */
4023 static void alc260_hp_master_update(struct hda_codec
*codec
,
4024 hda_nid_t hp
, hda_nid_t line
,
4027 struct alc_spec
*spec
= codec
->spec
;
4028 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4029 /* change HP and line-out pins */
4030 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4032 snd_hda_codec_write(codec
, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4034 /* mono (speaker) depending on the HP jack sense */
4035 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4036 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4040 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4041 struct snd_ctl_elem_value
*ucontrol
)
4043 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4044 struct alc_spec
*spec
= codec
->spec
;
4045 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4049 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4050 struct snd_ctl_elem_value
*ucontrol
)
4052 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4053 struct alc_spec
*spec
= codec
->spec
;
4054 int val
= !!*ucontrol
->value
.integer
.value
;
4055 hda_nid_t hp
, line
, mono
;
4057 if (val
== spec
->master_sw
)
4059 spec
->master_sw
= val
;
4060 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4061 line
= (kcontrol
->private_value
>> 8) & 0xff;
4062 mono
= kcontrol
->private_value
& 0xff;
4063 alc260_hp_master_update(codec
, hp
, line
, mono
);
4067 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4069 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4070 .name
= "Master Playback Switch",
4071 .info
= snd_ctl_boolean_mono_info
,
4072 .get
= alc260_hp_master_sw_get
,
4073 .put
= alc260_hp_master_sw_put
,
4074 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4076 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4077 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4078 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4079 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4080 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4082 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4086 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4087 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4091 static void alc260_hp_automute(struct hda_codec
*codec
)
4093 struct alc_spec
*spec
= codec
->spec
;
4094 unsigned int present
;
4096 present
= snd_hda_codec_read(codec
, 0x10, 0,
4097 AC_VERB_GET_PIN_SENSE
, 0);
4098 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4099 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4102 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4104 if ((res
>> 26) == ALC880_HP_EVENT
)
4105 alc260_hp_automute(codec
);
4108 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4110 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4111 .name
= "Master Playback Switch",
4112 .info
= snd_ctl_boolean_mono_info
,
4113 .get
= alc260_hp_master_sw_get
,
4114 .put
= alc260_hp_master_sw_put
,
4115 .private_value
= (0x10 << 16) | (0x15 << 8) | 0x11
4117 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4118 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4119 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4120 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4123 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4124 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4128 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4129 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4133 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4135 struct alc_spec
*spec
= codec
->spec
;
4136 unsigned int present
;
4138 present
= snd_hda_codec_read(codec
, 0x15, 0,
4139 AC_VERB_GET_PIN_SENSE
, 0);
4140 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4141 alc260_hp_master_update(codec
, 0x10, 0x15, 0x11);
4144 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4147 if ((res
>> 26) == ALC880_HP_EVENT
)
4148 alc260_hp_3013_automute(codec
);
4151 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4152 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4154 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4155 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4156 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4157 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4158 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4159 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4160 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4161 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4162 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4163 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4164 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4165 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4166 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4170 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4171 * versions of the ALC260 don't act on requests to enable mic bias from NID
4172 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4173 * datasheet doesn't mention this restriction. At this stage it's not clear
4174 * whether this behaviour is intentional or is a hardware bug in chip
4175 * revisions available in early 2006. Therefore for now allow the
4176 * "Headphone Jack Mode" control to span all choices, but if it turns out
4177 * that the lack of mic bias for this NID is intentional we could change the
4178 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4180 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4181 * don't appear to make the mic bias available from the "line" jack, even
4182 * though the NID used for this jack (0x14) can supply it. The theory is
4183 * that perhaps Acer have included blocking capacitors between the ALC260
4184 * and the output jack. If this turns out to be the case for all such
4185 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4186 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4188 * The C20x Tablet series have a mono internal speaker which is controlled
4189 * via the chip's Mono sum widget and pin complex, so include the necessary
4190 * controls for such models. On models without a "mono speaker" the control
4191 * won't do anything.
4193 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4194 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4195 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4196 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4197 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4199 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4201 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4202 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4204 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4205 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4206 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4207 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4208 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4209 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4210 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4214 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4215 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4217 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4218 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4219 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4221 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4222 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4223 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4224 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4225 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4226 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4227 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4228 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4229 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4233 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4234 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4236 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4237 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4238 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4239 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4240 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4241 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4242 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4243 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4244 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4245 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4246 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4250 /* capture mixer elements */
4251 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
4252 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
4253 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
4254 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
4255 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
4257 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4258 /* The multiple "Capture Source" controls confuse alsamixer
4259 * So call somewhat different..
4261 /* .name = "Capture Source", */
4262 .name
= "Input Source",
4264 .info
= alc_mux_enum_info
,
4265 .get
= alc_mux_enum_get
,
4266 .put
= alc_mux_enum_put
,
4271 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
4272 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
4273 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
4275 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4276 /* The multiple "Capture Source" controls confuse alsamixer
4277 * So call somewhat different..
4279 /* .name = "Capture Source", */
4280 .name
= "Input Source",
4282 .info
= alc_mux_enum_info
,
4283 .get
= alc_mux_enum_get
,
4284 .put
= alc_mux_enum_put
,
4290 * initialization verbs
4292 static struct hda_verb alc260_init_verbs
[] = {
4293 /* Line In pin widget for input */
4294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4295 /* CD pin widget for input */
4296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4297 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4298 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4299 /* Mic2 (front panel) pin widget for input and vref at 80% */
4300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4301 /* LINE-2 is used for line-out in rear */
4302 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4303 /* select line-out */
4304 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4306 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4308 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4310 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4311 /* mute capture amp left and right */
4312 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4313 /* set connection select to line in (default select for this ADC) */
4314 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4315 /* mute capture amp left and right */
4316 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4317 /* set connection select to line in (default select for this ADC) */
4318 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4319 /* set vol=0 Line-Out mixer amp left and right */
4320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4321 /* unmute pin widget amp left and right (no gain on this amp) */
4322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4323 /* set vol=0 HP mixer amp left and right */
4324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4325 /* unmute pin widget amp left and right (no gain on this amp) */
4326 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4327 /* set vol=0 Mono mixer amp left and right */
4328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4329 /* unmute pin widget amp left and right (no gain on this amp) */
4330 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4331 /* unmute LINE-2 out pin */
4332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4333 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4336 /* mute analog inputs */
4337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4342 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4343 /* mute Front out path */
4344 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4345 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4346 /* mute Headphone out path */
4347 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4349 /* mute Mono out path */
4350 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4351 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4355 #if 0 /* should be identical with alc260_init_verbs? */
4356 static struct hda_verb alc260_hp_init_verbs
[] = {
4357 /* Headphone and output */
4358 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4360 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4361 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4363 /* Mic2 (front panel) pin widget for input and vref at 80% */
4364 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4365 /* Line In pin widget for input */
4366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4367 /* Line-2 pin widget for output */
4368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4369 /* CD pin widget for input */
4370 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4371 /* unmute amp left and right */
4372 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4373 /* set connection select to line in (default select for this ADC) */
4374 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4375 /* unmute Line-Out mixer amp left and right (volume = 0) */
4376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4377 /* mute pin widget amp left and right (no gain on this amp) */
4378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4379 /* unmute HP mixer amp left and right (volume = 0) */
4380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4381 /* mute pin widget amp left and right (no gain on this amp) */
4382 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4383 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4386 /* mute analog inputs */
4387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4392 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4393 /* Unmute Front out path */
4394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4396 /* Unmute Headphone out path */
4397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4399 /* Unmute Mono out path */
4400 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4401 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4406 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4407 /* Line out and output */
4408 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4410 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4411 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4412 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4413 /* Mic2 (front panel) pin widget for input and vref at 80% */
4414 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4415 /* Line In pin widget for input */
4416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4417 /* Headphone pin widget for output */
4418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4419 /* CD pin widget for input */
4420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4421 /* unmute amp left and right */
4422 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4423 /* set connection select to line in (default select for this ADC) */
4424 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4425 /* unmute Line-Out mixer amp left and right (volume = 0) */
4426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4427 /* mute pin widget amp left and right (no gain on this amp) */
4428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4429 /* unmute HP mixer amp left and right (volume = 0) */
4430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4431 /* mute pin widget amp left and right (no gain on this amp) */
4432 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4433 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4436 /* mute analog inputs */
4437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4442 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4443 /* Unmute Front out path */
4444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4446 /* Unmute Headphone out path */
4447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4449 /* Unmute Mono out path */
4450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4455 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4456 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4457 * audio = 0x16, internal speaker = 0x10.
4459 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4460 /* Disable all GPIOs */
4461 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4462 /* Internal speaker is connected to headphone pin */
4463 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4464 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4466 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4468 /* Ensure all other unused pins are disabled and muted. */
4469 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4471 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4472 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4473 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4474 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4478 /* Disable digital (SPDIF) pins */
4479 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4480 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4482 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4483 * when acting as an output.
4485 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4487 /* Start with output sum widgets muted and their output gains at min */
4488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4491 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4494 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4495 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4496 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4498 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4499 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4500 /* Unmute Line1 pin widget output buffer since it starts as an output.
4501 * If the pin mode is changed by the user the pin mode control will
4502 * take care of enabling the pin's input/output buffers as needed.
4503 * Therefore there's no need to enable the input buffer at this
4506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4507 /* Unmute input buffer of pin widget used for Line-in (no equiv
4510 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4512 /* Mute capture amp left and right */
4513 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4514 /* Set ADC connection select to match default mixer setting - line
4517 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4519 /* Do the same for the second ADC: mute capture input amp and
4520 * set ADC connection to line in (on mic1 pin)
4522 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4523 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4525 /* Mute all inputs to mixer widget (even unconnected ones) */
4526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4538 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4539 * similar laptops (adapted from Fujitsu init verbs).
4541 static struct hda_verb alc260_acer_init_verbs
[] = {
4542 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4543 * the headphone jack. Turn this on and rely on the standard mute
4544 * methods whenever the user wants to turn these outputs off.
4546 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4547 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4548 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4549 /* Internal speaker/Headphone jack is connected to Line-out pin */
4550 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4551 /* Internal microphone/Mic jack is connected to Mic1 pin */
4552 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4553 /* Line In jack is connected to Line1 pin */
4554 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4555 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4556 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4557 /* Ensure all other unused pins are disabled and muted. */
4558 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4559 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4560 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4561 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4564 /* Disable digital (SPDIF) pins */
4565 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4566 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4568 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4569 * bus when acting as outputs.
4571 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4572 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4574 /* Start with output sum widgets muted and their output gains at min */
4575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4576 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4577 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4579 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4581 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4582 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4583 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4585 /* Unmute Line-out pin widget amp left and right
4586 * (no equiv mixer ctrl)
4588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4589 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4590 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4591 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4592 * inputs. If the pin mode is changed by the user the pin mode control
4593 * will take care of enabling the pin's input/output buffers as needed.
4594 * Therefore there's no need to enable the input buffer at this
4597 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4598 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4600 /* Mute capture amp left and right */
4601 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4602 /* Set ADC connection select to match default mixer setting - mic
4605 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4607 /* Do similar with the second ADC: mute capture input amp and
4608 * set ADC connection to mic to match ALSA's default state.
4610 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4611 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4613 /* Mute all inputs to mixer widget (even unconnected ones) */
4614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4626 static struct hda_verb alc260_will_verbs
[] = {
4627 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4628 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4629 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4630 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4631 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4632 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4636 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4637 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4638 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4639 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4641 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4642 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4643 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4645 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4649 /* toggle speaker-output according to the hp-jack state */
4650 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4652 unsigned int present
;
4654 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4655 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4656 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4658 snd_hda_codec_write_cache(codec
, 0x01, 0,
4659 AC_VERB_SET_GPIO_DATA
, 1);
4660 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4661 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4664 snd_hda_codec_write_cache(codec
, 0x01, 0,
4665 AC_VERB_SET_GPIO_DATA
, 0);
4666 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4667 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4672 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4675 if ((res
>> 26) == ALC880_HP_EVENT
)
4676 alc260_replacer_672v_automute(codec
);
4679 /* Test configuration for debugging, modelled after the ALC880 test
4682 #ifdef CONFIG_SND_DEBUG
4683 static hda_nid_t alc260_test_dac_nids
[1] = {
4686 static hda_nid_t alc260_test_adc_nids
[2] = {
4689 /* For testing the ALC260, each input MUX needs its own definition since
4690 * the signal assignments are different. This assumes that the first ADC
4693 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4697 { "MIC1 pin", 0x0 },
4698 { "MIC2 pin", 0x1 },
4699 { "LINE1 pin", 0x2 },
4700 { "LINE2 pin", 0x3 },
4702 { "LINE-OUT pin", 0x5 },
4703 { "HP-OUT pin", 0x6 },
4709 { "MIC1 pin", 0x0 },
4710 { "MIC2 pin", 0x1 },
4711 { "LINE1 pin", 0x2 },
4712 { "LINE2 pin", 0x3 },
4715 { "LINE-OUT pin", 0x6 },
4716 { "HP-OUT pin", 0x7 },
4720 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4721 /* Output driver widgets */
4722 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4723 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4724 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4725 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4726 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4727 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4729 /* Modes for retasking pin widgets
4730 * Note: the ALC260 doesn't seem to act on requests to enable mic
4731 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4732 * mention this restriction. At this stage it's not clear whether
4733 * this behaviour is intentional or is a hardware bug in chip
4734 * revisions available at least up until early 2006. Therefore for
4735 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4736 * choices, but if it turns out that the lack of mic bias for these
4737 * NIDs is intentional we could change their modes from
4738 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4740 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4741 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4742 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4743 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4744 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4745 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4747 /* Loopback mixer controls */
4748 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4749 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4750 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4751 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4752 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4753 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4754 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4755 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4756 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4757 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4758 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4759 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4760 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4761 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4762 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4763 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4765 /* Controls for GPIO pins, assuming they are configured as outputs */
4766 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4767 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4768 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4769 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4771 /* Switches to allow the digital IO pins to be enabled. The datasheet
4772 * is ambigious as to which NID is which; testing on laptops which
4773 * make this output available should provide clarification.
4775 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4776 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4778 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4779 * this output to turn on an external amplifier.
4781 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4782 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4786 static struct hda_verb alc260_test_init_verbs
[] = {
4787 /* Enable all GPIOs as outputs with an initial value of 0 */
4788 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4789 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4790 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4792 /* Enable retasking pins as output, initially without power amp */
4793 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4794 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4795 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4797 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4798 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4800 /* Disable digital (SPDIF) pins initially, but users can enable
4801 * them via a mixer switch. In the case of SPDIF-out, this initverb
4802 * payload also sets the generation to 0, output to be in "consumer"
4803 * PCM format, copyright asserted, no pre-emphasis and no validity
4806 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4807 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4809 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4810 * OUT1 sum bus when acting as an output.
4812 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4813 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4814 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4815 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4817 /* Start with output sum widgets muted and their output gains at min */
4818 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4823 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4824 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4825 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4826 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4828 /* Unmute retasking pin widget output buffers since the default
4829 * state appears to be output. As the pin mode is changed by the
4830 * user the pin mode control will take care of enabling the pin's
4831 * input/output buffers as needed.
4833 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4834 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4837 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4838 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4839 /* Also unmute the mono-out pin widget */
4840 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4842 /* Mute capture amp left and right */
4843 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4844 /* Set ADC connection select to match default mixer setting (mic1
4847 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4849 /* Do the same for the second ADC: mute capture input amp and
4850 * set ADC connection to mic1 pin
4852 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4853 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4855 /* Mute all inputs to mixer widget (even unconnected ones) */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4869 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4870 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4872 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4873 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4876 * for BIOS auto-configuration
4879 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4883 unsigned long vol_val
, sw_val
;
4887 if (nid
>= 0x0f && nid
< 0x11) {
4888 nid_vol
= nid
- 0x7;
4889 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4890 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4891 } else if (nid
== 0x11) {
4892 nid_vol
= nid
- 0x7;
4893 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4894 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4895 } else if (nid
>= 0x12 && nid
<= 0x15) {
4897 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4898 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4902 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4903 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4906 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4907 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4913 /* add playback controls from the parsed DAC table */
4914 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4915 const struct auto_pin_cfg
*cfg
)
4920 spec
->multiout
.num_dacs
= 1;
4921 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4922 spec
->multiout
.dac_nids
[0] = 0x02;
4924 nid
= cfg
->line_out_pins
[0];
4926 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4931 nid
= cfg
->speaker_pins
[0];
4933 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4938 nid
= cfg
->hp_pins
[0];
4940 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4947 /* create playback/capture controls for input pins */
4948 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4949 const struct auto_pin_cfg
*cfg
)
4951 struct hda_input_mux
*imux
= &spec
->private_imux
;
4954 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4955 if (cfg
->input_pins
[i
] >= 0x12) {
4956 idx
= cfg
->input_pins
[i
] - 0x12;
4957 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4958 auto_pin_cfg_labels
[i
], idx
,
4962 imux
->items
[imux
->num_items
].label
=
4963 auto_pin_cfg_labels
[i
];
4964 imux
->items
[imux
->num_items
].index
= idx
;
4967 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4968 idx
= cfg
->input_pins
[i
] - 0x09;
4969 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4970 auto_pin_cfg_labels
[i
], idx
,
4974 imux
->items
[imux
->num_items
].label
=
4975 auto_pin_cfg_labels
[i
];
4976 imux
->items
[imux
->num_items
].index
= idx
;
4983 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4984 hda_nid_t nid
, int pin_type
,
4987 alc_set_pin_output(codec
, nid
, pin_type
);
4988 /* need the manual connection? */
4990 int idx
= nid
- 0x12;
4991 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4992 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4996 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4998 struct alc_spec
*spec
= codec
->spec
;
5001 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
5002 nid
= spec
->autocfg
.line_out_pins
[0];
5004 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5005 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5008 nid
= spec
->autocfg
.speaker_pins
[0];
5010 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5012 nid
= spec
->autocfg
.hp_pins
[0];
5014 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5017 #define ALC260_PIN_CD_NID 0x16
5018 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5020 struct alc_spec
*spec
= codec
->spec
;
5023 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5024 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5026 snd_hda_codec_write(codec
, nid
, 0,
5027 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5028 i
<= AUTO_PIN_FRONT_MIC
?
5029 PIN_VREF80
: PIN_IN
);
5030 if (nid
!= ALC260_PIN_CD_NID
)
5031 snd_hda_codec_write(codec
, nid
, 0,
5032 AC_VERB_SET_AMP_GAIN_MUTE
,
5039 * generic initialization of ADC, input mixers and output mixers
5041 static struct hda_verb alc260_volume_init_verbs
[] = {
5043 * Unmute ADC0-1 and set the default input to mic-in
5045 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5046 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5047 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5050 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5052 * Note: PASD motherboards uses the Line In 2 as the input for
5053 * front panel mic (mic 2)
5055 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5056 /* mute analog inputs */
5057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5064 * Set up output mixers (0x08 - 0x0a)
5066 /* set vol=0 to output mixers */
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5068 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5069 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5070 /* set up input amps for analog loopback */
5071 /* Amp Indices: DAC = 0, mixer = 1 */
5072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5082 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5084 struct alc_spec
*spec
= codec
->spec
;
5087 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5089 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5093 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5096 if (!spec
->kctl_alloc
)
5097 return 0; /* can't find valid BIOS pin config */
5098 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5102 spec
->multiout
.max_channels
= 2;
5104 if (spec
->autocfg
.dig_out_pin
)
5105 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5106 if (spec
->kctl_alloc
)
5107 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
5109 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
5111 spec
->num_mux_defs
= 1;
5112 spec
->input_mux
= &spec
->private_imux
;
5114 /* check whether NID 0x04 is valid */
5115 wcap
= get_wcaps(codec
, 0x04);
5116 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
5117 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
5118 spec
->adc_nids
= alc260_adc_nids_alt
;
5119 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
5120 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
5122 spec
->adc_nids
= alc260_adc_nids
;
5123 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
5124 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
5131 /* additional initialization for auto-configuration model */
5132 static void alc260_auto_init(struct hda_codec
*codec
)
5134 struct alc_spec
*spec
= codec
->spec
;
5135 alc260_auto_init_multi_out(codec
);
5136 alc260_auto_init_analog_input(codec
);
5137 if (spec
->unsol_event
)
5138 alc_sku_automute(codec
);
5141 #ifdef CONFIG_SND_HDA_POWER_SAVE
5142 static struct hda_amp_list alc260_loopbacks
[] = {
5143 { 0x07, HDA_INPUT
, 0 },
5144 { 0x07, HDA_INPUT
, 1 },
5145 { 0x07, HDA_INPUT
, 2 },
5146 { 0x07, HDA_INPUT
, 3 },
5147 { 0x07, HDA_INPUT
, 4 },
5153 * ALC260 configurations
5155 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
5156 [ALC260_BASIC
] = "basic",
5158 [ALC260_HP_3013
] = "hp-3013",
5159 [ALC260_FUJITSU_S702X
] = "fujitsu",
5160 [ALC260_ACER
] = "acer",
5161 [ALC260_WILL
] = "will",
5162 [ALC260_REPLACER_672V
] = "replacer",
5163 #ifdef CONFIG_SND_DEBUG
5164 [ALC260_TEST
] = "test",
5166 [ALC260_AUTO
] = "auto",
5169 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5170 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5171 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5172 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5173 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5174 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5175 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
5176 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
5177 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5178 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5179 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5180 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5181 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5182 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5183 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5184 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5185 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5186 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5187 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5191 static struct alc_config_preset alc260_presets
[] = {
5193 .mixers
= { alc260_base_output_mixer
,
5195 alc260_pc_beep_mixer
,
5196 alc260_capture_mixer
},
5197 .init_verbs
= { alc260_init_verbs
},
5198 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5199 .dac_nids
= alc260_dac_nids
,
5200 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5201 .adc_nids
= alc260_adc_nids
,
5202 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5203 .channel_mode
= alc260_modes
,
5204 .input_mux
= &alc260_capture_source
,
5207 .mixers
= { alc260_hp_output_mixer
,
5209 alc260_capture_alt_mixer
},
5210 .init_verbs
= { alc260_init_verbs
,
5211 alc260_hp_unsol_verbs
},
5212 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5213 .dac_nids
= alc260_dac_nids
,
5214 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5215 .adc_nids
= alc260_hp_adc_nids
,
5216 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5217 .channel_mode
= alc260_modes
,
5218 .input_mux
= &alc260_capture_source
,
5219 .unsol_event
= alc260_hp_unsol_event
,
5220 .init_hook
= alc260_hp_automute
,
5222 [ALC260_HP_3013
] = {
5223 .mixers
= { alc260_hp_3013_mixer
,
5225 alc260_capture_alt_mixer
},
5226 .init_verbs
= { alc260_hp_3013_init_verbs
,
5227 alc260_hp_3013_unsol_verbs
},
5228 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5229 .dac_nids
= alc260_dac_nids
,
5230 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5231 .adc_nids
= alc260_hp_adc_nids
,
5232 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5233 .channel_mode
= alc260_modes
,
5234 .input_mux
= &alc260_capture_source
,
5235 .unsol_event
= alc260_hp_3013_unsol_event
,
5236 .init_hook
= alc260_hp_3013_automute
,
5238 [ALC260_FUJITSU_S702X
] = {
5239 .mixers
= { alc260_fujitsu_mixer
,
5240 alc260_capture_mixer
},
5241 .init_verbs
= { alc260_fujitsu_init_verbs
},
5242 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5243 .dac_nids
= alc260_dac_nids
,
5244 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5245 .adc_nids
= alc260_dual_adc_nids
,
5246 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5247 .channel_mode
= alc260_modes
,
5248 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5249 .input_mux
= alc260_fujitsu_capture_sources
,
5252 .mixers
= { alc260_acer_mixer
,
5253 alc260_capture_mixer
},
5254 .init_verbs
= { alc260_acer_init_verbs
},
5255 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5256 .dac_nids
= alc260_dac_nids
,
5257 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5258 .adc_nids
= alc260_dual_adc_nids
,
5259 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5260 .channel_mode
= alc260_modes
,
5261 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5262 .input_mux
= alc260_acer_capture_sources
,
5265 .mixers
= { alc260_will_mixer
,
5266 alc260_capture_mixer
},
5267 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5268 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5269 .dac_nids
= alc260_dac_nids
,
5270 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5271 .adc_nids
= alc260_adc_nids
,
5272 .dig_out_nid
= ALC260_DIGOUT_NID
,
5273 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5274 .channel_mode
= alc260_modes
,
5275 .input_mux
= &alc260_capture_source
,
5277 [ALC260_REPLACER_672V
] = {
5278 .mixers
= { alc260_replacer_672v_mixer
,
5279 alc260_capture_mixer
},
5280 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5281 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5282 .dac_nids
= alc260_dac_nids
,
5283 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5284 .adc_nids
= alc260_adc_nids
,
5285 .dig_out_nid
= ALC260_DIGOUT_NID
,
5286 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5287 .channel_mode
= alc260_modes
,
5288 .input_mux
= &alc260_capture_source
,
5289 .unsol_event
= alc260_replacer_672v_unsol_event
,
5290 .init_hook
= alc260_replacer_672v_automute
,
5292 #ifdef CONFIG_SND_DEBUG
5294 .mixers
= { alc260_test_mixer
,
5295 alc260_capture_mixer
},
5296 .init_verbs
= { alc260_test_init_verbs
},
5297 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5298 .dac_nids
= alc260_test_dac_nids
,
5299 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5300 .adc_nids
= alc260_test_adc_nids
,
5301 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5302 .channel_mode
= alc260_modes
,
5303 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5304 .input_mux
= alc260_test_capture_sources
,
5309 static int patch_alc260(struct hda_codec
*codec
)
5311 struct alc_spec
*spec
;
5312 int err
, board_config
;
5314 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5320 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5323 if (board_config
< 0) {
5324 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5325 "trying auto-probe from BIOS...\n");
5326 board_config
= ALC260_AUTO
;
5329 if (board_config
== ALC260_AUTO
) {
5330 /* automatic parse from the BIOS config */
5331 err
= alc260_parse_auto_config(codec
);
5337 "hda_codec: Cannot set up configuration "
5338 "from BIOS. Using base mode...\n");
5339 board_config
= ALC260_BASIC
;
5343 if (board_config
!= ALC260_AUTO
)
5344 setup_preset(spec
, &alc260_presets
[board_config
]);
5346 spec
->stream_name_analog
= "ALC260 Analog";
5347 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5348 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5350 spec
->stream_name_digital
= "ALC260 Digital";
5351 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5352 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5354 spec
->vmaster_nid
= 0x08;
5356 codec
->patch_ops
= alc_patch_ops
;
5357 if (board_config
== ALC260_AUTO
)
5358 spec
->init_hook
= alc260_auto_init
;
5359 #ifdef CONFIG_SND_HDA_POWER_SAVE
5360 if (!spec
->loopback
.amplist
)
5361 spec
->loopback
.amplist
= alc260_loopbacks
;
5371 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5372 * configuration. Each pin widget can choose any input DACs and a mixer.
5373 * Each ADC is connected from a mixer of all inputs. This makes possible
5374 * 6-channel independent captures.
5376 * In addition, an independent DAC for the multi-playback (not used in this
5379 #define ALC882_DIGOUT_NID 0x06
5380 #define ALC882_DIGIN_NID 0x0a
5382 static struct hda_channel_mode alc882_ch_modes
[1] = {
5386 static hda_nid_t alc882_dac_nids
[4] = {
5387 /* front, rear, clfe, rear_surr */
5388 0x02, 0x03, 0x04, 0x05
5391 /* identical with ALC880 */
5392 #define alc882_adc_nids alc880_adc_nids
5393 #define alc882_adc_nids_alt alc880_adc_nids_alt
5395 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5396 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5399 /* FIXME: should be a matrix-type input source selection */
5401 static struct hda_input_mux alc882_capture_source
= {
5405 { "Front Mic", 0x1 },
5410 #define alc882_mux_enum_info alc_mux_enum_info
5411 #define alc882_mux_enum_get alc_mux_enum_get
5413 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
5414 struct snd_ctl_elem_value
*ucontrol
)
5416 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5417 struct alc_spec
*spec
= codec
->spec
;
5418 const struct hda_input_mux
*imux
= spec
->input_mux
;
5419 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
5420 hda_nid_t nid
= spec
->capsrc_nids
?
5421 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
5422 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
5423 unsigned int i
, idx
;
5425 idx
= ucontrol
->value
.enumerated
.item
[0];
5426 if (idx
>= imux
->num_items
)
5427 idx
= imux
->num_items
- 1;
5428 if (*cur_val
== idx
)
5430 for (i
= 0; i
< imux
->num_items
; i
++) {
5431 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
5432 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
5433 imux
->items
[i
].index
,
5443 static struct hda_verb alc882_3ST_ch2_init
[] = {
5444 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5445 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5446 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5447 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5454 static struct hda_verb alc882_3ST_ch6_init
[] = {
5455 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5456 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5457 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5458 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5459 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5460 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5464 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5465 { 2, alc882_3ST_ch2_init
},
5466 { 6, alc882_3ST_ch6_init
},
5472 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5473 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5474 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5475 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5476 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5483 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5484 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5485 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5486 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5487 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5491 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5492 { 6, alc882_sixstack_ch6_init
},
5493 { 8, alc882_sixstack_ch8_init
},
5497 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5503 static struct hda_verb alc885_mbp_ch2_init
[] = {
5504 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5505 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5506 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5513 static struct hda_verb alc885_mbp_ch6_init
[] = {
5514 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5515 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5516 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5517 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5518 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5522 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5523 { 2, alc885_mbp_ch2_init
},
5524 { 6, alc885_mbp_ch6_init
},
5528 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5529 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5531 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5532 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5533 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5534 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5535 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5536 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5537 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5538 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5539 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5540 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5541 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5543 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5544 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5545 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5546 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5547 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5548 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5550 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5551 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5552 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5553 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5554 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5558 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5560 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
5561 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
5562 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
5563 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5564 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5565 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5566 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5567 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
5568 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5571 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5573 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5574 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5575 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5576 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5577 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5578 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5579 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5581 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5582 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5586 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5590 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5591 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5592 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5593 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5598 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5599 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5603 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5604 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5606 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5607 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5608 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5609 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5610 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5611 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5612 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5613 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5614 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5615 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5616 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5619 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5623 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5632 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5634 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5635 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5639 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5641 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5642 .name
= "Channel Mode",
5643 .info
= alc_ch_mode_info
,
5644 .get
= alc_ch_mode_get
,
5645 .put
= alc_ch_mode_put
,
5650 static struct hda_verb alc882_init_verbs
[] = {
5651 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5660 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5664 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5668 /* Front Pin: output 0 (0x0c) */
5669 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5670 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5671 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5672 /* Rear Pin: output 1 (0x0d) */
5673 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5675 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5676 /* CLFE Pin: output 2 (0x0e) */
5677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5678 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5679 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5680 /* Side Pin: output 3 (0x0f) */
5681 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5682 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5683 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5684 /* Mic (rear) pin: input vref at 80% */
5685 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5687 /* Front Mic pin: input vref at 80% */
5688 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5690 /* Line In pin: input */
5691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5693 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5694 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5695 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5696 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5697 /* CD pin widget for input */
5698 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5700 /* FIXME: use matrix-type input source selection */
5701 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5702 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5717 /* ADC1: mute amp left and right */
5718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5719 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5720 /* ADC2: mute amp left and right */
5721 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5722 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5723 /* ADC3: mute amp left and right */
5724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5725 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5730 static struct hda_verb alc882_eapd_verbs
[] = {
5731 /* change to EAPD mode */
5732 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5733 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5738 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5739 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5740 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5741 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5742 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5743 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5744 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5745 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5749 static struct hda_verb alc882_macpro_init_verbs
[] = {
5750 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5754 /* Front Pin: output 0 (0x0c) */
5755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5757 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5758 /* Front Mic pin: input vref at 80% */
5759 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5760 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5761 /* Speaker: output */
5762 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5763 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5764 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5765 /* Headphone output (output 0 - 0x0c) */
5766 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5767 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5768 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5770 /* FIXME: use matrix-type input source selection */
5771 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5772 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5774 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5775 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5778 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5779 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5787 /* ADC1: mute amp left and right */
5788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5789 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5790 /* ADC2: mute amp left and right */
5791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5792 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5793 /* ADC3: mute amp left and right */
5794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5795 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5800 /* Macbook Pro rev3 */
5801 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5802 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5810 /* Front Pin: output 0 (0x0c) */
5811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5813 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5814 /* HP Pin: output 0 (0x0d) */
5815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5817 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5818 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5819 /* Mic (rear) pin: input vref at 80% */
5820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5822 /* Front Mic pin: input vref at 80% */
5823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5825 /* Line In pin: use output 1 when in LineOut mode */
5826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5828 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5830 /* FIXME: use matrix-type input source selection */
5831 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5832 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5838 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5847 /* ADC1: mute amp left and right */
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5849 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5850 /* ADC2: mute amp left and right */
5851 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5852 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5853 /* ADC3: mute amp left and right */
5854 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5855 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5860 /* iMac 24 mixer. */
5861 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5862 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5863 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5867 /* iMac 24 init verbs. */
5868 static struct hda_verb alc885_imac24_init_verbs
[] = {
5869 /* Internal speakers: output 0 (0x0c) */
5870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5872 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5873 /* Internal speakers: output 0 (0x0c) */
5874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5876 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5877 /* Headphone: output 0 (0x0c) */
5878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5880 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5881 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5882 /* Front Mic: input vref at 80% */
5883 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5888 /* Toggle speaker-output according to the hp-jack state */
5889 static void alc885_imac24_automute(struct hda_codec
*codec
)
5891 unsigned int present
;
5893 present
= snd_hda_codec_read(codec
, 0x14, 0,
5894 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5895 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5896 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5897 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5898 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5901 /* Processes unsolicited events. */
5902 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5905 /* Headphone insertion or removal. */
5906 if ((res
>> 26) == ALC880_HP_EVENT
)
5907 alc885_imac24_automute(codec
);
5910 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5912 unsigned int present
;
5914 present
= snd_hda_codec_read(codec
, 0x15, 0,
5915 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5916 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5917 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5918 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5919 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5922 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5925 /* Headphone insertion or removal. */
5926 if ((res
>> 26) == ALC880_HP_EVENT
)
5927 alc885_mbp3_automute(codec
);
5931 static struct hda_verb alc882_targa_verbs
[] = {
5932 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5938 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5939 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5940 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5942 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5943 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5944 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5945 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5949 /* toggle speaker-output according to the hp-jack state */
5950 static void alc882_targa_automute(struct hda_codec
*codec
)
5952 unsigned int present
;
5954 present
= snd_hda_codec_read(codec
, 0x14, 0,
5955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5956 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5957 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5958 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5962 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5964 /* Looks like the unsol event is incompatible with the standard
5965 * definition. 4bit tag is placed at 26 bit!
5967 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5968 alc882_targa_automute(codec
);
5972 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5974 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5977 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5980 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5981 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5982 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5984 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5985 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5986 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5990 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5991 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5996 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5998 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5999 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6000 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6002 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6003 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6004 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6008 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6010 unsigned int gpiostate
, gpiomask
, gpiodir
;
6012 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6013 AC_VERB_GET_GPIO_DATA
, 0);
6016 gpiostate
|= (1 << pin
);
6018 gpiostate
&= ~(1 << pin
);
6020 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6021 AC_VERB_GET_GPIO_MASK
, 0);
6022 gpiomask
|= (1 << pin
);
6024 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6025 AC_VERB_GET_GPIO_DIRECTION
, 0);
6026 gpiodir
|= (1 << pin
);
6029 snd_hda_codec_write(codec
, codec
->afg
, 0,
6030 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6031 snd_hda_codec_write(codec
, codec
->afg
, 0,
6032 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6036 snd_hda_codec_write(codec
, codec
->afg
, 0,
6037 AC_VERB_SET_GPIO_DATA
, gpiostate
);
6040 /* set up GPIO at initialization */
6041 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
6043 alc882_gpio_mute(codec
, 0, 0);
6044 alc882_gpio_mute(codec
, 1, 0);
6047 /* set up GPIO and update auto-muting at initialization */
6048 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
6050 alc885_macpro_init_hook(codec
);
6051 alc885_imac24_automute(codec
);
6055 * generic initialization of ADC, input mixers and output mixers
6057 static struct hda_verb alc882_auto_init_verbs
[] = {
6059 * Unmute ADC0-2 and set the default input to mic-in
6061 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6063 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6064 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6065 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6066 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6068 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6070 * Note: PASD motherboards uses the Line In 2 as the input for
6071 * front panel mic (mic 2)
6073 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6075 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6077 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6081 * Set up output mixers (0x0c - 0x0f)
6083 /* set vol=0 to output mixers */
6084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6086 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6087 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6088 /* set up input amps for analog loopback */
6089 /* Amp Indices: DAC = 0, mixer = 1 */
6090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6093 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6095 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6096 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6097 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6098 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6099 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6101 /* FIXME: use matrix-type input source selection */
6102 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6103 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6104 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6105 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6109 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6110 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6111 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6112 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6117 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6122 /* capture mixer elements */
6123 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
6124 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6125 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6126 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6127 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6129 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6130 /* The multiple "Capture Source" controls confuse alsamixer
6131 * So call somewhat different..
6133 /* .name = "Capture Source", */
6134 .name
= "Input Source",
6136 .info
= alc882_mux_enum_info
,
6137 .get
= alc882_mux_enum_get
,
6138 .put
= alc882_mux_enum_put
,
6143 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
6144 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
6145 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
6146 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
6147 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
6148 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
6149 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
6151 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6152 /* The multiple "Capture Source" controls confuse alsamixer
6153 * So call somewhat different..
6155 /* .name = "Capture Source", */
6156 .name
= "Input Source",
6158 .info
= alc882_mux_enum_info
,
6159 .get
= alc882_mux_enum_get
,
6160 .put
= alc882_mux_enum_put
,
6165 #ifdef CONFIG_SND_HDA_POWER_SAVE
6166 #define alc882_loopbacks alc880_loopbacks
6169 /* pcm configuration: identiacal with ALC880 */
6170 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6171 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6172 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6173 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6176 * configuration and preset
6178 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6179 [ALC882_3ST_DIG
] = "3stack-dig",
6180 [ALC882_6ST_DIG
] = "6stack-dig",
6181 [ALC882_ARIMA
] = "arima",
6182 [ALC882_W2JC
] = "w2jc",
6183 [ALC882_TARGA
] = "targa",
6184 [ALC882_ASUS_A7J
] = "asus-a7j",
6185 [ALC882_ASUS_A7M
] = "asus-a7m",
6186 [ALC885_MACPRO
] = "macpro",
6187 [ALC885_MBP3
] = "mbp3",
6188 [ALC885_IMAC24
] = "imac24",
6189 [ALC882_AUTO
] = "auto",
6192 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6193 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6194 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6195 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6196 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6197 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6198 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6199 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6200 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6201 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6202 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6203 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6204 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6208 static struct alc_config_preset alc882_presets
[] = {
6209 [ALC882_3ST_DIG
] = {
6210 .mixers
= { alc882_base_mixer
},
6211 .init_verbs
= { alc882_init_verbs
},
6212 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6213 .dac_nids
= alc882_dac_nids
,
6214 .dig_out_nid
= ALC882_DIGOUT_NID
,
6215 .dig_in_nid
= ALC882_DIGIN_NID
,
6216 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6217 .channel_mode
= alc882_ch_modes
,
6219 .input_mux
= &alc882_capture_source
,
6221 [ALC882_6ST_DIG
] = {
6222 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6223 .init_verbs
= { alc882_init_verbs
},
6224 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6225 .dac_nids
= alc882_dac_nids
,
6226 .dig_out_nid
= ALC882_DIGOUT_NID
,
6227 .dig_in_nid
= ALC882_DIGIN_NID
,
6228 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6229 .channel_mode
= alc882_sixstack_modes
,
6230 .input_mux
= &alc882_capture_source
,
6233 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6234 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6235 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6236 .dac_nids
= alc882_dac_nids
,
6237 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6238 .channel_mode
= alc882_sixstack_modes
,
6239 .input_mux
= &alc882_capture_source
,
6242 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6243 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6244 alc880_gpio1_init_verbs
},
6245 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6246 .dac_nids
= alc882_dac_nids
,
6247 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6248 .channel_mode
= alc880_threestack_modes
,
6250 .input_mux
= &alc882_capture_source
,
6251 .dig_out_nid
= ALC882_DIGOUT_NID
,
6254 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6255 .init_verbs
= { alc885_mbp3_init_verbs
,
6256 alc880_gpio1_init_verbs
},
6257 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6258 .dac_nids
= alc882_dac_nids
,
6259 .channel_mode
= alc885_mbp_6ch_modes
,
6260 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6261 .input_mux
= &alc882_capture_source
,
6262 .dig_out_nid
= ALC882_DIGOUT_NID
,
6263 .dig_in_nid
= ALC882_DIGIN_NID
,
6264 .unsol_event
= alc885_mbp3_unsol_event
,
6265 .init_hook
= alc885_mbp3_automute
,
6268 .mixers
= { alc882_macpro_mixer
},
6269 .init_verbs
= { alc882_macpro_init_verbs
},
6270 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6271 .dac_nids
= alc882_dac_nids
,
6272 .dig_out_nid
= ALC882_DIGOUT_NID
,
6273 .dig_in_nid
= ALC882_DIGIN_NID
,
6274 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6275 .channel_mode
= alc882_ch_modes
,
6276 .input_mux
= &alc882_capture_source
,
6277 .init_hook
= alc885_macpro_init_hook
,
6280 .mixers
= { alc885_imac24_mixer
},
6281 .init_verbs
= { alc885_imac24_init_verbs
},
6282 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6283 .dac_nids
= alc882_dac_nids
,
6284 .dig_out_nid
= ALC882_DIGOUT_NID
,
6285 .dig_in_nid
= ALC882_DIGIN_NID
,
6286 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6287 .channel_mode
= alc882_ch_modes
,
6288 .input_mux
= &alc882_capture_source
,
6289 .unsol_event
= alc885_imac24_unsol_event
,
6290 .init_hook
= alc885_imac24_init_hook
,
6293 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
6294 alc882_capture_mixer
},
6295 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6296 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6297 .dac_nids
= alc882_dac_nids
,
6298 .dig_out_nid
= ALC882_DIGOUT_NID
,
6299 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6300 .adc_nids
= alc882_adc_nids
,
6301 .capsrc_nids
= alc882_capsrc_nids
,
6302 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6303 .channel_mode
= alc882_3ST_6ch_modes
,
6305 .input_mux
= &alc882_capture_source
,
6306 .unsol_event
= alc882_targa_unsol_event
,
6307 .init_hook
= alc882_targa_automute
,
6309 [ALC882_ASUS_A7J
] = {
6310 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
6311 alc882_capture_mixer
},
6312 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6313 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6314 .dac_nids
= alc882_dac_nids
,
6315 .dig_out_nid
= ALC882_DIGOUT_NID
,
6316 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6317 .adc_nids
= alc882_adc_nids
,
6318 .capsrc_nids
= alc882_capsrc_nids
,
6319 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6320 .channel_mode
= alc882_3ST_6ch_modes
,
6322 .input_mux
= &alc882_capture_source
,
6324 [ALC882_ASUS_A7M
] = {
6325 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6326 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6327 alc880_gpio1_init_verbs
,
6328 alc882_asus_a7m_verbs
},
6329 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6330 .dac_nids
= alc882_dac_nids
,
6331 .dig_out_nid
= ALC882_DIGOUT_NID
,
6332 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6333 .channel_mode
= alc880_threestack_modes
,
6335 .input_mux
= &alc882_capture_source
,
6344 PINFIX_ABIT_AW9D_MAX
6347 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6348 { 0x15, 0x01080104 }, /* side */
6349 { 0x16, 0x01011012 }, /* rear */
6350 { 0x17, 0x01016011 }, /* clfe */
6354 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6355 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6358 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6359 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6364 * BIOS auto configuration
6366 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6367 hda_nid_t nid
, int pin_type
,
6371 struct alc_spec
*spec
= codec
->spec
;
6374 alc_set_pin_output(codec
, nid
, pin_type
);
6375 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6378 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6379 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6383 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6385 struct alc_spec
*spec
= codec
->spec
;
6388 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6389 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6390 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6391 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6393 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6398 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6400 struct alc_spec
*spec
= codec
->spec
;
6403 pin
= spec
->autocfg
.hp_pins
[0];
6404 if (pin
) /* connect to front */
6406 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6407 pin
= spec
->autocfg
.speaker_pins
[0];
6409 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6412 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6413 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6415 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6417 struct alc_spec
*spec
= codec
->spec
;
6420 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6421 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6426 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6427 unsigned int pincap
;
6428 pincap
= snd_hda_param_read(codec
, nid
, AC_PAR_PIN_CAP
);
6429 if ((pincap
>> AC_PINCAP_VREF_SHIFT
) &
6433 snd_hda_codec_write(codec
, nid
, 0,
6434 AC_VERB_SET_PIN_WIDGET_CONTROL
, vref
);
6435 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
6436 snd_hda_codec_write(codec
, nid
, 0,
6437 AC_VERB_SET_AMP_GAIN_MUTE
,
6442 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
6444 struct alc_spec
*spec
= codec
->spec
;
6445 const struct hda_input_mux
*imux
= spec
->input_mux
;
6448 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
6449 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
6450 hda_nid_t nid
= spec
->capsrc_nids
[c
];
6451 int conns
, mute
, idx
, item
;
6453 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
6454 ARRAY_SIZE(conn_list
));
6457 for (idx
= 0; idx
< conns
; idx
++) {
6458 /* if the current connection is the selected one,
6459 * unmute it as default - otherwise mute it
6461 mute
= AMP_IN_MUTE(idx
);
6462 for (item
= 0; item
< imux
->num_items
; item
++) {
6463 if (imux
->items
[item
].index
== idx
) {
6464 if (spec
->cur_mux
[c
] == item
)
6465 mute
= AMP_IN_UNMUTE(idx
);
6469 snd_hda_codec_write(codec
, nid
, 0,
6470 AC_VERB_SET_AMP_GAIN_MUTE
, mute
);
6475 /* add mic boosts if needed */
6476 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6478 struct alc_spec
*spec
= codec
->spec
;
6482 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6483 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6484 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6486 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6490 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6491 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6492 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6494 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6501 /* almost identical with ALC880 parser... */
6502 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6504 struct alc_spec
*spec
= codec
->spec
;
6505 int err
= alc880_parse_auto_config(codec
);
6510 return 0; /* no config found */
6512 err
= alc_auto_add_mic_boost(codec
);
6516 /* hack - override the init verbs */
6517 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6519 return 1; /* config found */
6522 /* additional initialization for auto-configuration model */
6523 static void alc882_auto_init(struct hda_codec
*codec
)
6525 struct alc_spec
*spec
= codec
->spec
;
6526 alc882_auto_init_multi_out(codec
);
6527 alc882_auto_init_hp_out(codec
);
6528 alc882_auto_init_analog_input(codec
);
6529 alc882_auto_init_input_src(codec
);
6530 if (spec
->unsol_event
)
6531 alc_sku_automute(codec
);
6534 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
6536 static int patch_alc882(struct hda_codec
*codec
)
6538 struct alc_spec
*spec
;
6539 int err
, board_config
;
6541 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6547 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6551 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6552 /* Pick up systems that don't supply PCI SSID */
6553 switch (codec
->subsystem_id
) {
6554 case 0x106b0c00: /* Mac Pro */
6555 board_config
= ALC885_MACPRO
;
6557 case 0x106b1000: /* iMac 24 */
6558 board_config
= ALC885_IMAC24
;
6560 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6561 case 0x106b2c00: /* Macbook Pro rev3 */
6562 case 0x106b3600: /* Macbook 3.1 */
6563 board_config
= ALC885_MBP3
;
6566 /* ALC889A is handled better as ALC888-compatible */
6567 if (codec
->revision_id
== 0x100103) {
6569 return patch_alc883(codec
);
6571 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6572 "trying auto-probe from BIOS...\n");
6573 board_config
= ALC882_AUTO
;
6577 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6579 if (board_config
== ALC882_AUTO
) {
6580 /* automatic parse from the BIOS config */
6581 err
= alc882_parse_auto_config(codec
);
6587 "hda_codec: Cannot set up configuration "
6588 "from BIOS. Using base mode...\n");
6589 board_config
= ALC882_3ST_DIG
;
6593 if (board_config
!= ALC882_AUTO
)
6594 setup_preset(spec
, &alc882_presets
[board_config
]);
6596 if (codec
->vendor_id
== 0x10ec0885) {
6597 spec
->stream_name_analog
= "ALC885 Analog";
6598 spec
->stream_name_digital
= "ALC885 Digital";
6600 spec
->stream_name_analog
= "ALC882 Analog";
6601 spec
->stream_name_digital
= "ALC882 Digital";
6604 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6605 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6606 /* FIXME: setup DAC5 */
6607 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6608 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6610 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6611 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6613 if (!spec
->adc_nids
&& spec
->input_mux
) {
6614 /* check whether NID 0x07 is valid */
6615 unsigned int wcap
= get_wcaps(codec
, 0x07);
6617 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6618 if (wcap
!= AC_WID_AUD_IN
) {
6619 spec
->adc_nids
= alc882_adc_nids_alt
;
6620 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6621 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
6622 spec
->mixers
[spec
->num_mixers
] =
6623 alc882_capture_alt_mixer
;
6626 spec
->adc_nids
= alc882_adc_nids
;
6627 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6628 spec
->capsrc_nids
= alc882_capsrc_nids
;
6629 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6634 spec
->vmaster_nid
= 0x0c;
6636 codec
->patch_ops
= alc_patch_ops
;
6637 if (board_config
== ALC882_AUTO
)
6638 spec
->init_hook
= alc882_auto_init
;
6639 #ifdef CONFIG_SND_HDA_POWER_SAVE
6640 if (!spec
->loopback
.amplist
)
6641 spec
->loopback
.amplist
= alc882_loopbacks
;
6650 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6651 * configuration. Each pin widget can choose any input DACs and a mixer.
6652 * Each ADC is connected from a mixer of all inputs. This makes possible
6653 * 6-channel independent captures.
6655 * In addition, an independent DAC for the multi-playback (not used in this
6658 #define ALC883_DIGOUT_NID 0x06
6659 #define ALC883_DIGIN_NID 0x0a
6661 static hda_nid_t alc883_dac_nids
[4] = {
6662 /* front, rear, clfe, rear_surr */
6663 0x02, 0x03, 0x04, 0x05
6666 static hda_nid_t alc883_adc_nids
[2] = {
6671 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
6674 /* FIXME: should be a matrix-type input source selection */
6676 static struct hda_input_mux alc883_capture_source
= {
6680 { "Front Mic", 0x1 },
6686 static struct hda_input_mux alc883_3stack_6ch_intel
= {
6690 { "Front Mic", 0x0 },
6696 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6704 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6714 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
6722 #define alc883_mux_enum_info alc_mux_enum_info
6723 #define alc883_mux_enum_get alc_mux_enum_get
6724 /* ALC883 has the ALC882-type input selection */
6725 #define alc883_mux_enum_put alc882_mux_enum_put
6730 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6737 static struct hda_verb alc883_3ST_ch2_init
[] = {
6738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6740 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6741 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6748 static struct hda_verb alc883_3ST_ch4_init
[] = {
6749 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6750 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6751 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6752 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6753 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6760 static struct hda_verb alc883_3ST_ch6_init
[] = {
6761 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6762 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6763 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6764 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6765 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6766 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6770 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6771 { 2, alc883_3ST_ch2_init
},
6772 { 4, alc883_3ST_ch4_init
},
6773 { 6, alc883_3ST_ch6_init
},
6779 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
6780 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6781 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6790 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
6791 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6792 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6793 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6794 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6795 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6802 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
6803 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6804 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6805 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6806 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6807 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6808 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6812 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
6813 { 2, alc883_3ST_ch2_intel_init
},
6814 { 4, alc883_3ST_ch4_intel_init
},
6815 { 6, alc883_3ST_ch6_intel_init
},
6821 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6822 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6823 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6824 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6825 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6832 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6833 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6834 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6835 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6836 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6840 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6841 { 6, alc883_sixstack_ch6_init
},
6842 { 8, alc883_sixstack_ch8_init
},
6845 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6846 /* eanable EAPD on medion laptop */
6847 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6848 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6852 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6853 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6856 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6857 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6858 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6859 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6860 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6861 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6862 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6863 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6864 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6865 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6866 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6868 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6869 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6870 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6871 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6872 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6873 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6876 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6878 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6879 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6880 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6881 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6882 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6883 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6885 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6886 /* .name = "Capture Source", */
6887 .name
= "Input Source",
6889 .info
= alc883_mux_enum_info
,
6890 .get
= alc883_mux_enum_get
,
6891 .put
= alc883_mux_enum_put
,
6896 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
6897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6898 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6899 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6900 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6901 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6902 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6905 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6907 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6908 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6910 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6911 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6912 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6913 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6915 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6916 /* .name = "Capture Source", */
6917 .name
= "Input Source",
6919 .info
= alc883_mux_enum_info
,
6920 .get
= alc883_mux_enum_get
,
6921 .put
= alc883_mux_enum_put
,
6926 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
6927 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6928 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6929 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6930 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6932 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6934 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6935 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6936 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6937 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6938 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6939 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6940 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6942 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6943 /* .name = "Capture Source", */
6944 .name
= "Input Source",
6946 .info
= alc883_mux_enum_info
,
6947 .get
= alc883_mux_enum_get
,
6948 .put
= alc883_mux_enum_put
,
6953 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
6954 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6955 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6956 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6957 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6959 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6961 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6962 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6963 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6964 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6965 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6966 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6967 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6969 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6970 /* .name = "Capture Source", */
6971 .name
= "Input Source",
6973 .info
= alc883_mux_enum_info
,
6974 .get
= alc883_mux_enum_get
,
6975 .put
= alc883_mux_enum_put
,
6980 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6986 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6987 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6989 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6992 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6994 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6995 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6996 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6997 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6998 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6999 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7001 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7002 /* .name = "Capture Source", */
7003 .name
= "Input Source",
7005 .info
= alc883_mux_enum_info
,
7006 .get
= alc883_mux_enum_get
,
7007 .put
= alc883_mux_enum_put
,
7012 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
7013 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7014 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7015 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7016 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7017 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7018 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7019 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7020 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7023 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7027 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7030 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7032 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7033 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7034 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7035 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7036 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7037 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7039 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7040 /* .name = "Capture Source", */
7041 .name
= "Input Source",
7043 .info
= alc883_mux_enum_info
,
7044 .get
= alc883_mux_enum_get
,
7045 .put
= alc883_mux_enum_put
,
7050 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
7051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7052 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7054 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7066 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
7067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7069 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
7070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7071 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7072 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7073 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7074 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7075 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7076 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7078 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7079 /* .name = "Capture Source", */
7080 .name
= "Input Source",
7082 .info
= alc883_mux_enum_info
,
7083 .get
= alc883_mux_enum_get
,
7084 .put
= alc883_mux_enum_put
,
7089 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
7090 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7091 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7092 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7093 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7094 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7095 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7096 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7097 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7099 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7109 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7110 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7111 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7112 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7115 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7116 /* .name = "Capture Source", */
7117 .name
= "Input Source",
7119 .info
= alc883_mux_enum_info
,
7120 .get
= alc883_mux_enum_get
,
7121 .put
= alc883_mux_enum_put
,
7126 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
7127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7129 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7130 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7131 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7132 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7133 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7134 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7135 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7143 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7144 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7145 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7146 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7148 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7149 /* .name = "Capture Source", */
7150 .name
= "Input Source",
7152 .info
= alc883_mux_enum_info
,
7153 .get
= alc883_mux_enum_get
,
7154 .put
= alc883_mux_enum_put
,
7159 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
7160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7161 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7162 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7168 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7169 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7170 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7171 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7172 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7173 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7174 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7176 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7177 /* .name = "Capture Source", */
7178 .name
= "Input Source",
7180 .info
= alc883_mux_enum_info
,
7181 .get
= alc883_mux_enum_get
,
7182 .put
= alc883_mux_enum_put
,
7187 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
7188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7190 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7191 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7194 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7196 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7197 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7199 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7200 /* .name = "Capture Source", */
7201 .name
= "Input Source",
7203 .info
= alc883_mux_enum_info
,
7204 .get
= alc883_mux_enum_get
,
7205 .put
= alc883_mux_enum_put
,
7210 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
7211 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7212 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
7213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7218 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7219 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7220 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7221 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7222 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7223 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7225 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7226 /* .name = "Capture Source", */
7227 .name
= "Input Source",
7229 .info
= alc883_mux_enum_info
,
7230 .get
= alc883_mux_enum_get
,
7231 .put
= alc883_mux_enum_put
,
7236 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
7237 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7239 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7245 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7246 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7247 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7248 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7249 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7251 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7252 /* .name = "Capture Source", */
7253 .name
= "Input Source",
7255 .info
= alc883_mux_enum_info
,
7256 .get
= alc883_mux_enum_get
,
7257 .put
= alc883_mux_enum_put
,
7262 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7263 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7264 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7269 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7273 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7274 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7276 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7277 /* .name = "Capture Source", */
7278 .name
= "Input Source",
7280 .info
= alc883_mux_enum_info
,
7281 .get
= alc883_mux_enum_get
,
7282 .put
= alc883_mux_enum_put
,
7287 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7289 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7290 .name
= "Channel Mode",
7291 .info
= alc_ch_mode_info
,
7292 .get
= alc_ch_mode_get
,
7293 .put
= alc_ch_mode_put
,
7298 static struct hda_verb alc883_init_verbs
[] = {
7299 /* ADC1: mute amp left and right */
7300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7301 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7302 /* ADC2: mute amp left and right */
7303 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7304 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7305 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7319 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7322 /* mute analog input loopbacks */
7323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7329 /* Front Pin: output 0 (0x0c) */
7330 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7332 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7333 /* Rear Pin: output 1 (0x0d) */
7334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7336 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7337 /* CLFE Pin: output 2 (0x0e) */
7338 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7339 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7340 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7341 /* Side Pin: output 3 (0x0f) */
7342 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7343 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7344 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7345 /* Mic (rear) pin: input vref at 80% */
7346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7347 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7348 /* Front Mic pin: input vref at 80% */
7349 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7350 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7351 /* Line In pin: input */
7352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7354 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7355 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7356 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7357 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7358 /* CD pin widget for input */
7359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7361 /* FIXME: use matrix-type input source selection */
7362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7376 /* toggle speaker-output according to the hp-jack state */
7377 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7379 unsigned int present
;
7381 present
= snd_hda_codec_read(codec
, 0x15, 0,
7382 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7383 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7384 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7385 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7386 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7389 /* auto-toggle front mic */
7391 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7393 unsigned int present;
7396 present = snd_hda_codec_read(codec, 0x18, 0,
7397 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7398 bits = present ? HDA_AMP_MUTE : 0;
7399 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7403 static void alc883_mitac_automute(struct hda_codec
*codec
)
7405 alc883_mitac_hp_automute(codec
);
7406 /* alc883_mitac_mic_automute(codec); */
7409 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7412 switch (res
>> 26) {
7413 case ALC880_HP_EVENT
:
7414 alc883_mitac_hp_automute(codec
);
7416 case ALC880_MIC_EVENT
:
7417 /* alc883_mitac_mic_automute(codec); */
7422 static struct hda_verb alc883_mitac_verbs
[] = {
7424 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7427 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7428 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7430 /* enable unsolicited event */
7431 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7432 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7437 static struct hda_verb alc883_clevo_m720_verbs
[] = {
7439 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7442 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7445 /* enable unsolicited event */
7446 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7447 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
7452 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7454 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7457 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7460 /* enable unsolicited event */
7461 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7466 static struct hda_verb alc883_tagra_verbs
[] = {
7467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7473 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7474 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7475 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7477 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7478 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7479 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7480 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7485 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7486 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7487 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7488 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7492 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7493 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7495 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7500 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7503 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7504 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7505 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7509 static struct hda_verb alc883_haier_w66_verbs
[] = {
7510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7511 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7515 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7517 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7522 static struct hda_verb alc888_3st_hp_verbs
[] = {
7523 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7524 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7525 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7529 static struct hda_verb alc888_6st_dell_verbs
[] = {
7530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7534 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7535 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7536 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7537 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7538 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7542 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7543 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7544 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7545 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7546 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7550 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7551 { 2, alc888_3st_hp_2ch_init
},
7552 { 6, alc888_3st_hp_6ch_init
},
7555 /* toggle front-jack and RCA according to the hp-jack state */
7556 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7558 unsigned int present
;
7560 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7561 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7562 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7563 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7564 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7565 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7568 /* toggle RCA according to the front-jack state */
7569 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7571 unsigned int present
;
7573 present
= snd_hda_codec_read(codec
, 0x14, 0,
7574 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7575 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7576 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7579 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7582 if ((res
>> 26) == ALC880_HP_EVENT
)
7583 alc888_lenovo_ms7195_front_automute(codec
);
7584 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7585 alc888_lenovo_ms7195_rca_automute(codec
);
7588 static struct hda_verb alc883_medion_md2_verbs
[] = {
7589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7598 /* toggle speaker-output according to the hp-jack state */
7599 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7601 unsigned int present
;
7603 present
= snd_hda_codec_read(codec
, 0x14, 0,
7604 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7605 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7606 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7609 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7612 if ((res
>> 26) == ALC880_HP_EVENT
)
7613 alc883_medion_md2_automute(codec
);
7616 /* toggle speaker-output according to the hp-jack state */
7617 static void alc883_tagra_automute(struct hda_codec
*codec
)
7619 unsigned int present
;
7622 present
= snd_hda_codec_read(codec
, 0x14, 0,
7623 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7624 bits
= present
? HDA_AMP_MUTE
: 0;
7625 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7626 HDA_AMP_MUTE
, bits
);
7627 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7631 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7633 if ((res
>> 26) == ALC880_HP_EVENT
)
7634 alc883_tagra_automute(codec
);
7637 /* toggle speaker-output according to the hp-jack state */
7638 static void alc883_clevo_m720_hp_automute(struct hda_codec
*codec
)
7640 unsigned int present
;
7643 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
7644 & AC_PINSENSE_PRESENCE
;
7645 bits
= present
? HDA_AMP_MUTE
: 0;
7646 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7647 HDA_AMP_MUTE
, bits
);
7650 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
7652 unsigned int present
;
7654 present
= snd_hda_codec_read(codec
, 0x18, 0,
7655 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7656 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
7657 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7660 static void alc883_clevo_m720_automute(struct hda_codec
*codec
)
7662 alc883_clevo_m720_hp_automute(codec
);
7663 alc883_clevo_m720_mic_automute(codec
);
7666 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
7669 switch (res
>> 26) {
7670 case ALC880_HP_EVENT
:
7671 alc883_clevo_m720_hp_automute(codec
);
7673 case ALC880_MIC_EVENT
:
7674 alc883_clevo_m720_mic_automute(codec
);
7679 /* toggle speaker-output according to the hp-jack state */
7680 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
7682 unsigned int present
;
7685 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
7686 & AC_PINSENSE_PRESENCE
;
7687 bits
= present
? HDA_AMP_MUTE
: 0;
7688 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7689 HDA_AMP_MUTE
, bits
);
7692 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
7695 if ((res
>> 26) == ALC880_HP_EVENT
)
7696 alc883_2ch_fujitsu_pi2515_automute(codec
);
7699 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
7701 unsigned int present
;
7704 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7705 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7706 bits
= present
? 0x80 : 0;
7707 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7711 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
7714 if ((res
>> 26) == ALC880_HP_EVENT
)
7715 alc883_haier_w66_automute(codec
);
7718 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
7720 unsigned int present
;
7723 present
= snd_hda_codec_read(codec
, 0x14, 0,
7724 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7725 bits
= present
? HDA_AMP_MUTE
: 0;
7726 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7727 HDA_AMP_MUTE
, bits
);
7730 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
7732 unsigned int present
;
7735 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7736 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7737 bits
= present
? HDA_AMP_MUTE
: 0;
7738 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7739 HDA_AMP_MUTE
, bits
);
7740 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7741 HDA_AMP_MUTE
, bits
);
7744 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
7747 if ((res
>> 26) == ALC880_HP_EVENT
)
7748 alc883_lenovo_101e_all_automute(codec
);
7749 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7750 alc883_lenovo_101e_ispeaker_automute(codec
);
7753 /* toggle speaker-output according to the hp-jack state */
7754 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7756 unsigned int present
;
7758 present
= snd_hda_codec_read(codec
, 0x14, 0,
7759 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7760 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7761 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7762 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7763 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7766 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7769 if ((res
>> 26) == ALC880_HP_EVENT
)
7770 alc883_acer_aspire_automute(codec
);
7773 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7774 /* HP Pin: output 0 (0x0c) */
7775 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7777 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7778 /* Front Pin: output 0 (0x0c) */
7779 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7780 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7781 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7782 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7783 /* eanable EAPD on medion laptop */
7784 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7785 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7786 /* enable unsolicited event */
7787 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7791 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
7793 unsigned int present
;
7795 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7796 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7797 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7798 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7799 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7800 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7801 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7802 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7803 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7804 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7807 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
7810 switch (res
>> 26) {
7811 case ALC880_HP_EVENT
:
7812 printk("hp_event\n");
7813 alc888_6st_dell_front_automute(codec
);
7819 * generic initialization of ADC, input mixers and output mixers
7821 static struct hda_verb alc883_auto_init_verbs
[] = {
7823 * Unmute ADC0-2 and set the default input to mic-in
7825 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7827 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7830 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7832 * Note: PASD motherboards uses the Line In 2 as the input for
7833 * front panel mic (mic 2)
7835 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7843 * Set up output mixers (0x0c - 0x0f)
7845 /* set vol=0 to output mixers */
7846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7850 /* set up input amps for analog loopback */
7851 /* Amp Indices: DAC = 0, mixer = 1 */
7852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7855 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7857 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7858 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7860 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7861 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7863 /* FIXME: use matrix-type input source selection */
7864 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7867 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7868 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7869 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7875 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7881 /* capture mixer elements */
7882 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7883 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7884 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7885 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7886 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7888 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7889 /* The multiple "Capture Source" controls confuse alsamixer
7890 * So call somewhat different..
7892 /* .name = "Capture Source", */
7893 .name
= "Input Source",
7895 .info
= alc882_mux_enum_info
,
7896 .get
= alc882_mux_enum_get
,
7897 .put
= alc882_mux_enum_put
,
7902 #ifdef CONFIG_SND_HDA_POWER_SAVE
7903 #define alc883_loopbacks alc880_loopbacks
7906 /* pcm configuration: identiacal with ALC880 */
7907 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7908 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7909 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7910 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7911 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7914 * configuration and preset
7916 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7917 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7918 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7919 [ALC883_3ST_6ch
] = "3stack-6ch",
7920 [ALC883_6ST_DIG
] = "6stack-dig",
7921 [ALC883_TARGA_DIG
] = "targa-dig",
7922 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7923 [ALC883_ACER
] = "acer",
7924 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7925 [ALC883_MEDION
] = "medion",
7926 [ALC883_MEDION_MD2
] = "medion-md2",
7927 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7928 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7929 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7930 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7931 [ALC883_HAIER_W66
] = "haier-w66",
7932 [ALC888_3ST_HP
] = "3stack-hp",
7933 [ALC888_6ST_DELL
] = "6stack-dell",
7934 [ALC883_MITAC
] = "mitac",
7935 [ALC883_CLEVO_M720
] = "clevo-m720",
7936 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
7937 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
7938 [ALC883_AUTO
] = "auto",
7941 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7942 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7943 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7944 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7945 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7946 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
7947 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
7948 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
7949 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7950 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7951 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7952 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
7953 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7954 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
7955 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7956 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
7957 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7958 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7959 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7960 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7961 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
7962 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7963 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
7964 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7965 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
7966 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7967 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7968 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7969 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7970 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7971 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7972 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7973 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7974 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7975 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7976 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7977 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7978 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
7979 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7980 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7981 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7982 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7983 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
7984 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
7985 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7986 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7987 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7988 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
7989 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7990 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7991 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7992 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7993 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7994 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
7995 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
7996 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
7997 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
7998 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
8002 static struct alc_config_preset alc883_presets
[] = {
8003 [ALC883_3ST_2ch_DIG
] = {
8004 .mixers
= { alc883_3ST_2ch_mixer
},
8005 .init_verbs
= { alc883_init_verbs
},
8006 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8007 .dac_nids
= alc883_dac_nids
,
8008 .dig_out_nid
= ALC883_DIGOUT_NID
,
8009 .dig_in_nid
= ALC883_DIGIN_NID
,
8010 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8011 .channel_mode
= alc883_3ST_2ch_modes
,
8012 .input_mux
= &alc883_capture_source
,
8014 [ALC883_3ST_6ch_DIG
] = {
8015 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8016 .init_verbs
= { alc883_init_verbs
},
8017 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8018 .dac_nids
= alc883_dac_nids
,
8019 .dig_out_nid
= ALC883_DIGOUT_NID
,
8020 .dig_in_nid
= ALC883_DIGIN_NID
,
8021 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8022 .channel_mode
= alc883_3ST_6ch_modes
,
8024 .input_mux
= &alc883_capture_source
,
8026 [ALC883_3ST_6ch
] = {
8027 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8028 .init_verbs
= { alc883_init_verbs
},
8029 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8030 .dac_nids
= alc883_dac_nids
,
8031 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8032 .channel_mode
= alc883_3ST_6ch_modes
,
8034 .input_mux
= &alc883_capture_source
,
8036 [ALC883_3ST_6ch_INTEL
] = {
8037 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
8038 .init_verbs
= { alc883_init_verbs
},
8039 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8040 .dac_nids
= alc883_dac_nids
,
8041 .dig_out_nid
= ALC883_DIGOUT_NID
,
8042 .dig_in_nid
= ALC883_DIGIN_NID
,
8043 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
8044 .channel_mode
= alc883_3ST_6ch_intel_modes
,
8046 .input_mux
= &alc883_3stack_6ch_intel
,
8048 [ALC883_6ST_DIG
] = {
8049 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8050 .init_verbs
= { alc883_init_verbs
},
8051 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8052 .dac_nids
= alc883_dac_nids
,
8053 .dig_out_nid
= ALC883_DIGOUT_NID
,
8054 .dig_in_nid
= ALC883_DIGIN_NID
,
8055 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8056 .channel_mode
= alc883_sixstack_modes
,
8057 .input_mux
= &alc883_capture_source
,
8059 [ALC883_TARGA_DIG
] = {
8060 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
8061 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8062 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8063 .dac_nids
= alc883_dac_nids
,
8064 .dig_out_nid
= ALC883_DIGOUT_NID
,
8065 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8066 .channel_mode
= alc883_3ST_6ch_modes
,
8068 .input_mux
= &alc883_capture_source
,
8069 .unsol_event
= alc883_tagra_unsol_event
,
8070 .init_hook
= alc883_tagra_automute
,
8072 [ALC883_TARGA_2ch_DIG
] = {
8073 .mixers
= { alc883_tagra_2ch_mixer
},
8074 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8075 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8076 .dac_nids
= alc883_dac_nids
,
8077 .dig_out_nid
= ALC883_DIGOUT_NID
,
8078 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8079 .channel_mode
= alc883_3ST_2ch_modes
,
8080 .input_mux
= &alc883_capture_source
,
8081 .unsol_event
= alc883_tagra_unsol_event
,
8082 .init_hook
= alc883_tagra_automute
,
8085 .mixers
= { alc883_base_mixer
},
8086 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8087 * and the headphone jack. Turn this on and rely on the
8088 * standard mute methods whenever the user wants to turn
8089 * these outputs off.
8091 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
8092 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8093 .dac_nids
= alc883_dac_nids
,
8094 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8095 .channel_mode
= alc883_3ST_2ch_modes
,
8096 .input_mux
= &alc883_capture_source
,
8098 [ALC883_ACER_ASPIRE
] = {
8099 .mixers
= { alc883_acer_aspire_mixer
},
8100 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
8101 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8102 .dac_nids
= alc883_dac_nids
,
8103 .dig_out_nid
= ALC883_DIGOUT_NID
,
8104 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8105 .channel_mode
= alc883_3ST_2ch_modes
,
8106 .input_mux
= &alc883_capture_source
,
8107 .unsol_event
= alc883_acer_aspire_unsol_event
,
8108 .init_hook
= alc883_acer_aspire_automute
,
8111 .mixers
= { alc883_fivestack_mixer
,
8112 alc883_chmode_mixer
},
8113 .init_verbs
= { alc883_init_verbs
,
8114 alc883_medion_eapd_verbs
},
8115 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8116 .dac_nids
= alc883_dac_nids
,
8117 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8118 .channel_mode
= alc883_sixstack_modes
,
8119 .input_mux
= &alc883_capture_source
,
8121 [ALC883_MEDION_MD2
] = {
8122 .mixers
= { alc883_medion_md2_mixer
},
8123 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
8124 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8125 .dac_nids
= alc883_dac_nids
,
8126 .dig_out_nid
= ALC883_DIGOUT_NID
,
8127 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8128 .channel_mode
= alc883_3ST_2ch_modes
,
8129 .input_mux
= &alc883_capture_source
,
8130 .unsol_event
= alc883_medion_md2_unsol_event
,
8131 .init_hook
= alc883_medion_md2_automute
,
8133 [ALC883_LAPTOP_EAPD
] = {
8134 .mixers
= { alc883_base_mixer
},
8135 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
8136 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8137 .dac_nids
= alc883_dac_nids
,
8138 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8139 .channel_mode
= alc883_3ST_2ch_modes
,
8140 .input_mux
= &alc883_capture_source
,
8142 [ALC883_CLEVO_M720
] = {
8143 .mixers
= { alc883_clevo_m720_mixer
},
8144 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
8145 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8146 .dac_nids
= alc883_dac_nids
,
8147 .dig_out_nid
= ALC883_DIGOUT_NID
,
8148 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8149 .channel_mode
= alc883_3ST_2ch_modes
,
8150 .input_mux
= &alc883_capture_source
,
8151 .unsol_event
= alc883_clevo_m720_unsol_event
,
8152 .init_hook
= alc883_clevo_m720_automute
,
8154 [ALC883_LENOVO_101E_2ch
] = {
8155 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
8156 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
8157 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8158 .dac_nids
= alc883_dac_nids
,
8159 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8160 .channel_mode
= alc883_3ST_2ch_modes
,
8161 .input_mux
= &alc883_lenovo_101e_capture_source
,
8162 .unsol_event
= alc883_lenovo_101e_unsol_event
,
8163 .init_hook
= alc883_lenovo_101e_all_automute
,
8165 [ALC883_LENOVO_NB0763
] = {
8166 .mixers
= { alc883_lenovo_nb0763_mixer
},
8167 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
8168 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8169 .dac_nids
= alc883_dac_nids
,
8170 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8171 .channel_mode
= alc883_3ST_2ch_modes
,
8173 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
8174 .unsol_event
= alc883_medion_md2_unsol_event
,
8175 .init_hook
= alc883_medion_md2_automute
,
8177 [ALC888_LENOVO_MS7195_DIG
] = {
8178 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8179 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
8180 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8181 .dac_nids
= alc883_dac_nids
,
8182 .dig_out_nid
= ALC883_DIGOUT_NID
,
8183 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8184 .channel_mode
= alc883_3ST_6ch_modes
,
8186 .input_mux
= &alc883_capture_source
,
8187 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
8188 .init_hook
= alc888_lenovo_ms7195_front_automute
,
8190 [ALC883_HAIER_W66
] = {
8191 .mixers
= { alc883_tagra_2ch_mixer
},
8192 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
8193 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8194 .dac_nids
= alc883_dac_nids
,
8195 .dig_out_nid
= ALC883_DIGOUT_NID
,
8196 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8197 .channel_mode
= alc883_3ST_2ch_modes
,
8198 .input_mux
= &alc883_capture_source
,
8199 .unsol_event
= alc883_haier_w66_unsol_event
,
8200 .init_hook
= alc883_haier_w66_automute
,
8203 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8204 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
8205 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8206 .dac_nids
= alc883_dac_nids
,
8207 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
8208 .channel_mode
= alc888_3st_hp_modes
,
8210 .input_mux
= &alc883_capture_source
,
8212 [ALC888_6ST_DELL
] = {
8213 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8214 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8215 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8216 .dac_nids
= alc883_dac_nids
,
8217 .dig_out_nid
= ALC883_DIGOUT_NID
,
8218 .dig_in_nid
= ALC883_DIGIN_NID
,
8219 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8220 .channel_mode
= alc883_sixstack_modes
,
8221 .input_mux
= &alc883_capture_source
,
8222 .unsol_event
= alc888_6st_dell_unsol_event
,
8223 .init_hook
= alc888_6st_dell_front_automute
,
8226 .mixers
= { alc883_mitac_mixer
},
8227 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8228 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8229 .dac_nids
= alc883_dac_nids
,
8230 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8231 .channel_mode
= alc883_3ST_2ch_modes
,
8232 .input_mux
= &alc883_capture_source
,
8233 .unsol_event
= alc883_mitac_unsol_event
,
8234 .init_hook
= alc883_mitac_automute
,
8236 [ALC883_FUJITSU_PI2515
] = {
8237 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8238 .init_verbs
= { alc883_init_verbs
,
8239 alc883_2ch_fujitsu_pi2515_verbs
},
8240 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8241 .dac_nids
= alc883_dac_nids
,
8242 .dig_out_nid
= ALC883_DIGOUT_NID
,
8243 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8244 .channel_mode
= alc883_3ST_2ch_modes
,
8245 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8246 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8247 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8253 * BIOS auto configuration
8255 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8256 hda_nid_t nid
, int pin_type
,
8260 struct alc_spec
*spec
= codec
->spec
;
8263 alc_set_pin_output(codec
, nid
, pin_type
);
8264 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8267 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8268 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8272 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8274 struct alc_spec
*spec
= codec
->spec
;
8277 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8278 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8279 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8280 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8282 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8287 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8289 struct alc_spec
*spec
= codec
->spec
;
8292 pin
= spec
->autocfg
.hp_pins
[0];
8293 if (pin
) /* connect to front */
8295 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8296 pin
= spec
->autocfg
.speaker_pins
[0];
8298 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8301 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8302 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8304 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8306 struct alc_spec
*spec
= codec
->spec
;
8309 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8310 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8311 if (alc883_is_input_pin(nid
)) {
8312 snd_hda_codec_write(codec
, nid
, 0,
8313 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8314 (i
<= AUTO_PIN_FRONT_MIC
?
8315 PIN_VREF80
: PIN_IN
));
8316 if (nid
!= ALC883_PIN_CD_NID
)
8317 snd_hda_codec_write(codec
, nid
, 0,
8318 AC_VERB_SET_AMP_GAIN_MUTE
,
8324 #define alc883_auto_init_input_src alc882_auto_init_input_src
8326 /* almost identical with ALC880 parser... */
8327 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8329 struct alc_spec
*spec
= codec
->spec
;
8330 int err
= alc880_parse_auto_config(codec
);
8335 return 0; /* no config found */
8337 err
= alc_auto_add_mic_boost(codec
);
8341 /* hack - override the init verbs */
8342 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8343 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
8346 return 1; /* config found */
8349 /* additional initialization for auto-configuration model */
8350 static void alc883_auto_init(struct hda_codec
*codec
)
8352 struct alc_spec
*spec
= codec
->spec
;
8353 alc883_auto_init_multi_out(codec
);
8354 alc883_auto_init_hp_out(codec
);
8355 alc883_auto_init_analog_input(codec
);
8356 alc883_auto_init_input_src(codec
);
8357 if (spec
->unsol_event
)
8358 alc_sku_automute(codec
);
8361 static int patch_alc883(struct hda_codec
*codec
)
8363 struct alc_spec
*spec
;
8364 int err
, board_config
;
8366 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8372 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
8374 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8377 if (board_config
< 0) {
8378 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8379 "trying auto-probe from BIOS...\n");
8380 board_config
= ALC883_AUTO
;
8383 if (board_config
== ALC883_AUTO
) {
8384 /* automatic parse from the BIOS config */
8385 err
= alc883_parse_auto_config(codec
);
8391 "hda_codec: Cannot set up configuration "
8392 "from BIOS. Using base mode...\n");
8393 board_config
= ALC883_3ST_2ch_DIG
;
8397 if (board_config
!= ALC883_AUTO
)
8398 setup_preset(spec
, &alc883_presets
[board_config
]);
8400 switch (codec
->vendor_id
) {
8402 spec
->stream_name_analog
= "ALC888 Analog";
8403 spec
->stream_name_digital
= "ALC888 Digital";
8406 spec
->stream_name_analog
= "ALC889 Analog";
8407 spec
->stream_name_digital
= "ALC889 Digital";
8410 spec
->stream_name_analog
= "ALC883 Analog";
8411 spec
->stream_name_digital
= "ALC883 Digital";
8415 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
8416 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
8417 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
8419 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
8420 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
8422 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
8423 spec
->adc_nids
= alc883_adc_nids
;
8424 spec
->capsrc_nids
= alc883_capsrc_nids
;
8426 spec
->vmaster_nid
= 0x0c;
8428 codec
->patch_ops
= alc_patch_ops
;
8429 if (board_config
== ALC883_AUTO
)
8430 spec
->init_hook
= alc883_auto_init
;
8432 #ifdef CONFIG_SND_HDA_POWER_SAVE
8433 if (!spec
->loopback
.amplist
)
8434 spec
->loopback
.amplist
= alc883_loopbacks
;
8444 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8445 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8447 #define alc262_dac_nids alc260_dac_nids
8448 #define alc262_adc_nids alc882_adc_nids
8449 #define alc262_adc_nids_alt alc882_adc_nids_alt
8450 #define alc262_capsrc_nids alc882_capsrc_nids
8451 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8453 #define alc262_modes alc260_modes
8454 #define alc262_capture_source alc882_capture_source
8456 static struct snd_kcontrol_new alc262_base_mixer
[] = {
8457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8458 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8459 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8460 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8461 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8462 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8468 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8469 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8470 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8471 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
8472 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8473 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8474 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
8478 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
8479 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8480 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8481 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8482 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8483 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8484 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8487 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8488 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8489 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8490 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8491 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8492 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8493 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8494 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8498 /* update HP, line and mono-out pins according to the master switch */
8499 static void alc262_hp_master_update(struct hda_codec
*codec
)
8501 struct alc_spec
*spec
= codec
->spec
;
8502 int val
= spec
->master_sw
;
8505 snd_hda_codec_write_cache(codec
, 0x1b, 0,
8506 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8508 snd_hda_codec_write_cache(codec
, 0x15, 0,
8509 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8511 /* mono (speaker) depending on the HP jack sense */
8512 val
= val
&& !spec
->jack_present
;
8513 snd_hda_codec_write_cache(codec
, 0x16, 0,
8514 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8518 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
8520 struct alc_spec
*spec
= codec
->spec
;
8521 unsigned int presence
;
8522 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
8523 AC_VERB_GET_PIN_SENSE
, 0);
8524 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8525 alc262_hp_master_update(codec
);
8528 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8530 if ((res
>> 26) != ALC880_HP_EVENT
)
8532 alc262_hp_bpc_automute(codec
);
8535 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
8537 struct alc_spec
*spec
= codec
->spec
;
8538 unsigned int presence
;
8539 presence
= snd_hda_codec_read(codec
, 0x15, 0,
8540 AC_VERB_GET_PIN_SENSE
, 0);
8541 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8542 alc262_hp_master_update(codec
);
8545 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
8548 if ((res
>> 26) != ALC880_HP_EVENT
)
8550 alc262_hp_wildwest_automute(codec
);
8553 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
8554 struct snd_ctl_elem_value
*ucontrol
)
8556 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8557 struct alc_spec
*spec
= codec
->spec
;
8558 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
8562 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
8563 struct snd_ctl_elem_value
*ucontrol
)
8565 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8566 struct alc_spec
*spec
= codec
->spec
;
8567 int val
= !!*ucontrol
->value
.integer
.value
;
8569 if (val
== spec
->master_sw
)
8571 spec
->master_sw
= val
;
8572 alc262_hp_master_update(codec
);
8576 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
8578 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8579 .name
= "Master Playback Switch",
8580 .info
= snd_ctl_boolean_mono_info
,
8581 .get
= alc262_hp_master_sw_get
,
8582 .put
= alc262_hp_master_sw_put
,
8584 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8585 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8587 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8589 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8592 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8593 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8594 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8595 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8596 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8597 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8598 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8601 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8602 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8603 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
8604 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
8608 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
8610 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8611 .name
= "Master Playback Switch",
8612 .info
= snd_ctl_boolean_mono_info
,
8613 .get
= alc262_hp_master_sw_get
,
8614 .put
= alc262_hp_master_sw_put
,
8616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8617 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8618 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8620 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8622 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8625 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8626 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
8627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8629 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8630 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8631 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8632 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8636 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
8637 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8638 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8639 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
8643 /* mute/unmute internal speaker according to the hp jack and mute state */
8644 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
8646 struct alc_spec
*spec
= codec
->spec
;
8648 if (force
|| !spec
->sense_updated
) {
8649 unsigned int present
;
8650 present
= snd_hda_codec_read(codec
, 0x15, 0,
8651 AC_VERB_GET_PIN_SENSE
, 0);
8652 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
8653 spec
->sense_updated
= 1;
8655 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
8656 spec
->jack_present
? HDA_AMP_MUTE
: 0);
8659 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
8662 if ((res
>> 26) != ALC880_HP_EVENT
)
8664 alc262_hp_t5735_automute(codec
, 1);
8667 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
8669 alc262_hp_t5735_automute(codec
, 1);
8672 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
8673 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8674 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8675 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8678 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8679 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8683 static struct hda_verb alc262_hp_t5735_verbs
[] = {
8684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8687 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8691 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
8692 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8694 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8695 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8696 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8697 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8701 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
8702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8703 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8704 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8705 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8706 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8707 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8715 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
8722 /* bind hp and internal speaker mute (with plug check) */
8723 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
8724 struct snd_ctl_elem_value
*ucontrol
)
8726 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8727 long *valp
= ucontrol
->value
.integer
.value
;
8730 /* change hp mute */
8731 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
8733 valp
[0] ? 0 : HDA_AMP_MUTE
);
8734 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
8736 valp
[1] ? 0 : HDA_AMP_MUTE
);
8738 /* change speaker according to HP jack state */
8739 struct alc_spec
*spec
= codec
->spec
;
8741 if (spec
->jack_present
)
8742 mute
= HDA_AMP_MUTE
;
8744 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
8746 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8747 HDA_AMP_MUTE
, mute
);
8752 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
8753 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8755 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8756 .name
= "Master Playback Switch",
8757 .info
= snd_hda_mixer_amp_switch_info
,
8758 .get
= snd_hda_mixer_amp_switch_get
,
8759 .put
= alc262_sony_master_sw_put
,
8760 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
8762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8763 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8764 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8765 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8769 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
8770 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8771 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8775 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8776 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8780 #define alc262_capture_mixer alc882_capture_mixer
8781 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8784 * generic initialization of ADC, input mixers and output mixers
8786 static struct hda_verb alc262_init_verbs
[] = {
8788 * Unmute ADC0-2 and set the default input to mic-in
8790 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8792 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8794 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8797 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8799 * Note: PASD motherboards uses the Line In 2 as the input for
8800 * front panel mic (mic 2)
8802 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8810 * Set up output mixers (0x0c - 0x0e)
8812 /* set vol=0 to output mixers */
8813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8816 /* set up input amps for analog loopback */
8817 /* Amp Indices: DAC = 0, mixer = 1 */
8818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8825 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8827 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8828 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8830 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8832 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8835 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8836 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8838 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8839 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8841 /* FIXME: use matrix-type input source selection */
8842 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8843 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8862 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
8863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8868 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
8869 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8870 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8871 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8873 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8874 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8878 static struct hda_verb alc262_sony_unsol_verbs
[] = {
8879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8880 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8881 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
8883 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8884 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8888 /* mute/unmute internal speaker according to the hp jack and mute state */
8889 static void alc262_hippo_automute(struct hda_codec
*codec
)
8891 struct alc_spec
*spec
= codec
->spec
;
8893 unsigned int present
;
8895 /* need to execute and sync at first */
8896 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8897 present
= snd_hda_codec_read(codec
, 0x15, 0,
8898 AC_VERB_GET_PIN_SENSE
, 0);
8899 spec
->jack_present
= (present
& 0x80000000) != 0;
8900 if (spec
->jack_present
) {
8901 /* mute internal speaker */
8902 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8903 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8905 /* unmute internal speaker if necessary */
8906 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8907 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8908 HDA_AMP_MUTE
, mute
);
8912 /* unsolicited event for HP jack sensing */
8913 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
8916 if ((res
>> 26) != ALC880_HP_EVENT
)
8918 alc262_hippo_automute(codec
);
8921 static void alc262_hippo1_automute(struct hda_codec
*codec
)
8924 unsigned int present
;
8926 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8927 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8928 AC_VERB_GET_PIN_SENSE
, 0);
8929 present
= (present
& 0x80000000) != 0;
8931 /* mute internal speaker */
8932 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8933 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8935 /* unmute internal speaker if necessary */
8936 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8937 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8938 HDA_AMP_MUTE
, mute
);
8942 /* unsolicited event for HP jack sensing */
8943 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
8946 if ((res
>> 26) != ALC880_HP_EVENT
)
8948 alc262_hippo1_automute(codec
);
8954 * 0x16 = internal speaker
8955 * 0x18 = external mic
8958 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
8959 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8960 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
8962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8964 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8971 static struct hda_verb alc262_nec_verbs
[] = {
8972 /* Unmute Speaker */
8973 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8976 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8979 /* External mic to headphone */
8980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8981 /* External mic to speaker */
8982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8988 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8989 * 0x1b = port replicator headphone out
8992 #define ALC_HP_EVENT 0x37
8994 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
8995 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8997 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9002 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
9003 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9008 static struct hda_input_mux alc262_fujitsu_capture_source
= {
9017 static struct hda_input_mux alc262_HP_capture_source
= {
9021 { "Front Mic", 0x1 },
9028 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
9032 { "Front Mic", 0x2 },
9038 /* mute/unmute internal speaker according to the hp jacks and mute state */
9039 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
9041 struct alc_spec
*spec
= codec
->spec
;
9044 if (force
|| !spec
->sense_updated
) {
9045 unsigned int present
;
9046 /* need to execute and sync at first */
9047 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
9048 /* check laptop HP jack */
9049 present
= snd_hda_codec_read(codec
, 0x14, 0,
9050 AC_VERB_GET_PIN_SENSE
, 0);
9051 /* need to execute and sync at first */
9052 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9053 /* check docking HP jack */
9054 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
9055 AC_VERB_GET_PIN_SENSE
, 0);
9056 if (present
& AC_PINSENSE_PRESENCE
)
9057 spec
->jack_present
= 1;
9059 spec
->jack_present
= 0;
9060 spec
->sense_updated
= 1;
9062 /* unmute internal speaker only if both HPs are unplugged and
9063 * master switch is on
9065 if (spec
->jack_present
)
9066 mute
= HDA_AMP_MUTE
;
9068 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
9069 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9070 HDA_AMP_MUTE
, mute
);
9073 /* unsolicited event for HP jack sensing */
9074 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
9077 if ((res
>> 26) != ALC_HP_EVENT
)
9079 alc262_fujitsu_automute(codec
, 1);
9082 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
9084 alc262_fujitsu_automute(codec
, 1);
9087 /* bind volumes of both NID 0x0c and 0x0d */
9088 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
9089 .ops
= &snd_hda_bind_vol
,
9091 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
9092 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
9097 /* mute/unmute internal speaker according to the hp jack and mute state */
9098 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
9100 struct alc_spec
*spec
= codec
->spec
;
9103 if (force
|| !spec
->sense_updated
) {
9104 unsigned int present_int_hp
;
9105 /* need to execute and sync at first */
9106 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9107 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
9108 AC_VERB_GET_PIN_SENSE
, 0);
9109 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
9110 spec
->sense_updated
= 1;
9112 if (spec
->jack_present
) {
9113 /* mute internal speaker */
9114 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9115 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9116 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9117 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9119 /* unmute internal speaker if necessary */
9120 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9121 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9122 HDA_AMP_MUTE
, mute
);
9123 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9124 HDA_AMP_MUTE
, mute
);
9128 /* unsolicited event for HP jack sensing */
9129 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
9132 if ((res
>> 26) != ALC_HP_EVENT
)
9134 alc262_lenovo_3000_automute(codec
, 1);
9137 /* bind hp and internal speaker mute (with plug check) */
9138 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
9139 struct snd_ctl_elem_value
*ucontrol
)
9141 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9142 long *valp
= ucontrol
->value
.integer
.value
;
9145 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9147 valp
? 0 : HDA_AMP_MUTE
);
9148 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9150 valp
? 0 : HDA_AMP_MUTE
);
9153 alc262_fujitsu_automute(codec
, 0);
9157 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
9158 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9160 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9161 .name
= "Master Playback Switch",
9162 .info
= snd_hda_mixer_amp_switch_info
,
9163 .get
= snd_hda_mixer_amp_switch_get
,
9164 .put
= alc262_fujitsu_master_sw_put
,
9165 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9169 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT
),
9170 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT
),
9171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9174 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9175 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9176 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9180 /* bind hp and internal speaker mute (with plug check) */
9181 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
9182 struct snd_ctl_elem_value
*ucontrol
)
9184 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9185 long *valp
= ucontrol
->value
.integer
.value
;
9188 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9190 valp
? 0 : HDA_AMP_MUTE
);
9193 alc262_lenovo_3000_automute(codec
, 0);
9197 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
9198 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9200 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9201 .name
= "Master Playback Switch",
9202 .info
= snd_hda_mixer_amp_switch_info
,
9203 .get
= snd_hda_mixer_amp_switch_get
,
9204 .put
= alc262_lenovo_3000_master_sw_put
,
9205 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
9207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9209 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9212 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9213 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9214 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9218 /* additional init verbs for Benq laptops */
9219 static struct hda_verb alc262_EAPD_verbs
[] = {
9220 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9221 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9225 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
9226 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9229 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9230 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9234 /* Samsung Q1 Ultra Vista model setup */
9235 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
9236 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9237 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
9238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9240 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
9241 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
9245 static struct hda_verb alc262_ultra_verbs
[] = {
9247 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9253 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9254 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9259 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9260 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9262 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9264 /* ADC, choose mic */
9265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
9278 /* mute/unmute internal speaker according to the hp jack and mute state */
9279 static void alc262_ultra_automute(struct hda_codec
*codec
)
9281 struct alc_spec
*spec
= codec
->spec
;
9285 /* auto-mute only when HP is used as HP */
9286 if (!spec
->cur_mux
[0]) {
9287 unsigned int present
;
9288 /* need to execute and sync at first */
9289 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9290 present
= snd_hda_codec_read(codec
, 0x15, 0,
9291 AC_VERB_GET_PIN_SENSE
, 0);
9292 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9293 if (spec
->jack_present
)
9294 mute
= HDA_AMP_MUTE
;
9296 /* mute/unmute internal speaker */
9297 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9298 HDA_AMP_MUTE
, mute
);
9299 /* mute/unmute HP */
9300 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9301 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
9304 /* unsolicited event for HP jack sensing */
9305 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
9308 if ((res
>> 26) != ALC880_HP_EVENT
)
9310 alc262_ultra_automute(codec
);
9313 static struct hda_input_mux alc262_ultra_capture_source
= {
9317 { "Headphone", 0x7 },
9321 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
9322 struct snd_ctl_elem_value
*ucontrol
)
9324 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9325 struct alc_spec
*spec
= codec
->spec
;
9328 ret
= alc882_mux_enum_put(kcontrol
, ucontrol
);
9331 /* reprogram the HP pin as mic or HP according to the input source */
9332 snd_hda_codec_write_cache(codec
, 0x15, 0,
9333 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9334 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
9335 alc262_ultra_automute(codec
); /* mute/unmute HP */
9339 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
9340 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
9341 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
9343 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9344 .name
= "Capture Source",
9345 .info
= alc882_mux_enum_info
,
9346 .get
= alc882_mux_enum_get
,
9347 .put
= alc262_ultra_mux_enum_put
,
9352 /* add playback controls from the parsed DAC table */
9353 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9354 const struct auto_pin_cfg
*cfg
)
9359 spec
->multiout
.num_dacs
= 1; /* only use one dac */
9360 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9361 spec
->multiout
.dac_nids
[0] = 2;
9363 nid
= cfg
->line_out_pins
[0];
9365 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9366 "Front Playback Volume",
9367 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
9370 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9371 "Front Playback Switch",
9372 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
9377 nid
= cfg
->speaker_pins
[0];
9380 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9381 "Speaker Playback Volume",
9382 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9386 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9387 "Speaker Playback Switch",
9388 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9393 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9394 "Speaker Playback Switch",
9395 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9401 nid
= cfg
->hp_pins
[0];
9403 /* spec->multiout.hp_nid = 2; */
9405 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9406 "Headphone Playback Volume",
9407 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9411 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9412 "Headphone Playback Switch",
9413 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9418 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9419 "Headphone Playback Switch",
9420 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9429 /* identical with ALC880 */
9430 #define alc262_auto_create_analog_input_ctls \
9431 alc880_auto_create_analog_input_ctls
9434 * generic initialization of ADC, input mixers and output mixers
9436 static struct hda_verb alc262_volume_init_verbs
[] = {
9438 * Unmute ADC0-2 and set the default input to mic-in
9440 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9442 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9444 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9445 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9447 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9449 * Note: PASD motherboards uses the Line In 2 as the input for
9450 * front panel mic (mic 2)
9452 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9460 * Set up output mixers (0x0c - 0x0f)
9462 /* set vol=0 to output mixers */
9463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9467 /* set up input amps for analog loopback */
9468 /* Amp Indices: DAC = 0, mixer = 1 */
9469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9476 /* FIXME: use matrix-type input source selection */
9477 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9478 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9482 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9497 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
9499 * Unmute ADC0-2 and set the default input to mic-in
9501 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9503 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9505 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9508 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9510 * Note: PASD motherboards uses the Line In 2 as the input for
9511 * front panel mic (mic 2)
9513 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9523 * Set up output mixers (0x0c - 0x0e)
9525 /* set vol=0 to output mixers */
9526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9530 /* set up input amps for analog loopback */
9531 /* Amp Indices: DAC = 0, mixer = 1 */
9532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9536 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9539 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9540 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9541 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9546 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9547 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9550 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9553 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9555 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9556 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9557 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9558 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9559 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9560 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9563 /* FIXME: use matrix-type input source selection */
9564 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9565 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9566 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9567 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9568 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9569 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9571 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9572 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9574 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9586 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
9588 * Unmute ADC0-2 and set the default input to mic-in
9590 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9591 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9592 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9594 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9597 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9599 * Note: PASD motherboards uses the Line In 2 as the input for front
9602 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9612 * Set up output mixers (0x0c - 0x0e)
9614 /* set vol=0 to output mixers */
9615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9619 /* set up input amps for analog loopback */
9620 /* Amp Indices: DAC = 0, mixer = 1 */
9621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
9630 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
9631 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
9632 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
9633 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
9634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
9635 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
9637 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9640 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9641 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9643 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9644 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9645 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9646 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9647 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9648 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9650 /* FIXME: use matrix-type input source selection */
9651 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9652 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
9655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
9656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
9657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
9658 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
9661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9666 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9674 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9677 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9682 #ifdef CONFIG_SND_HDA_POWER_SAVE
9683 #define alc262_loopbacks alc880_loopbacks
9686 /* pcm configuration: identiacal with ALC880 */
9687 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9688 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9689 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9690 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9693 * BIOS auto configuration
9695 static int alc262_parse_auto_config(struct hda_codec
*codec
)
9697 struct alc_spec
*spec
= codec
->spec
;
9699 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
9701 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9705 if (!spec
->autocfg
.line_outs
)
9706 return 0; /* can't find valid BIOS pin config */
9707 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9710 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9714 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
9716 if (spec
->autocfg
.dig_out_pin
)
9717 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
9718 if (spec
->autocfg
.dig_in_pin
)
9719 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
9721 if (spec
->kctl_alloc
)
9722 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9724 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
9725 spec
->num_mux_defs
= 1;
9726 spec
->input_mux
= &spec
->private_imux
;
9728 err
= alc_auto_add_mic_boost(codec
);
9735 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9736 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9737 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9738 #define alc262_auto_init_input_src alc882_auto_init_input_src
9741 /* init callback for auto-configuration model -- overriding the default init */
9742 static void alc262_auto_init(struct hda_codec
*codec
)
9744 struct alc_spec
*spec
= codec
->spec
;
9745 alc262_auto_init_multi_out(codec
);
9746 alc262_auto_init_hp_out(codec
);
9747 alc262_auto_init_analog_input(codec
);
9748 alc262_auto_init_input_src(codec
);
9749 if (spec
->unsol_event
)
9750 alc_sku_automute(codec
);
9754 * configuration and preset
9756 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
9757 [ALC262_BASIC
] = "basic",
9758 [ALC262_HIPPO
] = "hippo",
9759 [ALC262_HIPPO_1
] = "hippo_1",
9760 [ALC262_FUJITSU
] = "fujitsu",
9761 [ALC262_HP_BPC
] = "hp-bpc",
9762 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
9763 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
9764 [ALC262_HP_RP5700
] = "hp-rp5700",
9765 [ALC262_BENQ_ED8
] = "benq",
9766 [ALC262_BENQ_T31
] = "benq-t31",
9767 [ALC262_SONY_ASSAMD
] = "sony-assamd",
9768 [ALC262_ULTRA
] = "ultra",
9769 [ALC262_LENOVO_3000
] = "lenovo-3000",
9770 [ALC262_NEC
] = "nec",
9771 [ALC262_AUTO
] = "auto",
9774 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
9775 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
9776 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
9777 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
9778 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
9779 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
9780 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
9781 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
9782 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
9783 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
9784 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
9785 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9786 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9787 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9788 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9789 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9790 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9791 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9792 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9793 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
9794 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
9795 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
9796 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9797 ALC262_HP_TC_T5735
),
9798 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
9799 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9800 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
9801 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9802 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9803 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
9804 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9805 ALC262_SONY_ASSAMD
),
9806 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
9807 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
9808 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
9809 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA
),
9810 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
9811 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
9812 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
9813 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
9817 static struct alc_config_preset alc262_presets
[] = {
9819 .mixers
= { alc262_base_mixer
},
9820 .init_verbs
= { alc262_init_verbs
},
9821 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9822 .dac_nids
= alc262_dac_nids
,
9824 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9825 .channel_mode
= alc262_modes
,
9826 .input_mux
= &alc262_capture_source
,
9829 .mixers
= { alc262_base_mixer
},
9830 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
9831 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9832 .dac_nids
= alc262_dac_nids
,
9834 .dig_out_nid
= ALC262_DIGOUT_NID
,
9835 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9836 .channel_mode
= alc262_modes
,
9837 .input_mux
= &alc262_capture_source
,
9838 .unsol_event
= alc262_hippo_unsol_event
,
9839 .init_hook
= alc262_hippo_automute
,
9841 [ALC262_HIPPO_1
] = {
9842 .mixers
= { alc262_hippo1_mixer
},
9843 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
9844 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9845 .dac_nids
= alc262_dac_nids
,
9847 .dig_out_nid
= ALC262_DIGOUT_NID
,
9848 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9849 .channel_mode
= alc262_modes
,
9850 .input_mux
= &alc262_capture_source
,
9851 .unsol_event
= alc262_hippo1_unsol_event
,
9852 .init_hook
= alc262_hippo1_automute
,
9854 [ALC262_FUJITSU
] = {
9855 .mixers
= { alc262_fujitsu_mixer
},
9856 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9857 alc262_fujitsu_unsol_verbs
},
9858 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9859 .dac_nids
= alc262_dac_nids
,
9861 .dig_out_nid
= ALC262_DIGOUT_NID
,
9862 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9863 .channel_mode
= alc262_modes
,
9864 .input_mux
= &alc262_fujitsu_capture_source
,
9865 .unsol_event
= alc262_fujitsu_unsol_event
,
9866 .init_hook
= alc262_fujitsu_init_hook
,
9869 .mixers
= { alc262_HP_BPC_mixer
},
9870 .init_verbs
= { alc262_HP_BPC_init_verbs
},
9871 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9872 .dac_nids
= alc262_dac_nids
,
9874 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9875 .channel_mode
= alc262_modes
,
9876 .input_mux
= &alc262_HP_capture_source
,
9877 .unsol_event
= alc262_hp_bpc_unsol_event
,
9878 .init_hook
= alc262_hp_bpc_automute
,
9880 [ALC262_HP_BPC_D7000_WF
] = {
9881 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
9882 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9883 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9884 .dac_nids
= alc262_dac_nids
,
9886 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9887 .channel_mode
= alc262_modes
,
9888 .input_mux
= &alc262_HP_D7000_capture_source
,
9889 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9890 .init_hook
= alc262_hp_wildwest_automute
,
9892 [ALC262_HP_BPC_D7000_WL
] = {
9893 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
9894 alc262_HP_BPC_WildWest_option_mixer
},
9895 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9896 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9897 .dac_nids
= alc262_dac_nids
,
9899 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9900 .channel_mode
= alc262_modes
,
9901 .input_mux
= &alc262_HP_D7000_capture_source
,
9902 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9903 .init_hook
= alc262_hp_wildwest_automute
,
9905 [ALC262_HP_TC_T5735
] = {
9906 .mixers
= { alc262_hp_t5735_mixer
},
9907 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
9908 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9909 .dac_nids
= alc262_dac_nids
,
9911 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9912 .channel_mode
= alc262_modes
,
9913 .input_mux
= &alc262_capture_source
,
9914 .unsol_event
= alc262_hp_t5735_unsol_event
,
9915 .init_hook
= alc262_hp_t5735_init_hook
,
9917 [ALC262_HP_RP5700
] = {
9918 .mixers
= { alc262_hp_rp5700_mixer
},
9919 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
9920 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9921 .dac_nids
= alc262_dac_nids
,
9922 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9923 .channel_mode
= alc262_modes
,
9924 .input_mux
= &alc262_hp_rp5700_capture_source
,
9926 [ALC262_BENQ_ED8
] = {
9927 .mixers
= { alc262_base_mixer
},
9928 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
9929 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9930 .dac_nids
= alc262_dac_nids
,
9932 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9933 .channel_mode
= alc262_modes
,
9934 .input_mux
= &alc262_capture_source
,
9936 [ALC262_SONY_ASSAMD
] = {
9937 .mixers
= { alc262_sony_mixer
},
9938 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
9939 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9940 .dac_nids
= alc262_dac_nids
,
9942 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9943 .channel_mode
= alc262_modes
,
9944 .input_mux
= &alc262_capture_source
,
9945 .unsol_event
= alc262_hippo_unsol_event
,
9946 .init_hook
= alc262_hippo_automute
,
9948 [ALC262_BENQ_T31
] = {
9949 .mixers
= { alc262_benq_t31_mixer
},
9950 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
9951 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9952 .dac_nids
= alc262_dac_nids
,
9954 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9955 .channel_mode
= alc262_modes
,
9956 .input_mux
= &alc262_capture_source
,
9957 .unsol_event
= alc262_hippo_unsol_event
,
9958 .init_hook
= alc262_hippo_automute
,
9961 .mixers
= { alc262_ultra_mixer
, alc262_ultra_capture_mixer
},
9962 .init_verbs
= { alc262_ultra_verbs
},
9963 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9964 .dac_nids
= alc262_dac_nids
,
9965 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9966 .channel_mode
= alc262_modes
,
9967 .input_mux
= &alc262_ultra_capture_source
,
9968 .adc_nids
= alc262_adc_nids
, /* ADC0 */
9969 .capsrc_nids
= alc262_capsrc_nids
,
9970 .num_adc_nids
= 1, /* single ADC */
9971 .unsol_event
= alc262_ultra_unsol_event
,
9972 .init_hook
= alc262_ultra_automute
,
9974 [ALC262_LENOVO_3000
] = {
9975 .mixers
= { alc262_lenovo_3000_mixer
},
9976 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9977 alc262_lenovo_3000_unsol_verbs
},
9978 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9979 .dac_nids
= alc262_dac_nids
,
9981 .dig_out_nid
= ALC262_DIGOUT_NID
,
9982 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9983 .channel_mode
= alc262_modes
,
9984 .input_mux
= &alc262_fujitsu_capture_source
,
9985 .unsol_event
= alc262_lenovo_3000_unsol_event
,
9988 .mixers
= { alc262_nec_mixer
},
9989 .init_verbs
= { alc262_nec_verbs
},
9990 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9991 .dac_nids
= alc262_dac_nids
,
9993 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9994 .channel_mode
= alc262_modes
,
9995 .input_mux
= &alc262_capture_source
,
9999 static int patch_alc262(struct hda_codec
*codec
)
10001 struct alc_spec
*spec
;
10005 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10009 codec
->spec
= spec
;
10011 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10016 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10017 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
10018 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10019 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
10023 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10025 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
10029 if (board_config
< 0) {
10030 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
10031 "trying auto-probe from BIOS...\n");
10032 board_config
= ALC262_AUTO
;
10035 if (board_config
== ALC262_AUTO
) {
10036 /* automatic parse from the BIOS config */
10037 err
= alc262_parse_auto_config(codec
);
10043 "hda_codec: Cannot set up configuration "
10044 "from BIOS. Using base mode...\n");
10045 board_config
= ALC262_BASIC
;
10049 if (board_config
!= ALC262_AUTO
)
10050 setup_preset(spec
, &alc262_presets
[board_config
]);
10052 spec
->stream_name_analog
= "ALC262 Analog";
10053 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
10054 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
10056 spec
->stream_name_digital
= "ALC262 Digital";
10057 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
10058 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
10060 if (!spec
->adc_nids
&& spec
->input_mux
) {
10061 /* check whether NID 0x07 is valid */
10062 unsigned int wcap
= get_wcaps(codec
, 0x07);
10065 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10066 if (wcap
!= AC_WID_AUD_IN
) {
10067 spec
->adc_nids
= alc262_adc_nids_alt
;
10068 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
10069 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
10070 spec
->mixers
[spec
->num_mixers
] =
10071 alc262_capture_alt_mixer
;
10072 spec
->num_mixers
++;
10074 spec
->adc_nids
= alc262_adc_nids
;
10075 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
10076 spec
->capsrc_nids
= alc262_capsrc_nids
;
10077 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
10078 spec
->num_mixers
++;
10082 spec
->vmaster_nid
= 0x0c;
10084 codec
->patch_ops
= alc_patch_ops
;
10085 if (board_config
== ALC262_AUTO
)
10086 spec
->init_hook
= alc262_auto_init
;
10087 #ifdef CONFIG_SND_HDA_POWER_SAVE
10088 if (!spec
->loopback
.amplist
)
10089 spec
->loopback
.amplist
= alc262_loopbacks
;
10096 * ALC268 channel source setting (2 channel)
10098 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10099 #define alc268_modes alc260_modes
10101 static hda_nid_t alc268_dac_nids
[2] = {
10106 static hda_nid_t alc268_adc_nids
[2] = {
10111 static hda_nid_t alc268_adc_nids_alt
[1] = {
10116 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
10118 static struct snd_kcontrol_new alc268_base_mixer
[] = {
10119 /* output mixer control */
10120 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10121 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10122 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10124 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10125 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10126 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10130 /* bind Beep switches of both NID 0x0f and 0x10 */
10131 static struct hda_bind_ctls alc268_bind_beep_sw
= {
10132 .ops
= &snd_hda_bind_sw
,
10134 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
10135 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
10140 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
10141 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
10142 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
10146 static struct hda_verb alc268_eapd_verbs
[] = {
10147 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10148 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10152 /* Toshiba specific */
10153 #define alc268_toshiba_automute alc262_hippo_automute
10155 static struct hda_verb alc268_toshiba_verbs
[] = {
10156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10160 /* Acer specific */
10161 /* bind volumes of both NID 0x02 and 0x03 */
10162 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
10163 .ops
= &snd_hda_bind_vol
,
10165 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
10166 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
10171 /* mute/unmute internal speaker according to the hp jack and mute state */
10172 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
10174 struct alc_spec
*spec
= codec
->spec
;
10177 if (force
|| !spec
->sense_updated
) {
10178 unsigned int present
;
10179 present
= snd_hda_codec_read(codec
, 0x14, 0,
10180 AC_VERB_GET_PIN_SENSE
, 0);
10181 spec
->jack_present
= (present
& 0x80000000) != 0;
10182 spec
->sense_updated
= 1;
10184 if (spec
->jack_present
)
10185 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
10186 else /* unmute internal speaker if necessary */
10187 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10188 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10189 HDA_AMP_MUTE
, mute
);
10193 /* bind hp and internal speaker mute (with plug check) */
10194 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
10195 struct snd_ctl_elem_value
*ucontrol
)
10197 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10198 long *valp
= ucontrol
->value
.integer
.value
;
10201 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
10203 valp
[0] ? 0 : HDA_AMP_MUTE
);
10204 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
10206 valp
[1] ? 0 : HDA_AMP_MUTE
);
10208 alc268_acer_automute(codec
, 0);
10212 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
10213 /* output mixer control */
10214 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10216 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10217 .name
= "Master Playback Switch",
10218 .info
= snd_hda_mixer_amp_switch_info
,
10219 .get
= snd_hda_mixer_amp_switch_get
,
10220 .put
= alc268_acer_master_sw_put
,
10221 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10224 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10225 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10229 static struct hda_verb alc268_acer_verbs
[] = {
10230 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
10231 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10232 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10234 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10235 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10237 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10241 /* unsolicited event for HP jack sensing */
10242 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
10245 if ((res
>> 26) != ALC880_HP_EVENT
)
10247 alc268_toshiba_automute(codec
);
10250 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
10253 if ((res
>> 26) != ALC880_HP_EVENT
)
10255 alc268_acer_automute(codec
, 1);
10258 static void alc268_acer_init_hook(struct hda_codec
*codec
)
10260 alc268_acer_automute(codec
, 1);
10263 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
10264 /* output mixer control */
10265 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10266 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10267 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10269 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10270 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10274 static struct hda_verb alc268_dell_verbs
[] = {
10275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10281 /* mute/unmute internal speaker according to the hp jack and mute state */
10282 static void alc268_dell_automute(struct hda_codec
*codec
)
10284 unsigned int present
;
10287 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
10288 if (present
& 0x80000000)
10289 mute
= HDA_AMP_MUTE
;
10291 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
10292 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10293 HDA_AMP_MUTE
, mute
);
10296 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
10299 if ((res
>> 26) != ALC880_HP_EVENT
)
10301 alc268_dell_automute(codec
);
10304 #define alc268_dell_init_hook alc268_dell_automute
10306 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
10307 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10308 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10309 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10311 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10312 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
10313 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
10314 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10318 static struct hda_verb alc267_quanta_il1_verbs
[] = {
10319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10320 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
10324 static void alc267_quanta_il1_hp_automute(struct hda_codec
*codec
)
10326 unsigned int present
;
10328 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
10329 & AC_PINSENSE_PRESENCE
;
10330 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
10331 present
? 0 : PIN_OUT
);
10334 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
10336 unsigned int present
;
10338 present
= snd_hda_codec_read(codec
, 0x18, 0,
10339 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10340 snd_hda_codec_write(codec
, 0x23, 0,
10341 AC_VERB_SET_CONNECT_SEL
,
10342 present
? 0x00 : 0x01);
10345 static void alc267_quanta_il1_automute(struct hda_codec
*codec
)
10347 alc267_quanta_il1_hp_automute(codec
);
10348 alc267_quanta_il1_mic_automute(codec
);
10351 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
10354 switch (res
>> 26) {
10355 case ALC880_HP_EVENT
:
10356 alc267_quanta_il1_hp_automute(codec
);
10358 case ALC880_MIC_EVENT
:
10359 alc267_quanta_il1_mic_automute(codec
);
10365 * generic initialization of ADC, input mixers and output mixers
10367 static struct hda_verb alc268_base_init_verbs
[] = {
10368 /* Unmute DAC0-1 and set vol = 0 */
10369 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10370 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10371 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10372 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10373 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10374 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10377 * Set up output mixers (0x0c - 0x0e)
10379 /* set vol=0 to output mixers */
10380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10381 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10382 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10383 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
10385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10386 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10391 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10392 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10394 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10395 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10399 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10400 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10401 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10402 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10403 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10405 /* set PCBEEP vol = 0, mute connections */
10406 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10408 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10410 /* Unmute Selector 23h,24h and set the default input to mic-in */
10412 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
10413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10414 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
10415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10421 * generic initialization of ADC, input mixers and output mixers
10423 static struct hda_verb alc268_volume_init_verbs
[] = {
10424 /* set output DAC */
10425 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10426 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10427 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10428 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10431 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10432 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10433 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10434 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10440 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10442 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10445 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10447 /* set PCBEEP vol = 0, mute connections */
10448 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10449 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10450 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10455 #define alc268_mux_enum_info alc_mux_enum_info
10456 #define alc268_mux_enum_get alc_mux_enum_get
10457 #define alc268_mux_enum_put alc_mux_enum_put
10459 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
10460 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10461 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10463 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10464 /* The multiple "Capture Source" controls confuse alsamixer
10465 * So call somewhat different..
10467 /* .name = "Capture Source", */
10468 .name
= "Input Source",
10470 .info
= alc268_mux_enum_info
,
10471 .get
= alc268_mux_enum_get
,
10472 .put
= alc268_mux_enum_put
,
10477 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
10478 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10479 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10480 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
10481 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
10483 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10484 /* The multiple "Capture Source" controls confuse alsamixer
10485 * So call somewhat different..
10487 /* .name = "Capture Source", */
10488 .name
= "Input Source",
10490 .info
= alc268_mux_enum_info
,
10491 .get
= alc268_mux_enum_get
,
10492 .put
= alc268_mux_enum_put
,
10497 static struct hda_input_mux alc268_capture_source
= {
10501 { "Front Mic", 0x1 },
10507 static struct hda_input_mux alc268_acer_capture_source
= {
10511 { "Internal Mic", 0x6 },
10516 #ifdef CONFIG_SND_DEBUG
10517 static struct snd_kcontrol_new alc268_test_mixer
[] = {
10518 /* Volume widgets */
10519 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10520 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10521 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
10522 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
10523 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
10524 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
10525 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
10526 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
10527 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
10528 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
10529 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
10530 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
10531 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
10532 /* The below appears problematic on some hardwares */
10533 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10534 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10535 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
10536 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
10537 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
10539 /* Modes for retasking pin widgets */
10540 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
10541 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
10542 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
10543 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
10545 /* Controls for GPIO pins, assuming they are configured as outputs */
10546 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10547 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10548 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10549 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10551 /* Switches to allow the digital SPDIF output pin to be enabled.
10552 * The ALC268 does not have an SPDIF input.
10554 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10556 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10557 * this output to turn on an external amplifier.
10559 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10560 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10566 /* create input playback/capture controls for the given pin */
10567 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
10568 const char *ctlname
, int idx
)
10573 sprintf(name
, "%s Playback Volume", ctlname
);
10575 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10576 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
10580 } else if (nid
== 0x15) {
10581 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10582 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
10588 sprintf(name
, "%s Playback Switch", ctlname
);
10589 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
10590 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
10596 /* add playback controls from the parsed DAC table */
10597 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10598 const struct auto_pin_cfg
*cfg
)
10603 spec
->multiout
.num_dacs
= 2; /* only use one dac */
10604 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10605 spec
->multiout
.dac_nids
[0] = 2;
10606 spec
->multiout
.dac_nids
[1] = 3;
10608 nid
= cfg
->line_out_pins
[0];
10610 alc268_new_analog_output(spec
, nid
, "Front", 0);
10612 nid
= cfg
->speaker_pins
[0];
10614 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10615 "Speaker Playback Volume",
10616 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10620 nid
= cfg
->hp_pins
[0];
10622 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
10624 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
10626 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10627 "Mono Playback Switch",
10628 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
10635 /* create playback/capture controls for input pins */
10636 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10637 const struct auto_pin_cfg
*cfg
)
10639 struct hda_input_mux
*imux
= &spec
->private_imux
;
10642 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10643 switch(cfg
->input_pins
[i
]) {
10645 idx1
= 0; /* Mic 1 */
10648 idx1
= 1; /* Mic 2 */
10651 idx1
= 2; /* Line In */
10658 idx1
= 6; /* digital mics */
10663 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10664 imux
->items
[imux
->num_items
].index
= idx1
;
10670 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
10672 struct alc_spec
*spec
= codec
->spec
;
10673 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10674 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10675 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10676 unsigned int dac_vol1
, dac_vol2
;
10679 snd_hda_codec_write(codec
, speaker_nid
, 0,
10680 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
10681 snd_hda_codec_write(codec
, 0x0f, 0,
10682 AC_VERB_SET_AMP_GAIN_MUTE
,
10684 snd_hda_codec_write(codec
, 0x10, 0,
10685 AC_VERB_SET_AMP_GAIN_MUTE
,
10688 snd_hda_codec_write(codec
, 0x0f, 0,
10689 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10690 snd_hda_codec_write(codec
, 0x10, 0,
10691 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10694 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
10695 if (line_nid
== 0x14)
10696 dac_vol2
= AMP_OUT_ZERO
;
10697 else if (line_nid
== 0x15)
10698 dac_vol1
= AMP_OUT_ZERO
;
10699 if (hp_nid
== 0x14)
10700 dac_vol2
= AMP_OUT_ZERO
;
10701 else if (hp_nid
== 0x15)
10702 dac_vol1
= AMP_OUT_ZERO
;
10703 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
10704 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
10705 spec
->autocfg
.line_out_pins
[2] != 0x16)
10706 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
10708 snd_hda_codec_write(codec
, 0x02, 0,
10709 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
10710 snd_hda_codec_write(codec
, 0x03, 0,
10711 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
10714 /* pcm configuration: identiacal with ALC880 */
10715 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10716 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10717 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10718 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10721 * BIOS auto configuration
10723 static int alc268_parse_auto_config(struct hda_codec
*codec
)
10725 struct alc_spec
*spec
= codec
->spec
;
10727 static hda_nid_t alc268_ignore
[] = { 0 };
10729 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10733 if (!spec
->autocfg
.line_outs
)
10734 return 0; /* can't find valid BIOS pin config */
10736 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10739 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10743 spec
->multiout
.max_channels
= 2;
10745 /* digital only support output */
10746 if (spec
->autocfg
.dig_out_pin
)
10747 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
10749 if (spec
->kctl_alloc
)
10750 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10752 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
10753 spec
->mixers
[spec
->num_mixers
++] = alc268_beep_mixer
;
10755 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
10756 spec
->num_mux_defs
= 1;
10757 spec
->input_mux
= &spec
->private_imux
;
10759 err
= alc_auto_add_mic_boost(codec
);
10766 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10767 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10768 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10770 /* init callback for auto-configuration model -- overriding the default init */
10771 static void alc268_auto_init(struct hda_codec
*codec
)
10773 struct alc_spec
*spec
= codec
->spec
;
10774 alc268_auto_init_multi_out(codec
);
10775 alc268_auto_init_hp_out(codec
);
10776 alc268_auto_init_mono_speaker_out(codec
);
10777 alc268_auto_init_analog_input(codec
);
10778 if (spec
->unsol_event
)
10779 alc_sku_automute(codec
);
10783 * configuration and preset
10785 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
10786 [ALC267_QUANTA_IL1
] = "quanta-il1",
10787 [ALC268_3ST
] = "3stack",
10788 [ALC268_TOSHIBA
] = "toshiba",
10789 [ALC268_ACER
] = "acer",
10790 [ALC268_DELL
] = "dell",
10791 [ALC268_ZEPTO
] = "zepto",
10792 #ifdef CONFIG_SND_DEBUG
10793 [ALC268_TEST
] = "test",
10795 [ALC268_AUTO
] = "auto",
10798 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
10799 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
10800 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
10801 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
10802 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
10803 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
10804 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
10805 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
10806 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
10807 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
10808 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
10809 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
10810 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
10811 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
10812 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
10816 static struct alc_config_preset alc268_presets
[] = {
10817 [ALC267_QUANTA_IL1
] = {
10818 .mixers
= { alc267_quanta_il1_mixer
},
10819 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10820 alc267_quanta_il1_verbs
},
10821 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10822 .dac_nids
= alc268_dac_nids
,
10823 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10824 .adc_nids
= alc268_adc_nids_alt
,
10826 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10827 .channel_mode
= alc268_modes
,
10828 .input_mux
= &alc268_capture_source
,
10829 .unsol_event
= alc267_quanta_il1_unsol_event
,
10830 .init_hook
= alc267_quanta_il1_automute
,
10833 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10834 alc268_beep_mixer
},
10835 .init_verbs
= { alc268_base_init_verbs
},
10836 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10837 .dac_nids
= alc268_dac_nids
,
10838 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10839 .adc_nids
= alc268_adc_nids_alt
,
10840 .capsrc_nids
= alc268_capsrc_nids
,
10842 .dig_out_nid
= ALC268_DIGOUT_NID
,
10843 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10844 .channel_mode
= alc268_modes
,
10845 .input_mux
= &alc268_capture_source
,
10847 [ALC268_TOSHIBA
] = {
10848 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10849 alc268_beep_mixer
},
10850 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10851 alc268_toshiba_verbs
},
10852 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10853 .dac_nids
= alc268_dac_nids
,
10854 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10855 .adc_nids
= alc268_adc_nids_alt
,
10856 .capsrc_nids
= alc268_capsrc_nids
,
10858 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10859 .channel_mode
= alc268_modes
,
10860 .input_mux
= &alc268_capture_source
,
10861 .unsol_event
= alc268_toshiba_unsol_event
,
10862 .init_hook
= alc268_toshiba_automute
,
10865 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
10866 alc268_beep_mixer
},
10867 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10868 alc268_acer_verbs
},
10869 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10870 .dac_nids
= alc268_dac_nids
,
10871 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10872 .adc_nids
= alc268_adc_nids_alt
,
10873 .capsrc_nids
= alc268_capsrc_nids
,
10875 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10876 .channel_mode
= alc268_modes
,
10877 .input_mux
= &alc268_acer_capture_source
,
10878 .unsol_event
= alc268_acer_unsol_event
,
10879 .init_hook
= alc268_acer_init_hook
,
10882 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
10883 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10884 alc268_dell_verbs
},
10885 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10886 .dac_nids
= alc268_dac_nids
,
10888 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10889 .channel_mode
= alc268_modes
,
10890 .unsol_event
= alc268_dell_unsol_event
,
10891 .init_hook
= alc268_dell_init_hook
,
10892 .input_mux
= &alc268_capture_source
,
10895 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10896 alc268_beep_mixer
},
10897 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10898 alc268_toshiba_verbs
},
10899 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10900 .dac_nids
= alc268_dac_nids
,
10901 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10902 .adc_nids
= alc268_adc_nids_alt
,
10903 .capsrc_nids
= alc268_capsrc_nids
,
10905 .dig_out_nid
= ALC268_DIGOUT_NID
,
10906 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10907 .channel_mode
= alc268_modes
,
10908 .input_mux
= &alc268_capture_source
,
10909 .unsol_event
= alc268_toshiba_unsol_event
,
10910 .init_hook
= alc268_toshiba_automute
10912 #ifdef CONFIG_SND_DEBUG
10914 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
10915 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10916 alc268_volume_init_verbs
},
10917 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10918 .dac_nids
= alc268_dac_nids
,
10919 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10920 .adc_nids
= alc268_adc_nids_alt
,
10921 .capsrc_nids
= alc268_capsrc_nids
,
10923 .dig_out_nid
= ALC268_DIGOUT_NID
,
10924 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10925 .channel_mode
= alc268_modes
,
10926 .input_mux
= &alc268_capture_source
,
10931 static int patch_alc268(struct hda_codec
*codec
)
10933 struct alc_spec
*spec
;
10937 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
10941 codec
->spec
= spec
;
10943 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
10947 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
10948 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
10949 "trying auto-probe from BIOS...\n");
10950 board_config
= ALC268_AUTO
;
10953 if (board_config
== ALC268_AUTO
) {
10954 /* automatic parse from the BIOS config */
10955 err
= alc268_parse_auto_config(codec
);
10961 "hda_codec: Cannot set up configuration "
10962 "from BIOS. Using base mode...\n");
10963 board_config
= ALC268_3ST
;
10967 if (board_config
!= ALC268_AUTO
)
10968 setup_preset(spec
, &alc268_presets
[board_config
]);
10970 if (codec
->vendor_id
== 0x10ec0267) {
10971 spec
->stream_name_analog
= "ALC267 Analog";
10972 spec
->stream_name_digital
= "ALC267 Digital";
10974 spec
->stream_name_analog
= "ALC268 Analog";
10975 spec
->stream_name_digital
= "ALC268 Digital";
10978 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
10979 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
10980 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
10982 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
10984 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
10985 /* override the amp caps for beep generator */
10986 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
10987 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
10988 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
10989 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
10990 (0 << AC_AMPCAP_MUTE_SHIFT
));
10992 if (!spec
->adc_nids
&& spec
->input_mux
) {
10993 /* check whether NID 0x07 is valid */
10994 unsigned int wcap
= get_wcaps(codec
, 0x07);
10998 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10999 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
11000 spec
->adc_nids
= alc268_adc_nids_alt
;
11001 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
11002 spec
->mixers
[spec
->num_mixers
] =
11003 alc268_capture_alt_mixer
;
11004 spec
->num_mixers
++;
11006 spec
->adc_nids
= alc268_adc_nids
;
11007 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
11008 spec
->mixers
[spec
->num_mixers
] =
11009 alc268_capture_mixer
;
11010 spec
->num_mixers
++;
11012 spec
->capsrc_nids
= alc268_capsrc_nids
;
11013 /* set default input source */
11014 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
11015 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
11016 0, AC_VERB_SET_CONNECT_SEL
,
11017 spec
->input_mux
->items
[0].index
);
11020 spec
->vmaster_nid
= 0x02;
11022 codec
->patch_ops
= alc_patch_ops
;
11023 if (board_config
== ALC268_AUTO
)
11024 spec
->init_hook
= alc268_auto_init
;
11030 * ALC269 channel source setting (2 channel)
11032 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11034 #define alc269_dac_nids alc260_dac_nids
11036 static hda_nid_t alc269_adc_nids
[1] = {
11041 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
11049 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
11057 #define alc269_modes alc260_modes
11058 #define alc269_capture_source alc880_lg_lw_capture_source
11060 static struct snd_kcontrol_new alc269_base_mixer
[] = {
11061 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11062 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11066 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11069 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11072 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11076 /* bind volumes of both NID 0x0c and 0x0d */
11077 static struct hda_bind_ctls alc269_epc_bind_vol
= {
11078 .ops
= &snd_hda_bind_vol
,
11080 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
11081 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
11086 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
11087 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11088 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol
),
11089 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11093 /* capture mixer elements */
11094 static struct snd_kcontrol_new alc269_capture_mixer
[] = {
11095 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11096 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11098 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11099 /* The multiple "Capture Source" controls confuse alsamixer
11100 * So call somewhat different..
11102 /* .name = "Capture Source", */
11103 .name
= "Input Source",
11105 .info
= alc_mux_enum_info
,
11106 .get
= alc_mux_enum_get
,
11107 .put
= alc_mux_enum_put
,
11112 /* capture mixer elements */
11113 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
11114 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11115 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11120 * generic initialization of ADC, input mixers and output mixers
11122 static struct hda_verb alc269_init_verbs
[] = {
11124 * Unmute ADC0 and set the default input to mic-in
11126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11128 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11129 * analog-loopback mixer widget
11130 * Note: PASD motherboards uses the Line In 2 as the input for
11131 * front panel mic (mic 2)
11133 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11141 * Set up output mixers (0x0c - 0x0e)
11143 /* set vol=0 to output mixers */
11144 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11145 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11147 /* set up input amps for analog loopback */
11148 /* Amp Indices: DAC = 0, mixer = 1 */
11149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11156 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11158 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11159 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11160 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11164 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11166 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11167 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11169 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11170 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11172 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11173 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11175 /* FIXME: use matrix-type input source selection */
11176 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11177 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11178 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11184 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11185 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11189 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
11190 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11191 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
11192 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11193 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
11194 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11195 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11196 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11200 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
11201 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11202 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
11203 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
11205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11206 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11210 /* toggle speaker-output according to the hp-jack state */
11211 static void alc269_speaker_automute(struct hda_codec
*codec
)
11213 unsigned int present
;
11216 present
= snd_hda_codec_read(codec
, 0x15, 0,
11217 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11218 bits
= present
? AMP_IN_MUTE(0) : 0;
11219 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
11220 AMP_IN_MUTE(0), bits
);
11221 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
11222 AMP_IN_MUTE(0), bits
);
11225 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
11227 unsigned int present
;
11229 present
= snd_hda_codec_read(codec
, 0x18, 0, AC_VERB_GET_PIN_SENSE
, 0)
11230 & AC_PINSENSE_PRESENCE
;
11231 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
11235 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
11237 unsigned int present
;
11239 present
= snd_hda_codec_read(codec
, 0x18, 0, AC_VERB_GET_PIN_SENSE
, 0)
11240 & AC_PINSENSE_PRESENCE
;
11241 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11242 present
? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0));
11243 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11244 present
? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1));
11247 /* unsolicited event for HP jack sensing */
11248 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
11251 if ((res
>> 26) == ALC880_HP_EVENT
)
11252 alc269_speaker_automute(codec
);
11254 if ((res
>> 26) == ALC880_MIC_EVENT
)
11255 alc269_eeepc_dmic_automute(codec
);
11258 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
11260 alc269_speaker_automute(codec
);
11261 alc269_eeepc_dmic_automute(codec
);
11264 /* unsolicited event for HP jack sensing */
11265 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
11268 if ((res
>> 26) == ALC880_HP_EVENT
)
11269 alc269_speaker_automute(codec
);
11271 if ((res
>> 26) == ALC880_MIC_EVENT
)
11272 alc269_eeepc_amic_automute(codec
);
11275 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
11277 alc269_speaker_automute(codec
);
11278 alc269_eeepc_amic_automute(codec
);
11281 /* add playback controls from the parsed DAC table */
11282 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11283 const struct auto_pin_cfg
*cfg
)
11288 spec
->multiout
.num_dacs
= 1; /* only use one dac */
11289 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11290 spec
->multiout
.dac_nids
[0] = 2;
11292 nid
= cfg
->line_out_pins
[0];
11294 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11295 "Front Playback Volume",
11296 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
11299 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11300 "Front Playback Switch",
11301 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
11306 nid
= cfg
->speaker_pins
[0];
11308 if (!cfg
->line_out_pins
[0]) {
11309 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11310 "Speaker Playback Volume",
11311 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11317 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11318 "Speaker Playback Switch",
11319 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11324 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11325 "Speaker Playback Switch",
11326 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11332 nid
= cfg
->hp_pins
[0];
11334 /* spec->multiout.hp_nid = 2; */
11335 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
11336 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11337 "Headphone Playback Volume",
11338 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11344 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11345 "Headphone Playback Switch",
11346 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11351 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11352 "Headphone Playback Switch",
11353 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11362 #define alc269_auto_create_analog_input_ctls \
11363 alc880_auto_create_analog_input_ctls
11365 #ifdef CONFIG_SND_HDA_POWER_SAVE
11366 #define alc269_loopbacks alc880_loopbacks
11369 /* pcm configuration: identiacal with ALC880 */
11370 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11371 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11372 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11373 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11376 * BIOS auto configuration
11378 static int alc269_parse_auto_config(struct hda_codec
*codec
)
11380 struct alc_spec
*spec
= codec
->spec
;
11382 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
11384 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11389 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11392 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11396 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11398 if (spec
->autocfg
.dig_out_pin
)
11399 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
11401 if (spec
->kctl_alloc
)
11402 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11404 spec
->init_verbs
[spec
->num_init_verbs
++] = alc269_init_verbs
;
11405 spec
->num_mux_defs
= 1;
11406 spec
->input_mux
= &spec
->private_imux
;
11408 err
= alc_auto_add_mic_boost(codec
);
11412 spec
->mixers
[spec
->num_mixers
] = alc269_capture_mixer
;
11413 spec
->num_mixers
++;
11418 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11419 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11420 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11423 /* init callback for auto-configuration model -- overriding the default init */
11424 static void alc269_auto_init(struct hda_codec
*codec
)
11426 struct alc_spec
*spec
= codec
->spec
;
11427 alc269_auto_init_multi_out(codec
);
11428 alc269_auto_init_hp_out(codec
);
11429 alc269_auto_init_analog_input(codec
);
11430 if (spec
->unsol_event
)
11431 alc_sku_automute(codec
);
11435 * configuration and preset
11437 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
11438 [ALC269_BASIC
] = "basic",
11441 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
11442 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11443 ALC269_ASUS_EEEPC_P703
),
11444 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11445 ALC269_ASUS_EEEPC_P901
),
11449 static struct alc_config_preset alc269_presets
[] = {
11451 .mixers
= { alc269_base_mixer
, alc269_capture_mixer
},
11452 .init_verbs
= { alc269_init_verbs
},
11453 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11454 .dac_nids
= alc269_dac_nids
,
11456 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11457 .channel_mode
= alc269_modes
,
11458 .input_mux
= &alc269_capture_source
,
11460 [ALC269_ASUS_EEEPC_P703
] = {
11461 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
11462 .init_verbs
= { alc269_init_verbs
,
11463 alc269_eeepc_amic_init_verbs
},
11464 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11465 .dac_nids
= alc269_dac_nids
,
11467 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11468 .channel_mode
= alc269_modes
,
11469 .input_mux
= &alc269_eeepc_amic_capture_source
,
11470 .unsol_event
= alc269_eeepc_amic_unsol_event
,
11471 .init_hook
= alc269_eeepc_amic_inithook
,
11473 [ALC269_ASUS_EEEPC_P901
] = {
11474 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
11475 .init_verbs
= { alc269_init_verbs
,
11476 alc269_eeepc_dmic_init_verbs
},
11477 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11478 .dac_nids
= alc269_dac_nids
,
11480 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11481 .channel_mode
= alc269_modes
,
11482 .input_mux
= &alc269_eeepc_dmic_capture_source
,
11483 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
11484 .init_hook
= alc269_eeepc_dmic_inithook
,
11488 static int patch_alc269(struct hda_codec
*codec
)
11490 struct alc_spec
*spec
;
11494 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11498 codec
->spec
= spec
;
11500 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
11502 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
11506 if (board_config
< 0) {
11507 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
11508 "trying auto-probe from BIOS...\n");
11509 board_config
= ALC269_AUTO
;
11512 if (board_config
== ALC269_AUTO
) {
11513 /* automatic parse from the BIOS config */
11514 err
= alc269_parse_auto_config(codec
);
11520 "hda_codec: Cannot set up configuration "
11521 "from BIOS. Using base mode...\n");
11522 board_config
= ALC269_BASIC
;
11526 if (board_config
!= ALC269_AUTO
)
11527 setup_preset(spec
, &alc269_presets
[board_config
]);
11529 spec
->stream_name_analog
= "ALC269 Analog";
11530 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
11531 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
11533 spec
->stream_name_digital
= "ALC269 Digital";
11534 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
11535 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
11537 spec
->adc_nids
= alc269_adc_nids
;
11538 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
11540 codec
->patch_ops
= alc_patch_ops
;
11541 if (board_config
== ALC269_AUTO
)
11542 spec
->init_hook
= alc269_auto_init
;
11543 #ifdef CONFIG_SND_HDA_POWER_SAVE
11544 if (!spec
->loopback
.amplist
)
11545 spec
->loopback
.amplist
= alc269_loopbacks
;
11552 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11556 * set the path ways for 2 channel output
11557 * need to set the codec line out and mic 1 pin widgets to inputs
11559 static struct hda_verb alc861_threestack_ch2_init
[] = {
11560 /* set pin widget 1Ah (line in) for input */
11561 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11562 /* set pin widget 18h (mic1/2) for input, for mic also enable
11565 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11567 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11570 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11576 * need to set the codec line out and mic 1 pin widgets to outputs
11578 static struct hda_verb alc861_threestack_ch6_init
[] = {
11579 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11580 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11581 /* set pin widget 18h (mic1) for output (CLFE)*/
11582 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11584 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11585 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11587 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11590 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11595 static struct hda_channel_mode alc861_threestack_modes
[2] = {
11596 { 2, alc861_threestack_ch2_init
},
11597 { 6, alc861_threestack_ch6_init
},
11599 /* Set mic1 as input and unmute the mixer */
11600 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
11601 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11605 /* Set mic1 as output and mute mixer */
11606 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
11607 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11608 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11612 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
11613 { 2, alc861_uniwill_m31_ch2_init
},
11614 { 4, alc861_uniwill_m31_ch4_init
},
11617 /* Set mic1 and line-in as input and unmute the mixer */
11618 static struct hda_verb alc861_asus_ch2_init
[] = {
11619 /* set pin widget 1Ah (line in) for input */
11620 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11621 /* set pin widget 18h (mic1/2) for input, for mic also enable
11624 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11626 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11629 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11633 /* Set mic1 nad line-in as output and mute mixer */
11634 static struct hda_verb alc861_asus_ch6_init
[] = {
11635 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11636 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11637 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11638 /* set pin widget 18h (mic1) for output (CLFE)*/
11639 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11640 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11641 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11642 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11644 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11646 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11647 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11652 static struct hda_channel_mode alc861_asus_modes
[2] = {
11653 { 2, alc861_asus_ch2_init
},
11654 { 6, alc861_asus_ch6_init
},
11659 static struct snd_kcontrol_new alc861_base_mixer
[] = {
11660 /* output mixer control */
11661 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11662 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11663 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11664 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11665 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11667 /*Input mixer control */
11668 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11669 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11670 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11671 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11672 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11673 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11675 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11679 /* Capture mixer control */
11680 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11681 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11683 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11684 .name
= "Capture Source",
11686 .info
= alc_mux_enum_info
,
11687 .get
= alc_mux_enum_get
,
11688 .put
= alc_mux_enum_put
,
11693 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
11694 /* output mixer control */
11695 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11696 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11697 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11698 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11699 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11701 /* Input mixer control */
11702 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11703 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11704 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11705 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11706 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11707 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11709 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11713 /* Capture mixer control */
11714 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11715 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11717 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11718 .name
= "Capture Source",
11720 .info
= alc_mux_enum_info
,
11721 .get
= alc_mux_enum_get
,
11722 .put
= alc_mux_enum_put
,
11725 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11726 .name
= "Channel Mode",
11727 .info
= alc_ch_mode_info
,
11728 .get
= alc_ch_mode_get
,
11729 .put
= alc_ch_mode_put
,
11730 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
11735 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
11736 /* output mixer control */
11737 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11738 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11739 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11741 /*Capture mixer control */
11742 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11743 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11745 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11746 .name
= "Capture Source",
11748 .info
= alc_mux_enum_info
,
11749 .get
= alc_mux_enum_get
,
11750 .put
= alc_mux_enum_put
,
11756 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
11757 /* output mixer control */
11758 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11759 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11760 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11761 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11762 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11764 /* Input mixer control */
11765 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11766 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11767 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11768 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11769 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11770 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11772 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11773 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11776 /* Capture mixer control */
11777 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11778 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11780 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11781 .name
= "Capture Source",
11783 .info
= alc_mux_enum_info
,
11784 .get
= alc_mux_enum_get
,
11785 .put
= alc_mux_enum_put
,
11788 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11789 .name
= "Channel Mode",
11790 .info
= alc_ch_mode_info
,
11791 .get
= alc_ch_mode_get
,
11792 .put
= alc_ch_mode_put
,
11793 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
11798 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
11799 /* output mixer control */
11800 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11801 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11802 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11803 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11804 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11806 /* Input mixer control */
11807 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
11808 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11809 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11810 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11811 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11812 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11814 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11815 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11816 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
11818 /* Capture mixer control */
11819 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11820 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11822 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11823 .name
= "Capture Source",
11825 .info
= alc_mux_enum_info
,
11826 .get
= alc_mux_enum_get
,
11827 .put
= alc_mux_enum_put
,
11830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11831 .name
= "Channel Mode",
11832 .info
= alc_ch_mode_info
,
11833 .get
= alc_ch_mode_get
,
11834 .put
= alc_ch_mode_put
,
11835 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
11840 /* additional mixer */
11841 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
11842 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11843 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11844 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
11845 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
11850 * generic initialization of ADC, input mixers and output mixers
11852 static struct hda_verb alc861_base_init_verbs
[] = {
11854 * Unmute ADC0 and set the default input to mic-in
11856 /* port-A for surround (rear panel) */
11857 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11858 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11859 /* port-B for mic-in (rear panel) with vref */
11860 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11861 /* port-C for line-in (rear panel) */
11862 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11863 /* port-D for Front */
11864 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11865 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11866 /* port-E for HP out (front panel) */
11867 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11868 /* route front PCM to HP */
11869 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11870 /* port-F for mic-in (front panel) with vref */
11871 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11872 /* port-G for CLFE (rear panel) */
11873 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11874 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11875 /* port-H for side (rear panel) */
11876 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11877 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11879 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11880 /* route front mic to ADC1*/
11881 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11882 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11884 /* Unmute DAC0~3 & spdif out*/
11885 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11886 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11887 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11888 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11891 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11892 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11893 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11894 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11895 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11897 /* Unmute Stereo Mixer 15 */
11898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11899 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11901 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11904 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11905 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11906 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11908 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11910 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11911 /* hp used DAC 3 (Front) */
11912 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11918 static struct hda_verb alc861_threestack_init_verbs
[] = {
11920 * Unmute ADC0 and set the default input to mic-in
11922 /* port-A for surround (rear panel) */
11923 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11924 /* port-B for mic-in (rear panel) with vref */
11925 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11926 /* port-C for line-in (rear panel) */
11927 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11928 /* port-D for Front */
11929 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11930 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11931 /* port-E for HP out (front panel) */
11932 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11933 /* route front PCM to HP */
11934 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11935 /* port-F for mic-in (front panel) with vref */
11936 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11937 /* port-G for CLFE (rear panel) */
11938 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11939 /* port-H for side (rear panel) */
11940 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11942 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11943 /* route front mic to ADC1*/
11944 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11946 /* Unmute DAC0~3 & spdif out*/
11947 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11948 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11949 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11950 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11951 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11953 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11954 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11955 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11956 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11957 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11959 /* Unmute Stereo Mixer 15 */
11960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11962 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11963 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11965 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11966 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11967 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11969 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11970 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11971 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11972 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11973 /* hp used DAC 3 (Front) */
11974 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11979 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
11981 * Unmute ADC0 and set the default input to mic-in
11983 /* port-A for surround (rear panel) */
11984 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11985 /* port-B for mic-in (rear panel) with vref */
11986 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11987 /* port-C for line-in (rear panel) */
11988 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11989 /* port-D for Front */
11990 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11991 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11992 /* port-E for HP out (front panel) */
11993 /* this has to be set to VREF80 */
11994 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11995 /* route front PCM to HP */
11996 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11997 /* port-F for mic-in (front panel) with vref */
11998 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11999 /* port-G for CLFE (rear panel) */
12000 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12001 /* port-H for side (rear panel) */
12002 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12004 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12005 /* route front mic to ADC1*/
12006 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12008 /* Unmute DAC0~3 & spdif out*/
12009 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12010 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12011 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12012 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12013 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12015 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12016 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12017 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12018 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12019 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12021 /* Unmute Stereo Mixer 15 */
12022 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12023 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12027 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12028 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12029 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12030 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12031 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12032 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12033 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12034 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12035 /* hp used DAC 3 (Front) */
12036 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12037 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12041 static struct hda_verb alc861_asus_init_verbs
[] = {
12043 * Unmute ADC0 and set the default input to mic-in
12045 /* port-A for surround (rear panel)
12046 * according to codec#0 this is the HP jack
12048 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
12049 /* route front PCM to HP */
12050 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
12051 /* port-B for mic-in (rear panel) with vref */
12052 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12053 /* port-C for line-in (rear panel) */
12054 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12055 /* port-D for Front */
12056 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12057 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12058 /* port-E for HP out (front panel) */
12059 /* this has to be set to VREF80 */
12060 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12061 /* route front PCM to HP */
12062 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12063 /* port-F for mic-in (front panel) with vref */
12064 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12065 /* port-G for CLFE (rear panel) */
12066 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12067 /* port-H for side (rear panel) */
12068 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12070 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12071 /* route front mic to ADC1*/
12072 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12074 /* Unmute DAC0~3 & spdif out*/
12075 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12076 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12077 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12078 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12080 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12081 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12082 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12083 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12084 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12086 /* Unmute Stereo Mixer 15 */
12087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12089 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12090 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12092 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12094 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12095 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12096 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12097 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12098 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12099 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12100 /* hp used DAC 3 (Front) */
12101 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12102 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12106 /* additional init verbs for ASUS laptops */
12107 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
12108 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
12109 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
12114 * generic initialization of ADC, input mixers and output mixers
12116 static struct hda_verb alc861_auto_init_verbs
[] = {
12118 * Unmute ADC0 and set the default input to mic-in
12120 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12123 /* Unmute DAC0~3 & spdif out*/
12124 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12125 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12126 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12127 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12130 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12131 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12132 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12133 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12134 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12136 /* Unmute Stereo Mixer 15 */
12137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
12142 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12143 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12145 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12147 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12148 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12151 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12155 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12156 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12157 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12160 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
12165 static struct hda_verb alc861_toshiba_init_verbs
[] = {
12166 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12171 /* toggle speaker-output according to the hp-jack state */
12172 static void alc861_toshiba_automute(struct hda_codec
*codec
)
12174 unsigned int present
;
12176 present
= snd_hda_codec_read(codec
, 0x0f, 0,
12177 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12178 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
12179 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
12180 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
12181 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
12184 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
12187 if ((res
>> 26) == ALC880_HP_EVENT
)
12188 alc861_toshiba_automute(codec
);
12191 /* pcm configuration: identiacal with ALC880 */
12192 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12193 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12194 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12195 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12198 #define ALC861_DIGOUT_NID 0x07
12200 static struct hda_channel_mode alc861_8ch_modes
[1] = {
12204 static hda_nid_t alc861_dac_nids
[4] = {
12205 /* front, surround, clfe, side */
12206 0x03, 0x06, 0x05, 0x04
12209 static hda_nid_t alc660_dac_nids
[3] = {
12210 /* front, clfe, surround */
12214 static hda_nid_t alc861_adc_nids
[1] = {
12219 static struct hda_input_mux alc861_capture_source
= {
12223 { "Front Mic", 0x3 },
12230 /* fill in the dac_nids table from the parsed pin configuration */
12231 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
12232 const struct auto_pin_cfg
*cfg
)
12237 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12238 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12239 nid
= cfg
->line_out_pins
[i
];
12241 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
12243 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
12246 spec
->multiout
.num_dacs
= cfg
->line_outs
;
12250 /* add playback controls from the parsed DAC table */
12251 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12252 const struct auto_pin_cfg
*cfg
)
12255 static const char *chname
[4] = {
12256 "Front", "Surround", NULL
/*CLFE*/, "Side"
12261 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12262 nid
= spec
->multiout
.dac_nids
[i
];
12267 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12268 "Center Playback Switch",
12269 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
12273 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12274 "LFE Playback Switch",
12275 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12280 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
12282 if (nid
== alc861_dac_nids
[idx
])
12284 sprintf(name
, "%s Playback Switch", chname
[idx
]);
12285 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12286 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12295 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
12303 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
12305 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12306 "Headphone Playback Switch",
12307 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12310 spec
->multiout
.hp_nid
= nid
;
12315 /* create playback/capture controls for input pins */
12316 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12317 const struct auto_pin_cfg
*cfg
)
12319 struct hda_input_mux
*imux
= &spec
->private_imux
;
12320 int i
, err
, idx
, idx1
;
12322 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12323 switch (cfg
->input_pins
[i
]) {
12326 idx
= 2; /* Line In */
12330 idx
= 2; /* Line In */
12334 idx
= 1; /* Mic In */
12338 idx
= 1; /* Mic In */
12348 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
12349 auto_pin_cfg_labels
[i
], idx
, 0x15);
12353 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
12354 imux
->items
[imux
->num_items
].index
= idx1
;
12360 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
12361 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12362 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12365 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12366 /* The multiple "Capture Source" controls confuse alsamixer
12367 * So call somewhat different..
12369 /* .name = "Capture Source", */
12370 .name
= "Input Source",
12372 .info
= alc_mux_enum_info
,
12373 .get
= alc_mux_enum_get
,
12374 .put
= alc_mux_enum_put
,
12379 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
12381 int pin_type
, int dac_idx
)
12383 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
12385 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12389 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
12391 struct alc_spec
*spec
= codec
->spec
;
12394 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
12395 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
12396 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12397 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12399 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
12400 spec
->multiout
.dac_nids
[i
]);
12404 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
12406 struct alc_spec
*spec
= codec
->spec
;
12409 pin
= spec
->autocfg
.hp_pins
[0];
12410 if (pin
) /* connect to front */
12411 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
12412 spec
->multiout
.dac_nids
[0]);
12413 pin
= spec
->autocfg
.speaker_pins
[0];
12415 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
12418 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
12420 struct alc_spec
*spec
= codec
->spec
;
12423 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12424 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12425 if (nid
>= 0x0c && nid
<= 0x11) {
12426 snd_hda_codec_write(codec
, nid
, 0,
12427 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12428 i
<= AUTO_PIN_FRONT_MIC
?
12429 PIN_VREF80
: PIN_IN
);
12434 /* parse the BIOS configuration and set up the alc_spec */
12435 /* return 1 if successful, 0 if the proper config is not found,
12436 * or a negative error code
12438 static int alc861_parse_auto_config(struct hda_codec
*codec
)
12440 struct alc_spec
*spec
= codec
->spec
;
12442 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
12444 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12448 if (!spec
->autocfg
.line_outs
)
12449 return 0; /* can't find valid BIOS pin config */
12451 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12454 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12457 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
12460 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12464 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12466 if (spec
->autocfg
.dig_out_pin
)
12467 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
12469 if (spec
->kctl_alloc
)
12470 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12472 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
12474 spec
->num_mux_defs
= 1;
12475 spec
->input_mux
= &spec
->private_imux
;
12477 spec
->adc_nids
= alc861_adc_nids
;
12478 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
12479 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
12480 spec
->num_mixers
++;
12485 /* additional initialization for auto-configuration model */
12486 static void alc861_auto_init(struct hda_codec
*codec
)
12488 struct alc_spec
*spec
= codec
->spec
;
12489 alc861_auto_init_multi_out(codec
);
12490 alc861_auto_init_hp_out(codec
);
12491 alc861_auto_init_analog_input(codec
);
12492 if (spec
->unsol_event
)
12493 alc_sku_automute(codec
);
12496 #ifdef CONFIG_SND_HDA_POWER_SAVE
12497 static struct hda_amp_list alc861_loopbacks
[] = {
12498 { 0x15, HDA_INPUT
, 0 },
12499 { 0x15, HDA_INPUT
, 1 },
12500 { 0x15, HDA_INPUT
, 2 },
12501 { 0x15, HDA_INPUT
, 3 },
12508 * configuration and preset
12510 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
12511 [ALC861_3ST
] = "3stack",
12512 [ALC660_3ST
] = "3stack-660",
12513 [ALC861_3ST_DIG
] = "3stack-dig",
12514 [ALC861_6ST_DIG
] = "6stack-dig",
12515 [ALC861_UNIWILL_M31
] = "uniwill-m31",
12516 [ALC861_TOSHIBA
] = "toshiba",
12517 [ALC861_ASUS
] = "asus",
12518 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
12519 [ALC861_AUTO
] = "auto",
12522 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
12523 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
12524 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12525 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12526 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
12527 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
12528 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
12529 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
12530 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12531 * Any other models that need this preset?
12533 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12534 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
12535 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
12536 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
12537 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
12538 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
12539 /* FIXME: the below seems conflict */
12540 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12541 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
12542 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
12546 static struct alc_config_preset alc861_presets
[] = {
12548 .mixers
= { alc861_3ST_mixer
},
12549 .init_verbs
= { alc861_threestack_init_verbs
},
12550 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12551 .dac_nids
= alc861_dac_nids
,
12552 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12553 .channel_mode
= alc861_threestack_modes
,
12555 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12556 .adc_nids
= alc861_adc_nids
,
12557 .input_mux
= &alc861_capture_source
,
12559 [ALC861_3ST_DIG
] = {
12560 .mixers
= { alc861_base_mixer
},
12561 .init_verbs
= { alc861_threestack_init_verbs
},
12562 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12563 .dac_nids
= alc861_dac_nids
,
12564 .dig_out_nid
= ALC861_DIGOUT_NID
,
12565 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12566 .channel_mode
= alc861_threestack_modes
,
12568 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12569 .adc_nids
= alc861_adc_nids
,
12570 .input_mux
= &alc861_capture_source
,
12572 [ALC861_6ST_DIG
] = {
12573 .mixers
= { alc861_base_mixer
},
12574 .init_verbs
= { alc861_base_init_verbs
},
12575 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12576 .dac_nids
= alc861_dac_nids
,
12577 .dig_out_nid
= ALC861_DIGOUT_NID
,
12578 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
12579 .channel_mode
= alc861_8ch_modes
,
12580 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12581 .adc_nids
= alc861_adc_nids
,
12582 .input_mux
= &alc861_capture_source
,
12585 .mixers
= { alc861_3ST_mixer
},
12586 .init_verbs
= { alc861_threestack_init_verbs
},
12587 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
12588 .dac_nids
= alc660_dac_nids
,
12589 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12590 .channel_mode
= alc861_threestack_modes
,
12592 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12593 .adc_nids
= alc861_adc_nids
,
12594 .input_mux
= &alc861_capture_source
,
12596 [ALC861_UNIWILL_M31
] = {
12597 .mixers
= { alc861_uniwill_m31_mixer
},
12598 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
12599 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12600 .dac_nids
= alc861_dac_nids
,
12601 .dig_out_nid
= ALC861_DIGOUT_NID
,
12602 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
12603 .channel_mode
= alc861_uniwill_m31_modes
,
12605 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12606 .adc_nids
= alc861_adc_nids
,
12607 .input_mux
= &alc861_capture_source
,
12609 [ALC861_TOSHIBA
] = {
12610 .mixers
= { alc861_toshiba_mixer
},
12611 .init_verbs
= { alc861_base_init_verbs
,
12612 alc861_toshiba_init_verbs
},
12613 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12614 .dac_nids
= alc861_dac_nids
,
12615 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12616 .channel_mode
= alc883_3ST_2ch_modes
,
12617 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12618 .adc_nids
= alc861_adc_nids
,
12619 .input_mux
= &alc861_capture_source
,
12620 .unsol_event
= alc861_toshiba_unsol_event
,
12621 .init_hook
= alc861_toshiba_automute
,
12624 .mixers
= { alc861_asus_mixer
},
12625 .init_verbs
= { alc861_asus_init_verbs
},
12626 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12627 .dac_nids
= alc861_dac_nids
,
12628 .dig_out_nid
= ALC861_DIGOUT_NID
,
12629 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
12630 .channel_mode
= alc861_asus_modes
,
12633 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12634 .adc_nids
= alc861_adc_nids
,
12635 .input_mux
= &alc861_capture_source
,
12637 [ALC861_ASUS_LAPTOP
] = {
12638 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
12639 .init_verbs
= { alc861_asus_init_verbs
,
12640 alc861_asus_laptop_init_verbs
},
12641 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12642 .dac_nids
= alc861_dac_nids
,
12643 .dig_out_nid
= ALC861_DIGOUT_NID
,
12644 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12645 .channel_mode
= alc883_3ST_2ch_modes
,
12647 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12648 .adc_nids
= alc861_adc_nids
,
12649 .input_mux
= &alc861_capture_source
,
12654 static int patch_alc861(struct hda_codec
*codec
)
12656 struct alc_spec
*spec
;
12660 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12664 codec
->spec
= spec
;
12666 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
12670 if (board_config
< 0) {
12671 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
12672 "trying auto-probe from BIOS...\n");
12673 board_config
= ALC861_AUTO
;
12676 if (board_config
== ALC861_AUTO
) {
12677 /* automatic parse from the BIOS config */
12678 err
= alc861_parse_auto_config(codec
);
12684 "hda_codec: Cannot set up configuration "
12685 "from BIOS. Using base mode...\n");
12686 board_config
= ALC861_3ST_DIG
;
12690 if (board_config
!= ALC861_AUTO
)
12691 setup_preset(spec
, &alc861_presets
[board_config
]);
12693 spec
->stream_name_analog
= "ALC861 Analog";
12694 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
12695 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
12697 spec
->stream_name_digital
= "ALC861 Digital";
12698 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
12699 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
12701 spec
->vmaster_nid
= 0x03;
12703 codec
->patch_ops
= alc_patch_ops
;
12704 if (board_config
== ALC861_AUTO
)
12705 spec
->init_hook
= alc861_auto_init
;
12706 #ifdef CONFIG_SND_HDA_POWER_SAVE
12707 if (!spec
->loopback
.amplist
)
12708 spec
->loopback
.amplist
= alc861_loopbacks
;
12715 * ALC861-VD support
12719 * In addition, an independent DAC
12721 #define ALC861VD_DIGOUT_NID 0x06
12723 static hda_nid_t alc861vd_dac_nids
[4] = {
12724 /* front, surr, clfe, side surr */
12725 0x02, 0x03, 0x04, 0x05
12728 /* dac_nids for ALC660vd are in a different order - according to
12729 * Realtek's driver.
12730 * This should probably tesult in a different mixer for 6stack models
12731 * of ALC660vd codecs, but for now there is only 3stack mixer
12732 * - and it is the same as in 861vd.
12733 * adc_nids in ALC660vd are (is) the same as in 861vd
12735 static hda_nid_t alc660vd_dac_nids
[3] = {
12736 /* front, rear, clfe, rear_surr */
12740 static hda_nid_t alc861vd_adc_nids
[1] = {
12745 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
12748 /* FIXME: should be a matrix-type input source selection */
12749 static struct hda_input_mux alc861vd_capture_source
= {
12753 { "Front Mic", 0x1 },
12759 static struct hda_input_mux alc861vd_dallas_capture_source
= {
12762 { "Ext Mic", 0x0 },
12763 { "Int Mic", 0x1 },
12767 static struct hda_input_mux alc861vd_hp_capture_source
= {
12770 { "Front Mic", 0x0 },
12771 { "ATAPI Mic", 0x1 },
12775 #define alc861vd_mux_enum_info alc_mux_enum_info
12776 #define alc861vd_mux_enum_get alc_mux_enum_get
12777 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12778 #define alc861vd_mux_enum_put alc882_mux_enum_put
12783 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
12790 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
12791 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12792 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12793 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12794 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12801 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
12802 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12803 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12804 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12805 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12809 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
12810 { 6, alc861vd_6stack_ch6_init
},
12811 { 8, alc861vd_6stack_ch8_init
},
12814 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
12816 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12817 .name
= "Channel Mode",
12818 .info
= alc_ch_mode_info
,
12819 .get
= alc_ch_mode_get
,
12820 .put
= alc_ch_mode_put
,
12825 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
12826 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
12827 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
12830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12831 /* The multiple "Capture Source" controls confuse alsamixer
12832 * So call somewhat different..
12834 /* .name = "Capture Source", */
12835 .name
= "Input Source",
12837 .info
= alc861vd_mux_enum_info
,
12838 .get
= alc861vd_mux_enum_get
,
12839 .put
= alc861vd_mux_enum_put
,
12844 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12845 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12847 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
12848 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12849 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12851 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12852 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
12854 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12856 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12858 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12859 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
12861 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
12862 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
12864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12866 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12868 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12870 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12871 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12872 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12880 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12881 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12886 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
12887 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12897 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12898 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12904 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12906 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12907 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12912 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
12913 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12914 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12915 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12919 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12923 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12924 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12925 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12927 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12928 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12933 /* Pin assignment: Speaker=0x14, HP = 0x15,
12934 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12936 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
12937 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12938 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
12939 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12940 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12941 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
12942 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12943 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12944 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
12945 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12946 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12947 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT
),
12948 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT
),
12952 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12953 * Front Mic=0x18, ATAPI Mic = 0x19,
12955 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
12956 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12957 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12959 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12960 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12961 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12962 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12963 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12969 * generic initialization of ADC, input mixers and output mixers
12971 static struct hda_verb alc861vd_volume_init_verbs
[] = {
12973 * Unmute ADC0 and set the default input to mic-in
12975 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12978 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12979 * the analog-loopback mixer widget
12981 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12982 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12983 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12984 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12988 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12990 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12991 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12992 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
12995 * Set up output mixers (0x02 - 0x05)
12997 /* set vol=0 to output mixers */
12998 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12999 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13000 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13001 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13003 /* set up input amps for analog loopback */
13004 /* Amp Indices: DAC = 0, mixer = 1 */
13005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13011 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13018 * 3-stack pin configuration:
13019 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13021 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
13023 * Set pin mode and muting
13025 /* set front pin widgets 0x14 for output */
13026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13028 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13030 /* Mic (rear) pin: input vref at 80% */
13031 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13032 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13033 /* Front Mic pin: input vref at 80% */
13034 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13035 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13036 /* Line In pin: input */
13037 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13039 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13040 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13041 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13042 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13043 /* CD pin widget for input */
13044 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13050 * 6-stack pin configuration:
13052 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
13054 * Set pin mode and muting
13056 /* set front pin widgets 0x14 for output */
13057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13059 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13061 /* Rear Pin: output 1 (0x0d) */
13062 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13064 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13065 /* CLFE Pin: output 2 (0x0e) */
13066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13068 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
13069 /* Side Pin: output 3 (0x0f) */
13070 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13072 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
13074 /* Mic (rear) pin: input vref at 80% */
13075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13077 /* Front Mic pin: input vref at 80% */
13078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13079 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13080 /* Line In pin: input */
13081 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13082 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13083 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13084 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13085 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13086 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13087 /* CD pin widget for input */
13088 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13093 static struct hda_verb alc861vd_eapd_verbs
[] = {
13094 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13098 static struct hda_verb alc660vd_eapd_verbs
[] = {
13099 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13100 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13104 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
13105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
13108 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13113 /* toggle speaker-output according to the hp-jack state */
13114 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
13116 unsigned int present
;
13117 unsigned char bits
;
13119 present
= snd_hda_codec_read(codec
, 0x1b, 0,
13120 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13121 bits
= present
? HDA_AMP_MUTE
: 0;
13122 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13123 HDA_AMP_MUTE
, bits
);
13126 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
13128 unsigned int present
;
13129 unsigned char bits
;
13131 present
= snd_hda_codec_read(codec
, 0x18, 0,
13132 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13133 bits
= present
? HDA_AMP_MUTE
: 0;
13134 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
13135 HDA_AMP_MUTE
, bits
);
13138 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
13140 alc861vd_lenovo_hp_automute(codec
);
13141 alc861vd_lenovo_mic_automute(codec
);
13144 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
13147 switch (res
>> 26) {
13148 case ALC880_HP_EVENT
:
13149 alc861vd_lenovo_hp_automute(codec
);
13151 case ALC880_MIC_EVENT
:
13152 alc861vd_lenovo_mic_automute(codec
);
13157 static struct hda_verb alc861vd_dallas_verbs
[] = {
13158 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13160 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13161 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13164 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13166 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13167 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13168 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13169 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13170 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13172 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13173 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13176 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13178 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13179 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13181 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
13182 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
13184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13185 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13187 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13188 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13196 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13197 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13202 /* toggle speaker-output according to the hp-jack state */
13203 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
13205 unsigned int present
;
13207 present
= snd_hda_codec_read(codec
, 0x15, 0,
13208 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13209 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13210 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
13213 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
13215 if ((res
>> 26) == ALC880_HP_EVENT
)
13216 alc861vd_dallas_automute(codec
);
13219 #ifdef CONFIG_SND_HDA_POWER_SAVE
13220 #define alc861vd_loopbacks alc880_loopbacks
13223 /* pcm configuration: identiacal with ALC880 */
13224 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13225 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13226 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13227 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13230 * configuration and preset
13232 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
13233 [ALC660VD_3ST
] = "3stack-660",
13234 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
13235 [ALC861VD_3ST
] = "3stack",
13236 [ALC861VD_3ST_DIG
] = "3stack-digout",
13237 [ALC861VD_6ST_DIG
] = "6stack-digout",
13238 [ALC861VD_LENOVO
] = "lenovo",
13239 [ALC861VD_DALLAS
] = "dallas",
13240 [ALC861VD_HP
] = "hp",
13241 [ALC861VD_AUTO
] = "auto",
13244 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
13245 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
13246 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
13247 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
13248 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
13249 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO
),
13250 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
13251 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
13252 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
13253 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13254 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
13255 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
13256 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
13257 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
13258 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
13259 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
13260 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO
),
13261 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
13265 static struct alc_config_preset alc861vd_presets
[] = {
13267 .mixers
= { alc861vd_3st_mixer
},
13268 .init_verbs
= { alc861vd_volume_init_verbs
,
13269 alc861vd_3stack_init_verbs
},
13270 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13271 .dac_nids
= alc660vd_dac_nids
,
13272 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13273 .channel_mode
= alc861vd_3stack_2ch_modes
,
13274 .input_mux
= &alc861vd_capture_source
,
13276 [ALC660VD_3ST_DIG
] = {
13277 .mixers
= { alc861vd_3st_mixer
},
13278 .init_verbs
= { alc861vd_volume_init_verbs
,
13279 alc861vd_3stack_init_verbs
},
13280 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13281 .dac_nids
= alc660vd_dac_nids
,
13282 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13283 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13284 .channel_mode
= alc861vd_3stack_2ch_modes
,
13285 .input_mux
= &alc861vd_capture_source
,
13288 .mixers
= { alc861vd_3st_mixer
},
13289 .init_verbs
= { alc861vd_volume_init_verbs
,
13290 alc861vd_3stack_init_verbs
},
13291 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13292 .dac_nids
= alc861vd_dac_nids
,
13293 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13294 .channel_mode
= alc861vd_3stack_2ch_modes
,
13295 .input_mux
= &alc861vd_capture_source
,
13297 [ALC861VD_3ST_DIG
] = {
13298 .mixers
= { alc861vd_3st_mixer
},
13299 .init_verbs
= { alc861vd_volume_init_verbs
,
13300 alc861vd_3stack_init_verbs
},
13301 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13302 .dac_nids
= alc861vd_dac_nids
,
13303 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13304 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13305 .channel_mode
= alc861vd_3stack_2ch_modes
,
13306 .input_mux
= &alc861vd_capture_source
,
13308 [ALC861VD_6ST_DIG
] = {
13309 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
13310 .init_verbs
= { alc861vd_volume_init_verbs
,
13311 alc861vd_6stack_init_verbs
},
13312 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13313 .dac_nids
= alc861vd_dac_nids
,
13314 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13315 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
13316 .channel_mode
= alc861vd_6stack_modes
,
13317 .input_mux
= &alc861vd_capture_source
,
13319 [ALC861VD_LENOVO
] = {
13320 .mixers
= { alc861vd_lenovo_mixer
},
13321 .init_verbs
= { alc861vd_volume_init_verbs
,
13322 alc861vd_3stack_init_verbs
,
13323 alc861vd_eapd_verbs
,
13324 alc861vd_lenovo_unsol_verbs
},
13325 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13326 .dac_nids
= alc660vd_dac_nids
,
13327 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13328 .channel_mode
= alc861vd_3stack_2ch_modes
,
13329 .input_mux
= &alc861vd_capture_source
,
13330 .unsol_event
= alc861vd_lenovo_unsol_event
,
13331 .init_hook
= alc861vd_lenovo_automute
,
13333 [ALC861VD_DALLAS
] = {
13334 .mixers
= { alc861vd_dallas_mixer
},
13335 .init_verbs
= { alc861vd_dallas_verbs
},
13336 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13337 .dac_nids
= alc861vd_dac_nids
,
13338 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13339 .channel_mode
= alc861vd_3stack_2ch_modes
,
13340 .input_mux
= &alc861vd_dallas_capture_source
,
13341 .unsol_event
= alc861vd_dallas_unsol_event
,
13342 .init_hook
= alc861vd_dallas_automute
,
13345 .mixers
= { alc861vd_hp_mixer
},
13346 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
13347 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13348 .dac_nids
= alc861vd_dac_nids
,
13349 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13350 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13351 .channel_mode
= alc861vd_3stack_2ch_modes
,
13352 .input_mux
= &alc861vd_hp_capture_source
,
13353 .unsol_event
= alc861vd_dallas_unsol_event
,
13354 .init_hook
= alc861vd_dallas_automute
,
13359 * BIOS auto configuration
13361 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
13362 hda_nid_t nid
, int pin_type
, int dac_idx
)
13364 alc_set_pin_output(codec
, nid
, pin_type
);
13367 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
13369 struct alc_spec
*spec
= codec
->spec
;
13372 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
13373 for (i
= 0; i
<= HDA_SIDE
; i
++) {
13374 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13375 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13377 alc861vd_auto_set_output_and_unmute(codec
, nid
,
13383 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
13385 struct alc_spec
*spec
= codec
->spec
;
13388 pin
= spec
->autocfg
.hp_pins
[0];
13389 if (pin
) /* connect to front and use dac 0 */
13390 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
13391 pin
= spec
->autocfg
.speaker_pins
[0];
13393 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13396 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13397 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13399 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
13401 struct alc_spec
*spec
= codec
->spec
;
13404 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13405 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13406 if (alc861vd_is_input_pin(nid
)) {
13407 snd_hda_codec_write(codec
, nid
, 0,
13408 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13409 i
<= AUTO_PIN_FRONT_MIC
?
13410 PIN_VREF80
: PIN_IN
);
13411 if (nid
!= ALC861VD_PIN_CD_NID
)
13412 snd_hda_codec_write(codec
, nid
, 0,
13413 AC_VERB_SET_AMP_GAIN_MUTE
,
13419 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
13421 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13422 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13424 /* add playback controls from the parsed DAC table */
13425 /* Based on ALC880 version. But ALC861VD has separate,
13426 * different NIDs for mute/unmute switch and volume control */
13427 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13428 const struct auto_pin_cfg
*cfg
)
13431 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
13432 hda_nid_t nid_v
, nid_s
;
13435 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13436 if (!spec
->multiout
.dac_nids
[i
])
13438 nid_v
= alc861vd_idx_to_mixer_vol(
13440 spec
->multiout
.dac_nids
[i
]));
13441 nid_s
= alc861vd_idx_to_mixer_switch(
13443 spec
->multiout
.dac_nids
[i
]));
13447 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13448 "Center Playback Volume",
13449 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
13453 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13454 "LFE Playback Volume",
13455 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
13459 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13460 "Center Playback Switch",
13461 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
13465 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13466 "LFE Playback Switch",
13467 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
13472 sprintf(name
, "%s Playback Volume", chname
[i
]);
13473 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13474 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
13478 sprintf(name
, "%s Playback Switch", chname
[i
]);
13479 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13480 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
13489 /* add playback controls for speaker and HP outputs */
13490 /* Based on ALC880 version. But ALC861VD has separate,
13491 * different NIDs for mute/unmute switch and volume control */
13492 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
13493 hda_nid_t pin
, const char *pfx
)
13495 hda_nid_t nid_v
, nid_s
;
13502 if (alc880_is_fixed_pin(pin
)) {
13503 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
13504 /* specify the DAC as the extra output */
13505 if (!spec
->multiout
.hp_nid
)
13506 spec
->multiout
.hp_nid
= nid_v
;
13508 spec
->multiout
.extra_out_nid
[0] = nid_v
;
13509 /* control HP volume/switch on the output mixer amp */
13510 nid_v
= alc861vd_idx_to_mixer_vol(
13511 alc880_fixed_pin_idx(pin
));
13512 nid_s
= alc861vd_idx_to_mixer_switch(
13513 alc880_fixed_pin_idx(pin
));
13515 sprintf(name
, "%s Playback Volume", pfx
);
13516 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13517 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
13520 sprintf(name
, "%s Playback Switch", pfx
);
13521 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13522 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
13525 } else if (alc880_is_multi_pin(pin
)) {
13526 /* set manual connection */
13527 /* we have only a switch on HP-out PIN */
13528 sprintf(name
, "%s Playback Switch", pfx
);
13529 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
13530 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
13537 /* parse the BIOS configuration and set up the alc_spec
13538 * return 1 if successful, 0 if the proper config is not found,
13539 * or a negative error code
13540 * Based on ALC880 version - had to change it to override
13541 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13542 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
13544 struct alc_spec
*spec
= codec
->spec
;
13546 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
13548 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13552 if (!spec
->autocfg
.line_outs
)
13553 return 0; /* can't find valid BIOS pin config */
13555 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13558 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13561 err
= alc861vd_auto_create_extra_out(spec
,
13562 spec
->autocfg
.speaker_pins
[0],
13566 err
= alc861vd_auto_create_extra_out(spec
,
13567 spec
->autocfg
.hp_pins
[0],
13571 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13575 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13577 if (spec
->autocfg
.dig_out_pin
)
13578 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
13580 if (spec
->kctl_alloc
)
13581 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
13583 spec
->init_verbs
[spec
->num_init_verbs
++]
13584 = alc861vd_volume_init_verbs
;
13586 spec
->num_mux_defs
= 1;
13587 spec
->input_mux
= &spec
->private_imux
;
13589 err
= alc_auto_add_mic_boost(codec
);
13596 /* additional initialization for auto-configuration model */
13597 static void alc861vd_auto_init(struct hda_codec
*codec
)
13599 struct alc_spec
*spec
= codec
->spec
;
13600 alc861vd_auto_init_multi_out(codec
);
13601 alc861vd_auto_init_hp_out(codec
);
13602 alc861vd_auto_init_analog_input(codec
);
13603 alc861vd_auto_init_input_src(codec
);
13604 if (spec
->unsol_event
)
13605 alc_sku_automute(codec
);
13608 static int patch_alc861vd(struct hda_codec
*codec
)
13610 struct alc_spec
*spec
;
13611 int err
, board_config
;
13613 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13617 codec
->spec
= spec
;
13619 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
13623 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
13624 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
13625 "ALC861VD, trying auto-probe from BIOS...\n");
13626 board_config
= ALC861VD_AUTO
;
13629 if (board_config
== ALC861VD_AUTO
) {
13630 /* automatic parse from the BIOS config */
13631 err
= alc861vd_parse_auto_config(codec
);
13637 "hda_codec: Cannot set up configuration "
13638 "from BIOS. Using base mode...\n");
13639 board_config
= ALC861VD_3ST
;
13643 if (board_config
!= ALC861VD_AUTO
)
13644 setup_preset(spec
, &alc861vd_presets
[board_config
]);
13646 if (codec
->vendor_id
== 0x10ec0660) {
13647 spec
->stream_name_analog
= "ALC660-VD Analog";
13648 spec
->stream_name_digital
= "ALC660-VD Digital";
13649 /* always turn on EAPD */
13650 spec
->init_verbs
[spec
->num_init_verbs
++] = alc660vd_eapd_verbs
;
13652 spec
->stream_name_analog
= "ALC861VD Analog";
13653 spec
->stream_name_digital
= "ALC861VD Digital";
13656 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
13657 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
13659 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
13660 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
13662 spec
->adc_nids
= alc861vd_adc_nids
;
13663 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
13664 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
13666 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
13667 spec
->num_mixers
++;
13669 spec
->vmaster_nid
= 0x02;
13671 codec
->patch_ops
= alc_patch_ops
;
13673 if (board_config
== ALC861VD_AUTO
)
13674 spec
->init_hook
= alc861vd_auto_init
;
13675 #ifdef CONFIG_SND_HDA_POWER_SAVE
13676 if (!spec
->loopback
.amplist
)
13677 spec
->loopback
.amplist
= alc861vd_loopbacks
;
13686 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13687 * configuration. Each pin widget can choose any input DACs and a mixer.
13688 * Each ADC is connected from a mixer of all inputs. This makes possible
13689 * 6-channel independent captures.
13691 * In addition, an independent DAC for the multi-playback (not used in this
13694 #define ALC662_DIGOUT_NID 0x06
13695 #define ALC662_DIGIN_NID 0x0a
13697 static hda_nid_t alc662_dac_nids
[4] = {
13698 /* front, rear, clfe, rear_surr */
13702 static hda_nid_t alc662_adc_nids
[1] = {
13707 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
13710 /* FIXME: should be a matrix-type input source selection */
13711 static struct hda_input_mux alc662_capture_source
= {
13715 { "Front Mic", 0x1 },
13721 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
13729 static struct hda_input_mux alc662_eeepc_capture_source
= {
13737 static struct hda_input_mux alc663_capture_source
= {
13741 { "Front Mic", 0x1 },
13746 static struct hda_input_mux alc663_m51va_capture_source
= {
13749 { "Ext-Mic", 0x0 },
13754 #define alc662_mux_enum_info alc_mux_enum_info
13755 #define alc662_mux_enum_get alc_mux_enum_get
13756 #define alc662_mux_enum_put alc882_mux_enum_put
13761 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
13768 static struct hda_verb alc662_3ST_ch2_init
[] = {
13769 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13770 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13771 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13772 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13779 static struct hda_verb alc662_3ST_ch6_init
[] = {
13780 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13781 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13782 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
13783 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13784 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13785 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13789 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
13790 { 2, alc662_3ST_ch2_init
},
13791 { 6, alc662_3ST_ch6_init
},
13797 static struct hda_verb alc662_sixstack_ch6_init
[] = {
13798 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13799 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13800 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13807 static struct hda_verb alc662_sixstack_ch8_init
[] = {
13808 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13809 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13810 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13814 static struct hda_channel_mode alc662_5stack_modes
[2] = {
13815 { 2, alc662_sixstack_ch6_init
},
13816 { 6, alc662_sixstack_ch8_init
},
13819 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13820 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13823 static struct snd_kcontrol_new alc662_base_mixer
[] = {
13824 /* output mixer control */
13825 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13826 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13828 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13829 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13830 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13831 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13832 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13833 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13835 /*Input mixer control */
13836 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
13837 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
13838 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
13839 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
13840 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
13841 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
13842 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
13843 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
13847 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
13848 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13849 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13851 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13852 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13853 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13854 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13856 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13857 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13858 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13859 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13860 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13864 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
13865 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13866 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13867 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13868 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13869 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13870 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13871 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13872 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13873 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13874 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13875 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13876 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13877 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13880 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13882 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13883 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13887 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
13888 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13889 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13890 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13891 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
13892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13893 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13894 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13900 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
13901 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13903 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13904 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13906 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
13907 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13908 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13910 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
13911 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13912 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13916 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
13917 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13918 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13919 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13920 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
13921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13925 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13926 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
13927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13934 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
13935 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13936 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13940 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT
),
13944 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
13945 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13946 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13947 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13948 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13952 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13953 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13954 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13958 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
13959 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13960 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13965 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13966 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13972 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
13974 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13975 .name
= "Channel Mode",
13976 .info
= alc_ch_mode_info
,
13977 .get
= alc_ch_mode_get
,
13978 .put
= alc_ch_mode_put
,
13983 static struct hda_verb alc662_init_verbs
[] = {
13984 /* ADC: mute amp left and right */
13985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13986 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13987 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13997 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14000 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14002 /* Front Pin: output 0 (0x0c) */
14003 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14006 /* Rear Pin: output 1 (0x0d) */
14007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14010 /* CLFE Pin: output 2 (0x0e) */
14011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14012 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14014 /* Mic (rear) pin: input vref at 80% */
14015 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14017 /* Front Mic pin: input vref at 80% */
14018 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14019 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14020 /* Line In pin: input */
14021 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14023 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14026 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14027 /* CD pin widget for input */
14028 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14030 /* FIXME: use matrix-type input source selection */
14031 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14038 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14039 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14040 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14041 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14043 /* always trun on EAPD */
14044 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14045 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14050 static struct hda_verb alc662_sue_init_verbs
[] = {
14051 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
14052 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
14056 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
14057 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14058 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14062 /* Set Unsolicited Event*/
14063 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
14064 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14065 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14070 * generic initialization of ADC, input mixers and output mixers
14072 static struct hda_verb alc662_auto_init_verbs
[] = {
14074 * Unmute ADC and set the default input to mic-in
14076 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14077 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14079 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14081 * Note: PASD motherboards uses the Line In 2 as the input for front
14082 * panel mic (mic 2)
14084 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14092 * Set up output mixers (0x0c - 0x0f)
14094 /* set vol=0 to output mixers */
14095 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14096 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14097 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14099 /* set up input amps for analog loopback */
14100 /* Amp Indices: DAC = 0, mixer = 1 */
14101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14103 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14104 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14105 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14109 /* FIXME: use matrix-type input source selection */
14110 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14117 /* additional verbs for ALC663 */
14118 static struct hda_verb alc663_auto_init_verbs
[] = {
14119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14120 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14124 static struct hda_verb alc663_m51va_init_verbs
[] = {
14125 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14126 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14127 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
14131 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14132 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14136 static struct hda_verb alc663_g71v_init_verbs
[] = {
14137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14138 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14139 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14141 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14142 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14143 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14145 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
14146 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
14147 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
14151 static struct hda_verb alc663_g50v_init_verbs
[] = {
14152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14154 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14156 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14157 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14161 /* capture mixer elements */
14162 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
14163 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14164 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14166 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14167 /* The multiple "Capture Source" controls confuse alsamixer
14168 * So call somewhat different..
14170 /* .name = "Capture Source", */
14171 .name
= "Input Source",
14173 .info
= alc662_mux_enum_info
,
14174 .get
= alc662_mux_enum_get
,
14175 .put
= alc662_mux_enum_put
,
14180 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
14182 unsigned int present
;
14183 unsigned char bits
;
14185 present
= snd_hda_codec_read(codec
, 0x14, 0,
14186 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14187 bits
= present
? HDA_AMP_MUTE
: 0;
14188 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14189 HDA_AMP_MUTE
, bits
);
14192 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
14194 unsigned int present
;
14195 unsigned char bits
;
14197 present
= snd_hda_codec_read(codec
, 0x1b, 0,
14198 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14199 bits
= present
? HDA_AMP_MUTE
: 0;
14200 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14201 HDA_AMP_MUTE
, bits
);
14202 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14203 HDA_AMP_MUTE
, bits
);
14206 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
14209 if ((res
>> 26) == ALC880_HP_EVENT
)
14210 alc662_lenovo_101e_all_automute(codec
);
14211 if ((res
>> 26) == ALC880_FRONT_EVENT
)
14212 alc662_lenovo_101e_ispeaker_automute(codec
);
14215 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
14217 unsigned int present
;
14219 present
= snd_hda_codec_read(codec
, 0x18, 0,
14220 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14221 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14222 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14223 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14224 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14225 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14226 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
14227 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14228 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
14231 /* unsolicited event for HP jack sensing */
14232 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
14235 if ((res
>> 26) == ALC880_HP_EVENT
)
14236 alc262_hippo1_automute( codec
);
14238 if ((res
>> 26) == ALC880_MIC_EVENT
)
14239 alc662_eeepc_mic_automute(codec
);
14242 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
14244 alc262_hippo1_automute( codec
);
14245 alc662_eeepc_mic_automute(codec
);
14248 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
14251 unsigned int present
;
14253 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
14254 present
= snd_hda_codec_read(codec
, 0x14, 0,
14255 AC_VERB_GET_PIN_SENSE
, 0);
14256 present
= (present
& 0x80000000) != 0;
14258 /* mute internal speaker */
14259 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
14260 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
14262 /* unmute internal speaker if necessary */
14263 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
14264 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
14265 HDA_AMP_MUTE
, mute
);
14269 /* unsolicited event for HP jack sensing */
14270 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
14273 if ((res
>> 26) == ALC880_HP_EVENT
)
14274 alc662_eeepc_ep20_automute(codec
);
14277 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
14279 alc662_eeepc_ep20_automute(codec
);
14282 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
14284 unsigned int present
;
14285 unsigned char bits
;
14287 present
= snd_hda_codec_read(codec
, 0x21, 0,
14288 AC_VERB_GET_PIN_SENSE
, 0)
14289 & AC_PINSENSE_PRESENCE
;
14290 bits
= present
? HDA_AMP_MUTE
: 0;
14291 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14292 HDA_AMP_MUTE
, bits
);
14295 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
14297 unsigned int present
;
14299 present
= snd_hda_codec_read(codec
, 0x18, 0,
14300 AC_VERB_GET_PIN_SENSE
, 0)
14301 & AC_PINSENSE_PRESENCE
;
14302 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14303 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14304 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14305 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14306 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14307 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14308 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14309 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14312 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
14315 switch (res
>> 26) {
14316 case ALC880_HP_EVENT
:
14317 alc663_m51va_speaker_automute(codec
);
14319 case ALC880_MIC_EVENT
:
14320 alc663_m51va_mic_automute(codec
);
14325 static void alc663_m51va_inithook(struct hda_codec
*codec
)
14327 alc663_m51va_speaker_automute(codec
);
14328 alc663_m51va_mic_automute(codec
);
14331 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
14333 unsigned int present
;
14334 unsigned char bits
;
14336 present
= snd_hda_codec_read(codec
, 0x21, 0,
14337 AC_VERB_GET_PIN_SENSE
, 0)
14338 & AC_PINSENSE_PRESENCE
;
14339 bits
= present
? HDA_AMP_MUTE
: 0;
14340 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14341 HDA_AMP_MUTE
, bits
);
14342 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14343 HDA_AMP_MUTE
, bits
);
14346 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
14348 unsigned int present
;
14349 unsigned char bits
;
14351 present
= snd_hda_codec_read(codec
, 0x15, 0,
14352 AC_VERB_GET_PIN_SENSE
, 0)
14353 & AC_PINSENSE_PRESENCE
;
14354 bits
= present
? HDA_AMP_MUTE
: 0;
14355 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14356 HDA_AMP_MUTE
, bits
);
14359 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
14362 switch (res
>> 26) {
14363 case ALC880_HP_EVENT
:
14364 alc663_g71v_hp_automute(codec
);
14366 case ALC880_FRONT_EVENT
:
14367 alc663_g71v_front_automute(codec
);
14369 case ALC880_MIC_EVENT
:
14370 alc662_eeepc_mic_automute(codec
);
14375 static void alc663_g71v_inithook(struct hda_codec
*codec
)
14377 alc663_g71v_front_automute(codec
);
14378 alc663_g71v_hp_automute(codec
);
14379 alc662_eeepc_mic_automute(codec
);
14382 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
14385 switch (res
>> 26) {
14386 case ALC880_HP_EVENT
:
14387 alc663_m51va_speaker_automute(codec
);
14389 case ALC880_MIC_EVENT
:
14390 alc662_eeepc_mic_automute(codec
);
14395 static void alc663_g50v_inithook(struct hda_codec
*codec
)
14397 alc663_m51va_speaker_automute(codec
);
14398 alc662_eeepc_mic_automute(codec
);
14401 #ifdef CONFIG_SND_HDA_POWER_SAVE
14402 #define alc662_loopbacks alc880_loopbacks
14406 /* pcm configuration: identiacal with ALC880 */
14407 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14408 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14409 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14410 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14413 * configuration and preset
14415 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
14416 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
14417 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
14418 [ALC662_3ST_6ch
] = "3stack-6ch",
14419 [ALC662_5ST_DIG
] = "6stack-dig",
14420 [ALC662_LENOVO_101E
] = "lenovo-101e",
14421 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
14422 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
14423 [ALC663_ASUS_M51VA
] = "m51va",
14424 [ALC663_ASUS_G71V
] = "g71v",
14425 [ALC663_ASUS_H13
] = "h13",
14426 [ALC663_ASUS_G50V
] = "g50v",
14427 [ALC662_AUTO
] = "auto",
14430 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
14431 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V
),
14432 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
14433 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V
),
14434 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
14435 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
14436 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
14437 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
14438 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13
),
14439 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13
),
14440 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13
),
14444 static struct alc_config_preset alc662_presets
[] = {
14445 [ALC662_3ST_2ch_DIG
] = {
14446 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
14447 .init_verbs
= { alc662_init_verbs
},
14448 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14449 .dac_nids
= alc662_dac_nids
,
14450 .dig_out_nid
= ALC662_DIGOUT_NID
,
14451 .dig_in_nid
= ALC662_DIGIN_NID
,
14452 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14453 .channel_mode
= alc662_3ST_2ch_modes
,
14454 .input_mux
= &alc662_capture_source
,
14456 [ALC662_3ST_6ch_DIG
] = {
14457 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14458 alc662_capture_mixer
},
14459 .init_verbs
= { alc662_init_verbs
},
14460 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14461 .dac_nids
= alc662_dac_nids
,
14462 .dig_out_nid
= ALC662_DIGOUT_NID
,
14463 .dig_in_nid
= ALC662_DIGIN_NID
,
14464 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14465 .channel_mode
= alc662_3ST_6ch_modes
,
14467 .input_mux
= &alc662_capture_source
,
14469 [ALC662_3ST_6ch
] = {
14470 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14471 alc662_capture_mixer
},
14472 .init_verbs
= { alc662_init_verbs
},
14473 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14474 .dac_nids
= alc662_dac_nids
,
14475 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14476 .channel_mode
= alc662_3ST_6ch_modes
,
14478 .input_mux
= &alc662_capture_source
,
14480 [ALC662_5ST_DIG
] = {
14481 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
14482 alc662_capture_mixer
},
14483 .init_verbs
= { alc662_init_verbs
},
14484 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14485 .dac_nids
= alc662_dac_nids
,
14486 .dig_out_nid
= ALC662_DIGOUT_NID
,
14487 .dig_in_nid
= ALC662_DIGIN_NID
,
14488 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
14489 .channel_mode
= alc662_5stack_modes
,
14490 .input_mux
= &alc662_capture_source
,
14492 [ALC662_LENOVO_101E
] = {
14493 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
14494 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
14495 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14496 .dac_nids
= alc662_dac_nids
,
14497 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14498 .channel_mode
= alc662_3ST_2ch_modes
,
14499 .input_mux
= &alc662_lenovo_101e_capture_source
,
14500 .unsol_event
= alc662_lenovo_101e_unsol_event
,
14501 .init_hook
= alc662_lenovo_101e_all_automute
,
14503 [ALC662_ASUS_EEEPC_P701
] = {
14504 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
14505 .init_verbs
= { alc662_init_verbs
,
14506 alc662_eeepc_sue_init_verbs
},
14507 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14508 .dac_nids
= alc662_dac_nids
,
14509 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14510 .channel_mode
= alc662_3ST_2ch_modes
,
14511 .input_mux
= &alc662_eeepc_capture_source
,
14512 .unsol_event
= alc662_eeepc_unsol_event
,
14513 .init_hook
= alc662_eeepc_inithook
,
14515 [ALC662_ASUS_EEEPC_EP20
] = {
14516 .mixers
= { alc662_eeepc_ep20_mixer
, alc662_capture_mixer
,
14517 alc662_chmode_mixer
},
14518 .init_verbs
= { alc662_init_verbs
,
14519 alc662_eeepc_ep20_sue_init_verbs
},
14520 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14521 .dac_nids
= alc662_dac_nids
,
14522 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14523 .channel_mode
= alc662_3ST_6ch_modes
,
14524 .input_mux
= &alc662_lenovo_101e_capture_source
,
14525 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
14526 .init_hook
= alc662_eeepc_ep20_inithook
,
14528 [ALC663_ASUS_M51VA
] = {
14529 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14530 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14531 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14532 .dac_nids
= alc662_dac_nids
,
14533 .dig_out_nid
= ALC662_DIGOUT_NID
,
14534 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14535 .channel_mode
= alc662_3ST_2ch_modes
,
14536 .input_mux
= &alc663_m51va_capture_source
,
14537 .unsol_event
= alc663_m51va_unsol_event
,
14538 .init_hook
= alc663_m51va_inithook
,
14540 [ALC663_ASUS_G71V
] = {
14541 .mixers
= { alc663_g71v_mixer
, alc662_capture_mixer
},
14542 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
14543 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14544 .dac_nids
= alc662_dac_nids
,
14545 .dig_out_nid
= ALC662_DIGOUT_NID
,
14546 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14547 .channel_mode
= alc662_3ST_2ch_modes
,
14548 .input_mux
= &alc662_eeepc_capture_source
,
14549 .unsol_event
= alc663_g71v_unsol_event
,
14550 .init_hook
= alc663_g71v_inithook
,
14552 [ALC663_ASUS_H13
] = {
14553 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14554 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14555 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14556 .dac_nids
= alc662_dac_nids
,
14557 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14558 .channel_mode
= alc662_3ST_2ch_modes
,
14559 .input_mux
= &alc663_m51va_capture_source
,
14560 .unsol_event
= alc663_m51va_unsol_event
,
14561 .init_hook
= alc663_m51va_inithook
,
14563 [ALC663_ASUS_G50V
] = {
14564 .mixers
= { alc663_g50v_mixer
, alc662_capture_mixer
},
14565 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
14566 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14567 .dac_nids
= alc662_dac_nids
,
14568 .dig_out_nid
= ALC662_DIGOUT_NID
,
14569 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14570 .channel_mode
= alc662_3ST_6ch_modes
,
14571 .input_mux
= &alc663_capture_source
,
14572 .unsol_event
= alc663_g50v_unsol_event
,
14573 .init_hook
= alc663_g50v_inithook
,
14579 * BIOS auto configuration
14582 /* add playback controls from the parsed DAC table */
14583 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14584 const struct auto_pin_cfg
*cfg
)
14587 static const char *chname
[4] = {
14588 "Front", "Surround", NULL
/*CLFE*/, "Side"
14593 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14594 if (!spec
->multiout
.dac_nids
[i
])
14596 nid
= alc880_idx_to_dac(i
);
14599 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14600 "Center Playback Volume",
14601 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
14605 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14606 "LFE Playback Volume",
14607 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
14611 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14612 "Center Playback Switch",
14613 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
14617 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14618 "LFE Playback Switch",
14619 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
14624 sprintf(name
, "%s Playback Volume", chname
[i
]);
14625 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14626 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
14630 sprintf(name
, "%s Playback Switch", chname
[i
]);
14631 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14632 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
14641 /* add playback controls for speaker and HP outputs */
14642 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
14653 /* ALC663 has a mono output pin on 0x17 */
14654 sprintf(name
, "%s Playback Switch", pfx
);
14655 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14656 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
14660 if (alc880_is_fixed_pin(pin
)) {
14661 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14662 /* printk("DAC nid=%x\n",nid); */
14663 /* specify the DAC as the extra output */
14664 if (!spec
->multiout
.hp_nid
)
14665 spec
->multiout
.hp_nid
= nid
;
14667 spec
->multiout
.extra_out_nid
[0] = nid
;
14668 /* control HP volume/switch on the output mixer amp */
14669 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14670 sprintf(name
, "%s Playback Volume", pfx
);
14671 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14672 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
14675 sprintf(name
, "%s Playback Switch", pfx
);
14676 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14677 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
14680 } else if (alc880_is_multi_pin(pin
)) {
14681 /* set manual connection */
14682 /* we have only a switch on HP-out PIN */
14683 sprintf(name
, "%s Playback Switch", pfx
);
14684 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14685 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
14692 /* create playback/capture controls for input pins */
14693 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
14694 const struct auto_pin_cfg
*cfg
)
14696 struct hda_input_mux
*imux
= &spec
->private_imux
;
14699 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14700 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
14701 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
14702 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
14703 auto_pin_cfg_labels
[i
],
14707 imux
->items
[imux
->num_items
].label
=
14708 auto_pin_cfg_labels
[i
];
14709 imux
->items
[imux
->num_items
].index
=
14710 alc880_input_pin_idx(cfg
->input_pins
[i
]);
14717 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
14718 hda_nid_t nid
, int pin_type
,
14721 alc_set_pin_output(codec
, nid
, pin_type
);
14722 /* need the manual connection? */
14723 if (alc880_is_multi_pin(nid
)) {
14724 struct alc_spec
*spec
= codec
->spec
;
14725 int idx
= alc880_multi_pin_idx(nid
);
14726 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
14727 AC_VERB_SET_CONNECT_SEL
,
14728 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
14732 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
14734 struct alc_spec
*spec
= codec
->spec
;
14737 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
14738 for (i
= 0; i
<= HDA_SIDE
; i
++) {
14739 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14740 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14742 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
14747 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
14749 struct alc_spec
*spec
= codec
->spec
;
14752 pin
= spec
->autocfg
.hp_pins
[0];
14753 if (pin
) /* connect to front */
14755 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
14756 pin
= spec
->autocfg
.speaker_pins
[0];
14758 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14761 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14762 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14764 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
14766 struct alc_spec
*spec
= codec
->spec
;
14769 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14770 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14771 if (alc662_is_input_pin(nid
)) {
14772 snd_hda_codec_write(codec
, nid
, 0,
14773 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14774 (i
<= AUTO_PIN_FRONT_MIC
?
14775 PIN_VREF80
: PIN_IN
));
14776 if (nid
!= ALC662_PIN_CD_NID
)
14777 snd_hda_codec_write(codec
, nid
, 0,
14778 AC_VERB_SET_AMP_GAIN_MUTE
,
14784 #define alc662_auto_init_input_src alc882_auto_init_input_src
14786 static int alc662_parse_auto_config(struct hda_codec
*codec
)
14788 struct alc_spec
*spec
= codec
->spec
;
14790 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
14792 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14796 if (!spec
->autocfg
.line_outs
)
14797 return 0; /* can't find valid BIOS pin config */
14799 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14802 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14805 err
= alc662_auto_create_extra_out(spec
,
14806 spec
->autocfg
.speaker_pins
[0],
14810 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
14814 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14818 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14820 if (spec
->autocfg
.dig_out_pin
)
14821 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
14823 if (spec
->kctl_alloc
)
14824 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
14826 spec
->num_mux_defs
= 1;
14827 spec
->input_mux
= &spec
->private_imux
;
14829 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
14830 if (codec
->vendor_id
== 0x10ec0663)
14831 spec
->init_verbs
[spec
->num_init_verbs
++] =
14832 alc663_auto_init_verbs
;
14834 err
= alc_auto_add_mic_boost(codec
);
14838 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
14839 spec
->num_mixers
++;
14843 /* additional initialization for auto-configuration model */
14844 static void alc662_auto_init(struct hda_codec
*codec
)
14846 struct alc_spec
*spec
= codec
->spec
;
14847 alc662_auto_init_multi_out(codec
);
14848 alc662_auto_init_hp_out(codec
);
14849 alc662_auto_init_analog_input(codec
);
14850 alc662_auto_init_input_src(codec
);
14851 if (spec
->unsol_event
)
14852 alc_sku_automute(codec
);
14855 static int patch_alc662(struct hda_codec
*codec
)
14857 struct alc_spec
*spec
;
14858 int err
, board_config
;
14860 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14864 codec
->spec
= spec
;
14866 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
14868 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
14871 if (board_config
< 0) {
14872 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
14873 "trying auto-probe from BIOS...\n");
14874 board_config
= ALC662_AUTO
;
14877 if (board_config
== ALC662_AUTO
) {
14878 /* automatic parse from the BIOS config */
14879 err
= alc662_parse_auto_config(codec
);
14885 "hda_codec: Cannot set up configuration "
14886 "from BIOS. Using base mode...\n");
14887 board_config
= ALC662_3ST_2ch_DIG
;
14891 if (board_config
!= ALC662_AUTO
)
14892 setup_preset(spec
, &alc662_presets
[board_config
]);
14894 if (codec
->vendor_id
== 0x10ec0663) {
14895 spec
->stream_name_analog
= "ALC663 Analog";
14896 spec
->stream_name_digital
= "ALC663 Digital";
14898 spec
->stream_name_analog
= "ALC662 Analog";
14899 spec
->stream_name_digital
= "ALC662 Digital";
14902 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
14903 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
14905 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
14906 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
14908 spec
->adc_nids
= alc662_adc_nids
;
14909 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
14910 spec
->capsrc_nids
= alc662_capsrc_nids
;
14912 spec
->vmaster_nid
= 0x02;
14914 codec
->patch_ops
= alc_patch_ops
;
14915 if (board_config
== ALC662_AUTO
)
14916 spec
->init_hook
= alc662_auto_init
;
14917 #ifdef CONFIG_SND_HDA_POWER_SAVE
14918 if (!spec
->loopback
.amplist
)
14919 spec
->loopback
.amplist
= alc662_loopbacks
;
14928 struct hda_codec_preset snd_hda_preset_realtek
[] = {
14929 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
14930 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
14931 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
14932 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
14933 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
14934 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
14935 .patch
= patch_alc861
},
14936 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
14937 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
14938 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
14939 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
14940 .patch
= patch_alc883
},
14941 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
14942 .patch
= patch_alc662
},
14943 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
14944 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
14945 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
14946 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
14947 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
14948 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
14949 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
14950 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
14951 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
14952 {} /* terminator */